Merge pull request #49 from TheBlueMatt/main
[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.20.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  * The reason the channel was closed. See individual variants more details.
2176  */
2177 typedef enum LDKClosureReason_Tag {
2178    /**
2179     * Closure generated from receiving a peer error message.
2180     *
2181     * Our counterparty may have broadcasted their latest commitment state, and we have
2182     * as well.
2183     */
2184    LDKClosureReason_CounterpartyForceClosed,
2185    /**
2186     * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
2187     *
2188     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
2189     */
2190    LDKClosureReason_HolderForceClosed,
2191    /**
2192     * The channel was closed after negotiating a cooperative close and we've now broadcasted
2193     * the cooperative close transaction. Note the shutdown may have been initiated by us.
2194     */
2195    LDKClosureReason_CooperativeClosure,
2196    /**
2197     * A commitment transaction was confirmed on chain, closing the channel. Most likely this
2198     * commitment transaction came from our counterparty, but it may also have come from
2199     * a copy of our own `ChannelMonitor`.
2200     */
2201    LDKClosureReason_CommitmentTxConfirmed,
2202    /**
2203     * Closure generated from processing an event, likely a HTLC forward/relay/reception.
2204     */
2205    LDKClosureReason_ProcessingError,
2206    /**
2207     * The `PeerManager` informed us that we've disconnected from the peer. We close channels
2208     * if the `PeerManager` informed us that it is unlikely we'll be able to connect to the
2209     * peer again in the future or if the peer disconnected before we finished negotiating
2210     * the channel open. The first case may be caused by incompatible features which our
2211     * counterparty, or we, require.
2212     */
2213    LDKClosureReason_DisconnectedPeer,
2214    /**
2215     * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than
2216     * the ChannelManager deserialized.
2217     */
2218    LDKClosureReason_OutdatedChannelManager,
2219    /**
2220     * Must be last for serialization purposes
2221     */
2222    LDKClosureReason_Sentinel,
2223 } LDKClosureReason_Tag;
2224
2225 typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
2226    /**
2227     * The error which the peer sent us.
2228     *
2229     * The string should be sanitized before it is used (e.g emitted to logs
2230     * or printed to stdout). Otherwise, a well crafted error message may exploit
2231     * a security vulnerability in the terminal emulator or the logging subsystem.
2232     */
2233    struct LDKStr peer_msg;
2234 } LDKClosureReason_LDKCounterpartyForceClosed_Body;
2235
2236 typedef struct LDKClosureReason_LDKProcessingError_Body {
2237    /**
2238     * A developer-readable error message which we generated.
2239     */
2240    struct LDKStr err;
2241 } LDKClosureReason_LDKProcessingError_Body;
2242
2243 typedef struct MUST_USE_STRUCT LDKClosureReason {
2244    LDKClosureReason_Tag tag;
2245    union {
2246       LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
2247       LDKClosureReason_LDKProcessingError_Body processing_error;
2248    };
2249 } LDKClosureReason;
2250
2251 /**
2252  * An enum which can either contain a crate::lightning::util::events::ClosureReason or not
2253  */
2254 typedef enum LDKCOption_ClosureReasonZ_Tag {
2255    /**
2256     * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
2257     */
2258    LDKCOption_ClosureReasonZ_Some,
2259    /**
2260     * When we're in this state, this COption_ClosureReasonZ contains nothing
2261     */
2262    LDKCOption_ClosureReasonZ_None,
2263    /**
2264     * Must be last for serialization purposes
2265     */
2266    LDKCOption_ClosureReasonZ_Sentinel,
2267 } LDKCOption_ClosureReasonZ_Tag;
2268
2269 typedef struct LDKCOption_ClosureReasonZ {
2270    LDKCOption_ClosureReasonZ_Tag tag;
2271    union {
2272       struct {
2273          struct LDKClosureReason some;
2274       };
2275    };
2276 } LDKCOption_ClosureReasonZ;
2277
2278 /**
2279  * The contents of CResult_COption_ClosureReasonZDecodeErrorZ
2280  */
2281 typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr {
2282    /**
2283     * A pointer to the contents in the success state.
2284     * Reading from this pointer when `result_ok` is not set is undefined.
2285     */
2286    struct LDKCOption_ClosureReasonZ *result;
2287    /**
2288     * A pointer to the contents in the error state.
2289     * Reading from this pointer when `result_ok` is set is undefined.
2290     */
2291    struct LDKDecodeError *err;
2292 } LDKCResult_COption_ClosureReasonZDecodeErrorZPtr;
2293
2294 /**
2295  * A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
2296  * containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2297  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2298  */
2299 typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ {
2300    /**
2301     * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
2302     * `err` or `result` depending on the state of `result_ok`.
2303     */
2304    union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents;
2305    /**
2306     * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
2307     */
2308    bool result_ok;
2309 } LDKCResult_COption_ClosureReasonZDecodeErrorZ;
2310
2311
2312
2313 /**
2314  * A channel_update message to be sent or received from a peer
2315  */
2316 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
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    LDKnativeChannelUpdate *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 } LDKChannelUpdate;
2330
2331 /**
2332  * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
2333  * return packet by a node along the route. See [BOLT #4] for details.
2334  *
2335  * [BOLT #4]: https://github.com/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md
2336  */
2337 typedef enum LDKNetworkUpdate_Tag {
2338    /**
2339     * An error indicating a `channel_update` messages should be applied via
2340     * [`NetworkGraph::update_channel`].
2341     */
2342    LDKNetworkUpdate_ChannelUpdateMessage,
2343    /**
2344     * An error indicating only that a channel has been closed, which should be applied via
2345     * [`NetworkGraph::close_channel_from_update`].
2346     */
2347    LDKNetworkUpdate_ChannelClosed,
2348    /**
2349     * An error indicating only that a node has failed, which should be applied via
2350     * [`NetworkGraph::fail_node`].
2351     */
2352    LDKNetworkUpdate_NodeFailure,
2353    /**
2354     * Must be last for serialization purposes
2355     */
2356    LDKNetworkUpdate_Sentinel,
2357 } LDKNetworkUpdate_Tag;
2358
2359 typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body {
2360    /**
2361     * The update to apply via [`NetworkGraph::update_channel`].
2362     */
2363    struct LDKChannelUpdate msg;
2364 } LDKNetworkUpdate_LDKChannelUpdateMessage_Body;
2365
2366 typedef struct LDKNetworkUpdate_LDKChannelClosed_Body {
2367    /**
2368     * The short channel id of the closed channel.
2369     */
2370    uint64_t short_channel_id;
2371    /**
2372     * Whether the channel should be permanently removed or temporarily disabled until a new
2373     * `channel_update` message is received.
2374     */
2375    bool is_permanent;
2376 } LDKNetworkUpdate_LDKChannelClosed_Body;
2377
2378 typedef struct LDKNetworkUpdate_LDKNodeFailure_Body {
2379    /**
2380     * The node id of the failed node.
2381     */
2382    struct LDKPublicKey node_id;
2383    /**
2384     * Whether the node should be permanently removed from consideration or can be restored
2385     * when a new `channel_update` message is received.
2386     */
2387    bool is_permanent;
2388 } LDKNetworkUpdate_LDKNodeFailure_Body;
2389
2390 typedef struct MUST_USE_STRUCT LDKNetworkUpdate {
2391    LDKNetworkUpdate_Tag tag;
2392    union {
2393       LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message;
2394       LDKNetworkUpdate_LDKChannelClosed_Body channel_closed;
2395       LDKNetworkUpdate_LDKNodeFailure_Body node_failure;
2396    };
2397 } LDKNetworkUpdate;
2398
2399 /**
2400  * An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
2401  */
2402 typedef enum LDKCOption_NetworkUpdateZ_Tag {
2403    /**
2404     * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
2405     */
2406    LDKCOption_NetworkUpdateZ_Some,
2407    /**
2408     * When we're in this state, this COption_NetworkUpdateZ contains nothing
2409     */
2410    LDKCOption_NetworkUpdateZ_None,
2411    /**
2412     * Must be last for serialization purposes
2413     */
2414    LDKCOption_NetworkUpdateZ_Sentinel,
2415 } LDKCOption_NetworkUpdateZ_Tag;
2416
2417 typedef struct LDKCOption_NetworkUpdateZ {
2418    LDKCOption_NetworkUpdateZ_Tag tag;
2419    union {
2420       struct {
2421          struct LDKNetworkUpdate some;
2422       };
2423    };
2424 } LDKCOption_NetworkUpdateZ;
2425
2426
2427
2428 /**
2429  * Information about a spendable output to a P2WSH script. See
2430  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
2431  */
2432 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
2433    /**
2434     * A pointer to the opaque Rust object.
2435     * Nearly everywhere, inner must be non-null, however in places where
2436     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2437     */
2438    LDKnativeDelayedPaymentOutputDescriptor *inner;
2439    /**
2440     * Indicates that this is the only struct which contains the same pointer.
2441     * Rust functions which take ownership of an object provided via an argument require
2442     * this to be true and invalidate the object pointed to by inner.
2443     */
2444    bool is_owned;
2445 } LDKDelayedPaymentOutputDescriptor;
2446
2447
2448
2449 /**
2450  * Information about a spendable output to our \"payment key\". See
2451  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
2452  */
2453 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
2454    /**
2455     * A pointer to the opaque Rust object.
2456     * Nearly everywhere, inner must be non-null, however in places where
2457     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2458     */
2459    LDKnativeStaticPaymentOutputDescriptor *inner;
2460    /**
2461     * Indicates that this is the only struct which contains the same pointer.
2462     * Rust functions which take ownership of an object provided via an argument require
2463     * this to be true and invalidate the object pointed to by inner.
2464     */
2465    bool is_owned;
2466 } LDKStaticPaymentOutputDescriptor;
2467
2468 /**
2469  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
2470  * claim at any point in the future) an event is generated which you must track and be able to
2471  * spend on-chain. The information needed to do this is provided in this enum, including the
2472  * outpoint describing which txid and output index is available, the full output which exists at
2473  * that txid/index, and any keys or other information required to sign.
2474  */
2475 typedef enum LDKSpendableOutputDescriptor_Tag {
2476    /**
2477     * An output to a script which was provided via KeysInterface directly, either from
2478     * `get_destination_script()` or `get_shutdown_scriptpubkey()`, thus you should already know
2479     * how to spend it. No secret keys are provided as rust-lightning was never given any key.
2480     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
2481     * on-chain using the payment preimage or after it has timed out.
2482     */
2483    LDKSpendableOutputDescriptor_StaticOutput,
2484    /**
2485     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
2486     *
2487     * The witness in the spending input should be:
2488     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
2489     *
2490     * Note that the nSequence field in the spending input must be set to to_self_delay
2491     * (which means the transaction is not broadcastable until at least to_self_delay
2492     * blocks after the outpoint confirms).
2493     *
2494     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
2495     * it is an output from an old state which we broadcast (which should never happen).
2496     *
2497     * To derive the delayed_payment key which is used to sign for this input, you must pass the
2498     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
2499     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
2500     * chan_utils::derive_private_key. The public key can be generated without the secret key
2501     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
2502     * Sign::pubkeys().
2503     *
2504     * To derive the revocation_pubkey provided here (which is used in the witness
2505     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
2506     * call to Sign::ready_channel) and the provided per_commitment point
2507     * to chan_utils::derive_public_revocation_key.
2508     *
2509     * The witness script which is hashed and included in the output script_pubkey may be
2510     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
2511     * (derived as above), and the to_self_delay contained here to
2512     * chan_utils::get_revokeable_redeemscript.
2513     */
2514    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
2515    /**
2516     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
2517     * corresponds to the public key in Sign::pubkeys().payment_point).
2518     * The witness in the spending input, is, thus, simply:
2519     * <BIP 143 signature> <payment key>
2520     *
2521     * These are generally the result of our counterparty having broadcast the current state,
2522     * allowing us to claim the non-HTLC-encumbered outputs immediately.
2523     */
2524    LDKSpendableOutputDescriptor_StaticPaymentOutput,
2525    /**
2526     * Must be last for serialization purposes
2527     */
2528    LDKSpendableOutputDescriptor_Sentinel,
2529 } LDKSpendableOutputDescriptor_Tag;
2530
2531 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
2532    /**
2533     * The outpoint which is spendable
2534     */
2535    struct LDKOutPoint outpoint;
2536    /**
2537     * The output which is referenced by the given outpoint.
2538     */
2539    struct LDKTxOut output;
2540 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
2541
2542 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
2543    LDKSpendableOutputDescriptor_Tag tag;
2544    union {
2545       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
2546       struct {
2547          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
2548       };
2549       struct {
2550          struct LDKStaticPaymentOutputDescriptor static_payment_output;
2551       };
2552    };
2553 } LDKSpendableOutputDescriptor;
2554
2555 /**
2556  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2557  * This corresponds to std::vector in C++
2558  */
2559 typedef struct LDKCVec_SpendableOutputDescriptorZ {
2560    /**
2561     * The elements in the array.
2562     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2563     */
2564    struct LDKSpendableOutputDescriptor *data;
2565    /**
2566     * The number of elements pointed to by `data`.
2567     */
2568    uintptr_t datalen;
2569 } LDKCVec_SpendableOutputDescriptorZ;
2570
2571 /**
2572  * Some information provided on receipt of payment depends on whether the payment received is a
2573  * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
2574  */
2575 typedef enum LDKPaymentPurpose_Tag {
2576    /**
2577     * Information for receiving a payment that we generated an invoice for.
2578     */
2579    LDKPaymentPurpose_InvoicePayment,
2580    /**
2581     * Because this is a spontaneous payment, the payer generated their own preimage rather than us
2582     * (the payee) providing a preimage.
2583     */
2584    LDKPaymentPurpose_SpontaneousPayment,
2585    /**
2586     * Must be last for serialization purposes
2587     */
2588    LDKPaymentPurpose_Sentinel,
2589 } LDKPaymentPurpose_Tag;
2590
2591 typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
2592    /**
2593     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
2594     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
2595     * [`ChannelManager::claim_funds`].
2596     *
2597     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2598     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2599     *
2600     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2601     */
2602    struct LDKThirtyTwoBytes payment_preimage;
2603    /**
2604     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
2605     * number of deanonymization attacks during the routing process.
2606     * It is provided here for your reference, however its accuracy is enforced directly by
2607     * [`ChannelManager`] using the values you previously provided to
2608     * [`ChannelManager::create_inbound_payment`] or
2609     * [`ChannelManager::create_inbound_payment_for_hash`].
2610     *
2611     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2612     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2613     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
2614     */
2615    struct LDKThirtyTwoBytes payment_secret;
2616    /**
2617     * This is the `user_payment_id` which was provided to
2618     * [`ChannelManager::create_inbound_payment_for_hash`] or
2619     * [`ChannelManager::create_inbound_payment`]. It has no meaning inside of LDK and is
2620     * simply copied here. It may be used to correlate PaymentReceived events with invoice
2621     * metadata stored elsewhere.
2622     *
2623     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2624     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
2625     */
2626    uint64_t user_payment_id;
2627 } LDKPaymentPurpose_LDKInvoicePayment_Body;
2628
2629 typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
2630    LDKPaymentPurpose_Tag tag;
2631    union {
2632       LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
2633       struct {
2634          struct LDKThirtyTwoBytes spontaneous_payment;
2635       };
2636    };
2637 } LDKPaymentPurpose;
2638
2639 /**
2640  * An Event which you should probably take some action in response to.
2641  *
2642  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
2643  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
2644  * written as it makes no sense to respond to it after reconnecting to peers).
2645  */
2646 typedef enum LDKEvent_Tag {
2647    /**
2648     * Used to indicate that the client should generate a funding transaction with the given
2649     * parameters and then call ChannelManager::funding_transaction_generated.
2650     * Generated in ChannelManager message handling.
2651     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
2652     * counterparty can steal your funds!
2653     */
2654    LDKEvent_FundingGenerationReady,
2655    /**
2656     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
2657     * [`ChannelManager::claim_funds`] to get it....
2658     * Note that if the preimage is not known, you should call
2659     * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
2660     * network congestion.
2661     * If you fail to call either [`ChannelManager::claim_funds`] or
2662     * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
2663     * automatically failed.
2664     *
2665     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2666     * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
2667     */
2668    LDKEvent_PaymentReceived,
2669    /**
2670     * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
2671     * and we got back the payment preimage for it).
2672     *
2673     * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
2674     * event. In this situation, you SHOULD treat this payment as having succeeded.
2675     */
2676    LDKEvent_PaymentSent,
2677    /**
2678     * Indicates an outbound payment we made failed. Probably some intermediary node dropped
2679     * something. You may wish to retry with a different route.
2680     */
2681    LDKEvent_PaymentPathFailed,
2682    /**
2683     * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
2684     * time in the future.
2685     */
2686    LDKEvent_PendingHTLCsForwardable,
2687    /**
2688     * Used to indicate that an output which you should know how to spend was confirmed on chain
2689     * and is now spendable.
2690     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
2691     * counterparty spending them due to some kind of timeout. Thus, you need to store them
2692     * somewhere and spend them when you create on-chain transactions.
2693     */
2694    LDKEvent_SpendableOutputs,
2695    /**
2696     * This event is generated when a payment has been successfully forwarded through us and a
2697     * forwarding fee earned.
2698     */
2699    LDKEvent_PaymentForwarded,
2700    /**
2701     * Used to indicate that a channel with the given `channel_id` is in the process of closure.
2702     */
2703    LDKEvent_ChannelClosed,
2704    /**
2705     * Used to indicate to the user that they can abandon the funding transaction and recycle the
2706     * inputs for another purpose.
2707     */
2708    LDKEvent_DiscardFunding,
2709    /**
2710     * Must be last for serialization purposes
2711     */
2712    LDKEvent_Sentinel,
2713 } LDKEvent_Tag;
2714
2715 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
2716    /**
2717     * The random channel_id we picked which you'll need to pass into
2718     * ChannelManager::funding_transaction_generated.
2719     */
2720    struct LDKThirtyTwoBytes temporary_channel_id;
2721    /**
2722     * The value, in satoshis, that the output should have.
2723     */
2724    uint64_t channel_value_satoshis;
2725    /**
2726     * The script which should be used in the transaction output.
2727     */
2728    struct LDKCVec_u8Z output_script;
2729    /**
2730     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
2731     * an inbound channel.
2732     *
2733     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
2734     */
2735    uint64_t user_channel_id;
2736 } LDKEvent_LDKFundingGenerationReady_Body;
2737
2738 typedef struct LDKEvent_LDKPaymentReceived_Body {
2739    /**
2740     * The hash for which the preimage should be handed to the ChannelManager.
2741     */
2742    struct LDKThirtyTwoBytes payment_hash;
2743    /**
2744     * The value, in thousandths of a satoshi, that this payment is for.
2745     */
2746    uint64_t amt;
2747    /**
2748     * Information for claiming this received payment, based on whether the purpose of the
2749     * payment is to pay an invoice or to send a spontaneous payment.
2750     */
2751    struct LDKPaymentPurpose purpose;
2752 } LDKEvent_LDKPaymentReceived_Body;
2753
2754 typedef struct LDKEvent_LDKPaymentSent_Body {
2755    /**
2756     * The id returned by [`ChannelManager::send_payment`] and used with
2757     * [`ChannelManager::retry_payment`].
2758     *
2759     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2760     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
2761     *
2762     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2763     */
2764    struct LDKThirtyTwoBytes payment_id;
2765    /**
2766     * The preimage to the hash given to ChannelManager::send_payment.
2767     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
2768     * store it somehow!
2769     */
2770    struct LDKThirtyTwoBytes payment_preimage;
2771    /**
2772     * The hash which was given to [`ChannelManager::send_payment`].
2773     *
2774     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2775     */
2776    struct LDKThirtyTwoBytes payment_hash;
2777    /**
2778     * The total fee which was spent at intermediate hops in this payment, across all paths.
2779     *
2780     * Note that, like [`Route::get_total_fees`] this does *not* include any potential
2781     * overpayment to the recipient node.
2782     *
2783     * If the recipient or an intermediate node misbehaves and gives us free money, this may
2784     * overstate the amount paid, though this is unlikely.
2785     *
2786     * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
2787     */
2788    struct LDKCOption_u64Z fee_paid_msat;
2789 } LDKEvent_LDKPaymentSent_Body;
2790
2791 typedef struct LDKEvent_LDKPaymentPathFailed_Body {
2792    /**
2793     * The id returned by [`ChannelManager::send_payment`] and used with
2794     * [`ChannelManager::retry_payment`].
2795     *
2796     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2797     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
2798     *
2799     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2800     */
2801    struct LDKThirtyTwoBytes payment_id;
2802    /**
2803     * The hash which was given to ChannelManager::send_payment.
2804     */
2805    struct LDKThirtyTwoBytes payment_hash;
2806    /**
2807     * Indicates the payment was rejected for some reason by the recipient. This implies that
2808     * the payment has failed, not just the route in question. If this is not set, you may
2809     * retry the payment via a different route.
2810     */
2811    bool rejected_by_dest;
2812    /**
2813     * Any failure information conveyed via the Onion return packet by a node along the failed
2814     * payment route.
2815     *
2816     * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
2817     * account the update. [`NetGraphMsgHandler`] is capable of doing this.
2818     *
2819     * [`NetworkGraph`]: crate::routing::network_graph::NetworkGraph
2820     * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
2821     */
2822    struct LDKCOption_NetworkUpdateZ network_update;
2823    /**
2824     * For both single-path and multi-path payments, this is set if all paths of the payment have
2825     * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
2826     * larger MPP payment were still in flight when this event was generated.
2827     */
2828    bool all_paths_failed;
2829    /**
2830     * The payment path that failed.
2831     */
2832    struct LDKCVec_RouteHopZ path;
2833    /**
2834     * The channel responsible for the failed payment path.
2835     *
2836     * If this is `Some`, then the corresponding channel should be avoided when the payment is
2837     * retried. May be `None` for older [`Event`] serializations.
2838     */
2839    struct LDKCOption_u64Z short_channel_id;
2840    /**
2841     * Parameters needed to compute a new [`Route`] when retrying the failed payment path.
2842     *
2843     * See [`find_route`] for details.
2844     *
2845     * [`Route`]: crate::routing::router::Route
2846     * [`find_route`]: crate::routing::router::find_route
2847     *
2848     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2849     */
2850    struct LDKRouteParameters retry;
2851 } LDKEvent_LDKPaymentPathFailed_Body;
2852
2853 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
2854    /**
2855     * The minimum amount of time that should be waited prior to calling
2856     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
2857     * you should wait a random amount of time in roughly the range (now + time_forwardable,
2858     * now + 5*time_forwardable).
2859     */
2860    uint64_t time_forwardable;
2861 } LDKEvent_LDKPendingHTLCsForwardable_Body;
2862
2863 typedef struct LDKEvent_LDKSpendableOutputs_Body {
2864    /**
2865     * The outputs which you should store as spendable by you.
2866     */
2867    struct LDKCVec_SpendableOutputDescriptorZ outputs;
2868 } LDKEvent_LDKSpendableOutputs_Body;
2869
2870 typedef struct LDKEvent_LDKPaymentForwarded_Body {
2871    /**
2872     * The fee, in milli-satoshis, which was earned as a result of the payment.
2873     *
2874     * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
2875     * was pending, the amount the next hop claimed will have been rounded down to the nearest
2876     * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
2877     * claimed the full value in millisatoshis from the source. In this case,
2878     * `claim_from_onchain_tx` will be set.
2879     *
2880     * If the channel which sent us the payment has been force-closed, we will claim the funds
2881     * via an on-chain transaction. In that case we do not yet know the on-chain transaction
2882     * fees which we will spend and will instead set this to `None`. It is possible duplicate
2883     * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
2884     * `None`.
2885     */
2886    struct LDKCOption_u64Z fee_earned_msat;
2887    /**
2888     * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
2889     * transaction.
2890     */
2891    bool claim_from_onchain_tx;
2892 } LDKEvent_LDKPaymentForwarded_Body;
2893
2894 typedef struct LDKEvent_LDKChannelClosed_Body {
2895    /**
2896     * The channel_id of the channel which has been closed. Note that on-chain transactions
2897     * resolving the channel are likely still awaiting confirmation.
2898     */
2899    struct LDKThirtyTwoBytes channel_id;
2900    /**
2901     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
2902     * an inbound channel. This will always be zero for objects serialized with LDK versions
2903     * prior to 0.0.102.
2904     *
2905     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
2906     */
2907    uint64_t user_channel_id;
2908    /**
2909     * The reason the channel was closed.
2910     */
2911    struct LDKClosureReason reason;
2912 } LDKEvent_LDKChannelClosed_Body;
2913
2914 typedef struct LDKEvent_LDKDiscardFunding_Body {
2915    /**
2916     * The channel_id of the channel which has been closed.
2917     */
2918    struct LDKThirtyTwoBytes channel_id;
2919    /**
2920     * The full transaction received from the user
2921     */
2922    struct LDKTransaction transaction;
2923 } LDKEvent_LDKDiscardFunding_Body;
2924
2925 typedef struct MUST_USE_STRUCT LDKEvent {
2926    LDKEvent_Tag tag;
2927    union {
2928       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
2929       LDKEvent_LDKPaymentReceived_Body payment_received;
2930       LDKEvent_LDKPaymentSent_Body payment_sent;
2931       LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
2932       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
2933       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
2934       LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
2935       LDKEvent_LDKChannelClosed_Body channel_closed;
2936       LDKEvent_LDKDiscardFunding_Body discard_funding;
2937    };
2938 } LDKEvent;
2939
2940 /**
2941  * An enum which can either contain a crate::lightning::util::events::Event or not
2942  */
2943 typedef enum LDKCOption_EventZ_Tag {
2944    /**
2945     * When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
2946     */
2947    LDKCOption_EventZ_Some,
2948    /**
2949     * When we're in this state, this COption_EventZ contains nothing
2950     */
2951    LDKCOption_EventZ_None,
2952    /**
2953     * Must be last for serialization purposes
2954     */
2955    LDKCOption_EventZ_Sentinel,
2956 } LDKCOption_EventZ_Tag;
2957
2958 typedef struct LDKCOption_EventZ {
2959    LDKCOption_EventZ_Tag tag;
2960    union {
2961       struct {
2962          struct LDKEvent some;
2963       };
2964    };
2965 } LDKCOption_EventZ;
2966
2967 /**
2968  * The contents of CResult_COption_EventZDecodeErrorZ
2969  */
2970 typedef union LDKCResult_COption_EventZDecodeErrorZPtr {
2971    /**
2972     * A pointer to the contents in the success state.
2973     * Reading from this pointer when `result_ok` is not set is undefined.
2974     */
2975    struct LDKCOption_EventZ *result;
2976    /**
2977     * A pointer to the contents in the error state.
2978     * Reading from this pointer when `result_ok` is set is undefined.
2979     */
2980    struct LDKDecodeError *err;
2981 } LDKCResult_COption_EventZDecodeErrorZPtr;
2982
2983 /**
2984  * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
2985  * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2986  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2987  */
2988 typedef struct LDKCResult_COption_EventZDecodeErrorZ {
2989    /**
2990     * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
2991     * `err` or `result` depending on the state of `result_ok`.
2992     */
2993    union LDKCResult_COption_EventZDecodeErrorZPtr contents;
2994    /**
2995     * Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
2996     */
2997    bool result_ok;
2998 } LDKCResult_COption_EventZDecodeErrorZ;
2999
3000
3001
3002 /**
3003  * An accept_channel message to be sent or received from a peer
3004  */
3005 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
3006    /**
3007     * A pointer to the opaque Rust object.
3008     * Nearly everywhere, inner must be non-null, however in places where
3009     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3010     */
3011    LDKnativeAcceptChannel *inner;
3012    /**
3013     * Indicates that this is the only struct which contains the same pointer.
3014     * Rust functions which take ownership of an object provided via an argument require
3015     * this to be true and invalidate the object pointed to by inner.
3016     */
3017    bool is_owned;
3018 } LDKAcceptChannel;
3019
3020
3021
3022 /**
3023  * An open_channel message to be sent or received from a peer
3024  */
3025 typedef struct MUST_USE_STRUCT LDKOpenChannel {
3026    /**
3027     * A pointer to the opaque Rust object.
3028     * Nearly everywhere, inner must be non-null, however in places where
3029     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3030     */
3031    LDKnativeOpenChannel *inner;
3032    /**
3033     * Indicates that this is the only struct which contains the same pointer.
3034     * Rust functions which take ownership of an object provided via an argument require
3035     * this to be true and invalidate the object pointed to by inner.
3036     */
3037    bool is_owned;
3038 } LDKOpenChannel;
3039
3040
3041
3042 /**
3043  * A funding_created message to be sent or received from a peer
3044  */
3045 typedef struct MUST_USE_STRUCT LDKFundingCreated {
3046    /**
3047     * A pointer to the opaque Rust object.
3048     * Nearly everywhere, inner must be non-null, however in places where
3049     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3050     */
3051    LDKnativeFundingCreated *inner;
3052    /**
3053     * Indicates that this is the only struct which contains the same pointer.
3054     * Rust functions which take ownership of an object provided via an argument require
3055     * this to be true and invalidate the object pointed to by inner.
3056     */
3057    bool is_owned;
3058 } LDKFundingCreated;
3059
3060
3061
3062 /**
3063  * A funding_signed message to be sent or received from a peer
3064  */
3065 typedef struct MUST_USE_STRUCT LDKFundingSigned {
3066    /**
3067     * A pointer to the opaque Rust object.
3068     * Nearly everywhere, inner must be non-null, however in places where
3069     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3070     */
3071    LDKnativeFundingSigned *inner;
3072    /**
3073     * Indicates that this is the only struct which contains the same pointer.
3074     * Rust functions which take ownership of an object provided via an argument require
3075     * this to be true and invalidate the object pointed to by inner.
3076     */
3077    bool is_owned;
3078 } LDKFundingSigned;
3079
3080
3081
3082 /**
3083  * A funding_locked message to be sent or received from a peer
3084  */
3085 typedef struct MUST_USE_STRUCT LDKFundingLocked {
3086    /**
3087     * A pointer to the opaque Rust object.
3088     * Nearly everywhere, inner must be non-null, however in places where
3089     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3090     */
3091    LDKnativeFundingLocked *inner;
3092    /**
3093     * Indicates that this is the only struct which contains the same pointer.
3094     * Rust functions which take ownership of an object provided via an argument require
3095     * this to be true and invalidate the object pointed to by inner.
3096     */
3097    bool is_owned;
3098 } LDKFundingLocked;
3099
3100
3101
3102 /**
3103  * An announcement_signatures message to be sent or received from a peer
3104  */
3105 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
3106    /**
3107     * A pointer to the opaque Rust object.
3108     * Nearly everywhere, inner must be non-null, however in places where
3109     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3110     */
3111    LDKnativeAnnouncementSignatures *inner;
3112    /**
3113     * Indicates that this is the only struct which contains the same pointer.
3114     * Rust functions which take ownership of an object provided via an argument require
3115     * this to be true and invalidate the object pointed to by inner.
3116     */
3117    bool is_owned;
3118 } LDKAnnouncementSignatures;
3119
3120
3121
3122 /**
3123  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
3124  * transaction updates if they were pending.
3125  */
3126 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
3127    /**
3128     * A pointer to the opaque Rust object.
3129     * Nearly everywhere, inner must be non-null, however in places where
3130     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3131     */
3132    LDKnativeCommitmentUpdate *inner;
3133    /**
3134     * Indicates that this is the only struct which contains the same pointer.
3135     * Rust functions which take ownership of an object provided via an argument require
3136     * this to be true and invalidate the object pointed to by inner.
3137     */
3138    bool is_owned;
3139 } LDKCommitmentUpdate;
3140
3141
3142
3143 /**
3144  * A revoke_and_ack message to be sent or received from a peer
3145  */
3146 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
3147    /**
3148     * A pointer to the opaque Rust object.
3149     * Nearly everywhere, inner must be non-null, however in places where
3150     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3151     */
3152    LDKnativeRevokeAndACK *inner;
3153    /**
3154     * Indicates that this is the only struct which contains the same pointer.
3155     * Rust functions which take ownership of an object provided via an argument require
3156     * this to be true and invalidate the object pointed to by inner.
3157     */
3158    bool is_owned;
3159 } LDKRevokeAndACK;
3160
3161
3162
3163 /**
3164  * A closing_signed message to be sent or received from a peer
3165  */
3166 typedef struct MUST_USE_STRUCT LDKClosingSigned {
3167    /**
3168     * A pointer to the opaque Rust object.
3169     * Nearly everywhere, inner must be non-null, however in places where
3170     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3171     */
3172    LDKnativeClosingSigned *inner;
3173    /**
3174     * Indicates that this is the only struct which contains the same pointer.
3175     * Rust functions which take ownership of an object provided via an argument require
3176     * this to be true and invalidate the object pointed to by inner.
3177     */
3178    bool is_owned;
3179 } LDKClosingSigned;
3180
3181
3182
3183 /**
3184  * A shutdown message to be sent or received from a peer
3185  */
3186 typedef struct MUST_USE_STRUCT LDKShutdown {
3187    /**
3188     * A pointer to the opaque Rust object.
3189     * Nearly everywhere, inner must be non-null, however in places where
3190     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3191     */
3192    LDKnativeShutdown *inner;
3193    /**
3194     * Indicates that this is the only struct which contains the same pointer.
3195     * Rust functions which take ownership of an object provided via an argument require
3196     * this to be true and invalidate the object pointed to by inner.
3197     */
3198    bool is_owned;
3199 } LDKShutdown;
3200
3201
3202
3203 /**
3204  * A channel_reestablish message to be sent or received from a peer
3205  */
3206 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
3207    /**
3208     * A pointer to the opaque Rust object.
3209     * Nearly everywhere, inner must be non-null, however in places where
3210     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3211     */
3212    LDKnativeChannelReestablish *inner;
3213    /**
3214     * Indicates that this is the only struct which contains the same pointer.
3215     * Rust functions which take ownership of an object provided via an argument require
3216     * this to be true and invalidate the object pointed to by inner.
3217     */
3218    bool is_owned;
3219 } LDKChannelReestablish;
3220
3221
3222
3223 /**
3224  * A channel_announcement message to be sent or received from a peer
3225  */
3226 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
3227    /**
3228     * A pointer to the opaque Rust object.
3229     * Nearly everywhere, inner must be non-null, however in places where
3230     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3231     */
3232    LDKnativeChannelAnnouncement *inner;
3233    /**
3234     * Indicates that this is the only struct which contains the same pointer.
3235     * Rust functions which take ownership of an object provided via an argument require
3236     * this to be true and invalidate the object pointed to by inner.
3237     */
3238    bool is_owned;
3239 } LDKChannelAnnouncement;
3240
3241
3242
3243 /**
3244  * A node_announcement message to be sent or received from a peer
3245  */
3246 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
3247    /**
3248     * A pointer to the opaque Rust object.
3249     * Nearly everywhere, inner must be non-null, however in places where
3250     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3251     */
3252    LDKnativeNodeAnnouncement *inner;
3253    /**
3254     * Indicates that this is the only struct which contains the same pointer.
3255     * Rust functions which take ownership of an object provided via an argument require
3256     * this to be true and invalidate the object pointed to by inner.
3257     */
3258    bool is_owned;
3259 } LDKNodeAnnouncement;
3260
3261
3262
3263 /**
3264  * An error message to be sent or received from a peer
3265  */
3266 typedef struct MUST_USE_STRUCT LDKErrorMessage {
3267    /**
3268     * A pointer to the opaque Rust object.
3269     * Nearly everywhere, inner must be non-null, however in places where
3270     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3271     */
3272    LDKnativeErrorMessage *inner;
3273    /**
3274     * Indicates that this is the only struct which contains the same pointer.
3275     * Rust functions which take ownership of an object provided via an argument require
3276     * this to be true and invalidate the object pointed to by inner.
3277     */
3278    bool is_owned;
3279 } LDKErrorMessage;
3280
3281 /**
3282  * Used to put an error message in a LightningError
3283  */
3284 typedef enum LDKErrorAction_Tag {
3285    /**
3286     * The peer took some action which made us think they were useless. Disconnect them.
3287     */
3288    LDKErrorAction_DisconnectPeer,
3289    /**
3290     * The peer did something harmless that we weren't able to process, just log and ignore
3291     */
3292    LDKErrorAction_IgnoreError,
3293    /**
3294     * The peer did something harmless that we weren't able to meaningfully process.
3295     * If the error is logged, log it at the given level.
3296     */
3297    LDKErrorAction_IgnoreAndLog,
3298    /**
3299     * The peer did something incorrect. Tell them.
3300     */
3301    LDKErrorAction_SendErrorMessage,
3302    /**
3303     * Must be last for serialization purposes
3304     */
3305    LDKErrorAction_Sentinel,
3306 } LDKErrorAction_Tag;
3307
3308 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
3309    /**
3310     * An error message which we should make an effort to send before we disconnect.
3311     *
3312     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3313     */
3314    struct LDKErrorMessage msg;
3315 } LDKErrorAction_LDKDisconnectPeer_Body;
3316
3317 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
3318    /**
3319     * The message to send.
3320     */
3321    struct LDKErrorMessage msg;
3322 } LDKErrorAction_LDKSendErrorMessage_Body;
3323
3324 typedef struct MUST_USE_STRUCT LDKErrorAction {
3325    LDKErrorAction_Tag tag;
3326    union {
3327       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
3328       struct {
3329          enum LDKLevel ignore_and_log;
3330       };
3331       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
3332    };
3333 } LDKErrorAction;
3334
3335
3336
3337 /**
3338  * A query_channel_range message is used to query a peer for channel
3339  * UTXOs in a range of blocks. The recipient of a query makes a best
3340  * effort to reply to the query using one or more reply_channel_range
3341  * messages.
3342  */
3343 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
3344    /**
3345     * A pointer to the opaque Rust object.
3346     * Nearly everywhere, inner must be non-null, however in places where
3347     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3348     */
3349    LDKnativeQueryChannelRange *inner;
3350    /**
3351     * Indicates that this is the only struct which contains the same pointer.
3352     * Rust functions which take ownership of an object provided via an argument require
3353     * this to be true and invalidate the object pointed to by inner.
3354     */
3355    bool is_owned;
3356 } LDKQueryChannelRange;
3357
3358
3359
3360 /**
3361  * A query_short_channel_ids message is used to query a peer for
3362  * routing gossip messages related to one or more short_channel_ids.
3363  * The query recipient will reply with the latest, if available,
3364  * channel_announcement, channel_update and node_announcement messages
3365  * it maintains for the requested short_channel_ids followed by a
3366  * reply_short_channel_ids_end message. The short_channel_ids sent in
3367  * this query are encoded. We only support encoding_type=0 uncompressed
3368  * serialization and do not support encoding_type=1 zlib serialization.
3369  */
3370 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
3371    /**
3372     * A pointer to the opaque Rust object.
3373     * Nearly everywhere, inner must be non-null, however in places where
3374     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3375     */
3376    LDKnativeQueryShortChannelIds *inner;
3377    /**
3378     * Indicates that this is the only struct which contains the same pointer.
3379     * Rust functions which take ownership of an object provided via an argument require
3380     * this to be true and invalidate the object pointed to by inner.
3381     */
3382    bool is_owned;
3383 } LDKQueryShortChannelIds;
3384
3385
3386
3387 /**
3388  * A reply_channel_range message is a reply to a query_channel_range
3389  * message. Multiple reply_channel_range messages can be sent in reply
3390  * to a single query_channel_range message. The query recipient makes a
3391  * best effort to respond based on their local network view which may
3392  * not be a perfect view of the network. The short_channel_ids in the
3393  * reply are encoded. We only support encoding_type=0 uncompressed
3394  * serialization and do not support encoding_type=1 zlib serialization.
3395  */
3396 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
3397    /**
3398     * A pointer to the opaque Rust object.
3399     * Nearly everywhere, inner must be non-null, however in places where
3400     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3401     */
3402    LDKnativeReplyChannelRange *inner;
3403    /**
3404     * Indicates that this is the only struct which contains the same pointer.
3405     * Rust functions which take ownership of an object provided via an argument require
3406     * this to be true and invalidate the object pointed to by inner.
3407     */
3408    bool is_owned;
3409 } LDKReplyChannelRange;
3410
3411 /**
3412  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
3413  * broadcast to most peers).
3414  * These events are handled by PeerManager::process_events if you are using a PeerManager.
3415  */
3416 typedef enum LDKMessageSendEvent_Tag {
3417    /**
3418     * Used to indicate that we've accepted a channel open and should send the accept_channel
3419     * message provided to the given peer.
3420     */
3421    LDKMessageSendEvent_SendAcceptChannel,
3422    /**
3423     * Used to indicate that we've initiated a channel open and should send the open_channel
3424     * message provided to the given peer.
3425     */
3426    LDKMessageSendEvent_SendOpenChannel,
3427    /**
3428     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
3429     */
3430    LDKMessageSendEvent_SendFundingCreated,
3431    /**
3432     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
3433     */
3434    LDKMessageSendEvent_SendFundingSigned,
3435    /**
3436     * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
3437     */
3438    LDKMessageSendEvent_SendFundingLocked,
3439    /**
3440     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
3441     */
3442    LDKMessageSendEvent_SendAnnouncementSignatures,
3443    /**
3444     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
3445     * message should be sent to the peer with the given node_id.
3446     */
3447    LDKMessageSendEvent_UpdateHTLCs,
3448    /**
3449     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
3450     */
3451    LDKMessageSendEvent_SendRevokeAndACK,
3452    /**
3453     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
3454     */
3455    LDKMessageSendEvent_SendClosingSigned,
3456    /**
3457     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
3458     */
3459    LDKMessageSendEvent_SendShutdown,
3460    /**
3461     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
3462     */
3463    LDKMessageSendEvent_SendChannelReestablish,
3464    /**
3465     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
3466     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
3467     *
3468     * Note that after doing so, you very likely (unless you did so very recently) want to call
3469     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
3470     * This ensures that any nodes which see our channel_announcement also have a relevant
3471     * node_announcement, including relevant feature flags which may be important for routing
3472     * through or to us.
3473     */
3474    LDKMessageSendEvent_BroadcastChannelAnnouncement,
3475    /**
3476     * Used to indicate that a node_announcement should be broadcast to all peers.
3477     */
3478    LDKMessageSendEvent_BroadcastNodeAnnouncement,
3479    /**
3480     * Used to indicate that a channel_update should be broadcast to all peers.
3481     */
3482    LDKMessageSendEvent_BroadcastChannelUpdate,
3483    /**
3484     * Used to indicate that a channel_update should be sent to a single peer.
3485     * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
3486     * private channel and we shouldn't be informing all of our peers of channel parameters.
3487     */
3488    LDKMessageSendEvent_SendChannelUpdate,
3489    /**
3490     * Broadcast an error downstream to be handled
3491     */
3492    LDKMessageSendEvent_HandleError,
3493    /**
3494     * Query a peer for channels with funding transaction UTXOs in a block range.
3495     */
3496    LDKMessageSendEvent_SendChannelRangeQuery,
3497    /**
3498     * Request routing gossip messages from a peer for a list of channels identified by
3499     * their short_channel_ids.
3500     */
3501    LDKMessageSendEvent_SendShortIdsQuery,
3502    /**
3503     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
3504     * emitted during processing of the query.
3505     */
3506    LDKMessageSendEvent_SendReplyChannelRange,
3507    /**
3508     * Must be last for serialization purposes
3509     */
3510    LDKMessageSendEvent_Sentinel,
3511 } LDKMessageSendEvent_Tag;
3512
3513 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
3514    /**
3515     * The node_id of the node which should receive this message
3516     */
3517    struct LDKPublicKey node_id;
3518    /**
3519     * The message which should be sent.
3520     */
3521    struct LDKAcceptChannel msg;
3522 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
3523
3524 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
3525    /**
3526     * The node_id of the node which should receive this message
3527     */
3528    struct LDKPublicKey node_id;
3529    /**
3530     * The message which should be sent.
3531     */
3532    struct LDKOpenChannel msg;
3533 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
3534
3535 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
3536    /**
3537     * The node_id of the node which should receive this message
3538     */
3539    struct LDKPublicKey node_id;
3540    /**
3541     * The message which should be sent.
3542     */
3543    struct LDKFundingCreated msg;
3544 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
3545
3546 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
3547    /**
3548     * The node_id of the node which should receive this message
3549     */
3550    struct LDKPublicKey node_id;
3551    /**
3552     * The message which should be sent.
3553     */
3554    struct LDKFundingSigned msg;
3555 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
3556
3557 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
3558    /**
3559     * The node_id of the node which should receive these message(s)
3560     */
3561    struct LDKPublicKey node_id;
3562    /**
3563     * The funding_locked message which should be sent.
3564     */
3565    struct LDKFundingLocked msg;
3566 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
3567
3568 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
3569    /**
3570     * The node_id of the node which should receive these message(s)
3571     */
3572    struct LDKPublicKey node_id;
3573    /**
3574     * The announcement_signatures message which should be sent.
3575     */
3576    struct LDKAnnouncementSignatures msg;
3577 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
3578
3579 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
3580    /**
3581     * The node_id of the node which should receive these message(s)
3582     */
3583    struct LDKPublicKey node_id;
3584    /**
3585     * The update messages which should be sent. ALL messages in the struct should be sent!
3586     */
3587    struct LDKCommitmentUpdate updates;
3588 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
3589
3590 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
3591    /**
3592     * The node_id of the node which should receive this message
3593     */
3594    struct LDKPublicKey node_id;
3595    /**
3596     * The message which should be sent.
3597     */
3598    struct LDKRevokeAndACK msg;
3599 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
3600
3601 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
3602    /**
3603     * The node_id of the node which should receive this message
3604     */
3605    struct LDKPublicKey node_id;
3606    /**
3607     * The message which should be sent.
3608     */
3609    struct LDKClosingSigned msg;
3610 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
3611
3612 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
3613    /**
3614     * The node_id of the node which should receive this message
3615     */
3616    struct LDKPublicKey node_id;
3617    /**
3618     * The message which should be sent.
3619     */
3620    struct LDKShutdown msg;
3621 } LDKMessageSendEvent_LDKSendShutdown_Body;
3622
3623 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
3624    /**
3625     * The node_id of the node which should receive this message
3626     */
3627    struct LDKPublicKey node_id;
3628    /**
3629     * The message which should be sent.
3630     */
3631    struct LDKChannelReestablish msg;
3632 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
3633
3634 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
3635    /**
3636     * The channel_announcement which should be sent.
3637     */
3638    struct LDKChannelAnnouncement msg;
3639    /**
3640     * The followup channel_update which should be sent.
3641     */
3642    struct LDKChannelUpdate update_msg;
3643 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
3644
3645 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
3646    /**
3647     * The node_announcement which should be sent.
3648     */
3649    struct LDKNodeAnnouncement msg;
3650 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
3651
3652 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
3653    /**
3654     * The channel_update which should be sent.
3655     */
3656    struct LDKChannelUpdate msg;
3657 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
3658
3659 typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
3660    /**
3661     * The node_id of the node which should receive this message
3662     */
3663    struct LDKPublicKey node_id;
3664    /**
3665     * The channel_update which should be sent.
3666     */
3667    struct LDKChannelUpdate msg;
3668 } LDKMessageSendEvent_LDKSendChannelUpdate_Body;
3669
3670 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
3671    /**
3672     * The node_id of the node which should receive this message
3673     */
3674    struct LDKPublicKey node_id;
3675    /**
3676     * The action which should be taken.
3677     */
3678    struct LDKErrorAction action;
3679 } LDKMessageSendEvent_LDKHandleError_Body;
3680
3681 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
3682    /**
3683     * The node_id of this message recipient
3684     */
3685    struct LDKPublicKey node_id;
3686    /**
3687     * The query_channel_range which should be sent.
3688     */
3689    struct LDKQueryChannelRange msg;
3690 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
3691
3692 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
3693    /**
3694     * The node_id of this message recipient
3695     */
3696    struct LDKPublicKey node_id;
3697    /**
3698     * The query_short_channel_ids which should be sent.
3699     */
3700    struct LDKQueryShortChannelIds msg;
3701 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
3702
3703 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
3704    /**
3705     * The node_id of this message recipient
3706     */
3707    struct LDKPublicKey node_id;
3708    /**
3709     * The reply_channel_range which should be sent.
3710     */
3711    struct LDKReplyChannelRange msg;
3712 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
3713
3714 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
3715    LDKMessageSendEvent_Tag tag;
3716    union {
3717       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
3718       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
3719       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
3720       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
3721       LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
3722       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
3723       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
3724       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
3725       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
3726       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
3727       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
3728       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
3729       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
3730       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
3731       LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
3732       LDKMessageSendEvent_LDKHandleError_Body handle_error;
3733       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
3734       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
3735       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
3736    };
3737 } LDKMessageSendEvent;
3738
3739 /**
3740  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3741  * This corresponds to std::vector in C++
3742  */
3743 typedef struct LDKCVec_MessageSendEventZ {
3744    /**
3745     * The elements in the array.
3746     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3747     */
3748    struct LDKMessageSendEvent *data;
3749    /**
3750     * The number of elements pointed to by `data`.
3751     */
3752    uintptr_t datalen;
3753 } LDKCVec_MessageSendEventZ;
3754
3755
3756
3757 /**
3758  * Features used within an `init` message.
3759  */
3760 typedef struct MUST_USE_STRUCT LDKInitFeatures {
3761    /**
3762     * A pointer to the opaque Rust object.
3763     * Nearly everywhere, inner must be non-null, however in places where
3764     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3765     */
3766    LDKnativeInitFeatures *inner;
3767    /**
3768     * Indicates that this is the only struct which contains the same pointer.
3769     * Rust functions which take ownership of an object provided via an argument require
3770     * this to be true and invalidate the object pointed to by inner.
3771     */
3772    bool is_owned;
3773 } LDKInitFeatures;
3774
3775 /**
3776  * The contents of CResult_InitFeaturesDecodeErrorZ
3777  */
3778 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
3779    /**
3780     * A pointer to the contents in the success state.
3781     * Reading from this pointer when `result_ok` is not set is undefined.
3782     */
3783    struct LDKInitFeatures *result;
3784    /**
3785     * A pointer to the contents in the error state.
3786     * Reading from this pointer when `result_ok` is set is undefined.
3787     */
3788    struct LDKDecodeError *err;
3789 } LDKCResult_InitFeaturesDecodeErrorZPtr;
3790
3791 /**
3792  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
3793  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3794  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3795  */
3796 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
3797    /**
3798     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
3799     * `err` or `result` depending on the state of `result_ok`.
3800     */
3801    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
3802    /**
3803     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
3804     */
3805    bool result_ok;
3806 } LDKCResult_InitFeaturesDecodeErrorZ;
3807
3808
3809
3810 /**
3811  * Features used within a `node_announcement` message.
3812  */
3813 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
3814    /**
3815     * A pointer to the opaque Rust object.
3816     * Nearly everywhere, inner must be non-null, however in places where
3817     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3818     */
3819    LDKnativeNodeFeatures *inner;
3820    /**
3821     * Indicates that this is the only struct which contains the same pointer.
3822     * Rust functions which take ownership of an object provided via an argument require
3823     * this to be true and invalidate the object pointed to by inner.
3824     */
3825    bool is_owned;
3826 } LDKNodeFeatures;
3827
3828 /**
3829  * The contents of CResult_NodeFeaturesDecodeErrorZ
3830  */
3831 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
3832    /**
3833     * A pointer to the contents in the success state.
3834     * Reading from this pointer when `result_ok` is not set is undefined.
3835     */
3836    struct LDKNodeFeatures *result;
3837    /**
3838     * A pointer to the contents in the error state.
3839     * Reading from this pointer when `result_ok` is set is undefined.
3840     */
3841    struct LDKDecodeError *err;
3842 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
3843
3844 /**
3845  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
3846  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3847  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3848  */
3849 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
3850    /**
3851     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
3852     * `err` or `result` depending on the state of `result_ok`.
3853     */
3854    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
3855    /**
3856     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
3857     */
3858    bool result_ok;
3859 } LDKCResult_NodeFeaturesDecodeErrorZ;
3860
3861
3862
3863 /**
3864  * Features used within a `channel_announcement` message.
3865  */
3866 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
3867    /**
3868     * A pointer to the opaque Rust object.
3869     * Nearly everywhere, inner must be non-null, however in places where
3870     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3871     */
3872    LDKnativeChannelFeatures *inner;
3873    /**
3874     * Indicates that this is the only struct which contains the same pointer.
3875     * Rust functions which take ownership of an object provided via an argument require
3876     * this to be true and invalidate the object pointed to by inner.
3877     */
3878    bool is_owned;
3879 } LDKChannelFeatures;
3880
3881 /**
3882  * The contents of CResult_ChannelFeaturesDecodeErrorZ
3883  */
3884 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
3885    /**
3886     * A pointer to the contents in the success state.
3887     * Reading from this pointer when `result_ok` is not set is undefined.
3888     */
3889    struct LDKChannelFeatures *result;
3890    /**
3891     * A pointer to the contents in the error state.
3892     * Reading from this pointer when `result_ok` is set is undefined.
3893     */
3894    struct LDKDecodeError *err;
3895 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
3896
3897 /**
3898  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
3899  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3900  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3901  */
3902 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
3903    /**
3904     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
3905     * `err` or `result` depending on the state of `result_ok`.
3906     */
3907    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
3908    /**
3909     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
3910     */
3911    bool result_ok;
3912 } LDKCResult_ChannelFeaturesDecodeErrorZ;
3913
3914
3915
3916 /**
3917  * Features used within an invoice.
3918  */
3919 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
3920    /**
3921     * A pointer to the opaque Rust object.
3922     * Nearly everywhere, inner must be non-null, however in places where
3923     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3924     */
3925    LDKnativeInvoiceFeatures *inner;
3926    /**
3927     * Indicates that this is the only struct which contains the same pointer.
3928     * Rust functions which take ownership of an object provided via an argument require
3929     * this to be true and invalidate the object pointed to by inner.
3930     */
3931    bool is_owned;
3932 } LDKInvoiceFeatures;
3933
3934 /**
3935  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
3936  */
3937 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
3938    /**
3939     * A pointer to the contents in the success state.
3940     * Reading from this pointer when `result_ok` is not set is undefined.
3941     */
3942    struct LDKInvoiceFeatures *result;
3943    /**
3944     * A pointer to the contents in the error state.
3945     * Reading from this pointer when `result_ok` is set is undefined.
3946     */
3947    struct LDKDecodeError *err;
3948 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
3949
3950 /**
3951  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
3952  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3953  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3954  */
3955 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
3956    /**
3957     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
3958     * `err` or `result` depending on the state of `result_ok`.
3959     */
3960    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
3961    /**
3962     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
3963     */
3964    bool result_ok;
3965 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
3966
3967
3968
3969 /**
3970  * Parameters for configuring [`Scorer`].
3971  */
3972 typedef struct MUST_USE_STRUCT LDKScoringParameters {
3973    /**
3974     * A pointer to the opaque Rust object.
3975     * Nearly everywhere, inner must be non-null, however in places where
3976     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3977     */
3978    LDKnativeScoringParameters *inner;
3979    /**
3980     * Indicates that this is the only struct which contains the same pointer.
3981     * Rust functions which take ownership of an object provided via an argument require
3982     * this to be true and invalidate the object pointed to by inner.
3983     */
3984    bool is_owned;
3985 } LDKScoringParameters;
3986
3987 /**
3988  * The contents of CResult_ScoringParametersDecodeErrorZ
3989  */
3990 typedef union LDKCResult_ScoringParametersDecodeErrorZPtr {
3991    /**
3992     * A pointer to the contents in the success state.
3993     * Reading from this pointer when `result_ok` is not set is undefined.
3994     */
3995    struct LDKScoringParameters *result;
3996    /**
3997     * A pointer to the contents in the error state.
3998     * Reading from this pointer when `result_ok` is set is undefined.
3999     */
4000    struct LDKDecodeError *err;
4001 } LDKCResult_ScoringParametersDecodeErrorZPtr;
4002
4003 /**
4004  * A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
4005  * containing a crate::lightning::routing::scorer::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4006  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4007  */
4008 typedef struct LDKCResult_ScoringParametersDecodeErrorZ {
4009    /**
4010     * The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
4011     * `err` or `result` depending on the state of `result_ok`.
4012     */
4013    union LDKCResult_ScoringParametersDecodeErrorZPtr contents;
4014    /**
4015     * Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
4016     */
4017    bool result_ok;
4018 } LDKCResult_ScoringParametersDecodeErrorZ;
4019
4020
4021
4022 /**
4023  * [`routing::Score`] implementation that provides reasonable default behavior.
4024  *
4025  * Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with
4026  * slightly higher fees are available. Will further penalize channels that fail to relay payments.
4027  *
4028  * See [module-level documentation] for usage.
4029  *
4030  * [module-level documentation]: crate::routing::scorer
4031  */
4032 typedef struct MUST_USE_STRUCT LDKScorer {
4033    /**
4034     * A pointer to the opaque Rust object.
4035     * Nearly everywhere, inner must be non-null, however in places where
4036     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4037     */
4038    LDKnativeScorer *inner;
4039    /**
4040     * Indicates that this is the only struct which contains the same pointer.
4041     * Rust functions which take ownership of an object provided via an argument require
4042     * this to be true and invalidate the object pointed to by inner.
4043     */
4044    bool is_owned;
4045 } LDKScorer;
4046
4047 /**
4048  * The contents of CResult_ScorerDecodeErrorZ
4049  */
4050 typedef union LDKCResult_ScorerDecodeErrorZPtr {
4051    /**
4052     * A pointer to the contents in the success state.
4053     * Reading from this pointer when `result_ok` is not set is undefined.
4054     */
4055    struct LDKScorer *result;
4056    /**
4057     * A pointer to the contents in the error state.
4058     * Reading from this pointer when `result_ok` is set is undefined.
4059     */
4060    struct LDKDecodeError *err;
4061 } LDKCResult_ScorerDecodeErrorZPtr;
4062
4063 /**
4064  * A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
4065  * containing a crate::lightning::routing::scorer::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4066  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4067  */
4068 typedef struct LDKCResult_ScorerDecodeErrorZ {
4069    /**
4070     * The contents of this CResult_ScorerDecodeErrorZ, accessible via either
4071     * `err` or `result` depending on the state of `result_ok`.
4072     */
4073    union LDKCResult_ScorerDecodeErrorZPtr contents;
4074    /**
4075     * Whether this CResult_ScorerDecodeErrorZ represents a success state.
4076     */
4077    bool result_ok;
4078 } LDKCResult_ScorerDecodeErrorZ;
4079
4080 /**
4081  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
4082  */
4083 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4084    /**
4085     * A pointer to the contents in the success state.
4086     * Reading from this pointer when `result_ok` is not set is undefined.
4087     */
4088    struct LDKDelayedPaymentOutputDescriptor *result;
4089    /**
4090     * A pointer to the contents in the error state.
4091     * Reading from this pointer when `result_ok` is set is undefined.
4092     */
4093    struct LDKDecodeError *err;
4094 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
4095
4096 /**
4097  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4098  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4099  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4100  */
4101 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4102    /**
4103     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
4104     * `err` or `result` depending on the state of `result_ok`.
4105     */
4106    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
4107    /**
4108     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
4109     */
4110    bool result_ok;
4111 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
4112
4113 /**
4114  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
4115  */
4116 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4117    /**
4118     * A pointer to the contents in the success state.
4119     * Reading from this pointer when `result_ok` is not set is undefined.
4120     */
4121    struct LDKStaticPaymentOutputDescriptor *result;
4122    /**
4123     * A pointer to the contents in the error state.
4124     * Reading from this pointer when `result_ok` is set is undefined.
4125     */
4126    struct LDKDecodeError *err;
4127 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
4128
4129 /**
4130  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4131  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4132  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4133  */
4134 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4135    /**
4136     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
4137     * `err` or `result` depending on the state of `result_ok`.
4138     */
4139    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
4140    /**
4141     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
4142     */
4143    bool result_ok;
4144 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
4145
4146 /**
4147  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4148  */
4149 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
4150    /**
4151     * A pointer to the contents in the success state.
4152     * Reading from this pointer when `result_ok` is not set is undefined.
4153     */
4154    struct LDKSpendableOutputDescriptor *result;
4155    /**
4156     * A pointer to the contents in the error state.
4157     * Reading from this pointer when `result_ok` is set is undefined.
4158     */
4159    struct LDKDecodeError *err;
4160 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
4161
4162 /**
4163  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4164  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4165  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4166  */
4167 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
4168    /**
4169     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4170     * `err` or `result` depending on the state of `result_ok`.
4171     */
4172    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
4173    /**
4174     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4175     */
4176    bool result_ok;
4177 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
4178
4179 /**
4180  * The contents of CResult_NoneNoneZ
4181  */
4182 typedef union LDKCResult_NoneNoneZPtr {
4183    /**
4184     * Note that this value is always NULL, as there are no contents in the OK variant
4185     */
4186    void *result;
4187    /**
4188     * Note that this value is always NULL, as there are no contents in the Err variant
4189     */
4190    void *err;
4191 } LDKCResult_NoneNoneZPtr;
4192
4193 /**
4194  * A CResult_NoneNoneZ represents the result of a fallible operation,
4195  * containing a () on success and a () on failure.
4196  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4197  */
4198 typedef struct LDKCResult_NoneNoneZ {
4199    /**
4200     * The contents of this CResult_NoneNoneZ, accessible via either
4201     * `err` or `result` depending on the state of `result_ok`.
4202     */
4203    union LDKCResult_NoneNoneZPtr contents;
4204    /**
4205     * Whether this CResult_NoneNoneZ represents a success state.
4206     */
4207    bool result_ok;
4208 } LDKCResult_NoneNoneZ;
4209
4210 /**
4211  * A tuple of 2 elements. See the individual fields for the types contained.
4212  */
4213 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
4214    /**
4215     * The element at position 0
4216     */
4217    struct LDKSignature a;
4218    /**
4219     * The element at position 1
4220     */
4221    struct LDKCVec_SignatureZ b;
4222 } LDKC2Tuple_SignatureCVec_SignatureZZ;
4223
4224 /**
4225  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4226  */
4227 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4228    /**
4229     * A pointer to the contents in the success state.
4230     * Reading from this pointer when `result_ok` is not set is undefined.
4231     */
4232    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
4233    /**
4234     * Note that this value is always NULL, as there are no contents in the Err variant
4235     */
4236    void *err;
4237 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
4238
4239 /**
4240  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4241  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4242  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4243  */
4244 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4245    /**
4246     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4247     * `err` or `result` depending on the state of `result_ok`.
4248     */
4249    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
4250    /**
4251     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4252     */
4253    bool result_ok;
4254 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
4255
4256 /**
4257  * The contents of CResult_SignatureNoneZ
4258  */
4259 typedef union LDKCResult_SignatureNoneZPtr {
4260    /**
4261     * A pointer to the contents in the success state.
4262     * Reading from this pointer when `result_ok` is not set is undefined.
4263     */
4264    struct LDKSignature *result;
4265    /**
4266     * Note that this value is always NULL, as there are no contents in the Err variant
4267     */
4268    void *err;
4269 } LDKCResult_SignatureNoneZPtr;
4270
4271 /**
4272  * A CResult_SignatureNoneZ represents the result of a fallible operation,
4273  * containing a crate::c_types::Signature on success and a () on failure.
4274  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4275  */
4276 typedef struct LDKCResult_SignatureNoneZ {
4277    /**
4278     * The contents of this CResult_SignatureNoneZ, accessible via either
4279     * `err` or `result` depending on the state of `result_ok`.
4280     */
4281    union LDKCResult_SignatureNoneZPtr contents;
4282    /**
4283     * Whether this CResult_SignatureNoneZ represents a success state.
4284     */
4285    bool result_ok;
4286 } LDKCResult_SignatureNoneZ;
4287
4288
4289
4290 /**
4291  * This class tracks the per-transaction information needed to build a closing transaction and will
4292  * actually build it and sign.
4293  *
4294  * This class can be used inside a signer implementation to generate a signature given the relevant
4295  * secret key.
4296  */
4297 typedef struct MUST_USE_STRUCT LDKClosingTransaction {
4298    /**
4299     * A pointer to the opaque Rust object.
4300     * Nearly everywhere, inner must be non-null, however in places where
4301     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4302     */
4303    LDKnativeClosingTransaction *inner;
4304    /**
4305     * Indicates that this is the only struct which contains the same pointer.
4306     * Rust functions which take ownership of an object provided via an argument require
4307     * this to be true and invalidate the object pointed to by inner.
4308     */
4309    bool is_owned;
4310 } LDKClosingTransaction;
4311
4312
4313
4314 /**
4315  * The unsigned part of a channel_announcement
4316  */
4317 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
4318    /**
4319     * A pointer to the opaque Rust object.
4320     * Nearly everywhere, inner must be non-null, however in places where
4321     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4322     */
4323    LDKnativeUnsignedChannelAnnouncement *inner;
4324    /**
4325     * Indicates that this is the only struct which contains the same pointer.
4326     * Rust functions which take ownership of an object provided via an argument require
4327     * this to be true and invalidate the object pointed to by inner.
4328     */
4329    bool is_owned;
4330 } LDKUnsignedChannelAnnouncement;
4331
4332 /**
4333  * A trait to sign lightning channel transactions as described in BOLT 3.
4334  *
4335  * Signing services could be implemented on a hardware wallet. In this case,
4336  * the current Sign would be a front-end on top of a communication
4337  * channel connected to your secure device and lightning key material wouldn't
4338  * reside on a hot server. Nevertheless, a this deployment would still need
4339  * to trust the ChannelManager to avoid loss of funds as this latest component
4340  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
4341  *
4342  * A more secure iteration would be to use hashlock (or payment points) to pair
4343  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
4344  * at the price of more state and computation on the hardware wallet side. In the future,
4345  * we are looking forward to design such interface.
4346  *
4347  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
4348  * to act, as liveness and breach reply correctness are always going to be hard requirements
4349  * of LN security model, orthogonal of key management issues.
4350  */
4351 typedef struct LDKBaseSign {
4352    /**
4353     * An opaque pointer which is passed to your function implementations as an argument.
4354     * This has no meaning in the LDK, and can be NULL or any other value.
4355     */
4356    void *this_arg;
4357    /**
4358     * Gets the per-commitment point for a specific commitment number
4359     *
4360     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
4361     */
4362    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
4363    /**
4364     * Gets the commitment secret for a specific commitment number as part of the revocation process
4365     *
4366     * An external signer implementation should error here if the commitment was already signed
4367     * and should refuse to sign it in the future.
4368     *
4369     * May be called more than once for the same index.
4370     *
4371     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
4372     */
4373    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
4374    /**
4375     * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
4376     *
4377     * This is required in order for the signer to make sure that releasing a commitment
4378     * secret won't leave us without a broadcastable holder transaction.
4379     * Policy checks should be implemented in this function, including checking the amount
4380     * sent to us and checking the HTLCs.
4381     */
4382    struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx);
4383    /**
4384     * Gets the holder's channel public keys and basepoints
4385     */
4386    struct LDKChannelPublicKeys pubkeys;
4387    /**
4388     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
4389     * Note that this takes a pointer to this object, not the this_ptr like other methods do
4390     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
4391     */
4392    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
4393    /**
4394     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
4395     * some SpendableOutputDescriptor types. This should be sufficient to identify this
4396     * Sign object uniquely and lookup or re-derive its keys.
4397     */
4398    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
4399    /**
4400     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
4401     *
4402     * Note that if signing fails or is rejected, the channel will be force-closed.
4403     *
4404     * Policy checks should be implemented in this function, including checking the amount
4405     * sent to us and checking the HTLCs.
4406     */
4407    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
4408    /**
4409     * Validate the counterparty's revocation.
4410     *
4411     * This is required in order for the signer to make sure that the state has moved
4412     * forward and it is safe to sign the next counterparty commitment.
4413     */
4414    struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
4415    /**
4416     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
4417     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
4418     * latest commitment_tx when we initiate a force-close.
4419     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
4420     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
4421     * the latest.
4422     * This may be called multiple times for the same transaction.
4423     *
4424     * An external signer implementation should check that the commitment has not been revoked.
4425     *
4426     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
4427     */
4428    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
4429    /**
4430     * Create a signature for the given input in a transaction spending an HTLC transaction output
4431     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
4432     *
4433     * A justice transaction may claim multiple outputs at the same time if timelocks are
4434     * similar, but only a signature for the input at index `input` should be signed for here.
4435     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
4436     * to an upcoming timelock expiration.
4437     *
4438     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
4439     *
4440     * per_commitment_key is revocation secret which was provided by our counterparty when they
4441     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
4442     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
4443     * so).
4444     */
4445    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]);
4446    /**
4447     * Create a signature for the given input in a transaction spending a commitment transaction
4448     * HTLC output when our counterparty broadcasts an old state.
4449     *
4450     * A justice transaction may claim multiple outputs at the same time if timelocks are
4451     * similar, but only a signature for the input at index `input` should be signed for here.
4452     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
4453     * to an upcoming timelock expiration.
4454     *
4455     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
4456     *
4457     * per_commitment_key is revocation secret which was provided by our counterparty when they
4458     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
4459     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
4460     * so).
4461     *
4462     * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
4463     * (which is committed to in the BIP 143 signatures).
4464     */
4465    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);
4466    /**
4467     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
4468     * transaction, either offered or received.
4469     *
4470     * Such a transaction may claim multiples offered outputs at same time if we know the
4471     * preimage for each when we create it, but only the input at index `input` should be
4472     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
4473     * needed with regards to an upcoming timelock expiration.
4474     *
4475     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
4476     * outputs.
4477     *
4478     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
4479     *
4480     * Per_commitment_point is the dynamic point corresponding to the channel state
4481     * detected onchain. It has been generated by our counterparty and is used to derive
4482     * channel state keys, which are then included in the witness script and committed to in the
4483     * BIP 143 signature.
4484     */
4485    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);
4486    /**
4487     * Create a signature for a (proposed) closing transaction.
4488     *
4489     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
4490     * chosen to forgo their output as dust.
4491     */
4492    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
4493    /**
4494     * Signs a channel announcement message with our funding key, proving it comes from one
4495     * of the channel participants.
4496     *
4497     * Note that if this fails or is rejected, the channel will not be publicly announced and
4498     * our counterparty may (though likely will not) close the channel on us for violating the
4499     * protocol.
4500     */
4501    struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
4502    /**
4503     * Set the counterparty static channel data, including basepoints,
4504     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
4505     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
4506     * they MUST NOT be allowed to change to different values once set.
4507     *
4508     * channel_parameters.is_populated() MUST be true.
4509     *
4510     * We bind holder_selected_contest_delay late here for API convenience.
4511     *
4512     * Will be called before any signatures are applied.
4513     */
4514    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
4515    /**
4516     * Frees any resources associated with this object given its this_arg pointer.
4517     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4518     */
4519    void (*free)(void *this_arg);
4520 } LDKBaseSign;
4521
4522 /**
4523  * A cloneable signer.
4524  *
4525  * Although we require signers to be cloneable, it may be useful for developers to be able to use
4526  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
4527  * which implies Sized, into this derived trait.
4528  */
4529 typedef struct LDKSign {
4530    /**
4531     * An opaque pointer which is passed to your function implementations as an argument.
4532     * This has no meaning in the LDK, and can be NULL or any other value.
4533     */
4534    void *this_arg;
4535    /**
4536     * Implementation of BaseSign for this object.
4537     */
4538    struct LDKBaseSign BaseSign;
4539    /**
4540     * Serialize the object into a byte array
4541     */
4542    struct LDKCVec_u8Z (*write)(const void *this_arg);
4543    /**
4544     * Called, if set, after this Sign has been cloned into a duplicate object.
4545     * The new Sign is provided, and should be mutated as needed to perform a
4546     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
4547     */
4548    void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign);
4549    /**
4550     * Frees any resources associated with this object given its this_arg pointer.
4551     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4552     */
4553    void (*free)(void *this_arg);
4554 } LDKSign;
4555
4556 /**
4557  * The contents of CResult_SignDecodeErrorZ
4558  */
4559 typedef union LDKCResult_SignDecodeErrorZPtr {
4560    /**
4561     * A pointer to the contents in the success state.
4562     * Reading from this pointer when `result_ok` is not set is undefined.
4563     */
4564    struct LDKSign *result;
4565    /**
4566     * A pointer to the contents in the error state.
4567     * Reading from this pointer when `result_ok` is set is undefined.
4568     */
4569    struct LDKDecodeError *err;
4570 } LDKCResult_SignDecodeErrorZPtr;
4571
4572 /**
4573  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
4574  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
4575  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4576  */
4577 typedef struct LDKCResult_SignDecodeErrorZ {
4578    /**
4579     * The contents of this CResult_SignDecodeErrorZ, accessible via either
4580     * `err` or `result` depending on the state of `result_ok`.
4581     */
4582    union LDKCResult_SignDecodeErrorZPtr contents;
4583    /**
4584     * Whether this CResult_SignDecodeErrorZ represents a success state.
4585     */
4586    bool result_ok;
4587 } LDKCResult_SignDecodeErrorZ;
4588
4589 /**
4590  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
4591  * allows recovering the exact public key which created the signature given the message.
4592  */
4593 typedef struct LDKRecoverableSignature {
4594    /**
4595     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
4596     * recovery.
4597     */
4598    uint8_t serialized_form[68];
4599 } LDKRecoverableSignature;
4600
4601 /**
4602  * The contents of CResult_RecoverableSignatureNoneZ
4603  */
4604 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
4605    /**
4606     * A pointer to the contents in the success state.
4607     * Reading from this pointer when `result_ok` is not set is undefined.
4608     */
4609    struct LDKRecoverableSignature *result;
4610    /**
4611     * Note that this value is always NULL, as there are no contents in the Err variant
4612     */
4613    void *err;
4614 } LDKCResult_RecoverableSignatureNoneZPtr;
4615
4616 /**
4617  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
4618  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
4619  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4620  */
4621 typedef struct LDKCResult_RecoverableSignatureNoneZ {
4622    /**
4623     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
4624     * `err` or `result` depending on the state of `result_ok`.
4625     */
4626    union LDKCResult_RecoverableSignatureNoneZPtr contents;
4627    /**
4628     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
4629     */
4630    bool result_ok;
4631 } LDKCResult_RecoverableSignatureNoneZ;
4632
4633 /**
4634  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
4635  * This corresponds to std::vector in C++
4636  */
4637 typedef struct LDKCVec_CVec_u8ZZ {
4638    /**
4639     * The elements in the array.
4640     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4641     */
4642    struct LDKCVec_u8Z *data;
4643    /**
4644     * The number of elements pointed to by `data`.
4645     */
4646    uintptr_t datalen;
4647 } LDKCVec_CVec_u8ZZ;
4648
4649 /**
4650  * The contents of CResult_CVec_CVec_u8ZZNoneZ
4651  */
4652 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
4653    /**
4654     * A pointer to the contents in the success state.
4655     * Reading from this pointer when `result_ok` is not set is undefined.
4656     */
4657    struct LDKCVec_CVec_u8ZZ *result;
4658    /**
4659     * Note that this value is always NULL, as there are no contents in the Err variant
4660     */
4661    void *err;
4662 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
4663
4664 /**
4665  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
4666  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
4667  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4668  */
4669 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
4670    /**
4671     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
4672     * `err` or `result` depending on the state of `result_ok`.
4673     */
4674    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
4675    /**
4676     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
4677     */
4678    bool result_ok;
4679 } LDKCResult_CVec_CVec_u8ZZNoneZ;
4680
4681
4682
4683 /**
4684  * A simple implementation of Sign that just keeps the private keys in memory.
4685  *
4686  * This implementation performs no policy checks and is insufficient by itself as
4687  * a secure external signer.
4688  */
4689 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
4690    /**
4691     * A pointer to the opaque Rust object.
4692     * Nearly everywhere, inner must be non-null, however in places where
4693     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4694     */
4695    LDKnativeInMemorySigner *inner;
4696    /**
4697     * Indicates that this is the only struct which contains the same pointer.
4698     * Rust functions which take ownership of an object provided via an argument require
4699     * this to be true and invalidate the object pointed to by inner.
4700     */
4701    bool is_owned;
4702 } LDKInMemorySigner;
4703
4704 /**
4705  * The contents of CResult_InMemorySignerDecodeErrorZ
4706  */
4707 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
4708    /**
4709     * A pointer to the contents in the success state.
4710     * Reading from this pointer when `result_ok` is not set is undefined.
4711     */
4712    struct LDKInMemorySigner *result;
4713    /**
4714     * A pointer to the contents in the error state.
4715     * Reading from this pointer when `result_ok` is set is undefined.
4716     */
4717    struct LDKDecodeError *err;
4718 } LDKCResult_InMemorySignerDecodeErrorZPtr;
4719
4720 /**
4721  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
4722  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
4723  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4724  */
4725 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
4726    /**
4727     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
4728     * `err` or `result` depending on the state of `result_ok`.
4729     */
4730    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
4731    /**
4732     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
4733     */
4734    bool result_ok;
4735 } LDKCResult_InMemorySignerDecodeErrorZ;
4736
4737 /**
4738  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
4739  * This corresponds to std::vector in C++
4740  */
4741 typedef struct LDKCVec_TxOutZ {
4742    /**
4743     * The elements in the array.
4744     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4745     */
4746    struct LDKTxOut *data;
4747    /**
4748     * The number of elements pointed to by `data`.
4749     */
4750    uintptr_t datalen;
4751 } LDKCVec_TxOutZ;
4752
4753 /**
4754  * The contents of CResult_TransactionNoneZ
4755  */
4756 typedef union LDKCResult_TransactionNoneZPtr {
4757    /**
4758     * A pointer to the contents in the success state.
4759     * Reading from this pointer when `result_ok` is not set is undefined.
4760     */
4761    struct LDKTransaction *result;
4762    /**
4763     * Note that this value is always NULL, as there are no contents in the Err variant
4764     */
4765    void *err;
4766 } LDKCResult_TransactionNoneZPtr;
4767
4768 /**
4769  * A CResult_TransactionNoneZ represents the result of a fallible operation,
4770  * containing a crate::c_types::Transaction on success and a () on failure.
4771  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4772  */
4773 typedef struct LDKCResult_TransactionNoneZ {
4774    /**
4775     * The contents of this CResult_TransactionNoneZ, accessible via either
4776     * `err` or `result` depending on the state of `result_ok`.
4777     */
4778    union LDKCResult_TransactionNoneZPtr contents;
4779    /**
4780     * Whether this CResult_TransactionNoneZ represents a success state.
4781     */
4782    bool result_ok;
4783 } LDKCResult_TransactionNoneZ;
4784
4785
4786
4787 /**
4788  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
4789  * on-chain transactions to ensure no loss of funds occurs.
4790  *
4791  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
4792  * information and are actively monitoring the chain.
4793  *
4794  * Pending Events or updated HTLCs which have not yet been read out by
4795  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
4796  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
4797  * gotten are fully handled before re-serializing the new state.
4798  *
4799  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
4800  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
4801  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
4802  * returned block hash and the the current chain and then reconnecting blocks to get to the
4803  * best chain) upon deserializing the object!
4804  */
4805 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
4806    /**
4807     * A pointer to the opaque Rust object.
4808     * Nearly everywhere, inner must be non-null, however in places where
4809     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4810     */
4811    LDKnativeChannelMonitor *inner;
4812    /**
4813     * Indicates that this is the only struct which contains the same pointer.
4814     * Rust functions which take ownership of an object provided via an argument require
4815     * this to be true and invalidate the object pointed to by inner.
4816     */
4817    bool is_owned;
4818 } LDKChannelMonitor;
4819
4820 /**
4821  * A tuple of 2 elements. See the individual fields for the types contained.
4822  */
4823 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
4824    /**
4825     * The element at position 0
4826     */
4827    struct LDKThirtyTwoBytes a;
4828    /**
4829     * The element at position 1
4830     */
4831    struct LDKChannelMonitor b;
4832 } LDKC2Tuple_BlockHashChannelMonitorZ;
4833
4834 /**
4835  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
4836  * This corresponds to std::vector in C++
4837  */
4838 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
4839    /**
4840     * The elements in the array.
4841     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4842     */
4843    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
4844    /**
4845     * The number of elements pointed to by `data`.
4846     */
4847    uintptr_t datalen;
4848 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
4849
4850 /**
4851  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
4852  */
4853 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
4854    /**
4855     * A pointer to the contents in the success state.
4856     * Reading from this pointer when `result_ok` is not set is undefined.
4857     */
4858    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
4859    /**
4860     * A pointer to the contents in the error state.
4861     * Reading from this pointer when `result_ok` is set is undefined.
4862     */
4863    enum LDKIOError *err;
4864 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
4865
4866 /**
4867  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
4868  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
4869  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4870  */
4871 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
4872    /**
4873     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
4874     * `err` or `result` depending on the state of `result_ok`.
4875     */
4876    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
4877    /**
4878     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
4879     */
4880    bool result_ok;
4881 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
4882
4883 /**
4884  * An enum which can either contain a u16 or not
4885  */
4886 typedef enum LDKCOption_u16Z_Tag {
4887    /**
4888     * When we're in this state, this COption_u16Z contains a u16
4889     */
4890    LDKCOption_u16Z_Some,
4891    /**
4892     * When we're in this state, this COption_u16Z contains nothing
4893     */
4894    LDKCOption_u16Z_None,
4895    /**
4896     * Must be last for serialization purposes
4897     */
4898    LDKCOption_u16Z_Sentinel,
4899 } LDKCOption_u16Z_Tag;
4900
4901 typedef struct LDKCOption_u16Z {
4902    LDKCOption_u16Z_Tag tag;
4903    union {
4904       struct {
4905          uint16_t some;
4906       };
4907    };
4908 } LDKCOption_u16Z;
4909
4910 /**
4911  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
4912  * too-high values)
4913  */
4914 typedef enum LDKAPIError_Tag {
4915    /**
4916     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
4917     * are documented, but generally indicates some precondition of a function was violated.
4918     */
4919    LDKAPIError_APIMisuseError,
4920    /**
4921     * Due to a high feerate, we were unable to complete the request.
4922     * For example, this may be returned if the feerate implies we cannot open a channel at the
4923     * requested value, but opening a larger channel would succeed.
4924     */
4925    LDKAPIError_FeeRateTooHigh,
4926    /**
4927     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
4928     * too-many-hops, etc).
4929     */
4930    LDKAPIError_RouteError,
4931    /**
4932     * We were unable to complete the request as the Channel required to do so is unable to
4933     * complete the request (or was not found). This can take many forms, including disconnected
4934     * peer, channel at capacity, channel shutting down, etc.
4935     */
4936    LDKAPIError_ChannelUnavailable,
4937    /**
4938     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
4939     * attempted action to fail.
4940     */
4941    LDKAPIError_MonitorUpdateFailed,
4942    /**
4943     * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
4944     * with the channel counterparty as negotiated in [`InitFeatures`].
4945     *
4946     * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
4947     * a channel or cooperatively close one with this peer (and will have to force-close instead).
4948     *
4949     * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
4950     * [`InitFeatures`]: crate::ln::features::InitFeatures
4951     */
4952    LDKAPIError_IncompatibleShutdownScript,
4953    /**
4954     * Must be last for serialization purposes
4955     */
4956    LDKAPIError_Sentinel,
4957 } LDKAPIError_Tag;
4958
4959 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
4960    /**
4961     * A human-readable error message
4962     */
4963    struct LDKStr err;
4964 } LDKAPIError_LDKAPIMisuseError_Body;
4965
4966 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
4967    /**
4968     * A human-readable error message
4969     */
4970    struct LDKStr err;
4971    /**
4972     * The feerate which was too high.
4973     */
4974    uint32_t feerate;
4975 } LDKAPIError_LDKFeeRateTooHigh_Body;
4976
4977 typedef struct LDKAPIError_LDKRouteError_Body {
4978    /**
4979     * A human-readable error message
4980     */
4981    struct LDKStr err;
4982 } LDKAPIError_LDKRouteError_Body;
4983
4984 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
4985    /**
4986     * A human-readable error message
4987     */
4988    struct LDKStr err;
4989 } LDKAPIError_LDKChannelUnavailable_Body;
4990
4991 typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
4992    /**
4993     * The incompatible shutdown script.
4994     */
4995    struct LDKShutdownScript script;
4996 } LDKAPIError_LDKIncompatibleShutdownScript_Body;
4997
4998 typedef struct MUST_USE_STRUCT LDKAPIError {
4999    LDKAPIError_Tag tag;
5000    union {
5001       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
5002       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
5003       LDKAPIError_LDKRouteError_Body route_error;
5004       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
5005       LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
5006    };
5007 } LDKAPIError;
5008
5009 /**
5010  * The contents of CResult_NoneAPIErrorZ
5011  */
5012 typedef union LDKCResult_NoneAPIErrorZPtr {
5013    /**
5014     * Note that this value is always NULL, as there are no contents in the OK variant
5015     */
5016    void *result;
5017    /**
5018     * A pointer to the contents in the error state.
5019     * Reading from this pointer when `result_ok` is set is undefined.
5020     */
5021    struct LDKAPIError *err;
5022 } LDKCResult_NoneAPIErrorZPtr;
5023
5024 /**
5025  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
5026  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
5027  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5028  */
5029 typedef struct LDKCResult_NoneAPIErrorZ {
5030    /**
5031     * The contents of this CResult_NoneAPIErrorZ, accessible via either
5032     * `err` or `result` depending on the state of `result_ok`.
5033     */
5034    union LDKCResult_NoneAPIErrorZPtr contents;
5035    /**
5036     * Whether this CResult_NoneAPIErrorZ represents a success state.
5037     */
5038    bool result_ok;
5039 } LDKCResult_NoneAPIErrorZ;
5040
5041 /**
5042  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
5043  * This corresponds to std::vector in C++
5044  */
5045 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
5046    /**
5047     * The elements in the array.
5048     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5049     */
5050    struct LDKCResult_NoneAPIErrorZ *data;
5051    /**
5052     * The number of elements pointed to by `data`.
5053     */
5054    uintptr_t datalen;
5055 } LDKCVec_CResult_NoneAPIErrorZZ;
5056
5057 /**
5058  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
5059  * This corresponds to std::vector in C++
5060  */
5061 typedef struct LDKCVec_APIErrorZ {
5062    /**
5063     * The elements in the array.
5064     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5065     */
5066    struct LDKAPIError *data;
5067    /**
5068     * The number of elements pointed to by `data`.
5069     */
5070    uintptr_t datalen;
5071 } LDKCVec_APIErrorZ;
5072
5073 /**
5074  * The contents of CResult__u832APIErrorZ
5075  */
5076 typedef union LDKCResult__u832APIErrorZPtr {
5077    /**
5078     * A pointer to the contents in the success state.
5079     * Reading from this pointer when `result_ok` is not set is undefined.
5080     */
5081    struct LDKThirtyTwoBytes *result;
5082    /**
5083     * A pointer to the contents in the error state.
5084     * Reading from this pointer when `result_ok` is set is undefined.
5085     */
5086    struct LDKAPIError *err;
5087 } LDKCResult__u832APIErrorZPtr;
5088
5089 /**
5090  * A CResult__u832APIErrorZ represents the result of a fallible operation,
5091  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
5092  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5093  */
5094 typedef struct LDKCResult__u832APIErrorZ {
5095    /**
5096     * The contents of this CResult__u832APIErrorZ, accessible via either
5097     * `err` or `result` depending on the state of `result_ok`.
5098     */
5099    union LDKCResult__u832APIErrorZPtr contents;
5100    /**
5101     * Whether this CResult__u832APIErrorZ represents a success state.
5102     */
5103    bool result_ok;
5104 } LDKCResult__u832APIErrorZ;
5105
5106 /**
5107  * If a payment fails to send, it can be in one of several states. This enum is returned as the
5108  * Err() type describing which state the payment is in, see the description of individual enum
5109  * states for more.
5110  */
5111 typedef enum LDKPaymentSendFailure_Tag {
5112    /**
5113     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
5114     * send the payment at all. No channel state has been changed or messages sent to peers, and
5115     * once you've changed the parameter at error, you can freely retry the payment in full.
5116     */
5117    LDKPaymentSendFailure_ParameterError,
5118    /**
5119     * A parameter in a single path which was passed to send_payment was invalid, preventing us
5120     * from attempting to send the payment at all. No channel state has been changed or messages
5121     * sent to peers, and once you've changed the parameter at error, you can freely retry the
5122     * payment in full.
5123     *
5124     * The results here are ordered the same as the paths in the route object which was passed to
5125     * send_payment.
5126     */
5127    LDKPaymentSendFailure_PathParameterError,
5128    /**
5129     * All paths which were attempted failed to send, with no channel state change taking place.
5130     * You can freely retry the payment in full (though you probably want to do so over different
5131     * paths than the ones selected).
5132     */
5133    LDKPaymentSendFailure_AllFailedRetrySafe,
5134    /**
5135     * Some paths which were attempted failed to send, though possibly not all. At least some
5136     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
5137     * in over-/re-payment.
5138     *
5139     * The results here are ordered the same as the paths in the route object which was passed to
5140     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
5141     * retried (though there is currently no API with which to do so).
5142     *
5143     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
5144     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
5145     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
5146     * with the latest update_id.
5147     */
5148    LDKPaymentSendFailure_PartialFailure,
5149    /**
5150     * Must be last for serialization purposes
5151     */
5152    LDKPaymentSendFailure_Sentinel,
5153 } LDKPaymentSendFailure_Tag;
5154
5155 typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
5156    /**
5157     * The errors themselves, in the same order as the route hops.
5158     */
5159    struct LDKCVec_CResult_NoneAPIErrorZZ results;
5160    /**
5161     * If some paths failed without irrevocably committing to the new HTLC(s), this will
5162     * contain a [`RouteParameters`] object which can be used to calculate a new route that
5163     * will pay all remaining unpaid balance.
5164     *
5165     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
5166     */
5167    struct LDKRouteParameters failed_paths_retry;
5168    /**
5169     * The payment id for the payment, which is now at least partially pending.
5170     */
5171    struct LDKThirtyTwoBytes payment_id;
5172 } LDKPaymentSendFailure_LDKPartialFailure_Body;
5173
5174 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
5175    LDKPaymentSendFailure_Tag tag;
5176    union {
5177       struct {
5178          struct LDKAPIError parameter_error;
5179       };
5180       struct {
5181          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
5182       };
5183       struct {
5184          struct LDKCVec_APIErrorZ all_failed_retry_safe;
5185       };
5186       LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
5187    };
5188 } LDKPaymentSendFailure;
5189
5190 /**
5191  * The contents of CResult_PaymentIdPaymentSendFailureZ
5192  */
5193 typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr {
5194    /**
5195     * A pointer to the contents in the success state.
5196     * Reading from this pointer when `result_ok` is not set is undefined.
5197     */
5198    struct LDKThirtyTwoBytes *result;
5199    /**
5200     * A pointer to the contents in the error state.
5201     * Reading from this pointer when `result_ok` is set is undefined.
5202     */
5203    struct LDKPaymentSendFailure *err;
5204 } LDKCResult_PaymentIdPaymentSendFailureZPtr;
5205
5206 /**
5207  * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
5208  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5209  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5210  */
5211 typedef struct LDKCResult_PaymentIdPaymentSendFailureZ {
5212    /**
5213     * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
5214     * `err` or `result` depending on the state of `result_ok`.
5215     */
5216    union LDKCResult_PaymentIdPaymentSendFailureZPtr contents;
5217    /**
5218     * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
5219     */
5220    bool result_ok;
5221 } LDKCResult_PaymentIdPaymentSendFailureZ;
5222
5223 /**
5224  * The contents of CResult_NonePaymentSendFailureZ
5225  */
5226 typedef union LDKCResult_NonePaymentSendFailureZPtr {
5227    /**
5228     * Note that this value is always NULL, as there are no contents in the OK variant
5229     */
5230    void *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 LDKPaymentSendFailure *err;
5236 } LDKCResult_NonePaymentSendFailureZPtr;
5237
5238 /**
5239  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
5240  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5241  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5242  */
5243 typedef struct LDKCResult_NonePaymentSendFailureZ {
5244    /**
5245     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
5246     * `err` or `result` depending on the state of `result_ok`.
5247     */
5248    union LDKCResult_NonePaymentSendFailureZPtr contents;
5249    /**
5250     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
5251     */
5252    bool result_ok;
5253 } LDKCResult_NonePaymentSendFailureZ;
5254
5255 /**
5256  * A tuple of 2 elements. See the individual fields for the types contained.
5257  */
5258 typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
5259    /**
5260     * The element at position 0
5261     */
5262    struct LDKThirtyTwoBytes a;
5263    /**
5264     * The element at position 1
5265     */
5266    struct LDKThirtyTwoBytes b;
5267 } LDKC2Tuple_PaymentHashPaymentIdZ;
5268
5269 /**
5270  * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
5271  */
5272 typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5273    /**
5274     * A pointer to the contents in the success state.
5275     * Reading from this pointer when `result_ok` is not set is undefined.
5276     */
5277    struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
5278    /**
5279     * A pointer to the contents in the error state.
5280     * Reading from this pointer when `result_ok` is set is undefined.
5281     */
5282    struct LDKPaymentSendFailure *err;
5283 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
5284
5285 /**
5286  * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
5287  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5288  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5289  */
5290 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5291    /**
5292     * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
5293     * `err` or `result` depending on the state of `result_ok`.
5294     */
5295    union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
5296    /**
5297     * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
5298     */
5299    bool result_ok;
5300 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
5301
5302 /**
5303  * A 4-byte byte array.
5304  */
5305 typedef struct LDKFourBytes {
5306    /**
5307     * The four bytes
5308     */
5309    uint8_t data[4];
5310 } LDKFourBytes;
5311
5312 /**
5313  * A 16-byte byte array.
5314  */
5315 typedef struct LDKSixteenBytes {
5316    /**
5317     * The sixteen bytes
5318     */
5319    uint8_t data[16];
5320 } LDKSixteenBytes;
5321
5322 /**
5323  * A 10-byte byte array.
5324  */
5325 typedef struct LDKTenBytes {
5326    /**
5327     * The ten bytes
5328     */
5329    uint8_t data[10];
5330 } LDKTenBytes;
5331
5332 /**
5333  * An address which can be used to connect to a remote peer
5334  */
5335 typedef enum LDKNetAddress_Tag {
5336    /**
5337     * An IPv4 address/port on which the peer is listening.
5338     */
5339    LDKNetAddress_IPv4,
5340    /**
5341     * An IPv6 address/port on which the peer is listening.
5342     */
5343    LDKNetAddress_IPv6,
5344    /**
5345     * An old-style Tor onion address/port on which the peer is listening.
5346     */
5347    LDKNetAddress_OnionV2,
5348    /**
5349     * A new-style Tor onion address/port on which the peer is listening.
5350     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
5351     * wrap as base32 and append \".onion\".
5352     */
5353    LDKNetAddress_OnionV3,
5354    /**
5355     * Must be last for serialization purposes
5356     */
5357    LDKNetAddress_Sentinel,
5358 } LDKNetAddress_Tag;
5359
5360 typedef struct LDKNetAddress_LDKIPv4_Body {
5361    /**
5362     * The 4-byte IPv4 address
5363     */
5364    struct LDKFourBytes addr;
5365    /**
5366     * The port on which the node is listening
5367     */
5368    uint16_t port;
5369 } LDKNetAddress_LDKIPv4_Body;
5370
5371 typedef struct LDKNetAddress_LDKIPv6_Body {
5372    /**
5373     * The 16-byte IPv6 address
5374     */
5375    struct LDKSixteenBytes addr;
5376    /**
5377     * The port on which the node is listening
5378     */
5379    uint16_t port;
5380 } LDKNetAddress_LDKIPv6_Body;
5381
5382 typedef struct LDKNetAddress_LDKOnionV2_Body {
5383    /**
5384     * The bytes (usually encoded in base32 with \".onion\" appended)
5385     */
5386    struct LDKTenBytes addr;
5387    /**
5388     * The port on which the node is listening
5389     */
5390    uint16_t port;
5391 } LDKNetAddress_LDKOnionV2_Body;
5392
5393 typedef struct LDKNetAddress_LDKOnionV3_Body {
5394    /**
5395     * The ed25519 long-term public key of the peer
5396     */
5397    struct LDKThirtyTwoBytes ed25519_pubkey;
5398    /**
5399     * The checksum of the pubkey and version, as included in the onion address
5400     */
5401    uint16_t checksum;
5402    /**
5403     * The version byte, as defined by the Tor Onion v3 spec.
5404     */
5405    uint8_t version;
5406    /**
5407     * The port on which the node is listening
5408     */
5409    uint16_t port;
5410 } LDKNetAddress_LDKOnionV3_Body;
5411
5412 typedef struct MUST_USE_STRUCT LDKNetAddress {
5413    LDKNetAddress_Tag tag;
5414    union {
5415       LDKNetAddress_LDKIPv4_Body i_pv4;
5416       LDKNetAddress_LDKIPv6_Body i_pv6;
5417       LDKNetAddress_LDKOnionV2_Body onion_v2;
5418       LDKNetAddress_LDKOnionV3_Body onion_v3;
5419    };
5420 } LDKNetAddress;
5421
5422 /**
5423  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5424  * This corresponds to std::vector in C++
5425  */
5426 typedef struct LDKCVec_NetAddressZ {
5427    /**
5428     * The elements in the array.
5429     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5430     */
5431    struct LDKNetAddress *data;
5432    /**
5433     * The number of elements pointed to by `data`.
5434     */
5435    uintptr_t datalen;
5436 } LDKCVec_NetAddressZ;
5437
5438 /**
5439  * A tuple of 2 elements. See the individual fields for the types contained.
5440  */
5441 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
5442    /**
5443     * The element at position 0
5444     */
5445    struct LDKThirtyTwoBytes a;
5446    /**
5447     * The element at position 1
5448     */
5449    struct LDKThirtyTwoBytes b;
5450 } LDKC2Tuple_PaymentHashPaymentSecretZ;
5451
5452 /**
5453  * The contents of CResult_PaymentSecretAPIErrorZ
5454  */
5455 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
5456    /**
5457     * A pointer to the contents in the success state.
5458     * Reading from this pointer when `result_ok` is not set is undefined.
5459     */
5460    struct LDKThirtyTwoBytes *result;
5461    /**
5462     * A pointer to the contents in the error state.
5463     * Reading from this pointer when `result_ok` is set is undefined.
5464     */
5465    struct LDKAPIError *err;
5466 } LDKCResult_PaymentSecretAPIErrorZPtr;
5467
5468 /**
5469  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
5470  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
5471  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5472  */
5473 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
5474    /**
5475     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
5476     * `err` or `result` depending on the state of `result_ok`.
5477     */
5478    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
5479    /**
5480     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
5481     */
5482    bool result_ok;
5483 } LDKCResult_PaymentSecretAPIErrorZ;
5484
5485 /**
5486  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
5487  * This corresponds to std::vector in C++
5488  */
5489 typedef struct LDKCVec_ChannelMonitorZ {
5490    /**
5491     * The elements in the array.
5492     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5493     */
5494    struct LDKChannelMonitor *data;
5495    /**
5496     * The number of elements pointed to by `data`.
5497     */
5498    uintptr_t datalen;
5499 } LDKCVec_ChannelMonitorZ;
5500
5501
5502
5503 /**
5504  * An update generated by the underlying Channel itself which contains some new information the
5505  * ChannelMonitor should be made aware of.
5506  */
5507 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
5508    /**
5509     * A pointer to the opaque Rust object.
5510     * Nearly everywhere, inner must be non-null, however in places where
5511     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5512     */
5513    LDKnativeChannelMonitorUpdate *inner;
5514    /**
5515     * Indicates that this is the only struct which contains the same pointer.
5516     * Rust functions which take ownership of an object provided via an argument require
5517     * this to be true and invalidate the object pointed to by inner.
5518     */
5519    bool is_owned;
5520 } LDKChannelMonitorUpdate;
5521
5522 /**
5523  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
5524  * blocks are connected and disconnected.
5525  *
5526  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
5527  * responsible for maintaining a set of monitors such that they can be updated accordingly as
5528  * channel state changes and HTLCs are resolved. See method documentation for specific
5529  * requirements.
5530  *
5531  * Implementations **must** ensure that updates are successfully applied and persisted upon method
5532  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
5533  * without taking any further action such as persisting the current state.
5534  *
5535  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
5536  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
5537  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
5538  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
5539  * multiple instances.
5540  *
5541  * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure
5542  */
5543 typedef struct LDKWatch {
5544    /**
5545     * An opaque pointer which is passed to your function implementations as an argument.
5546     * This has no meaning in the LDK, and can be NULL or any other value.
5547     */
5548    void *this_arg;
5549    /**
5550     * Watches a channel identified by `funding_txo` using `monitor`.
5551     *
5552     * Implementations are responsible for watching the chain for the funding transaction along
5553     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
5554     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
5555     *
5556     * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if
5557     * the given `funding_txo` has previously been registered via `watch_channel`.
5558     *
5559     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
5560     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
5561     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
5562     */
5563    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
5564    /**
5565     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
5566     *
5567     * Implementations must call [`update_monitor`] with the given update. See
5568     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
5569     *
5570     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
5571     */
5572    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
5573    /**
5574     * Returns any monitor events since the last call. Subsequent calls must only return new
5575     * events.
5576     *
5577     * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
5578     * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
5579     * to disk.
5580     *
5581     * For details on asynchronous [`ChannelMonitor`] updating and returning
5582     * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
5583     */
5584    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
5585    /**
5586     * Frees any resources associated with this object given its this_arg pointer.
5587     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5588     */
5589    void (*free)(void *this_arg);
5590 } LDKWatch;
5591
5592 /**
5593  * An interface to send a transaction to the Bitcoin network.
5594  */
5595 typedef struct LDKBroadcasterInterface {
5596    /**
5597     * An opaque pointer which is passed to your function implementations as an argument.
5598     * This has no meaning in the LDK, and can be NULL or any other value.
5599     */
5600    void *this_arg;
5601    /**
5602     * Sends a transaction out to (hopefully) be mined.
5603     */
5604    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
5605    /**
5606     * Frees any resources associated with this object given its this_arg pointer.
5607     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5608     */
5609    void (*free)(void *this_arg);
5610 } LDKBroadcasterInterface;
5611
5612 /**
5613  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
5614  * own the memory pointed to by data.
5615  */
5616 typedef struct LDKu8slice {
5617    /**
5618     * A pointer to the byte buffer
5619     */
5620    const uint8_t *data;
5621    /**
5622     * The number of bytes pointed to by `data`.
5623     */
5624    uintptr_t datalen;
5625 } LDKu8slice;
5626
5627 /**
5628  * A trait to describe an object which can get user secrets and key material.
5629  */
5630 typedef struct LDKKeysInterface {
5631    /**
5632     * An opaque pointer which is passed to your function implementations as an argument.
5633     * This has no meaning in the LDK, and can be NULL or any other value.
5634     */
5635    void *this_arg;
5636    /**
5637     * Get node secret key (aka node_id or network_key).
5638     *
5639     * This method must return the same value each time it is called.
5640     */
5641    struct LDKSecretKey (*get_node_secret)(const void *this_arg);
5642    /**
5643     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
5644     *
5645     * This method should return a different value each time it is called, to avoid linking
5646     * on-chain funds across channels as controlled to the same user.
5647     */
5648    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
5649    /**
5650     * Get a script pubkey which we will send funds to when closing a channel.
5651     *
5652     * This method should return a different value each time it is called, to avoid linking
5653     * on-chain funds across channels as controlled to the same user.
5654     */
5655    struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
5656    /**
5657     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
5658     * restarted with some stale data!
5659     *
5660     * This method must return a different value each time it is called.
5661     */
5662    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
5663    /**
5664     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
5665     * onion packets and for temporary channel IDs. There is no requirement that these be
5666     * persisted anywhere, though they must be unique across restarts.
5667     *
5668     * This method must return a different value each time it is called.
5669     */
5670    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
5671    /**
5672     * Reads a `Signer` for this `KeysInterface` from the given input stream.
5673     * This is only called during deserialization of other objects which contain
5674     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
5675     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
5676     * contain no versioning scheme. You may wish to include your own version prefix and ensure
5677     * you've read all of the provided bytes to ensure no corruption occurred.
5678     */
5679    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
5680    /**
5681     * Sign an invoice's preimage (note that this is the preimage of the invoice, not the HTLC's
5682     * preimage). By parameterizing by the preimage instead of the hash, we allow implementors of
5683     * this trait to parse the invoice and make sure they're signing what they expect, rather than
5684     * blindly signing the hash.
5685     */
5686    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKCVec_u8Z invoice_preimage);
5687    /**
5688     * Frees any resources associated with this object given its this_arg pointer.
5689     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5690     */
5691    void (*free)(void *this_arg);
5692 } LDKKeysInterface;
5693
5694 /**
5695  * A trait which should be implemented to provide feerate information on a number of time
5696  * horizons.
5697  *
5698  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
5699  * called from inside the library in response to chain events, P2P events, or timer events).
5700  */
5701 typedef struct LDKFeeEstimator {
5702    /**
5703     * An opaque pointer which is passed to your function implementations as an argument.
5704     * This has no meaning in the LDK, and can be NULL or any other value.
5705     */
5706    void *this_arg;
5707    /**
5708     * Gets estimated satoshis of fee required per 1000 Weight-Units.
5709     *
5710     * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
5711     * don't put us below 1 satoshi-per-byte).
5712     *
5713     * This translates to:
5714     *  * satoshis-per-byte * 250
5715     *  * ceil(satoshis-per-kbyte / 4)
5716     */
5717    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
5718    /**
5719     * Frees any resources associated with this object given its this_arg pointer.
5720     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5721     */
5722    void (*free)(void *this_arg);
5723 } LDKFeeEstimator;
5724
5725
5726
5727 /**
5728  * A Record, unit of logging output with Metadata to enable filtering
5729  * Module_path, file, line to inform on log's source
5730  */
5731 typedef struct MUST_USE_STRUCT LDKRecord {
5732    /**
5733     * A pointer to the opaque Rust object.
5734     * Nearly everywhere, inner must be non-null, however in places where
5735     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5736     */
5737    LDKnativeRecord *inner;
5738    /**
5739     * Indicates that this is the only struct which contains the same pointer.
5740     * Rust functions which take ownership of an object provided via an argument require
5741     * this to be true and invalidate the object pointed to by inner.
5742     */
5743    bool is_owned;
5744 } LDKRecord;
5745
5746 /**
5747  * A trait encapsulating the operations required of a logger
5748  */
5749 typedef struct LDKLogger {
5750    /**
5751     * An opaque pointer which is passed to your function implementations as an argument.
5752     * This has no meaning in the LDK, and can be NULL or any other value.
5753     */
5754    void *this_arg;
5755    /**
5756     * Logs the `Record`
5757     */
5758    void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record);
5759    /**
5760     * Frees any resources associated with this object given its this_arg pointer.
5761     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5762     */
5763    void (*free)(void *this_arg);
5764 } LDKLogger;
5765
5766
5767
5768 /**
5769  * Manager which keeps track of a number of channels and sends messages to the appropriate
5770  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
5771  *
5772  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
5773  * to individual Channels.
5774  *
5775  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
5776  * all peers during write/read (though does not modify this instance, only the instance being
5777  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
5778  * called funding_transaction_generated for outbound channels).
5779  *
5780  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
5781  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
5782  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
5783  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
5784  * the serialization process). If the deserialized version is out-of-date compared to the
5785  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
5786  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
5787  *
5788  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
5789  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
5790  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
5791  * block_connected() to step towards your best block) upon deserialization before using the
5792  * object!
5793  *
5794  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
5795  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
5796  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
5797  * offline for a full minute. In order to track this, you must call
5798  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
5799  *
5800  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
5801  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
5802  * essentially you should default to using a SimpleRefChannelManager, and use a
5803  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
5804  * you're using lightning-net-tokio.
5805  */
5806 typedef struct MUST_USE_STRUCT LDKChannelManager {
5807    /**
5808     * A pointer to the opaque Rust object.
5809     * Nearly everywhere, inner must be non-null, however in places where
5810     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5811     */
5812    LDKnativeChannelManager *inner;
5813    /**
5814     * Indicates that this is the only struct which contains the same pointer.
5815     * Rust functions which take ownership of an object provided via an argument require
5816     * this to be true and invalidate the object pointed to by inner.
5817     */
5818    bool is_owned;
5819 } LDKChannelManager;
5820
5821 /**
5822  * A tuple of 2 elements. See the individual fields for the types contained.
5823  */
5824 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
5825    /**
5826     * The element at position 0
5827     */
5828    struct LDKThirtyTwoBytes a;
5829    /**
5830     * The element at position 1
5831     */
5832    struct LDKChannelManager b;
5833 } LDKC2Tuple_BlockHashChannelManagerZ;
5834
5835 /**
5836  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
5837  */
5838 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
5839    /**
5840     * A pointer to the contents in the success state.
5841     * Reading from this pointer when `result_ok` is not set is undefined.
5842     */
5843    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
5844    /**
5845     * A pointer to the contents in the error state.
5846     * Reading from this pointer when `result_ok` is set is undefined.
5847     */
5848    struct LDKDecodeError *err;
5849 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
5850
5851 /**
5852  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
5853  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5854  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5855  */
5856 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
5857    /**
5858     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
5859     * `err` or `result` depending on the state of `result_ok`.
5860     */
5861    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
5862    /**
5863     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
5864     */
5865    bool result_ok;
5866 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
5867
5868
5869
5870 /**
5871  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
5872  * with our counterparty.
5873  */
5874 typedef struct MUST_USE_STRUCT LDKChannelConfig {
5875    /**
5876     * A pointer to the opaque Rust object.
5877     * Nearly everywhere, inner must be non-null, however in places where
5878     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5879     */
5880    LDKnativeChannelConfig *inner;
5881    /**
5882     * Indicates that this is the only struct which contains the same pointer.
5883     * Rust functions which take ownership of an object provided via an argument require
5884     * this to be true and invalidate the object pointed to by inner.
5885     */
5886    bool is_owned;
5887 } LDKChannelConfig;
5888
5889 /**
5890  * The contents of CResult_ChannelConfigDecodeErrorZ
5891  */
5892 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
5893    /**
5894     * A pointer to the contents in the success state.
5895     * Reading from this pointer when `result_ok` is not set is undefined.
5896     */
5897    struct LDKChannelConfig *result;
5898    /**
5899     * A pointer to the contents in the error state.
5900     * Reading from this pointer when `result_ok` is set is undefined.
5901     */
5902    struct LDKDecodeError *err;
5903 } LDKCResult_ChannelConfigDecodeErrorZPtr;
5904
5905 /**
5906  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
5907  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
5908  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5909  */
5910 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
5911    /**
5912     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
5913     * `err` or `result` depending on the state of `result_ok`.
5914     */
5915    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
5916    /**
5917     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
5918     */
5919    bool result_ok;
5920 } LDKCResult_ChannelConfigDecodeErrorZ;
5921
5922 /**
5923  * The contents of CResult_OutPointDecodeErrorZ
5924  */
5925 typedef union LDKCResult_OutPointDecodeErrorZPtr {
5926    /**
5927     * A pointer to the contents in the success state.
5928     * Reading from this pointer when `result_ok` is not set is undefined.
5929     */
5930    struct LDKOutPoint *result;
5931    /**
5932     * A pointer to the contents in the error state.
5933     * Reading from this pointer when `result_ok` is set is undefined.
5934     */
5935    struct LDKDecodeError *err;
5936 } LDKCResult_OutPointDecodeErrorZPtr;
5937
5938 /**
5939  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
5940  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
5941  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5942  */
5943 typedef struct LDKCResult_OutPointDecodeErrorZ {
5944    /**
5945     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
5946     * `err` or `result` depending on the state of `result_ok`.
5947     */
5948    union LDKCResult_OutPointDecodeErrorZPtr contents;
5949    /**
5950     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
5951     */
5952    bool result_ok;
5953 } LDKCResult_OutPointDecodeErrorZ;
5954
5955 /**
5956  * Defines a type identifier for sending messages over the wire.
5957  *
5958  * Messages implementing this trait specify a type and must be [`Writeable`].
5959  */
5960 typedef struct LDKType {
5961    /**
5962     * An opaque pointer which is passed to your function implementations as an argument.
5963     * This has no meaning in the LDK, and can be NULL or any other value.
5964     */
5965    void *this_arg;
5966    /**
5967     * Returns the type identifying the message payload.
5968     */
5969    uint16_t (*type_id)(const void *this_arg);
5970    /**
5971     * Return a human-readable "debug" string describing this object
5972     */
5973    struct LDKStr (*debug_str)(const void *this_arg);
5974    /**
5975     * Serialize the object into a byte array
5976     */
5977    struct LDKCVec_u8Z (*write)(const void *this_arg);
5978    /**
5979     * Frees any resources associated with this object given its this_arg pointer.
5980     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5981     */
5982    void (*free)(void *this_arg);
5983 } LDKType;
5984
5985 /**
5986  * An enum which can either contain a crate::lightning::ln::wire::Type or not
5987  */
5988 typedef enum LDKCOption_TypeZ_Tag {
5989    /**
5990     * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
5991     */
5992    LDKCOption_TypeZ_Some,
5993    /**
5994     * When we're in this state, this COption_TypeZ contains nothing
5995     */
5996    LDKCOption_TypeZ_None,
5997    /**
5998     * Must be last for serialization purposes
5999     */
6000    LDKCOption_TypeZ_Sentinel,
6001 } LDKCOption_TypeZ_Tag;
6002
6003 typedef struct LDKCOption_TypeZ {
6004    LDKCOption_TypeZ_Tag tag;
6005    union {
6006       struct {
6007          struct LDKType some;
6008       };
6009    };
6010 } LDKCOption_TypeZ;
6011
6012 /**
6013  * The contents of CResult_COption_TypeZDecodeErrorZ
6014  */
6015 typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
6016    /**
6017     * A pointer to the contents in the success state.
6018     * Reading from this pointer when `result_ok` is not set is undefined.
6019     */
6020    struct LDKCOption_TypeZ *result;
6021    /**
6022     * A pointer to the contents in the error state.
6023     * Reading from this pointer when `result_ok` is set is undefined.
6024     */
6025    struct LDKDecodeError *err;
6026 } LDKCResult_COption_TypeZDecodeErrorZPtr;
6027
6028 /**
6029  * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
6030  * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6031  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6032  */
6033 typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
6034    /**
6035     * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
6036     * `err` or `result` depending on the state of `result_ok`.
6037     */
6038    union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
6039    /**
6040     * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
6041     */
6042    bool result_ok;
6043 } LDKCResult_COption_TypeZDecodeErrorZ;
6044
6045 /**
6046  * An error that may occur when making a payment.
6047  */
6048 typedef enum LDKPaymentError_Tag {
6049    /**
6050     * An error resulting from the provided [`Invoice`] or payment hash.
6051     */
6052    LDKPaymentError_Invoice,
6053    /**
6054     * An error occurring when finding a route.
6055     */
6056    LDKPaymentError_Routing,
6057    /**
6058     * An error occurring when sending a payment.
6059     */
6060    LDKPaymentError_Sending,
6061    /**
6062     * Must be last for serialization purposes
6063     */
6064    LDKPaymentError_Sentinel,
6065 } LDKPaymentError_Tag;
6066
6067 typedef struct MUST_USE_STRUCT LDKPaymentError {
6068    LDKPaymentError_Tag tag;
6069    union {
6070       struct {
6071          struct LDKStr invoice;
6072       };
6073       struct {
6074          struct LDKLightningError routing;
6075       };
6076       struct {
6077          struct LDKPaymentSendFailure sending;
6078       };
6079    };
6080 } LDKPaymentError;
6081
6082 /**
6083  * The contents of CResult_PaymentIdPaymentErrorZ
6084  */
6085 typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
6086    /**
6087     * A pointer to the contents in the success state.
6088     * Reading from this pointer when `result_ok` is not set is undefined.
6089     */
6090    struct LDKThirtyTwoBytes *result;
6091    /**
6092     * A pointer to the contents in the error state.
6093     * Reading from this pointer when `result_ok` is set is undefined.
6094     */
6095    struct LDKPaymentError *err;
6096 } LDKCResult_PaymentIdPaymentErrorZPtr;
6097
6098 /**
6099  * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
6100  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
6101  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6102  */
6103 typedef struct LDKCResult_PaymentIdPaymentErrorZ {
6104    /**
6105     * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
6106     * `err` or `result` depending on the state of `result_ok`.
6107     */
6108    union LDKCResult_PaymentIdPaymentErrorZPtr contents;
6109    /**
6110     * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
6111     */
6112    bool result_ok;
6113 } LDKCResult_PaymentIdPaymentErrorZ;
6114
6115 /**
6116  * The contents of CResult_SiPrefixNoneZ
6117  */
6118 typedef union LDKCResult_SiPrefixNoneZPtr {
6119    /**
6120     * A pointer to the contents in the success state.
6121     * Reading from this pointer when `result_ok` is not set is undefined.
6122     */
6123    enum LDKSiPrefix *result;
6124    /**
6125     * Note that this value is always NULL, as there are no contents in the Err variant
6126     */
6127    void *err;
6128 } LDKCResult_SiPrefixNoneZPtr;
6129
6130 /**
6131  * A CResult_SiPrefixNoneZ represents the result of a fallible operation,
6132  * containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
6133  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6134  */
6135 typedef struct LDKCResult_SiPrefixNoneZ {
6136    /**
6137     * The contents of this CResult_SiPrefixNoneZ, accessible via either
6138     * `err` or `result` depending on the state of `result_ok`.
6139     */
6140    union LDKCResult_SiPrefixNoneZPtr contents;
6141    /**
6142     * Whether this CResult_SiPrefixNoneZ represents a success state.
6143     */
6144    bool result_ok;
6145 } LDKCResult_SiPrefixNoneZ;
6146
6147
6148
6149 /**
6150  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
6151  *
6152  * There are three ways to construct an `Invoice`:
6153  *  1. using `InvoiceBuilder`
6154  *  2. using `Invoice::from_signed(SignedRawInvoice)`
6155  *  3. using `str::parse::<Invoice>(&str)`
6156  */
6157 typedef struct MUST_USE_STRUCT LDKInvoice {
6158    /**
6159     * A pointer to the opaque Rust object.
6160     * Nearly everywhere, inner must be non-null, however in places where
6161     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6162     */
6163    LDKnativeInvoice *inner;
6164    /**
6165     * Indicates that this is the only struct which contains the same pointer.
6166     * Rust functions which take ownership of an object provided via an argument require
6167     * this to be true and invalidate the object pointed to by inner.
6168     */
6169    bool is_owned;
6170 } LDKInvoice;
6171
6172 /**
6173  * The contents of CResult_InvoiceNoneZ
6174  */
6175 typedef union LDKCResult_InvoiceNoneZPtr {
6176    /**
6177     * A pointer to the contents in the success state.
6178     * Reading from this pointer when `result_ok` is not set is undefined.
6179     */
6180    struct LDKInvoice *result;
6181    /**
6182     * Note that this value is always NULL, as there are no contents in the Err variant
6183     */
6184    void *err;
6185 } LDKCResult_InvoiceNoneZPtr;
6186
6187 /**
6188  * A CResult_InvoiceNoneZ represents the result of a fallible operation,
6189  * containing a crate::lightning_invoice::Invoice on success and a () on failure.
6190  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6191  */
6192 typedef struct LDKCResult_InvoiceNoneZ {
6193    /**
6194     * The contents of this CResult_InvoiceNoneZ, accessible via either
6195     * `err` or `result` depending on the state of `result_ok`.
6196     */
6197    union LDKCResult_InvoiceNoneZPtr contents;
6198    /**
6199     * Whether this CResult_InvoiceNoneZ represents a success state.
6200     */
6201    bool result_ok;
6202 } LDKCResult_InvoiceNoneZ;
6203
6204
6205
6206 /**
6207  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
6208  * invalid.
6209  *
6210  * # Invariants
6211  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
6212  */
6213 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
6214    /**
6215     * A pointer to the opaque Rust object.
6216     * Nearly everywhere, inner must be non-null, however in places where
6217     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6218     */
6219    LDKnativeSignedRawInvoice *inner;
6220    /**
6221     * Indicates that this is the only struct which contains the same pointer.
6222     * Rust functions which take ownership of an object provided via an argument require
6223     * this to be true and invalidate the object pointed to by inner.
6224     */
6225    bool is_owned;
6226 } LDKSignedRawInvoice;
6227
6228 /**
6229  * The contents of CResult_SignedRawInvoiceNoneZ
6230  */
6231 typedef union LDKCResult_SignedRawInvoiceNoneZPtr {
6232    /**
6233     * A pointer to the contents in the success state.
6234     * Reading from this pointer when `result_ok` is not set is undefined.
6235     */
6236    struct LDKSignedRawInvoice *result;
6237    /**
6238     * Note that this value is always NULL, as there are no contents in the Err variant
6239     */
6240    void *err;
6241 } LDKCResult_SignedRawInvoiceNoneZPtr;
6242
6243 /**
6244  * A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
6245  * containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
6246  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6247  */
6248 typedef struct LDKCResult_SignedRawInvoiceNoneZ {
6249    /**
6250     * The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
6251     * `err` or `result` depending on the state of `result_ok`.
6252     */
6253    union LDKCResult_SignedRawInvoiceNoneZPtr contents;
6254    /**
6255     * Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
6256     */
6257    bool result_ok;
6258 } LDKCResult_SignedRawInvoiceNoneZ;
6259
6260
6261
6262 /**
6263  * Represents an syntactically correct Invoice for a payment on the lightning network,
6264  * but without the signature information.
6265  * De- and encoding should not lead to information loss but may lead to different hashes.
6266  *
6267  * For methods without docs see the corresponding methods in `Invoice`.
6268  */
6269 typedef struct MUST_USE_STRUCT LDKRawInvoice {
6270    /**
6271     * A pointer to the opaque Rust object.
6272     * Nearly everywhere, inner must be non-null, however in places where
6273     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6274     */
6275    LDKnativeRawInvoice *inner;
6276    /**
6277     * Indicates that this is the only struct which contains the same pointer.
6278     * Rust functions which take ownership of an object provided via an argument require
6279     * this to be true and invalidate the object pointed to by inner.
6280     */
6281    bool is_owned;
6282 } LDKRawInvoice;
6283
6284
6285
6286 /**
6287  * Recoverable signature
6288  */
6289 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
6290    /**
6291     * A pointer to the opaque Rust object.
6292     * Nearly everywhere, inner must be non-null, however in places where
6293     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6294     */
6295    LDKnativeInvoiceSignature *inner;
6296    /**
6297     * Indicates that this is the only struct which contains the same pointer.
6298     * Rust functions which take ownership of an object provided via an argument require
6299     * this to be true and invalidate the object pointed to by inner.
6300     */
6301    bool is_owned;
6302 } LDKInvoiceSignature;
6303
6304 /**
6305  * A tuple of 3 elements. See the individual fields for the types contained.
6306  */
6307 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
6308    /**
6309     * The element at position 0
6310     */
6311    struct LDKRawInvoice a;
6312    /**
6313     * The element at position 1
6314     */
6315    struct LDKThirtyTwoBytes b;
6316    /**
6317     * The element at position 2
6318     */
6319    struct LDKInvoiceSignature c;
6320 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
6321
6322
6323
6324 /**
6325  * Payee public key
6326  */
6327 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
6328    /**
6329     * A pointer to the opaque Rust object.
6330     * Nearly everywhere, inner must be non-null, however in places where
6331     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6332     */
6333    LDKnativePayeePubKey *inner;
6334    /**
6335     * Indicates that this is the only struct which contains the same pointer.
6336     * Rust functions which take ownership of an object provided via an argument require
6337     * this to be true and invalidate the object pointed to by inner.
6338     */
6339    bool is_owned;
6340 } LDKPayeePubKey;
6341
6342 /**
6343  * The contents of CResult_PayeePubKeyErrorZ
6344  */
6345 typedef union LDKCResult_PayeePubKeyErrorZPtr {
6346    /**
6347     * A pointer to the contents in the success state.
6348     * Reading from this pointer when `result_ok` is not set is undefined.
6349     */
6350    struct LDKPayeePubKey *result;
6351    /**
6352     * A pointer to the contents in the error state.
6353     * Reading from this pointer when `result_ok` is set is undefined.
6354     */
6355    enum LDKSecp256k1Error *err;
6356 } LDKCResult_PayeePubKeyErrorZPtr;
6357
6358 /**
6359  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
6360  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
6361  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6362  */
6363 typedef struct LDKCResult_PayeePubKeyErrorZ {
6364    /**
6365     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
6366     * `err` or `result` depending on the state of `result_ok`.
6367     */
6368    union LDKCResult_PayeePubKeyErrorZPtr contents;
6369    /**
6370     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
6371     */
6372    bool result_ok;
6373 } LDKCResult_PayeePubKeyErrorZ;
6374
6375
6376
6377 /**
6378  * Private routing information
6379  *
6380  * # Invariants
6381  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
6382  *
6383  */
6384 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
6385    /**
6386     * A pointer to the opaque Rust object.
6387     * Nearly everywhere, inner must be non-null, however in places where
6388     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6389     */
6390    LDKnativePrivateRoute *inner;
6391    /**
6392     * Indicates that this is the only struct which contains the same pointer.
6393     * Rust functions which take ownership of an object provided via an argument require
6394     * this to be true and invalidate the object pointed to by inner.
6395     */
6396    bool is_owned;
6397 } LDKPrivateRoute;
6398
6399 /**
6400  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
6401  * This corresponds to std::vector in C++
6402  */
6403 typedef struct LDKCVec_PrivateRouteZ {
6404    /**
6405     * The elements in the array.
6406     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6407     */
6408    struct LDKPrivateRoute *data;
6409    /**
6410     * The number of elements pointed to by `data`.
6411     */
6412    uintptr_t datalen;
6413 } LDKCVec_PrivateRouteZ;
6414
6415
6416
6417 /**
6418  * A timestamp that refers to a date after 1 January 1970 which means its representation as UNIX
6419  * timestamp is positive.
6420  *
6421  * # Invariants
6422  * The UNIX timestamp representing the stored time has to be positive and small enough so that
6423  * a `EpiryTime` can be added to it without an overflow.
6424  */
6425 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
6426    /**
6427     * A pointer to the opaque Rust object.
6428     * Nearly everywhere, inner must be non-null, however in places where
6429     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6430     */
6431    LDKnativePositiveTimestamp *inner;
6432    /**
6433     * Indicates that this is the only struct which contains the same pointer.
6434     * Rust functions which take ownership of an object provided via an argument require
6435     * this to be true and invalidate the object pointed to by inner.
6436     */
6437    bool is_owned;
6438 } LDKPositiveTimestamp;
6439
6440 /**
6441  * The contents of CResult_PositiveTimestampCreationErrorZ
6442  */
6443 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
6444    /**
6445     * A pointer to the contents in the success state.
6446     * Reading from this pointer when `result_ok` is not set is undefined.
6447     */
6448    struct LDKPositiveTimestamp *result;
6449    /**
6450     * A pointer to the contents in the error state.
6451     * Reading from this pointer when `result_ok` is set is undefined.
6452     */
6453    enum LDKCreationError *err;
6454 } LDKCResult_PositiveTimestampCreationErrorZPtr;
6455
6456 /**
6457  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
6458  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
6459  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6460  */
6461 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
6462    /**
6463     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
6464     * `err` or `result` depending on the state of `result_ok`.
6465     */
6466    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
6467    /**
6468     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
6469     */
6470    bool result_ok;
6471 } LDKCResult_PositiveTimestampCreationErrorZ;
6472
6473 /**
6474  * The contents of CResult_NoneSemanticErrorZ
6475  */
6476 typedef union LDKCResult_NoneSemanticErrorZPtr {
6477    /**
6478     * Note that this value is always NULL, as there are no contents in the OK variant
6479     */
6480    void *result;
6481    /**
6482     * A pointer to the contents in the error state.
6483     * Reading from this pointer when `result_ok` is set is undefined.
6484     */
6485    enum LDKSemanticError *err;
6486 } LDKCResult_NoneSemanticErrorZPtr;
6487
6488 /**
6489  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
6490  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
6491  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6492  */
6493 typedef struct LDKCResult_NoneSemanticErrorZ {
6494    /**
6495     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
6496     * `err` or `result` depending on the state of `result_ok`.
6497     */
6498    union LDKCResult_NoneSemanticErrorZPtr contents;
6499    /**
6500     * Whether this CResult_NoneSemanticErrorZ represents a success state.
6501     */
6502    bool result_ok;
6503 } LDKCResult_NoneSemanticErrorZ;
6504
6505 /**
6506  * The contents of CResult_InvoiceSemanticErrorZ
6507  */
6508 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
6509    /**
6510     * A pointer to the contents in the success state.
6511     * Reading from this pointer when `result_ok` is not set is undefined.
6512     */
6513    struct LDKInvoice *result;
6514    /**
6515     * A pointer to the contents in the error state.
6516     * Reading from this pointer when `result_ok` is set is undefined.
6517     */
6518    enum LDKSemanticError *err;
6519 } LDKCResult_InvoiceSemanticErrorZPtr;
6520
6521 /**
6522  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
6523  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
6524  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6525  */
6526 typedef struct LDKCResult_InvoiceSemanticErrorZ {
6527    /**
6528     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
6529     * `err` or `result` depending on the state of `result_ok`.
6530     */
6531    union LDKCResult_InvoiceSemanticErrorZPtr contents;
6532    /**
6533     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
6534     */
6535    bool result_ok;
6536 } LDKCResult_InvoiceSemanticErrorZ;
6537
6538
6539
6540 /**
6541  * Description string
6542  *
6543  * # Invariants
6544  * The description can be at most 639 __bytes__ long
6545  */
6546 typedef struct MUST_USE_STRUCT LDKDescription {
6547    /**
6548     * A pointer to the opaque Rust object.
6549     * Nearly everywhere, inner must be non-null, however in places where
6550     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6551     */
6552    LDKnativeDescription *inner;
6553    /**
6554     * Indicates that this is the only struct which contains the same pointer.
6555     * Rust functions which take ownership of an object provided via an argument require
6556     * this to be true and invalidate the object pointed to by inner.
6557     */
6558    bool is_owned;
6559 } LDKDescription;
6560
6561 /**
6562  * The contents of CResult_DescriptionCreationErrorZ
6563  */
6564 typedef union LDKCResult_DescriptionCreationErrorZPtr {
6565    /**
6566     * A pointer to the contents in the success state.
6567     * Reading from this pointer when `result_ok` is not set is undefined.
6568     */
6569    struct LDKDescription *result;
6570    /**
6571     * A pointer to the contents in the error state.
6572     * Reading from this pointer when `result_ok` is set is undefined.
6573     */
6574    enum LDKCreationError *err;
6575 } LDKCResult_DescriptionCreationErrorZPtr;
6576
6577 /**
6578  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
6579  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
6580  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6581  */
6582 typedef struct LDKCResult_DescriptionCreationErrorZ {
6583    /**
6584     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
6585     * `err` or `result` depending on the state of `result_ok`.
6586     */
6587    union LDKCResult_DescriptionCreationErrorZPtr contents;
6588    /**
6589     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
6590     */
6591    bool result_ok;
6592 } LDKCResult_DescriptionCreationErrorZ;
6593
6594
6595
6596 /**
6597  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
6598  * expires
6599  *
6600  * # Invariants
6601  * The number of seconds this expiry time represents has to be in the range
6602  * `0...(SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME)` to avoid overflows when adding it to a
6603  * timestamp
6604  */
6605 typedef struct MUST_USE_STRUCT LDKExpiryTime {
6606    /**
6607     * A pointer to the opaque Rust object.
6608     * Nearly everywhere, inner must be non-null, however in places where
6609     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6610     */
6611    LDKnativeExpiryTime *inner;
6612    /**
6613     * Indicates that this is the only struct which contains the same pointer.
6614     * Rust functions which take ownership of an object provided via an argument require
6615     * this to be true and invalidate the object pointed to by inner.
6616     */
6617    bool is_owned;
6618 } LDKExpiryTime;
6619
6620 /**
6621  * The contents of CResult_ExpiryTimeCreationErrorZ
6622  */
6623 typedef union LDKCResult_ExpiryTimeCreationErrorZPtr {
6624    /**
6625     * A pointer to the contents in the success state.
6626     * Reading from this pointer when `result_ok` is not set is undefined.
6627     */
6628    struct LDKExpiryTime *result;
6629    /**
6630     * A pointer to the contents in the error state.
6631     * Reading from this pointer when `result_ok` is set is undefined.
6632     */
6633    enum LDKCreationError *err;
6634 } LDKCResult_ExpiryTimeCreationErrorZPtr;
6635
6636 /**
6637  * A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
6638  * containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
6639  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6640  */
6641 typedef struct LDKCResult_ExpiryTimeCreationErrorZ {
6642    /**
6643     * The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
6644     * `err` or `result` depending on the state of `result_ok`.
6645     */
6646    union LDKCResult_ExpiryTimeCreationErrorZPtr contents;
6647    /**
6648     * Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
6649     */
6650    bool result_ok;
6651 } LDKCResult_ExpiryTimeCreationErrorZ;
6652
6653 /**
6654  * The contents of CResult_PrivateRouteCreationErrorZ
6655  */
6656 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
6657    /**
6658     * A pointer to the contents in the success state.
6659     * Reading from this pointer when `result_ok` is not set is undefined.
6660     */
6661    struct LDKPrivateRoute *result;
6662    /**
6663     * A pointer to the contents in the error state.
6664     * Reading from this pointer when `result_ok` is set is undefined.
6665     */
6666    enum LDKCreationError *err;
6667 } LDKCResult_PrivateRouteCreationErrorZPtr;
6668
6669 /**
6670  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
6671  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
6672  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6673  */
6674 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
6675    /**
6676     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
6677     * `err` or `result` depending on the state of `result_ok`.
6678     */
6679    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
6680    /**
6681     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
6682     */
6683    bool result_ok;
6684 } LDKCResult_PrivateRouteCreationErrorZ;
6685
6686 /**
6687  * The contents of CResult_StringErrorZ
6688  */
6689 typedef union LDKCResult_StringErrorZPtr {
6690    /**
6691     * A pointer to the contents in the success state.
6692     * Reading from this pointer when `result_ok` is not set is undefined.
6693     */
6694    struct LDKStr *result;
6695    /**
6696     * A pointer to the contents in the error state.
6697     * Reading from this pointer when `result_ok` is set is undefined.
6698     */
6699    enum LDKSecp256k1Error *err;
6700 } LDKCResult_StringErrorZPtr;
6701
6702 /**
6703  * A CResult_StringErrorZ represents the result of a fallible operation,
6704  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
6705  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6706  */
6707 typedef struct LDKCResult_StringErrorZ {
6708    /**
6709     * The contents of this CResult_StringErrorZ, accessible via either
6710     * `err` or `result` depending on the state of `result_ok`.
6711     */
6712    union LDKCResult_StringErrorZPtr contents;
6713    /**
6714     * Whether this CResult_StringErrorZ represents a success state.
6715     */
6716    bool result_ok;
6717 } LDKCResult_StringErrorZ;
6718
6719 /**
6720  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
6721  */
6722 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
6723    /**
6724     * A pointer to the contents in the success state.
6725     * Reading from this pointer when `result_ok` is not set is undefined.
6726     */
6727    struct LDKChannelMonitorUpdate *result;
6728    /**
6729     * A pointer to the contents in the error state.
6730     * Reading from this pointer when `result_ok` is set is undefined.
6731     */
6732    struct LDKDecodeError *err;
6733 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
6734
6735 /**
6736  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
6737  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6738  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6739  */
6740 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
6741    /**
6742     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
6743     * `err` or `result` depending on the state of `result_ok`.
6744     */
6745    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
6746    /**
6747     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
6748     */
6749    bool result_ok;
6750 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
6751
6752 /**
6753  * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
6754  */
6755 typedef enum LDKCOption_MonitorEventZ_Tag {
6756    /**
6757     * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
6758     */
6759    LDKCOption_MonitorEventZ_Some,
6760    /**
6761     * When we're in this state, this COption_MonitorEventZ contains nothing
6762     */
6763    LDKCOption_MonitorEventZ_None,
6764    /**
6765     * Must be last for serialization purposes
6766     */
6767    LDKCOption_MonitorEventZ_Sentinel,
6768 } LDKCOption_MonitorEventZ_Tag;
6769
6770 typedef struct LDKCOption_MonitorEventZ {
6771    LDKCOption_MonitorEventZ_Tag tag;
6772    union {
6773       struct {
6774          struct LDKMonitorEvent some;
6775       };
6776    };
6777 } LDKCOption_MonitorEventZ;
6778
6779 /**
6780  * The contents of CResult_COption_MonitorEventZDecodeErrorZ
6781  */
6782 typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr {
6783    /**
6784     * A pointer to the contents in the success state.
6785     * Reading from this pointer when `result_ok` is not set is undefined.
6786     */
6787    struct LDKCOption_MonitorEventZ *result;
6788    /**
6789     * A pointer to the contents in the error state.
6790     * Reading from this pointer when `result_ok` is set is undefined.
6791     */
6792    struct LDKDecodeError *err;
6793 } LDKCResult_COption_MonitorEventZDecodeErrorZPtr;
6794
6795 /**
6796  * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
6797  * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6798  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6799  */
6800 typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ {
6801    /**
6802     * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
6803     * `err` or `result` depending on the state of `result_ok`.
6804     */
6805    union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents;
6806    /**
6807     * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
6808     */
6809    bool result_ok;
6810 } LDKCResult_COption_MonitorEventZDecodeErrorZ;
6811
6812 /**
6813  * The contents of CResult_HTLCUpdateDecodeErrorZ
6814  */
6815 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
6816    /**
6817     * A pointer to the contents in the success state.
6818     * Reading from this pointer when `result_ok` is not set is undefined.
6819     */
6820    struct LDKHTLCUpdate *result;
6821    /**
6822     * A pointer to the contents in the error state.
6823     * Reading from this pointer when `result_ok` is set is undefined.
6824     */
6825    struct LDKDecodeError *err;
6826 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
6827
6828 /**
6829  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
6830  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6831  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6832  */
6833 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
6834    /**
6835     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
6836     * `err` or `result` depending on the state of `result_ok`.
6837     */
6838    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
6839    /**
6840     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
6841     */
6842    bool result_ok;
6843 } LDKCResult_HTLCUpdateDecodeErrorZ;
6844
6845
6846
6847 /**
6848  * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
6849  * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
6850  * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
6851  * corrupted.
6852  * Contains a developer-readable error message.
6853  */
6854 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
6855    /**
6856     * A pointer to the opaque Rust object.
6857     * Nearly everywhere, inner must be non-null, however in places where
6858     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6859     */
6860    LDKnativeMonitorUpdateError *inner;
6861    /**
6862     * Indicates that this is the only struct which contains the same pointer.
6863     * Rust functions which take ownership of an object provided via an argument require
6864     * this to be true and invalidate the object pointed to by inner.
6865     */
6866    bool is_owned;
6867 } LDKMonitorUpdateError;
6868
6869 /**
6870  * The contents of CResult_NoneMonitorUpdateErrorZ
6871  */
6872 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
6873    /**
6874     * Note that this value is always NULL, as there are no contents in the OK variant
6875     */
6876    void *result;
6877    /**
6878     * A pointer to the contents in the error state.
6879     * Reading from this pointer when `result_ok` is set is undefined.
6880     */
6881    struct LDKMonitorUpdateError *err;
6882 } LDKCResult_NoneMonitorUpdateErrorZPtr;
6883
6884 /**
6885  * A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
6886  * containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
6887  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6888  */
6889 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
6890    /**
6891     * The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
6892     * `err` or `result` depending on the state of `result_ok`.
6893     */
6894    union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
6895    /**
6896     * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
6897     */
6898    bool result_ok;
6899 } LDKCResult_NoneMonitorUpdateErrorZ;
6900
6901 /**
6902  * A tuple of 2 elements. See the individual fields for the types contained.
6903  */
6904 typedef struct LDKC2Tuple_OutPointScriptZ {
6905    /**
6906     * The element at position 0
6907     */
6908    struct LDKOutPoint a;
6909    /**
6910     * The element at position 1
6911     */
6912    struct LDKCVec_u8Z b;
6913 } LDKC2Tuple_OutPointScriptZ;
6914
6915 /**
6916  * A tuple of 2 elements. See the individual fields for the types contained.
6917  */
6918 typedef struct LDKC2Tuple_u32ScriptZ {
6919    /**
6920     * The element at position 0
6921     */
6922    uint32_t a;
6923    /**
6924     * The element at position 1
6925     */
6926    struct LDKCVec_u8Z b;
6927 } LDKC2Tuple_u32ScriptZ;
6928
6929 /**
6930  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
6931  * This corresponds to std::vector in C++
6932  */
6933 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
6934    /**
6935     * The elements in the array.
6936     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6937     */
6938    struct LDKC2Tuple_u32ScriptZ *data;
6939    /**
6940     * The number of elements pointed to by `data`.
6941     */
6942    uintptr_t datalen;
6943 } LDKCVec_C2Tuple_u32ScriptZZ;
6944
6945 /**
6946  * A tuple of 2 elements. See the individual fields for the types contained.
6947  */
6948 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
6949    /**
6950     * The element at position 0
6951     */
6952    struct LDKThirtyTwoBytes a;
6953    /**
6954     * The element at position 1
6955     */
6956    struct LDKCVec_C2Tuple_u32ScriptZZ b;
6957 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
6958
6959 /**
6960  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
6961  * This corresponds to std::vector in C++
6962  */
6963 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
6964    /**
6965     * The elements in the array.
6966     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6967     */
6968    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
6969    /**
6970     * The number of elements pointed to by `data`.
6971     */
6972    uintptr_t datalen;
6973 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
6974
6975 /**
6976  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
6977  * This corresponds to std::vector in C++
6978  */
6979 typedef struct LDKCVec_EventZ {
6980    /**
6981     * The elements in the array.
6982     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6983     */
6984    struct LDKEvent *data;
6985    /**
6986     * The number of elements pointed to by `data`.
6987     */
6988    uintptr_t datalen;
6989 } LDKCVec_EventZ;
6990
6991 /**
6992  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
6993  * This corresponds to std::vector in C++
6994  */
6995 typedef struct LDKCVec_TransactionZ {
6996    /**
6997     * The elements in the array.
6998     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6999     */
7000    struct LDKTransaction *data;
7001    /**
7002     * The number of elements pointed to by `data`.
7003     */
7004    uintptr_t datalen;
7005 } LDKCVec_TransactionZ;
7006
7007 /**
7008  * A tuple of 2 elements. See the individual fields for the types contained.
7009  */
7010 typedef struct LDKC2Tuple_u32TxOutZ {
7011    /**
7012     * The element at position 0
7013     */
7014    uint32_t a;
7015    /**
7016     * The element at position 1
7017     */
7018    struct LDKTxOut b;
7019 } LDKC2Tuple_u32TxOutZ;
7020
7021 /**
7022  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
7023  * This corresponds to std::vector in C++
7024  */
7025 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
7026    /**
7027     * The elements in the array.
7028     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7029     */
7030    struct LDKC2Tuple_u32TxOutZ *data;
7031    /**
7032     * The number of elements pointed to by `data`.
7033     */
7034    uintptr_t datalen;
7035 } LDKCVec_C2Tuple_u32TxOutZZ;
7036
7037 /**
7038  * A tuple of 2 elements. See the individual fields for the types contained.
7039  */
7040 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7041    /**
7042     * The element at position 0
7043     */
7044    struct LDKThirtyTwoBytes a;
7045    /**
7046     * The element at position 1
7047     */
7048    struct LDKCVec_C2Tuple_u32TxOutZZ b;
7049 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
7050
7051 /**
7052  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
7053  * This corresponds to std::vector in C++
7054  */
7055 typedef struct LDKCVec_TransactionOutputsZ {
7056    /**
7057     * The elements in the array.
7058     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7059     */
7060    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
7061    /**
7062     * The number of elements pointed to by `data`.
7063     */
7064    uintptr_t datalen;
7065 } LDKCVec_TransactionOutputsZ;
7066
7067 /**
7068  * Details about the balance(s) available for spending once the channel appears on chain.
7069  *
7070  * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
7071  * be provided.
7072  */
7073 typedef enum LDKBalance_Tag {
7074    /**
7075     * The channel is not yet closed (or the commitment or closing transaction has not yet
7076     * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
7077     * force-closed now.
7078     */
7079    LDKBalance_ClaimableOnChannelClose,
7080    /**
7081     * The channel has been closed, and the given balance is ours but awaiting confirmations until
7082     * we consider it spendable.
7083     */
7084    LDKBalance_ClaimableAwaitingConfirmations,
7085    /**
7086     * The channel has been closed, and the given balance should be ours but awaiting spending
7087     * transaction confirmation. If the spending transaction does not confirm in time, it is
7088     * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
7089     *
7090     * Once the spending transaction confirms, before it has reached enough confirmations to be
7091     * considered safe from chain reorganizations, the balance will instead be provided via
7092     * [`Balance::ClaimableAwaitingConfirmations`].
7093     */
7094    LDKBalance_ContentiousClaimable,
7095    /**
7096     * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
7097     * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
7098     * likely to be claimed by our counterparty before we do.
7099     */
7100    LDKBalance_MaybeClaimableHTLCAwaitingTimeout,
7101    /**
7102     * Must be last for serialization purposes
7103     */
7104    LDKBalance_Sentinel,
7105 } LDKBalance_Tag;
7106
7107 typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
7108    /**
7109     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
7110     * required to do so.
7111     */
7112    uint64_t claimable_amount_satoshis;
7113 } LDKBalance_LDKClaimableOnChannelClose_Body;
7114
7115 typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
7116    /**
7117     * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
7118     * were spent in broadcasting the transaction.
7119     */
7120    uint64_t claimable_amount_satoshis;
7121    /**
7122     * The height at which an [`Event::SpendableOutputs`] event will be generated for this
7123     * amount.
7124     */
7125    uint32_t confirmation_height;
7126 } LDKBalance_LDKClaimableAwaitingConfirmations_Body;
7127
7128 typedef struct LDKBalance_LDKContentiousClaimable_Body {
7129    /**
7130     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
7131     * required to do so.
7132     */
7133    uint64_t claimable_amount_satoshis;
7134    /**
7135     * The height at which the counterparty may be able to claim the balance if we have not
7136     * done so.
7137     */
7138    uint32_t timeout_height;
7139 } LDKBalance_LDKContentiousClaimable_Body;
7140
7141 typedef struct LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body {
7142    /**
7143     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
7144     * required to do so.
7145     */
7146    uint64_t claimable_amount_satoshis;
7147    /**
7148     * The height at which we will be able to claim the balance if our counterparty has not
7149     * done so.
7150     */
7151    uint32_t claimable_height;
7152 } LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body;
7153
7154 typedef struct MUST_USE_STRUCT LDKBalance {
7155    LDKBalance_Tag tag;
7156    union {
7157       LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
7158       LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
7159       LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
7160       LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body maybe_claimable_htlc_awaiting_timeout;
7161    };
7162 } LDKBalance;
7163
7164 /**
7165  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
7166  * This corresponds to std::vector in C++
7167  */
7168 typedef struct LDKCVec_BalanceZ {
7169    /**
7170     * The elements in the array.
7171     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7172     */
7173    struct LDKBalance *data;
7174    /**
7175     * The number of elements pointed to by `data`.
7176     */
7177    uintptr_t datalen;
7178 } LDKCVec_BalanceZ;
7179
7180 /**
7181  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
7182  */
7183 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7184    /**
7185     * A pointer to the contents in the success state.
7186     * Reading from this pointer when `result_ok` is not set is undefined.
7187     */
7188    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
7189    /**
7190     * A pointer to the contents in the error state.
7191     * Reading from this pointer when `result_ok` is set is undefined.
7192     */
7193    struct LDKDecodeError *err;
7194 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
7195
7196 /**
7197  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
7198  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7199  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7200  */
7201 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
7202    /**
7203     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
7204     * `err` or `result` depending on the state of `result_ok`.
7205     */
7206    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
7207    /**
7208     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
7209     */
7210    bool result_ok;
7211 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
7212
7213 /**
7214  * The contents of CResult_NoneLightningErrorZ
7215  */
7216 typedef union LDKCResult_NoneLightningErrorZPtr {
7217    /**
7218     * Note that this value is always NULL, as there are no contents in the OK variant
7219     */
7220    void *result;
7221    /**
7222     * A pointer to the contents in the error state.
7223     * Reading from this pointer when `result_ok` is set is undefined.
7224     */
7225    struct LDKLightningError *err;
7226 } LDKCResult_NoneLightningErrorZPtr;
7227
7228 /**
7229  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
7230  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
7231  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7232  */
7233 typedef struct LDKCResult_NoneLightningErrorZ {
7234    /**
7235     * The contents of this CResult_NoneLightningErrorZ, accessible via either
7236     * `err` or `result` depending on the state of `result_ok`.
7237     */
7238    union LDKCResult_NoneLightningErrorZPtr contents;
7239    /**
7240     * Whether this CResult_NoneLightningErrorZ represents a success state.
7241     */
7242    bool result_ok;
7243 } LDKCResult_NoneLightningErrorZ;
7244
7245 /**
7246  * A tuple of 2 elements. See the individual fields for the types contained.
7247  */
7248 typedef struct LDKC2Tuple_PublicKeyTypeZ {
7249    /**
7250     * The element at position 0
7251     */
7252    struct LDKPublicKey a;
7253    /**
7254     * The element at position 1
7255     */
7256    struct LDKType b;
7257 } LDKC2Tuple_PublicKeyTypeZ;
7258
7259 /**
7260  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
7261  * This corresponds to std::vector in C++
7262  */
7263 typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
7264    /**
7265     * The elements in the array.
7266     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7267     */
7268    struct LDKC2Tuple_PublicKeyTypeZ *data;
7269    /**
7270     * The number of elements pointed to by `data`.
7271     */
7272    uintptr_t datalen;
7273 } LDKCVec_C2Tuple_PublicKeyTypeZZ;
7274
7275 /**
7276  * The contents of CResult_boolLightningErrorZ
7277  */
7278 typedef union LDKCResult_boolLightningErrorZPtr {
7279    /**
7280     * A pointer to the contents in the success state.
7281     * Reading from this pointer when `result_ok` is not set is undefined.
7282     */
7283    bool *result;
7284    /**
7285     * A pointer to the contents in the error state.
7286     * Reading from this pointer when `result_ok` is set is undefined.
7287     */
7288    struct LDKLightningError *err;
7289 } LDKCResult_boolLightningErrorZPtr;
7290
7291 /**
7292  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
7293  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
7294  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7295  */
7296 typedef struct LDKCResult_boolLightningErrorZ {
7297    /**
7298     * The contents of this CResult_boolLightningErrorZ, accessible via either
7299     * `err` or `result` depending on the state of `result_ok`.
7300     */
7301    union LDKCResult_boolLightningErrorZPtr contents;
7302    /**
7303     * Whether this CResult_boolLightningErrorZ represents a success state.
7304     */
7305    bool result_ok;
7306 } LDKCResult_boolLightningErrorZ;
7307
7308 /**
7309  * A tuple of 3 elements. See the individual fields for the types contained.
7310  */
7311 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
7312    /**
7313     * The element at position 0
7314     */
7315    struct LDKChannelAnnouncement a;
7316    /**
7317     * The element at position 1
7318     */
7319    struct LDKChannelUpdate b;
7320    /**
7321     * The element at position 2
7322     */
7323    struct LDKChannelUpdate c;
7324 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
7325
7326 /**
7327  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
7328  * This corresponds to std::vector in C++
7329  */
7330 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
7331    /**
7332     * The elements in the array.
7333     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7334     */
7335    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
7336    /**
7337     * The number of elements pointed to by `data`.
7338     */
7339    uintptr_t datalen;
7340 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
7341
7342 /**
7343  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
7344  * This corresponds to std::vector in C++
7345  */
7346 typedef struct LDKCVec_NodeAnnouncementZ {
7347    /**
7348     * The elements in the array.
7349     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7350     */
7351    struct LDKNodeAnnouncement *data;
7352    /**
7353     * The number of elements pointed to by `data`.
7354     */
7355    uintptr_t datalen;
7356 } LDKCVec_NodeAnnouncementZ;
7357
7358 /**
7359  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
7360  * This corresponds to std::vector in C++
7361  */
7362 typedef struct LDKCVec_PublicKeyZ {
7363    /**
7364     * The elements in the array.
7365     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7366     */
7367    struct LDKPublicKey *data;
7368    /**
7369     * The number of elements pointed to by `data`.
7370     */
7371    uintptr_t datalen;
7372 } LDKCVec_PublicKeyZ;
7373
7374
7375
7376 /**
7377  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
7378  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
7379  * descriptor.
7380  */
7381 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
7382    /**
7383     * A pointer to the opaque Rust object.
7384     * Nearly everywhere, inner must be non-null, however in places where
7385     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7386     */
7387    LDKnativePeerHandleError *inner;
7388    /**
7389     * Indicates that this is the only struct which contains the same pointer.
7390     * Rust functions which take ownership of an object provided via an argument require
7391     * this to be true and invalidate the object pointed to by inner.
7392     */
7393    bool is_owned;
7394 } LDKPeerHandleError;
7395
7396 /**
7397  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
7398  */
7399 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
7400    /**
7401     * A pointer to the contents in the success state.
7402     * Reading from this pointer when `result_ok` is not set is undefined.
7403     */
7404    struct LDKCVec_u8Z *result;
7405    /**
7406     * A pointer to the contents in the error state.
7407     * Reading from this pointer when `result_ok` is set is undefined.
7408     */
7409    struct LDKPeerHandleError *err;
7410 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
7411
7412 /**
7413  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
7414  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7415  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7416  */
7417 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
7418    /**
7419     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
7420     * `err` or `result` depending on the state of `result_ok`.
7421     */
7422    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
7423    /**
7424     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
7425     */
7426    bool result_ok;
7427 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
7428
7429 /**
7430  * The contents of CResult_NonePeerHandleErrorZ
7431  */
7432 typedef union LDKCResult_NonePeerHandleErrorZPtr {
7433    /**
7434     * Note that this value is always NULL, as there are no contents in the OK variant
7435     */
7436    void *result;
7437    /**
7438     * A pointer to the contents in the error state.
7439     * Reading from this pointer when `result_ok` is set is undefined.
7440     */
7441    struct LDKPeerHandleError *err;
7442 } LDKCResult_NonePeerHandleErrorZPtr;
7443
7444 /**
7445  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
7446  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7447  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7448  */
7449 typedef struct LDKCResult_NonePeerHandleErrorZ {
7450    /**
7451     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
7452     * `err` or `result` depending on the state of `result_ok`.
7453     */
7454    union LDKCResult_NonePeerHandleErrorZPtr contents;
7455    /**
7456     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
7457     */
7458    bool result_ok;
7459 } LDKCResult_NonePeerHandleErrorZ;
7460
7461 /**
7462  * The contents of CResult_boolPeerHandleErrorZ
7463  */
7464 typedef union LDKCResult_boolPeerHandleErrorZPtr {
7465    /**
7466     * A pointer to the contents in the success state.
7467     * Reading from this pointer when `result_ok` is not set is undefined.
7468     */
7469    bool *result;
7470    /**
7471     * A pointer to the contents in the error state.
7472     * Reading from this pointer when `result_ok` is set is undefined.
7473     */
7474    struct LDKPeerHandleError *err;
7475 } LDKCResult_boolPeerHandleErrorZPtr;
7476
7477 /**
7478  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
7479  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
7480  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7481  */
7482 typedef struct LDKCResult_boolPeerHandleErrorZ {
7483    /**
7484     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
7485     * `err` or `result` depending on the state of `result_ok`.
7486     */
7487    union LDKCResult_boolPeerHandleErrorZPtr contents;
7488    /**
7489     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
7490     */
7491    bool result_ok;
7492 } LDKCResult_boolPeerHandleErrorZ;
7493
7494
7495
7496 /**
7497  * Represents the compressed public key of a node
7498  */
7499 typedef struct MUST_USE_STRUCT LDKNodeId {
7500    /**
7501     * A pointer to the opaque Rust object.
7502     * Nearly everywhere, inner must be non-null, however in places where
7503     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7504     */
7505    LDKnativeNodeId *inner;
7506    /**
7507     * Indicates that this is the only struct which contains the same pointer.
7508     * Rust functions which take ownership of an object provided via an argument require
7509     * this to be true and invalidate the object pointed to by inner.
7510     */
7511    bool is_owned;
7512 } LDKNodeId;
7513
7514 /**
7515  * The contents of CResult_NodeIdDecodeErrorZ
7516  */
7517 typedef union LDKCResult_NodeIdDecodeErrorZPtr {
7518    /**
7519     * A pointer to the contents in the success state.
7520     * Reading from this pointer when `result_ok` is not set is undefined.
7521     */
7522    struct LDKNodeId *result;
7523    /**
7524     * A pointer to the contents in the error state.
7525     * Reading from this pointer when `result_ok` is set is undefined.
7526     */
7527    struct LDKDecodeError *err;
7528 } LDKCResult_NodeIdDecodeErrorZPtr;
7529
7530 /**
7531  * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
7532  * containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
7533  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7534  */
7535 typedef struct LDKCResult_NodeIdDecodeErrorZ {
7536    /**
7537     * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
7538     * `err` or `result` depending on the state of `result_ok`.
7539     */
7540    union LDKCResult_NodeIdDecodeErrorZPtr contents;
7541    /**
7542     * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
7543     */
7544    bool result_ok;
7545 } LDKCResult_NodeIdDecodeErrorZ;
7546
7547 /**
7548  * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
7549  */
7550 typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr {
7551    /**
7552     * A pointer to the contents in the success state.
7553     * Reading from this pointer when `result_ok` is not set is undefined.
7554     */
7555    struct LDKCOption_NetworkUpdateZ *result;
7556    /**
7557     * A pointer to the contents in the error state.
7558     * Reading from this pointer when `result_ok` is set is undefined.
7559     */
7560    struct LDKDecodeError *err;
7561 } LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr;
7562
7563 /**
7564  * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
7565  * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7566  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7567  */
7568 typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ {
7569    /**
7570     * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
7571     * `err` or `result` depending on the state of `result_ok`.
7572     */
7573    union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents;
7574    /**
7575     * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
7576     */
7577    bool result_ok;
7578 } LDKCResult_COption_NetworkUpdateZDecodeErrorZ;
7579
7580 /**
7581  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
7582  * UTXOs.
7583  */
7584 typedef struct LDKAccess {
7585    /**
7586     * An opaque pointer which is passed to your function implementations as an argument.
7587     * This has no meaning in the LDK, and can be NULL or any other value.
7588     */
7589    void *this_arg;
7590    /**
7591     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
7592     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
7593     * is unknown.
7594     *
7595     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
7596     */
7597    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
7598    /**
7599     * Frees any resources associated with this object given its this_arg pointer.
7600     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7601     */
7602    void (*free)(void *this_arg);
7603 } LDKAccess;
7604
7605 /**
7606  * An enum which can either contain a crate::lightning::chain::Access or not
7607  */
7608 typedef enum LDKCOption_AccessZ_Tag {
7609    /**
7610     * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
7611     */
7612    LDKCOption_AccessZ_Some,
7613    /**
7614     * When we're in this state, this COption_AccessZ contains nothing
7615     */
7616    LDKCOption_AccessZ_None,
7617    /**
7618     * Must be last for serialization purposes
7619     */
7620    LDKCOption_AccessZ_Sentinel,
7621 } LDKCOption_AccessZ_Tag;
7622
7623 typedef struct LDKCOption_AccessZ {
7624    LDKCOption_AccessZ_Tag tag;
7625    union {
7626       struct {
7627          struct LDKAccess some;
7628       };
7629    };
7630 } LDKCOption_AccessZ;
7631
7632
7633
7634 /**
7635  * Details about one direction of a channel. Received
7636  * within a channel update.
7637  */
7638 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
7639    /**
7640     * A pointer to the opaque Rust object.
7641     * Nearly everywhere, inner must be non-null, however in places where
7642     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7643     */
7644    LDKnativeDirectionalChannelInfo *inner;
7645    /**
7646     * Indicates that this is the only struct which contains the same pointer.
7647     * Rust functions which take ownership of an object provided via an argument require
7648     * this to be true and invalidate the object pointed to by inner.
7649     */
7650    bool is_owned;
7651 } LDKDirectionalChannelInfo;
7652
7653 /**
7654  * The contents of CResult_DirectionalChannelInfoDecodeErrorZ
7655  */
7656 typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr {
7657    /**
7658     * A pointer to the contents in the success state.
7659     * Reading from this pointer when `result_ok` is not set is undefined.
7660     */
7661    struct LDKDirectionalChannelInfo *result;
7662    /**
7663     * A pointer to the contents in the error state.
7664     * Reading from this pointer when `result_ok` is set is undefined.
7665     */
7666    struct LDKDecodeError *err;
7667 } LDKCResult_DirectionalChannelInfoDecodeErrorZPtr;
7668
7669 /**
7670  * A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
7671  * containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7672  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7673  */
7674 typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ {
7675    /**
7676     * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
7677     * `err` or `result` depending on the state of `result_ok`.
7678     */
7679    union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents;
7680    /**
7681     * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
7682     */
7683    bool result_ok;
7684 } LDKCResult_DirectionalChannelInfoDecodeErrorZ;
7685
7686
7687
7688 /**
7689  * Details about a channel (both directions).
7690  * Received within a channel announcement.
7691  */
7692 typedef struct MUST_USE_STRUCT LDKChannelInfo {
7693    /**
7694     * A pointer to the opaque Rust object.
7695     * Nearly everywhere, inner must be non-null, however in places where
7696     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7697     */
7698    LDKnativeChannelInfo *inner;
7699    /**
7700     * Indicates that this is the only struct which contains the same pointer.
7701     * Rust functions which take ownership of an object provided via an argument require
7702     * this to be true and invalidate the object pointed to by inner.
7703     */
7704    bool is_owned;
7705 } LDKChannelInfo;
7706
7707 /**
7708  * The contents of CResult_ChannelInfoDecodeErrorZ
7709  */
7710 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
7711    /**
7712     * A pointer to the contents in the success state.
7713     * Reading from this pointer when `result_ok` is not set is undefined.
7714     */
7715    struct LDKChannelInfo *result;
7716    /**
7717     * A pointer to the contents in the error state.
7718     * Reading from this pointer when `result_ok` is set is undefined.
7719     */
7720    struct LDKDecodeError *err;
7721 } LDKCResult_ChannelInfoDecodeErrorZPtr;
7722
7723 /**
7724  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
7725  * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7726  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7727  */
7728 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
7729    /**
7730     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
7731     * `err` or `result` depending on the state of `result_ok`.
7732     */
7733    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
7734    /**
7735     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
7736     */
7737    bool result_ok;
7738 } LDKCResult_ChannelInfoDecodeErrorZ;
7739
7740
7741
7742 /**
7743  * Fees for routing via a given channel or a node
7744  */
7745 typedef struct MUST_USE_STRUCT LDKRoutingFees {
7746    /**
7747     * A pointer to the opaque Rust object.
7748     * Nearly everywhere, inner must be non-null, however in places where
7749     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7750     */
7751    LDKnativeRoutingFees *inner;
7752    /**
7753     * Indicates that this is the only struct which contains the same pointer.
7754     * Rust functions which take ownership of an object provided via an argument require
7755     * this to be true and invalidate the object pointed to by inner.
7756     */
7757    bool is_owned;
7758 } LDKRoutingFees;
7759
7760 /**
7761  * The contents of CResult_RoutingFeesDecodeErrorZ
7762  */
7763 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
7764    /**
7765     * A pointer to the contents in the success state.
7766     * Reading from this pointer when `result_ok` is not set is undefined.
7767     */
7768    struct LDKRoutingFees *result;
7769    /**
7770     * A pointer to the contents in the error state.
7771     * Reading from this pointer when `result_ok` is set is undefined.
7772     */
7773    struct LDKDecodeError *err;
7774 } LDKCResult_RoutingFeesDecodeErrorZPtr;
7775
7776 /**
7777  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
7778  * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
7779  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7780  */
7781 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
7782    /**
7783     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
7784     * `err` or `result` depending on the state of `result_ok`.
7785     */
7786    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
7787    /**
7788     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
7789     */
7790    bool result_ok;
7791 } LDKCResult_RoutingFeesDecodeErrorZ;
7792
7793
7794
7795 /**
7796  * Information received in the latest node_announcement from this node.
7797  */
7798 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
7799    /**
7800     * A pointer to the opaque Rust object.
7801     * Nearly everywhere, inner must be non-null, however in places where
7802     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7803     */
7804    LDKnativeNodeAnnouncementInfo *inner;
7805    /**
7806     * Indicates that this is the only struct which contains the same pointer.
7807     * Rust functions which take ownership of an object provided via an argument require
7808     * this to be true and invalidate the object pointed to by inner.
7809     */
7810    bool is_owned;
7811 } LDKNodeAnnouncementInfo;
7812
7813 /**
7814  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
7815  */
7816 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
7817    /**
7818     * A pointer to the contents in the success state.
7819     * Reading from this pointer when `result_ok` is not set is undefined.
7820     */
7821    struct LDKNodeAnnouncementInfo *result;
7822    /**
7823     * A pointer to the contents in the error state.
7824     * Reading from this pointer when `result_ok` is set is undefined.
7825     */
7826    struct LDKDecodeError *err;
7827 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
7828
7829 /**
7830  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
7831  * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7832  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7833  */
7834 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
7835    /**
7836     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
7837     * `err` or `result` depending on the state of `result_ok`.
7838     */
7839    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
7840    /**
7841     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
7842     */
7843    bool result_ok;
7844 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
7845
7846 /**
7847  * A dynamically-allocated array of u64s of arbitrary size.
7848  * This corresponds to std::vector in C++
7849  */
7850 typedef struct LDKCVec_u64Z {
7851    /**
7852     * The elements in the array.
7853     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7854     */
7855    uint64_t *data;
7856    /**
7857     * The number of elements pointed to by `data`.
7858     */
7859    uintptr_t datalen;
7860 } LDKCVec_u64Z;
7861
7862
7863
7864 /**
7865  * Details about a node in the network, known from the network announcement.
7866  */
7867 typedef struct MUST_USE_STRUCT LDKNodeInfo {
7868    /**
7869     * A pointer to the opaque Rust object.
7870     * Nearly everywhere, inner must be non-null, however in places where
7871     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7872     */
7873    LDKnativeNodeInfo *inner;
7874    /**
7875     * Indicates that this is the only struct which contains the same pointer.
7876     * Rust functions which take ownership of an object provided via an argument require
7877     * this to be true and invalidate the object pointed to by inner.
7878     */
7879    bool is_owned;
7880 } LDKNodeInfo;
7881
7882 /**
7883  * The contents of CResult_NodeInfoDecodeErrorZ
7884  */
7885 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
7886    /**
7887     * A pointer to the contents in the success state.
7888     * Reading from this pointer when `result_ok` is not set is undefined.
7889     */
7890    struct LDKNodeInfo *result;
7891    /**
7892     * A pointer to the contents in the error state.
7893     * Reading from this pointer when `result_ok` is set is undefined.
7894     */
7895    struct LDKDecodeError *err;
7896 } LDKCResult_NodeInfoDecodeErrorZPtr;
7897
7898 /**
7899  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
7900  * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7901  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7902  */
7903 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
7904    /**
7905     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
7906     * `err` or `result` depending on the state of `result_ok`.
7907     */
7908    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
7909    /**
7910     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
7911     */
7912    bool result_ok;
7913 } LDKCResult_NodeInfoDecodeErrorZ;
7914
7915
7916
7917 /**
7918  * Represents the network as nodes and channels between them
7919  */
7920 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
7921    /**
7922     * A pointer to the opaque Rust object.
7923     * Nearly everywhere, inner must be non-null, however in places where
7924     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7925     */
7926    LDKnativeNetworkGraph *inner;
7927    /**
7928     * Indicates that this is the only struct which contains the same pointer.
7929     * Rust functions which take ownership of an object provided via an argument require
7930     * this to be true and invalidate the object pointed to by inner.
7931     */
7932    bool is_owned;
7933 } LDKNetworkGraph;
7934
7935 /**
7936  * The contents of CResult_NetworkGraphDecodeErrorZ
7937  */
7938 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
7939    /**
7940     * A pointer to the contents in the success state.
7941     * Reading from this pointer when `result_ok` is not set is undefined.
7942     */
7943    struct LDKNetworkGraph *result;
7944    /**
7945     * A pointer to the contents in the error state.
7946     * Reading from this pointer when `result_ok` is set is undefined.
7947     */
7948    struct LDKDecodeError *err;
7949 } LDKCResult_NetworkGraphDecodeErrorZPtr;
7950
7951 /**
7952  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7953  * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7954  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7955  */
7956 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
7957    /**
7958     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7959     * `err` or `result` depending on the state of `result_ok`.
7960     */
7961    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
7962    /**
7963     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7964     */
7965    bool result_ok;
7966 } LDKCResult_NetworkGraphDecodeErrorZ;
7967
7968 /**
7969  * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
7970  */
7971 typedef enum LDKCOption_CVec_NetAddressZZ_Tag {
7972    /**
7973     * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
7974     */
7975    LDKCOption_CVec_NetAddressZZ_Some,
7976    /**
7977     * When we're in this state, this COption_CVec_NetAddressZZ contains nothing
7978     */
7979    LDKCOption_CVec_NetAddressZZ_None,
7980    /**
7981     * Must be last for serialization purposes
7982     */
7983    LDKCOption_CVec_NetAddressZZ_Sentinel,
7984 } LDKCOption_CVec_NetAddressZZ_Tag;
7985
7986 typedef struct LDKCOption_CVec_NetAddressZZ {
7987    LDKCOption_CVec_NetAddressZZ_Tag tag;
7988    union {
7989       struct {
7990          struct LDKCVec_NetAddressZ some;
7991       };
7992    };
7993 } LDKCOption_CVec_NetAddressZZ;
7994
7995 /**
7996  * The contents of CResult_NetAddressDecodeErrorZ
7997  */
7998 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
7999    /**
8000     * A pointer to the contents in the success state.
8001     * Reading from this pointer when `result_ok` is not set is undefined.
8002     */
8003    struct LDKNetAddress *result;
8004    /**
8005     * A pointer to the contents in the error state.
8006     * Reading from this pointer when `result_ok` is set is undefined.
8007     */
8008    struct LDKDecodeError *err;
8009 } LDKCResult_NetAddressDecodeErrorZPtr;
8010
8011 /**
8012  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
8013  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
8014  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8015  */
8016 typedef struct LDKCResult_NetAddressDecodeErrorZ {
8017    /**
8018     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
8019     * `err` or `result` depending on the state of `result_ok`.
8020     */
8021    union LDKCResult_NetAddressDecodeErrorZPtr contents;
8022    /**
8023     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
8024     */
8025    bool result_ok;
8026 } LDKCResult_NetAddressDecodeErrorZ;
8027
8028
8029
8030 /**
8031  * An update_add_htlc message to be sent or received from a peer
8032  */
8033 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
8034    /**
8035     * A pointer to the opaque Rust object.
8036     * Nearly everywhere, inner must be non-null, however in places where
8037     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8038     */
8039    LDKnativeUpdateAddHTLC *inner;
8040    /**
8041     * Indicates that this is the only struct which contains the same pointer.
8042     * Rust functions which take ownership of an object provided via an argument require
8043     * this to be true and invalidate the object pointed to by inner.
8044     */
8045    bool is_owned;
8046 } LDKUpdateAddHTLC;
8047
8048 /**
8049  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
8050  * This corresponds to std::vector in C++
8051  */
8052 typedef struct LDKCVec_UpdateAddHTLCZ {
8053    /**
8054     * The elements in the array.
8055     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8056     */
8057    struct LDKUpdateAddHTLC *data;
8058    /**
8059     * The number of elements pointed to by `data`.
8060     */
8061    uintptr_t datalen;
8062 } LDKCVec_UpdateAddHTLCZ;
8063
8064
8065
8066 /**
8067  * An update_fulfill_htlc message to be sent or received from a peer
8068  */
8069 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
8070    /**
8071     * A pointer to the opaque Rust object.
8072     * Nearly everywhere, inner must be non-null, however in places where
8073     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8074     */
8075    LDKnativeUpdateFulfillHTLC *inner;
8076    /**
8077     * Indicates that this is the only struct which contains the same pointer.
8078     * Rust functions which take ownership of an object provided via an argument require
8079     * this to be true and invalidate the object pointed to by inner.
8080     */
8081    bool is_owned;
8082 } LDKUpdateFulfillHTLC;
8083
8084 /**
8085  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
8086  * This corresponds to std::vector in C++
8087  */
8088 typedef struct LDKCVec_UpdateFulfillHTLCZ {
8089    /**
8090     * The elements in the array.
8091     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8092     */
8093    struct LDKUpdateFulfillHTLC *data;
8094    /**
8095     * The number of elements pointed to by `data`.
8096     */
8097    uintptr_t datalen;
8098 } LDKCVec_UpdateFulfillHTLCZ;
8099
8100
8101
8102 /**
8103  * An update_fail_htlc message to be sent or received from a peer
8104  */
8105 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
8106    /**
8107     * A pointer to the opaque Rust object.
8108     * Nearly everywhere, inner must be non-null, however in places where
8109     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8110     */
8111    LDKnativeUpdateFailHTLC *inner;
8112    /**
8113     * Indicates that this is the only struct which contains the same pointer.
8114     * Rust functions which take ownership of an object provided via an argument require
8115     * this to be true and invalidate the object pointed to by inner.
8116     */
8117    bool is_owned;
8118 } LDKUpdateFailHTLC;
8119
8120 /**
8121  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
8122  * This corresponds to std::vector in C++
8123  */
8124 typedef struct LDKCVec_UpdateFailHTLCZ {
8125    /**
8126     * The elements in the array.
8127     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8128     */
8129    struct LDKUpdateFailHTLC *data;
8130    /**
8131     * The number of elements pointed to by `data`.
8132     */
8133    uintptr_t datalen;
8134 } LDKCVec_UpdateFailHTLCZ;
8135
8136
8137
8138 /**
8139  * An update_fail_malformed_htlc message to be sent or received from a peer
8140  */
8141 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
8142    /**
8143     * A pointer to the opaque Rust object.
8144     * Nearly everywhere, inner must be non-null, however in places where
8145     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8146     */
8147    LDKnativeUpdateFailMalformedHTLC *inner;
8148    /**
8149     * Indicates that this is the only struct which contains the same pointer.
8150     * Rust functions which take ownership of an object provided via an argument require
8151     * this to be true and invalidate the object pointed to by inner.
8152     */
8153    bool is_owned;
8154 } LDKUpdateFailMalformedHTLC;
8155
8156 /**
8157  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
8158  * This corresponds to std::vector in C++
8159  */
8160 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
8161    /**
8162     * The elements in the array.
8163     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8164     */
8165    struct LDKUpdateFailMalformedHTLC *data;
8166    /**
8167     * The number of elements pointed to by `data`.
8168     */
8169    uintptr_t datalen;
8170 } LDKCVec_UpdateFailMalformedHTLCZ;
8171
8172 /**
8173  * The contents of CResult_AcceptChannelDecodeErrorZ
8174  */
8175 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
8176    /**
8177     * A pointer to the contents in the success state.
8178     * Reading from this pointer when `result_ok` is not set is undefined.
8179     */
8180    struct LDKAcceptChannel *result;
8181    /**
8182     * A pointer to the contents in the error state.
8183     * Reading from this pointer when `result_ok` is set is undefined.
8184     */
8185    struct LDKDecodeError *err;
8186 } LDKCResult_AcceptChannelDecodeErrorZPtr;
8187
8188 /**
8189  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
8190  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
8191  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8192  */
8193 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
8194    /**
8195     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
8196     * `err` or `result` depending on the state of `result_ok`.
8197     */
8198    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
8199    /**
8200     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
8201     */
8202    bool result_ok;
8203 } LDKCResult_AcceptChannelDecodeErrorZ;
8204
8205 /**
8206  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
8207  */
8208 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
8209    /**
8210     * A pointer to the contents in the success state.
8211     * Reading from this pointer when `result_ok` is not set is undefined.
8212     */
8213    struct LDKAnnouncementSignatures *result;
8214    /**
8215     * A pointer to the contents in the error state.
8216     * Reading from this pointer when `result_ok` is set is undefined.
8217     */
8218    struct LDKDecodeError *err;
8219 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
8220
8221 /**
8222  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
8223  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
8224  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8225  */
8226 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
8227    /**
8228     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
8229     * `err` or `result` depending on the state of `result_ok`.
8230     */
8231    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
8232    /**
8233     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
8234     */
8235    bool result_ok;
8236 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
8237
8238 /**
8239  * The contents of CResult_ChannelReestablishDecodeErrorZ
8240  */
8241 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
8242    /**
8243     * A pointer to the contents in the success state.
8244     * Reading from this pointer when `result_ok` is not set is undefined.
8245     */
8246    struct LDKChannelReestablish *result;
8247    /**
8248     * A pointer to the contents in the error state.
8249     * Reading from this pointer when `result_ok` is set is undefined.
8250     */
8251    struct LDKDecodeError *err;
8252 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
8253
8254 /**
8255  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
8256  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
8257  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8258  */
8259 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
8260    /**
8261     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
8262     * `err` or `result` depending on the state of `result_ok`.
8263     */
8264    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
8265    /**
8266     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
8267     */
8268    bool result_ok;
8269 } LDKCResult_ChannelReestablishDecodeErrorZ;
8270
8271 /**
8272  * The contents of CResult_ClosingSignedDecodeErrorZ
8273  */
8274 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
8275    /**
8276     * A pointer to the contents in the success state.
8277     * Reading from this pointer when `result_ok` is not set is undefined.
8278     */
8279    struct LDKClosingSigned *result;
8280    /**
8281     * A pointer to the contents in the error state.
8282     * Reading from this pointer when `result_ok` is set is undefined.
8283     */
8284    struct LDKDecodeError *err;
8285 } LDKCResult_ClosingSignedDecodeErrorZPtr;
8286
8287 /**
8288  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
8289  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8290  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8291  */
8292 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
8293    /**
8294     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
8295     * `err` or `result` depending on the state of `result_ok`.
8296     */
8297    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
8298    /**
8299     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
8300     */
8301    bool result_ok;
8302 } LDKCResult_ClosingSignedDecodeErrorZ;
8303
8304
8305
8306 /**
8307  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
8308  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
8309  * to use.
8310  */
8311 typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
8312    /**
8313     * A pointer to the opaque Rust object.
8314     * Nearly everywhere, inner must be non-null, however in places where
8315     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8316     */
8317    LDKnativeClosingSignedFeeRange *inner;
8318    /**
8319     * Indicates that this is the only struct which contains the same pointer.
8320     * Rust functions which take ownership of an object provided via an argument require
8321     * this to be true and invalidate the object pointed to by inner.
8322     */
8323    bool is_owned;
8324 } LDKClosingSignedFeeRange;
8325
8326 /**
8327  * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
8328  */
8329 typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
8330    /**
8331     * A pointer to the contents in the success state.
8332     * Reading from this pointer when `result_ok` is not set is undefined.
8333     */
8334    struct LDKClosingSignedFeeRange *result;
8335    /**
8336     * A pointer to the contents in the error state.
8337     * Reading from this pointer when `result_ok` is set is undefined.
8338     */
8339    struct LDKDecodeError *err;
8340 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr;
8341
8342 /**
8343  * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
8344  * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
8345  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8346  */
8347 typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ {
8348    /**
8349     * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
8350     * `err` or `result` depending on the state of `result_ok`.
8351     */
8352    union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
8353    /**
8354     * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
8355     */
8356    bool result_ok;
8357 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
8358
8359
8360
8361 /**
8362  * A commitment_signed message to be sent or received from a peer
8363  */
8364 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
8365    /**
8366     * A pointer to the opaque Rust object.
8367     * Nearly everywhere, inner must be non-null, however in places where
8368     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8369     */
8370    LDKnativeCommitmentSigned *inner;
8371    /**
8372     * Indicates that this is the only struct which contains the same pointer.
8373     * Rust functions which take ownership of an object provided via an argument require
8374     * this to be true and invalidate the object pointed to by inner.
8375     */
8376    bool is_owned;
8377 } LDKCommitmentSigned;
8378
8379 /**
8380  * The contents of CResult_CommitmentSignedDecodeErrorZ
8381  */
8382 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
8383    /**
8384     * A pointer to the contents in the success state.
8385     * Reading from this pointer when `result_ok` is not set is undefined.
8386     */
8387    struct LDKCommitmentSigned *result;
8388    /**
8389     * A pointer to the contents in the error state.
8390     * Reading from this pointer when `result_ok` is set is undefined.
8391     */
8392    struct LDKDecodeError *err;
8393 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
8394
8395 /**
8396  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
8397  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8398  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8399  */
8400 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
8401    /**
8402     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
8403     * `err` or `result` depending on the state of `result_ok`.
8404     */
8405    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
8406    /**
8407     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
8408     */
8409    bool result_ok;
8410 } LDKCResult_CommitmentSignedDecodeErrorZ;
8411
8412 /**
8413  * The contents of CResult_FundingCreatedDecodeErrorZ
8414  */
8415 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
8416    /**
8417     * A pointer to the contents in the success state.
8418     * Reading from this pointer when `result_ok` is not set is undefined.
8419     */
8420    struct LDKFundingCreated *result;
8421    /**
8422     * A pointer to the contents in the error state.
8423     * Reading from this pointer when `result_ok` is set is undefined.
8424     */
8425    struct LDKDecodeError *err;
8426 } LDKCResult_FundingCreatedDecodeErrorZPtr;
8427
8428 /**
8429  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
8430  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
8431  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8432  */
8433 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
8434    /**
8435     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
8436     * `err` or `result` depending on the state of `result_ok`.
8437     */
8438    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
8439    /**
8440     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
8441     */
8442    bool result_ok;
8443 } LDKCResult_FundingCreatedDecodeErrorZ;
8444
8445 /**
8446  * The contents of CResult_FundingSignedDecodeErrorZ
8447  */
8448 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
8449    /**
8450     * A pointer to the contents in the success state.
8451     * Reading from this pointer when `result_ok` is not set is undefined.
8452     */
8453    struct LDKFundingSigned *result;
8454    /**
8455     * A pointer to the contents in the error state.
8456     * Reading from this pointer when `result_ok` is set is undefined.
8457     */
8458    struct LDKDecodeError *err;
8459 } LDKCResult_FundingSignedDecodeErrorZPtr;
8460
8461 /**
8462  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
8463  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
8464  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8465  */
8466 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
8467    /**
8468     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
8469     * `err` or `result` depending on the state of `result_ok`.
8470     */
8471    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
8472    /**
8473     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
8474     */
8475    bool result_ok;
8476 } LDKCResult_FundingSignedDecodeErrorZ;
8477
8478 /**
8479  * The contents of CResult_FundingLockedDecodeErrorZ
8480  */
8481 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
8482    /**
8483     * A pointer to the contents in the success state.
8484     * Reading from this pointer when `result_ok` is not set is undefined.
8485     */
8486    struct LDKFundingLocked *result;
8487    /**
8488     * A pointer to the contents in the error state.
8489     * Reading from this pointer when `result_ok` is set is undefined.
8490     */
8491    struct LDKDecodeError *err;
8492 } LDKCResult_FundingLockedDecodeErrorZPtr;
8493
8494 /**
8495  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
8496  * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
8497  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8498  */
8499 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
8500    /**
8501     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
8502     * `err` or `result` depending on the state of `result_ok`.
8503     */
8504    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
8505    /**
8506     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
8507     */
8508    bool result_ok;
8509 } LDKCResult_FundingLockedDecodeErrorZ;
8510
8511
8512
8513 /**
8514  * An init message to be sent or received from a peer
8515  */
8516 typedef struct MUST_USE_STRUCT LDKInit {
8517    /**
8518     * A pointer to the opaque Rust object.
8519     * Nearly everywhere, inner must be non-null, however in places where
8520     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8521     */
8522    LDKnativeInit *inner;
8523    /**
8524     * Indicates that this is the only struct which contains the same pointer.
8525     * Rust functions which take ownership of an object provided via an argument require
8526     * this to be true and invalidate the object pointed to by inner.
8527     */
8528    bool is_owned;
8529 } LDKInit;
8530
8531 /**
8532  * The contents of CResult_InitDecodeErrorZ
8533  */
8534 typedef union LDKCResult_InitDecodeErrorZPtr {
8535    /**
8536     * A pointer to the contents in the success state.
8537     * Reading from this pointer when `result_ok` is not set is undefined.
8538     */
8539    struct LDKInit *result;
8540    /**
8541     * A pointer to the contents in the error state.
8542     * Reading from this pointer when `result_ok` is set is undefined.
8543     */
8544    struct LDKDecodeError *err;
8545 } LDKCResult_InitDecodeErrorZPtr;
8546
8547 /**
8548  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
8549  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
8550  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8551  */
8552 typedef struct LDKCResult_InitDecodeErrorZ {
8553    /**
8554     * The contents of this CResult_InitDecodeErrorZ, accessible via either
8555     * `err` or `result` depending on the state of `result_ok`.
8556     */
8557    union LDKCResult_InitDecodeErrorZPtr contents;
8558    /**
8559     * Whether this CResult_InitDecodeErrorZ represents a success state.
8560     */
8561    bool result_ok;
8562 } LDKCResult_InitDecodeErrorZ;
8563
8564 /**
8565  * The contents of CResult_OpenChannelDecodeErrorZ
8566  */
8567 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
8568    /**
8569     * A pointer to the contents in the success state.
8570     * Reading from this pointer when `result_ok` is not set is undefined.
8571     */
8572    struct LDKOpenChannel *result;
8573    /**
8574     * A pointer to the contents in the error state.
8575     * Reading from this pointer when `result_ok` is set is undefined.
8576     */
8577    struct LDKDecodeError *err;
8578 } LDKCResult_OpenChannelDecodeErrorZPtr;
8579
8580 /**
8581  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
8582  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
8583  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8584  */
8585 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
8586    /**
8587     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
8588     * `err` or `result` depending on the state of `result_ok`.
8589     */
8590    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
8591    /**
8592     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
8593     */
8594    bool result_ok;
8595 } LDKCResult_OpenChannelDecodeErrorZ;
8596
8597 /**
8598  * The contents of CResult_RevokeAndACKDecodeErrorZ
8599  */
8600 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
8601    /**
8602     * A pointer to the contents in the success state.
8603     * Reading from this pointer when `result_ok` is not set is undefined.
8604     */
8605    struct LDKRevokeAndACK *result;
8606    /**
8607     * A pointer to the contents in the error state.
8608     * Reading from this pointer when `result_ok` is set is undefined.
8609     */
8610    struct LDKDecodeError *err;
8611 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
8612
8613 /**
8614  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
8615  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
8616  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8617  */
8618 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
8619    /**
8620     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
8621     * `err` or `result` depending on the state of `result_ok`.
8622     */
8623    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
8624    /**
8625     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
8626     */
8627    bool result_ok;
8628 } LDKCResult_RevokeAndACKDecodeErrorZ;
8629
8630 /**
8631  * The contents of CResult_ShutdownDecodeErrorZ
8632  */
8633 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
8634    /**
8635     * A pointer to the contents in the success state.
8636     * Reading from this pointer when `result_ok` is not set is undefined.
8637     */
8638    struct LDKShutdown *result;
8639    /**
8640     * A pointer to the contents in the error state.
8641     * Reading from this pointer when `result_ok` is set is undefined.
8642     */
8643    struct LDKDecodeError *err;
8644 } LDKCResult_ShutdownDecodeErrorZPtr;
8645
8646 /**
8647  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
8648  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
8649  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8650  */
8651 typedef struct LDKCResult_ShutdownDecodeErrorZ {
8652    /**
8653     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
8654     * `err` or `result` depending on the state of `result_ok`.
8655     */
8656    union LDKCResult_ShutdownDecodeErrorZPtr contents;
8657    /**
8658     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
8659     */
8660    bool result_ok;
8661 } LDKCResult_ShutdownDecodeErrorZ;
8662
8663 /**
8664  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
8665  */
8666 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
8667    /**
8668     * A pointer to the contents in the success state.
8669     * Reading from this pointer when `result_ok` is not set is undefined.
8670     */
8671    struct LDKUpdateFailHTLC *result;
8672    /**
8673     * A pointer to the contents in the error state.
8674     * Reading from this pointer when `result_ok` is set is undefined.
8675     */
8676    struct LDKDecodeError *err;
8677 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
8678
8679 /**
8680  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
8681  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
8682  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8683  */
8684 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
8685    /**
8686     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
8687     * `err` or `result` depending on the state of `result_ok`.
8688     */
8689    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
8690    /**
8691     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
8692     */
8693    bool result_ok;
8694 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
8695
8696 /**
8697  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
8698  */
8699 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
8700    /**
8701     * A pointer to the contents in the success state.
8702     * Reading from this pointer when `result_ok` is not set is undefined.
8703     */
8704    struct LDKUpdateFailMalformedHTLC *result;
8705    /**
8706     * A pointer to the contents in the error state.
8707     * Reading from this pointer when `result_ok` is set is undefined.
8708     */
8709    struct LDKDecodeError *err;
8710 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
8711
8712 /**
8713  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
8714  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
8715  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8716  */
8717 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
8718    /**
8719     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
8720     * `err` or `result` depending on the state of `result_ok`.
8721     */
8722    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
8723    /**
8724     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
8725     */
8726    bool result_ok;
8727 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
8728
8729
8730
8731 /**
8732  * An update_fee message to be sent or received from a peer
8733  */
8734 typedef struct MUST_USE_STRUCT LDKUpdateFee {
8735    /**
8736     * A pointer to the opaque Rust object.
8737     * Nearly everywhere, inner must be non-null, however in places where
8738     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8739     */
8740    LDKnativeUpdateFee *inner;
8741    /**
8742     * Indicates that this is the only struct which contains the same pointer.
8743     * Rust functions which take ownership of an object provided via an argument require
8744     * this to be true and invalidate the object pointed to by inner.
8745     */
8746    bool is_owned;
8747 } LDKUpdateFee;
8748
8749 /**
8750  * The contents of CResult_UpdateFeeDecodeErrorZ
8751  */
8752 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
8753    /**
8754     * A pointer to the contents in the success state.
8755     * Reading from this pointer when `result_ok` is not set is undefined.
8756     */
8757    struct LDKUpdateFee *result;
8758    /**
8759     * A pointer to the contents in the error state.
8760     * Reading from this pointer when `result_ok` is set is undefined.
8761     */
8762    struct LDKDecodeError *err;
8763 } LDKCResult_UpdateFeeDecodeErrorZPtr;
8764
8765 /**
8766  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
8767  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
8768  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8769  */
8770 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
8771    /**
8772     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
8773     * `err` or `result` depending on the state of `result_ok`.
8774     */
8775    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
8776    /**
8777     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
8778     */
8779    bool result_ok;
8780 } LDKCResult_UpdateFeeDecodeErrorZ;
8781
8782 /**
8783  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
8784  */
8785 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
8786    /**
8787     * A pointer to the contents in the success state.
8788     * Reading from this pointer when `result_ok` is not set is undefined.
8789     */
8790    struct LDKUpdateFulfillHTLC *result;
8791    /**
8792     * A pointer to the contents in the error state.
8793     * Reading from this pointer when `result_ok` is set is undefined.
8794     */
8795    struct LDKDecodeError *err;
8796 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
8797
8798 /**
8799  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
8800  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
8801  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8802  */
8803 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
8804    /**
8805     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
8806     * `err` or `result` depending on the state of `result_ok`.
8807     */
8808    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
8809    /**
8810     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
8811     */
8812    bool result_ok;
8813 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
8814
8815 /**
8816  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
8817  */
8818 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
8819    /**
8820     * A pointer to the contents in the success state.
8821     * Reading from this pointer when `result_ok` is not set is undefined.
8822     */
8823    struct LDKUpdateAddHTLC *result;
8824    /**
8825     * A pointer to the contents in the error state.
8826     * Reading from this pointer when `result_ok` is set is undefined.
8827     */
8828    struct LDKDecodeError *err;
8829 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
8830
8831 /**
8832  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
8833  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
8834  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8835  */
8836 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
8837    /**
8838     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
8839     * `err` or `result` depending on the state of `result_ok`.
8840     */
8841    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
8842    /**
8843     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
8844     */
8845    bool result_ok;
8846 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
8847
8848
8849
8850 /**
8851  * A ping message to be sent or received from a peer
8852  */
8853 typedef struct MUST_USE_STRUCT LDKPing {
8854    /**
8855     * A pointer to the opaque Rust object.
8856     * Nearly everywhere, inner must be non-null, however in places where
8857     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8858     */
8859    LDKnativePing *inner;
8860    /**
8861     * Indicates that this is the only struct which contains the same pointer.
8862     * Rust functions which take ownership of an object provided via an argument require
8863     * this to be true and invalidate the object pointed to by inner.
8864     */
8865    bool is_owned;
8866 } LDKPing;
8867
8868 /**
8869  * The contents of CResult_PingDecodeErrorZ
8870  */
8871 typedef union LDKCResult_PingDecodeErrorZPtr {
8872    /**
8873     * A pointer to the contents in the success state.
8874     * Reading from this pointer when `result_ok` is not set is undefined.
8875     */
8876    struct LDKPing *result;
8877    /**
8878     * A pointer to the contents in the error state.
8879     * Reading from this pointer when `result_ok` is set is undefined.
8880     */
8881    struct LDKDecodeError *err;
8882 } LDKCResult_PingDecodeErrorZPtr;
8883
8884 /**
8885  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
8886  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
8887  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8888  */
8889 typedef struct LDKCResult_PingDecodeErrorZ {
8890    /**
8891     * The contents of this CResult_PingDecodeErrorZ, accessible via either
8892     * `err` or `result` depending on the state of `result_ok`.
8893     */
8894    union LDKCResult_PingDecodeErrorZPtr contents;
8895    /**
8896     * Whether this CResult_PingDecodeErrorZ represents a success state.
8897     */
8898    bool result_ok;
8899 } LDKCResult_PingDecodeErrorZ;
8900
8901
8902
8903 /**
8904  * A pong message to be sent or received from a peer
8905  */
8906 typedef struct MUST_USE_STRUCT LDKPong {
8907    /**
8908     * A pointer to the opaque Rust object.
8909     * Nearly everywhere, inner must be non-null, however in places where
8910     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8911     */
8912    LDKnativePong *inner;
8913    /**
8914     * Indicates that this is the only struct which contains the same pointer.
8915     * Rust functions which take ownership of an object provided via an argument require
8916     * this to be true and invalidate the object pointed to by inner.
8917     */
8918    bool is_owned;
8919 } LDKPong;
8920
8921 /**
8922  * The contents of CResult_PongDecodeErrorZ
8923  */
8924 typedef union LDKCResult_PongDecodeErrorZPtr {
8925    /**
8926     * A pointer to the contents in the success state.
8927     * Reading from this pointer when `result_ok` is not set is undefined.
8928     */
8929    struct LDKPong *result;
8930    /**
8931     * A pointer to the contents in the error state.
8932     * Reading from this pointer when `result_ok` is set is undefined.
8933     */
8934    struct LDKDecodeError *err;
8935 } LDKCResult_PongDecodeErrorZPtr;
8936
8937 /**
8938  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
8939  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
8940  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8941  */
8942 typedef struct LDKCResult_PongDecodeErrorZ {
8943    /**
8944     * The contents of this CResult_PongDecodeErrorZ, accessible via either
8945     * `err` or `result` depending on the state of `result_ok`.
8946     */
8947    union LDKCResult_PongDecodeErrorZPtr contents;
8948    /**
8949     * Whether this CResult_PongDecodeErrorZ represents a success state.
8950     */
8951    bool result_ok;
8952 } LDKCResult_PongDecodeErrorZ;
8953
8954 /**
8955  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
8956  */
8957 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
8958    /**
8959     * A pointer to the contents in the success state.
8960     * Reading from this pointer when `result_ok` is not set is undefined.
8961     */
8962    struct LDKUnsignedChannelAnnouncement *result;
8963    /**
8964     * A pointer to the contents in the error state.
8965     * Reading from this pointer when `result_ok` is set is undefined.
8966     */
8967    struct LDKDecodeError *err;
8968 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
8969
8970 /**
8971  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
8972  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
8973  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8974  */
8975 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
8976    /**
8977     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
8978     * `err` or `result` depending on the state of `result_ok`.
8979     */
8980    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
8981    /**
8982     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
8983     */
8984    bool result_ok;
8985 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
8986
8987 /**
8988  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
8989  */
8990 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
8991    /**
8992     * A pointer to the contents in the success state.
8993     * Reading from this pointer when `result_ok` is not set is undefined.
8994     */
8995    struct LDKChannelAnnouncement *result;
8996    /**
8997     * A pointer to the contents in the error state.
8998     * Reading from this pointer when `result_ok` is set is undefined.
8999     */
9000    struct LDKDecodeError *err;
9001 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
9002
9003 /**
9004  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
9005  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
9006  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9007  */
9008 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
9009    /**
9010     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
9011     * `err` or `result` depending on the state of `result_ok`.
9012     */
9013    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
9014    /**
9015     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
9016     */
9017    bool result_ok;
9018 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
9019
9020
9021
9022 /**
9023  * The unsigned part of a channel_update
9024  */
9025 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
9026    /**
9027     * A pointer to the opaque Rust object.
9028     * Nearly everywhere, inner must be non-null, however in places where
9029     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9030     */
9031    LDKnativeUnsignedChannelUpdate *inner;
9032    /**
9033     * Indicates that this is the only struct which contains the same pointer.
9034     * Rust functions which take ownership of an object provided via an argument require
9035     * this to be true and invalidate the object pointed to by inner.
9036     */
9037    bool is_owned;
9038 } LDKUnsignedChannelUpdate;
9039
9040 /**
9041  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
9042  */
9043 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
9044    /**
9045     * A pointer to the contents in the success state.
9046     * Reading from this pointer when `result_ok` is not set is undefined.
9047     */
9048    struct LDKUnsignedChannelUpdate *result;
9049    /**
9050     * A pointer to the contents in the error state.
9051     * Reading from this pointer when `result_ok` is set is undefined.
9052     */
9053    struct LDKDecodeError *err;
9054 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
9055
9056 /**
9057  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
9058  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9059  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9060  */
9061 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
9062    /**
9063     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
9064     * `err` or `result` depending on the state of `result_ok`.
9065     */
9066    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
9067    /**
9068     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
9069     */
9070    bool result_ok;
9071 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
9072
9073 /**
9074  * The contents of CResult_ChannelUpdateDecodeErrorZ
9075  */
9076 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
9077    /**
9078     * A pointer to the contents in the success state.
9079     * Reading from this pointer when `result_ok` is not set is undefined.
9080     */
9081    struct LDKChannelUpdate *result;
9082    /**
9083     * A pointer to the contents in the error state.
9084     * Reading from this pointer when `result_ok` is set is undefined.
9085     */
9086    struct LDKDecodeError *err;
9087 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
9088
9089 /**
9090  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
9091  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9092  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9093  */
9094 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
9095    /**
9096     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
9097     * `err` or `result` depending on the state of `result_ok`.
9098     */
9099    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
9100    /**
9101     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
9102     */
9103    bool result_ok;
9104 } LDKCResult_ChannelUpdateDecodeErrorZ;
9105
9106 /**
9107  * The contents of CResult_ErrorMessageDecodeErrorZ
9108  */
9109 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
9110    /**
9111     * A pointer to the contents in the success state.
9112     * Reading from this pointer when `result_ok` is not set is undefined.
9113     */
9114    struct LDKErrorMessage *result;
9115    /**
9116     * A pointer to the contents in the error state.
9117     * Reading from this pointer when `result_ok` is set is undefined.
9118     */
9119    struct LDKDecodeError *err;
9120 } LDKCResult_ErrorMessageDecodeErrorZPtr;
9121
9122 /**
9123  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
9124  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
9125  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9126  */
9127 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
9128    /**
9129     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
9130     * `err` or `result` depending on the state of `result_ok`.
9131     */
9132    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
9133    /**
9134     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
9135     */
9136    bool result_ok;
9137 } LDKCResult_ErrorMessageDecodeErrorZ;
9138
9139
9140
9141 /**
9142  * The unsigned part of a node_announcement
9143  */
9144 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
9145    /**
9146     * A pointer to the opaque Rust object.
9147     * Nearly everywhere, inner must be non-null, however in places where
9148     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9149     */
9150    LDKnativeUnsignedNodeAnnouncement *inner;
9151    /**
9152     * Indicates that this is the only struct which contains the same pointer.
9153     * Rust functions which take ownership of an object provided via an argument require
9154     * this to be true and invalidate the object pointed to by inner.
9155     */
9156    bool is_owned;
9157 } LDKUnsignedNodeAnnouncement;
9158
9159 /**
9160  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
9161  */
9162 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
9163    /**
9164     * A pointer to the contents in the success state.
9165     * Reading from this pointer when `result_ok` is not set is undefined.
9166     */
9167    struct LDKUnsignedNodeAnnouncement *result;
9168    /**
9169     * A pointer to the contents in the error state.
9170     * Reading from this pointer when `result_ok` is set is undefined.
9171     */
9172    struct LDKDecodeError *err;
9173 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
9174
9175 /**
9176  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
9177  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
9178  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9179  */
9180 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
9181    /**
9182     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
9183     * `err` or `result` depending on the state of `result_ok`.
9184     */
9185    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
9186    /**
9187     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
9188     */
9189    bool result_ok;
9190 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
9191
9192 /**
9193  * The contents of CResult_NodeAnnouncementDecodeErrorZ
9194  */
9195 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
9196    /**
9197     * A pointer to the contents in the success state.
9198     * Reading from this pointer when `result_ok` is not set is undefined.
9199     */
9200    struct LDKNodeAnnouncement *result;
9201    /**
9202     * A pointer to the contents in the error state.
9203     * Reading from this pointer when `result_ok` is set is undefined.
9204     */
9205    struct LDKDecodeError *err;
9206 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
9207
9208 /**
9209  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
9210  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
9211  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9212  */
9213 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
9214    /**
9215     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
9216     * `err` or `result` depending on the state of `result_ok`.
9217     */
9218    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
9219    /**
9220     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
9221     */
9222    bool result_ok;
9223 } LDKCResult_NodeAnnouncementDecodeErrorZ;
9224
9225 /**
9226  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
9227  */
9228 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
9229    /**
9230     * A pointer to the contents in the success state.
9231     * Reading from this pointer when `result_ok` is not set is undefined.
9232     */
9233    struct LDKQueryShortChannelIds *result;
9234    /**
9235     * A pointer to the contents in the error state.
9236     * Reading from this pointer when `result_ok` is set is undefined.
9237     */
9238    struct LDKDecodeError *err;
9239 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
9240
9241 /**
9242  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
9243  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
9244  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9245  */
9246 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
9247    /**
9248     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
9249     * `err` or `result` depending on the state of `result_ok`.
9250     */
9251    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
9252    /**
9253     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
9254     */
9255    bool result_ok;
9256 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
9257
9258
9259
9260 /**
9261  * A reply_short_channel_ids_end message is sent as a reply to a
9262  * query_short_channel_ids message. The query recipient makes a best
9263  * effort to respond based on their local network view which may not be
9264  * a perfect view of the network.
9265  */
9266 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
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    LDKnativeReplyShortChannelIdsEnd *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 } LDKReplyShortChannelIdsEnd;
9280
9281 /**
9282  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
9283  */
9284 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
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 LDKReplyShortChannelIdsEnd *result;
9290    /**
9291     * A pointer to the contents in the error state.
9292     * Reading from this pointer when `result_ok` is set is undefined.
9293     */
9294    struct LDKDecodeError *err;
9295 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
9296
9297 /**
9298  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
9299  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
9300  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9301  */
9302 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
9303    /**
9304     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
9305     * `err` or `result` depending on the state of `result_ok`.
9306     */
9307    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
9308    /**
9309     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
9310     */
9311    bool result_ok;
9312 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
9313
9314 /**
9315  * The contents of CResult_QueryChannelRangeDecodeErrorZ
9316  */
9317 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
9318    /**
9319     * A pointer to the contents in the success state.
9320     * Reading from this pointer when `result_ok` is not set is undefined.
9321     */
9322    struct LDKQueryChannelRange *result;
9323    /**
9324     * A pointer to the contents in the error state.
9325     * Reading from this pointer when `result_ok` is set is undefined.
9326     */
9327    struct LDKDecodeError *err;
9328 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
9329
9330 /**
9331  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
9332  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
9333  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9334  */
9335 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
9336    /**
9337     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
9338     * `err` or `result` depending on the state of `result_ok`.
9339     */
9340    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
9341    /**
9342     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
9343     */
9344    bool result_ok;
9345 } LDKCResult_QueryChannelRangeDecodeErrorZ;
9346
9347 /**
9348  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
9349  */
9350 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
9351    /**
9352     * A pointer to the contents in the success state.
9353     * Reading from this pointer when `result_ok` is not set is undefined.
9354     */
9355    struct LDKReplyChannelRange *result;
9356    /**
9357     * A pointer to the contents in the error state.
9358     * Reading from this pointer when `result_ok` is set is undefined.
9359     */
9360    struct LDKDecodeError *err;
9361 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
9362
9363 /**
9364  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
9365  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
9366  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9367  */
9368 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
9369    /**
9370     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
9371     * `err` or `result` depending on the state of `result_ok`.
9372     */
9373    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
9374    /**
9375     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
9376     */
9377    bool result_ok;
9378 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
9379
9380
9381
9382 /**
9383  * A gossip_timestamp_filter message is used by a node to request
9384  * gossip relay for messages in the requested time range when the
9385  * gossip_queries feature has been negotiated.
9386  */
9387 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
9388    /**
9389     * A pointer to the opaque Rust object.
9390     * Nearly everywhere, inner must be non-null, however in places where
9391     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9392     */
9393    LDKnativeGossipTimestampFilter *inner;
9394    /**
9395     * Indicates that this is the only struct which contains the same pointer.
9396     * Rust functions which take ownership of an object provided via an argument require
9397     * this to be true and invalidate the object pointed to by inner.
9398     */
9399    bool is_owned;
9400 } LDKGossipTimestampFilter;
9401
9402 /**
9403  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
9404  */
9405 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
9406    /**
9407     * A pointer to the contents in the success state.
9408     * Reading from this pointer when `result_ok` is not set is undefined.
9409     */
9410    struct LDKGossipTimestampFilter *result;
9411    /**
9412     * A pointer to the contents in the error state.
9413     * Reading from this pointer when `result_ok` is set is undefined.
9414     */
9415    struct LDKDecodeError *err;
9416 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
9417
9418 /**
9419  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
9420  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
9421  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9422  */
9423 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
9424    /**
9425     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
9426     * `err` or `result` depending on the state of `result_ok`.
9427     */
9428    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
9429    /**
9430     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
9431     */
9432    bool result_ok;
9433 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
9434
9435 /**
9436  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
9437  * may occur.
9438  */
9439 typedef enum LDKSignOrCreationError_Tag {
9440    /**
9441     * An error occurred during signing
9442     */
9443    LDKSignOrCreationError_SignError,
9444    /**
9445     * An error occurred while building the transaction
9446     */
9447    LDKSignOrCreationError_CreationError,
9448    /**
9449     * Must be last for serialization purposes
9450     */
9451    LDKSignOrCreationError_Sentinel,
9452 } LDKSignOrCreationError_Tag;
9453
9454 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
9455    LDKSignOrCreationError_Tag tag;
9456    union {
9457       struct {
9458          enum LDKCreationError creation_error;
9459       };
9460    };
9461 } LDKSignOrCreationError;
9462
9463 /**
9464  * The contents of CResult_InvoiceSignOrCreationErrorZ
9465  */
9466 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
9467    /**
9468     * A pointer to the contents in the success state.
9469     * Reading from this pointer when `result_ok` is not set is undefined.
9470     */
9471    struct LDKInvoice *result;
9472    /**
9473     * A pointer to the contents in the error state.
9474     * Reading from this pointer when `result_ok` is set is undefined.
9475     */
9476    struct LDKSignOrCreationError *err;
9477 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
9478
9479 /**
9480  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
9481  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
9482  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9483  */
9484 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
9485    /**
9486     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
9487     * `err` or `result` depending on the state of `result_ok`.
9488     */
9489    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
9490    /**
9491     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
9492     */
9493    bool result_ok;
9494 } LDKCResult_InvoiceSignOrCreationErrorZ;
9495
9496
9497
9498 /**
9499  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
9500  *
9501  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
9502  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
9503  * the return value of [`Filter::register_output`].
9504  *
9505  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
9506  * may have been spent there. See [`Filter::register_output`] for details.
9507  *
9508  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
9509  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
9510  */
9511 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
9512    /**
9513     * A pointer to the opaque Rust object.
9514     * Nearly everywhere, inner must be non-null, however in places where
9515     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9516     */
9517    LDKnativeWatchedOutput *inner;
9518    /**
9519     * Indicates that this is the only struct which contains the same pointer.
9520     * Rust functions which take ownership of an object provided via an argument require
9521     * this to be true and invalidate the object pointed to by inner.
9522     */
9523    bool is_owned;
9524 } LDKWatchedOutput;
9525
9526 /**
9527  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
9528  * channels.
9529  *
9530  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
9531  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
9532  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
9533  * receiving full blocks from a chain source, any further filtering is unnecessary.
9534  *
9535  * After an output has been registered, subsequent block retrievals from the chain source must not
9536  * exclude any transactions matching the new criteria nor any in-block descendants of such
9537  * transactions.
9538  *
9539  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
9540  * should not block on I/O. Implementations should instead queue the newly monitored data to be
9541  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
9542  * invocation that has called the `Filter` must return [`TemporaryFailure`].
9543  *
9544  * [`TemporaryFailure`]: ChannelMonitorUpdateErr::TemporaryFailure
9545  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
9546  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
9547  */
9548 typedef struct LDKFilter {
9549    /**
9550     * An opaque pointer which is passed to your function implementations as an argument.
9551     * This has no meaning in the LDK, and can be NULL or any other value.
9552     */
9553    void *this_arg;
9554    /**
9555     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
9556     * a spending condition.
9557     */
9558    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
9559    /**
9560     * Registers interest in spends of a transaction output.
9561     *
9562     * Optionally, when `output.block_hash` is set, should return any transaction spending the
9563     * output that is found in the corresponding block along with its index.
9564     *
9565     * This return value is useful for Electrum clients in order to supply in-block descendant
9566     * transactions which otherwise were not included. This is not necessary for other clients if
9567     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
9568     * full block).
9569     */
9570    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
9571    /**
9572     * Frees any resources associated with this object given its this_arg pointer.
9573     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9574     */
9575    void (*free)(void *this_arg);
9576 } LDKFilter;
9577
9578 /**
9579  * An enum which can either contain a crate::lightning::chain::Filter or not
9580  */
9581 typedef enum LDKCOption_FilterZ_Tag {
9582    /**
9583     * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
9584     */
9585    LDKCOption_FilterZ_Some,
9586    /**
9587     * When we're in this state, this COption_FilterZ contains nothing
9588     */
9589    LDKCOption_FilterZ_None,
9590    /**
9591     * Must be last for serialization purposes
9592     */
9593    LDKCOption_FilterZ_Sentinel,
9594 } LDKCOption_FilterZ_Tag;
9595
9596 typedef struct LDKCOption_FilterZ {
9597    LDKCOption_FilterZ_Tag tag;
9598    union {
9599       struct {
9600          struct LDKFilter some;
9601       };
9602    };
9603 } LDKCOption_FilterZ;
9604
9605
9606
9607 /**
9608  * A read-only reference to a current ChannelMonitor.
9609  *
9610  * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is
9611  * released.
9612  */
9613 typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor {
9614    /**
9615     * A pointer to the opaque Rust object.
9616     * Nearly everywhere, inner must be non-null, however in places where
9617     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9618     */
9619    LDKnativeLockedChannelMonitor *inner;
9620    /**
9621     * Indicates that this is the only struct which contains the same pointer.
9622     * Rust functions which take ownership of an object provided via an argument require
9623     * this to be true and invalidate the object pointed to by inner.
9624     */
9625    bool is_owned;
9626 } LDKLockedChannelMonitor;
9627
9628 /**
9629  * The contents of CResult_LockedChannelMonitorNoneZ
9630  */
9631 typedef union LDKCResult_LockedChannelMonitorNoneZPtr {
9632    /**
9633     * A pointer to the contents in the success state.
9634     * Reading from this pointer when `result_ok` is not set is undefined.
9635     */
9636    struct LDKLockedChannelMonitor *result;
9637    /**
9638     * Note that this value is always NULL, as there are no contents in the Err variant
9639     */
9640    void *err;
9641 } LDKCResult_LockedChannelMonitorNoneZPtr;
9642
9643 /**
9644  * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
9645  * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
9646  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9647  */
9648 typedef struct LDKCResult_LockedChannelMonitorNoneZ {
9649    /**
9650     * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
9651     * `err` or `result` depending on the state of `result_ok`.
9652     */
9653    union LDKCResult_LockedChannelMonitorNoneZPtr contents;
9654    /**
9655     * Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
9656     */
9657    bool result_ok;
9658 } LDKCResult_LockedChannelMonitorNoneZ;
9659
9660 /**
9661  * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
9662  * This corresponds to std::vector in C++
9663  */
9664 typedef struct LDKCVec_OutPointZ {
9665    /**
9666     * The elements in the array.
9667     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9668     */
9669    struct LDKOutPoint *data;
9670    /**
9671     * The number of elements pointed to by `data`.
9672     */
9673    uintptr_t datalen;
9674 } LDKCVec_OutPointZ;
9675
9676 /**
9677  * A trait indicating an object may generate message send events
9678  */
9679 typedef struct LDKMessageSendEventsProvider {
9680    /**
9681     * An opaque pointer which is passed to your function implementations as an argument.
9682     * This has no meaning in the LDK, and can be NULL or any other value.
9683     */
9684    void *this_arg;
9685    /**
9686     * Gets the list of pending events which were generated by previous actions, clearing the list
9687     * in the process.
9688     */
9689    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
9690    /**
9691     * Frees any resources associated with this object given its this_arg pointer.
9692     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9693     */
9694    void (*free)(void *this_arg);
9695 } LDKMessageSendEventsProvider;
9696
9697 /**
9698  * A trait implemented for objects handling events from [`EventsProvider`].
9699  */
9700 typedef struct LDKEventHandler {
9701    /**
9702     * An opaque pointer which is passed to your function implementations as an argument.
9703     * This has no meaning in the LDK, and can be NULL or any other value.
9704     */
9705    void *this_arg;
9706    /**
9707     * Handles the given [`Event`].
9708     *
9709     * See [`EventsProvider`] for details that must be considered when implementing this method.
9710     */
9711    void (*handle_event)(const void *this_arg, const struct LDKEvent *NONNULL_PTR event);
9712    /**
9713     * Frees any resources associated with this object given its this_arg pointer.
9714     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9715     */
9716    void (*free)(void *this_arg);
9717 } LDKEventHandler;
9718
9719 /**
9720  * A trait indicating an object may generate events.
9721  *
9722  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
9723  *
9724  * # Requirements
9725  *
9726  * See [`process_pending_events`] for requirements around event processing.
9727  *
9728  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
9729  * event since the last invocation. The handler must either act upon the event immediately
9730  * or preserve it for later handling.
9731  *
9732  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
9733  * consult the provider's documentation on the implication of processing events and how a handler
9734  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
9735  * [`ChainMonitor::process_pending_events`]).
9736  *
9737  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
9738  * own type(s).
9739  *
9740  * [`process_pending_events`]: Self::process_pending_events
9741  * [`handle_event`]: EventHandler::handle_event
9742  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
9743  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
9744  */
9745 typedef struct LDKEventsProvider {
9746    /**
9747     * An opaque pointer which is passed to your function implementations as an argument.
9748     * This has no meaning in the LDK, and can be NULL or any other value.
9749     */
9750    void *this_arg;
9751    /**
9752     * Processes any events generated since the last call using the given event handler.
9753     *
9754     * Subsequent calls must only process new events. However, handlers must be capable of handling
9755     * duplicate events across process restarts. This may occur if the provider was recovered from
9756     * an old state (i.e., it hadn't been successfully persisted after processing pending events).
9757     */
9758    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
9759    /**
9760     * Frees any resources associated with this object given its this_arg pointer.
9761     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9762     */
9763    void (*free)(void *this_arg);
9764 } LDKEventsProvider;
9765
9766
9767
9768 /**
9769  * Configuration we set when applicable.
9770  *
9771  * Default::default() provides sane defaults.
9772  */
9773 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
9774    /**
9775     * A pointer to the opaque Rust object.
9776     * Nearly everywhere, inner must be non-null, however in places where
9777     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9778     */
9779    LDKnativeChannelHandshakeConfig *inner;
9780    /**
9781     * Indicates that this is the only struct which contains the same pointer.
9782     * Rust functions which take ownership of an object provided via an argument require
9783     * this to be true and invalidate the object pointed to by inner.
9784     */
9785    bool is_owned;
9786 } LDKChannelHandshakeConfig;
9787
9788
9789
9790 /**
9791  * Optional channel limits which are applied during channel creation.
9792  *
9793  * These limits are only applied to our counterparty's limits, not our own.
9794  *
9795  * Use 0/<type>::max_value() as appropriate to skip checking.
9796  *
9797  * Provides sane defaults for most configurations.
9798  *
9799  * Most additional limits are disabled except those with which specify a default in individual
9800  * field documentation. Note that this may result in barely-usable channels, but since they
9801  * are applied mostly only to incoming channels that's not much of a problem.
9802  */
9803 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
9804    /**
9805     * A pointer to the opaque Rust object.
9806     * Nearly everywhere, inner must be non-null, however in places where
9807     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9808     */
9809    LDKnativeChannelHandshakeLimits *inner;
9810    /**
9811     * Indicates that this is the only struct which contains the same pointer.
9812     * Rust functions which take ownership of an object provided via an argument require
9813     * this to be true and invalidate the object pointed to by inner.
9814     */
9815    bool is_owned;
9816 } LDKChannelHandshakeLimits;
9817
9818
9819
9820 /**
9821  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
9822  *
9823  * Default::default() provides sane defaults for most configurations
9824  * (but currently with 0 relay fees!)
9825  */
9826 typedef struct MUST_USE_STRUCT LDKUserConfig {
9827    /**
9828     * A pointer to the opaque Rust object.
9829     * Nearly everywhere, inner must be non-null, however in places where
9830     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9831     */
9832    LDKnativeUserConfig *inner;
9833    /**
9834     * Indicates that this is the only struct which contains the same pointer.
9835     * Rust functions which take ownership of an object provided via an argument require
9836     * this to be true and invalidate the object pointed to by inner.
9837     */
9838    bool is_owned;
9839 } LDKUserConfig;
9840
9841
9842
9843 /**
9844  * The best known block as identified by its hash and height.
9845  */
9846 typedef struct MUST_USE_STRUCT LDKBestBlock {
9847    /**
9848     * A pointer to the opaque Rust object.
9849     * Nearly everywhere, inner must be non-null, however in places where
9850     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9851     */
9852    LDKnativeBestBlock *inner;
9853    /**
9854     * Indicates that this is the only struct which contains the same pointer.
9855     * Rust functions which take ownership of an object provided via an argument require
9856     * this to be true and invalidate the object pointed to by inner.
9857     */
9858    bool is_owned;
9859 } LDKBestBlock;
9860
9861 /**
9862  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
9863  * chain.
9864  *
9865  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
9866  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
9867  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
9868  * when needed.
9869  */
9870 typedef struct LDKListen {
9871    /**
9872     * An opaque pointer which is passed to your function implementations as an argument.
9873     * This has no meaning in the LDK, and can be NULL or any other value.
9874     */
9875    void *this_arg;
9876    /**
9877     * Notifies the listener that a block was added at the given height.
9878     */
9879    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
9880    /**
9881     * Notifies the listener that a block was removed at the given height.
9882     */
9883    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
9884    /**
9885     * Frees any resources associated with this object given its this_arg pointer.
9886     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9887     */
9888    void (*free)(void *this_arg);
9889 } LDKListen;
9890
9891 /**
9892  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
9893  * unconfirmed during a chain reorganization.
9894  *
9895  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
9896  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
9897  * related to registered transactions and outputs. Upon notification, it would pass along the
9898  * matching transactions using this interface.
9899  *
9900  * # Use
9901  *
9902  * The intended use is as follows:
9903  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
9904  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
9905  *   that has been reorganized out of the chain.
9906  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
9907  *
9908  * # Order
9909  *
9910  * Clients must call these methods in chain order. Specifically:
9911  * - Transactions confirmed in a block must be given before transactions confirmed in a later
9912  *   block.
9913  * - Dependent transactions within the same block must be given in topological order, possibly in
9914  *   separate calls.
9915  * - Unconfirmed transactions must be given after the original confirmations and before any
9916  *   reconfirmation.
9917  *
9918  * See individual method documentation for further details.
9919  *
9920  * [`transactions_confirmed`]: Self::transactions_confirmed
9921  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
9922  * [`best_block_updated`]: Self::best_block_updated
9923  * [`get_relevant_txids`]: Self::get_relevant_txids
9924  */
9925 typedef struct LDKConfirm {
9926    /**
9927     * An opaque pointer which is passed to your function implementations as an argument.
9928     * This has no meaning in the LDK, and can be NULL or any other value.
9929     */
9930    void *this_arg;
9931    /**
9932     * Processes transactions confirmed in a block with a given header and height.
9933     *
9934     * Should be called for any transactions registered by [`Filter::register_tx`] or any
9935     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
9936     * appearing in the same block do not need to be included in the same call; instead, multiple
9937     * calls with additional transactions may be made so long as they are made in [chain order].
9938     *
9939     * May be called before or after [`best_block_updated`] for the corresponding block. However,
9940     * in the event of a chain reorganization, it must not be called with a `header` that is no
9941     * longer in the chain as of the last call to [`best_block_updated`].
9942     *
9943     * [chain order]: Confirm#Order
9944     * [`best_block_updated`]: Self::best_block_updated
9945     */
9946    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
9947    /**
9948     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
9949     *
9950     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
9951     * reorganized out of the best chain. Once called, the given transaction should not be returned
9952     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
9953     *
9954     * [`get_relevant_txids`]: Self::get_relevant_txids
9955     * [`transactions_confirmed`]: Self::transactions_confirmed
9956     */
9957    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
9958    /**
9959     * Processes an update to the best header connected at the given height.
9960     *
9961     * Should be called when a new header is available but may be skipped for intermediary blocks
9962     * if they become available at the same time.
9963     */
9964    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
9965    /**
9966     * Returns transactions that should be monitored for reorganization out of the chain.
9967     *
9968     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
9969     * confirmations to be safe from a chain reorganization. Should not include any transactions
9970     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
9971     *
9972     * May be called to determine the subset of transactions that must still be monitored for
9973     * reorganization. Will be idempotent between calls but may change as a result of calls to the
9974     * other interface methods. Thus, this is useful to determine which transactions may need to be
9975     * given to [`transaction_unconfirmed`].
9976     *
9977     * [`transactions_confirmed`]: Self::transactions_confirmed
9978     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
9979     */
9980    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
9981    /**
9982     * Frees any resources associated with this object given its this_arg pointer.
9983     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9984     */
9985    void (*free)(void *this_arg);
9986 } LDKConfirm;
9987
9988
9989
9990 /**
9991  * An opaque identifier describing a specific [`Persist`] method call.
9992  */
9993 typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
9994    /**
9995     * A pointer to the opaque Rust object.
9996     * Nearly everywhere, inner must be non-null, however in places where
9997     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9998     */
9999    LDKnativeMonitorUpdateId *inner;
10000    /**
10001     * Indicates that this is the only struct which contains the same pointer.
10002     * Rust functions which take ownership of an object provided via an argument require
10003     * this to be true and invalidate the object pointed to by inner.
10004     */
10005    bool is_owned;
10006 } LDKMonitorUpdateId;
10007
10008 /**
10009  * `Persist` defines behavior for persisting channel monitors: this could mean
10010  * writing once to disk, and/or uploading to one or more backup services.
10011  *
10012  * Each method can return three possible values:
10013  *  * If persistence (including any relevant `fsync()` calls) happens immediately, the
10014  *    implementation should return `Ok(())`, indicating normal channel operation should continue.
10015  *  * If persistence happens asynchronously, implementations should first ensure the
10016  *    [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return
10017  *    `Err(ChannelMonitorUpdateErr::TemporaryFailure)` while the update continues in the
10018  *    background. Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be
10019  *    called with the corresponding [`MonitorUpdateId`].
10020  *
10021  *    Note that unlike the direct [`chain::Watch`] interface,
10022  *    [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
10023  *
10024  *  * If persistence fails for some reason, implementations should return
10025  *    `Err(ChannelMonitorUpdateErr::PermanentFailure)`, in which case the channel will likely be
10026  *    closed without broadcasting the latest state. See
10027  *    [`ChannelMonitorUpdateErr::PermanentFailure`] for more details.
10028  */
10029 typedef struct LDKPersist {
10030    /**
10031     * An opaque pointer which is passed to your function implementations as an argument.
10032     * This has no meaning in the LDK, and can be NULL or any other value.
10033     */
10034    void *this_arg;
10035    /**
10036     * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
10037     * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
10038     *
10039     * The data can be stored any way you want, but the identifier provided by LDK is the
10040     * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
10041     * and the stored channel data). Note that you **must** persist every new monitor to disk.
10042     *
10043     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
10044     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
10045     *
10046     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
10047     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
10048     *
10049     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
10050     * [`Writeable::write`]: crate::util::ser::Writeable::write
10051     */
10052    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
10053    /**
10054     * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
10055     * update.
10056     *
10057     * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
10058     * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
10059     * details.
10060     *
10061     * During blockchain synchronization operations, this may be called with no
10062     * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
10063     * Note that after the full [`ChannelMonitor`] is persisted any previous
10064     * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
10065     * applied to the persisted [`ChannelMonitor`] as they were already applied.
10066     *
10067     * If an implementer chooses to persist the updates only, they need to make
10068     * sure that all the updates are applied to the `ChannelMonitors` *before*
10069     * the set of channel monitors is given to the `ChannelManager`
10070     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
10071     * applying a monitor update to a monitor. If full `ChannelMonitors` are
10072     * persisted, then there is no need to persist individual updates.
10073     *
10074     * Note that there could be a performance tradeoff between persisting complete
10075     * channel monitors on every update vs. persisting only updates and applying
10076     * them in batches. The size of each monitor grows `O(number of state updates)`
10077     * whereas updates are small and `O(1)`.
10078     *
10079     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
10080     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
10081     *
10082     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
10083     * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
10084     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
10085     *
10086     * [`Writeable::write`]: crate::util::ser::Writeable::write
10087     *
10088     * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
10089     */
10090    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);
10091    /**
10092     * Frees any resources associated with this object given its this_arg pointer.
10093     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10094     */
10095    void (*free)(void *this_arg);
10096 } LDKPersist;
10097
10098
10099
10100 /**
10101  * An implementation of [`chain::Watch`] for monitoring channels.
10102  *
10103  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
10104  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
10105  * or used independently to monitor channels remotely. See the [module-level documentation] for
10106  * details.
10107  *
10108  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
10109  * [module-level documentation]: crate::chain::chainmonitor
10110  */
10111 typedef struct MUST_USE_STRUCT LDKChainMonitor {
10112    /**
10113     * A pointer to the opaque Rust object.
10114     * Nearly everywhere, inner must be non-null, however in places where
10115     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10116     */
10117    LDKnativeChainMonitor *inner;
10118    /**
10119     * Indicates that this is the only struct which contains the same pointer.
10120     * Rust functions which take ownership of an object provided via an argument require
10121     * this to be true and invalidate the object pointed to by inner.
10122     */
10123    bool is_owned;
10124 } LDKChainMonitor;
10125
10126
10127
10128 /**
10129  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
10130  * and derives keys from that.
10131  *
10132  * Your node_id is seed/0'
10133  * ChannelMonitor closes may use seed/1'
10134  * Cooperative closes may use seed/2'
10135  * The two close keys may be needed to claim on-chain funds!
10136  */
10137 typedef struct MUST_USE_STRUCT LDKKeysManager {
10138    /**
10139     * A pointer to the opaque Rust object.
10140     * Nearly everywhere, inner must be non-null, however in places where
10141     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10142     */
10143    LDKnativeKeysManager *inner;
10144    /**
10145     * Indicates that this is the only struct which contains the same pointer.
10146     * Rust functions which take ownership of an object provided via an argument require
10147     * this to be true and invalidate the object pointed to by inner.
10148     */
10149    bool is_owned;
10150 } LDKKeysManager;
10151
10152
10153
10154 /**
10155  * Chain-related parameters used to construct a new `ChannelManager`.
10156  *
10157  * Typically, the block-specific parameters are derived from the best block hash for the network,
10158  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
10159  * are not needed when deserializing a previously constructed `ChannelManager`.
10160  */
10161 typedef struct MUST_USE_STRUCT LDKChainParameters {
10162    /**
10163     * A pointer to the opaque Rust object.
10164     * Nearly everywhere, inner must be non-null, however in places where
10165     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10166     */
10167    LDKnativeChainParameters *inner;
10168    /**
10169     * Indicates that this is the only struct which contains the same pointer.
10170     * Rust functions which take ownership of an object provided via an argument require
10171     * this to be true and invalidate the object pointed to by inner.
10172     */
10173    bool is_owned;
10174 } LDKChainParameters;
10175
10176
10177
10178 /**
10179  * Information needed for constructing an invoice route hint for this channel.
10180  */
10181 typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
10182    /**
10183     * A pointer to the opaque Rust object.
10184     * Nearly everywhere, inner must be non-null, however in places where
10185     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10186     */
10187    LDKnativeCounterpartyForwardingInfo *inner;
10188    /**
10189     * Indicates that this is the only struct which contains the same pointer.
10190     * Rust functions which take ownership of an object provided via an argument require
10191     * this to be true and invalidate the object pointed to by inner.
10192     */
10193    bool is_owned;
10194 } LDKCounterpartyForwardingInfo;
10195
10196
10197
10198 /**
10199  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
10200  * to better separate parameters.
10201  */
10202 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
10203    /**
10204     * A pointer to the opaque Rust object.
10205     * Nearly everywhere, inner must be non-null, however in places where
10206     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10207     */
10208    LDKnativeChannelCounterparty *inner;
10209    /**
10210     * Indicates that this is the only struct which contains the same pointer.
10211     * Rust functions which take ownership of an object provided via an argument require
10212     * this to be true and invalidate the object pointed to by inner.
10213     */
10214    bool is_owned;
10215 } LDKChannelCounterparty;
10216
10217 /**
10218  * A 3-byte byte array.
10219  */
10220 typedef struct LDKThreeBytes {
10221    /**
10222     * The three bytes
10223     */
10224    uint8_t data[3];
10225 } LDKThreeBytes;
10226
10227 /**
10228  * A trait to describe an object which can receive channel messages.
10229  *
10230  * Messages MAY be called in parallel when they originate from different their_node_ids, however
10231  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
10232  */
10233 typedef struct LDKChannelMessageHandler {
10234    /**
10235     * An opaque pointer which is passed to your function implementations as an argument.
10236     * This has no meaning in the LDK, and can be NULL or any other value.
10237     */
10238    void *this_arg;
10239    /**
10240     * Handle an incoming open_channel message from the given peer.
10241     */
10242    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
10243    /**
10244     * Handle an incoming accept_channel message from the given peer.
10245     */
10246    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
10247    /**
10248     * Handle an incoming funding_created message from the given peer.
10249     */
10250    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
10251    /**
10252     * Handle an incoming funding_signed message from the given peer.
10253     */
10254    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
10255    /**
10256     * Handle an incoming funding_locked message from the given peer.
10257     */
10258    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
10259    /**
10260     * Handle an incoming shutdown message from the given peer.
10261     */
10262    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);
10263    /**
10264     * Handle an incoming closing_signed message from the given peer.
10265     */
10266    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
10267    /**
10268     * Handle an incoming update_add_htlc message from the given peer.
10269     */
10270    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
10271    /**
10272     * Handle an incoming update_fulfill_htlc message from the given peer.
10273     */
10274    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
10275    /**
10276     * Handle an incoming update_fail_htlc message from the given peer.
10277     */
10278    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
10279    /**
10280     * Handle an incoming update_fail_malformed_htlc message from the given peer.
10281     */
10282    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
10283    /**
10284     * Handle an incoming commitment_signed message from the given peer.
10285     */
10286    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
10287    /**
10288     * Handle an incoming revoke_and_ack message from the given peer.
10289     */
10290    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
10291    /**
10292     * Handle an incoming update_fee message from the given peer.
10293     */
10294    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
10295    /**
10296     * Handle an incoming announcement_signatures message from the given peer.
10297     */
10298    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
10299    /**
10300     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
10301     * is believed to be possible in the future (eg they're sending us messages we don't
10302     * understand or indicate they require unknown feature bits), no_connection_possible is set
10303     * and any outstanding channels should be failed.
10304     */
10305    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
10306    /**
10307     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
10308     */
10309    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
10310    /**
10311     * Handle an incoming channel_reestablish message from the given peer.
10312     */
10313    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
10314    /**
10315     * Handle an incoming channel update from the given peer.
10316     */
10317    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
10318    /**
10319     * Handle an incoming error message from the given peer.
10320     */
10321    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
10322    /**
10323     * Implementation of MessageSendEventsProvider for this object.
10324     */
10325    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
10326    /**
10327     * Frees any resources associated with this object given its this_arg pointer.
10328     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10329     */
10330    void (*free)(void *this_arg);
10331 } LDKChannelMessageHandler;
10332
10333
10334
10335 /**
10336  * Arguments for the creation of a ChannelManager that are not deserialized.
10337  *
10338  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
10339  * is:
10340  * 1) Deserialize all stored [`ChannelMonitor`]s.
10341  * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
10342  *    `<(BlockHash, ChannelManager)>::read(reader, args)`
10343  *    This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
10344  *    [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
10345  * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
10346  *    same way you would handle a [`chain::Filter`] call using
10347  *    [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
10348  * 4) Reconnect blocks on your [`ChannelMonitor`]s.
10349  * 5) Disconnect/connect blocks on the [`ChannelManager`].
10350  * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
10351  *    Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
10352  *    will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
10353  *    the next step.
10354  * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
10355  *    [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
10356  *
10357  * Note that the ordering of #4-7 is not of importance, however all four must occur before you
10358  * call any other methods on the newly-deserialized [`ChannelManager`].
10359  *
10360  * Note that because some channels may be closed during deserialization, it is critical that you
10361  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
10362  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
10363  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
10364  * not force-close the same channels but consider them live), you may end up revoking a state for
10365  * which you've already broadcasted the transaction.
10366  *
10367  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
10368  */
10369 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
10370    /**
10371     * A pointer to the opaque Rust object.
10372     * Nearly everywhere, inner must be non-null, however in places where
10373     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10374     */
10375    LDKnativeChannelManagerReadArgs *inner;
10376    /**
10377     * Indicates that this is the only struct which contains the same pointer.
10378     * Rust functions which take ownership of an object provided via an argument require
10379     * this to be true and invalidate the object pointed to by inner.
10380     */
10381    bool is_owned;
10382 } LDKChannelManagerReadArgs;
10383
10384
10385
10386 /**
10387  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
10388  * This is used to convince the recipient that the channel is at a certain commitment
10389  * number even if they lost that data due to a local failure.  Of course, the peer may lie
10390  * and even later commitments may have been revoked.
10391  */
10392 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
10393    /**
10394     * A pointer to the opaque Rust object.
10395     * Nearly everywhere, inner must be non-null, however in places where
10396     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10397     */
10398    LDKnativeDataLossProtect *inner;
10399    /**
10400     * Indicates that this is the only struct which contains the same pointer.
10401     * Rust functions which take ownership of an object provided via an argument require
10402     * this to be true and invalidate the object pointed to by inner.
10403     */
10404    bool is_owned;
10405 } LDKDataLossProtect;
10406
10407 /**
10408  * A trait to describe an object which can receive routing messages.
10409  *
10410  * # Implementor DoS Warnings
10411  *
10412  * For `gossip_queries` messages there are potential DoS vectors when handling
10413  * inbound queries. Implementors using an on-disk network graph should be aware of
10414  * repeated disk I/O for queries accessing different parts of the network graph.
10415  */
10416 typedef struct LDKRoutingMessageHandler {
10417    /**
10418     * An opaque pointer which is passed to your function implementations as an argument.
10419     * This has no meaning in the LDK, and can be NULL or any other value.
10420     */
10421    void *this_arg;
10422    /**
10423     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
10424     * false or returning an Err otherwise.
10425     */
10426    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
10427    /**
10428     * Handle a channel_announcement message, returning true if it should be forwarded on, false
10429     * or returning an Err otherwise.
10430     */
10431    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
10432    /**
10433     * Handle an incoming channel_update message, returning true if it should be forwarded on,
10434     * false or returning an Err otherwise.
10435     */
10436    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
10437    /**
10438     * Gets a subset of the channel announcements and updates required to dump our routing table
10439     * to a remote node, starting at the short_channel_id indicated by starting_point and
10440     * including the batch_amount entries immediately higher in numerical value than starting_point.
10441     */
10442    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
10443    /**
10444     * Gets a subset of the node announcements required to dump our routing table to a remote node,
10445     * starting at the node *after* the provided publickey and including batch_amount entries
10446     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
10447     * If None is provided for starting_point, we start at the first node.
10448     *
10449     * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
10450     */
10451    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
10452    /**
10453     * Called when a connection is established with a peer. This can be used to
10454     * perform routing table synchronization using a strategy defined by the
10455     * implementor.
10456     */
10457    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
10458    /**
10459     * Handles the reply of a query we initiated to learn about channels
10460     * for a given range of blocks. We can expect to receive one or more
10461     * replies to a single query.
10462     */
10463    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
10464    /**
10465     * Handles the reply of a query we initiated asking for routing gossip
10466     * messages for a list of channels. We should receive this message when
10467     * a node has completed its best effort to send us the pertaining routing
10468     * gossip messages.
10469     */
10470    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
10471    /**
10472     * Handles when a peer asks us to send a list of short_channel_ids
10473     * for the requested range of blocks.
10474     */
10475    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
10476    /**
10477     * Handles when a peer asks us to send routing gossip messages for a
10478     * list of short_channel_ids.
10479     */
10480    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
10481    /**
10482     * Implementation of MessageSendEventsProvider for this object.
10483     */
10484    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
10485    /**
10486     * Frees any resources associated with this object given its this_arg pointer.
10487     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10488     */
10489    void (*free)(void *this_arg);
10490 } LDKRoutingMessageHandler;
10491
10492 /**
10493  * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
10494  * decoders.
10495  */
10496 typedef struct LDKCustomMessageReader {
10497    /**
10498     * An opaque pointer which is passed to your function implementations as an argument.
10499     * This has no meaning in the LDK, and can be NULL or any other value.
10500     */
10501    void *this_arg;
10502    /**
10503     * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
10504     * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
10505     * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
10506     * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
10507     */
10508    struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer);
10509    /**
10510     * Frees any resources associated with this object given its this_arg pointer.
10511     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10512     */
10513    void (*free)(void *this_arg);
10514 } LDKCustomMessageReader;
10515
10516 /**
10517  * Handler for BOLT1-compliant messages.
10518  */
10519 typedef struct LDKCustomMessageHandler {
10520    /**
10521     * An opaque pointer which is passed to your function implementations as an argument.
10522     * This has no meaning in the LDK, and can be NULL or any other value.
10523     */
10524    void *this_arg;
10525    /**
10526     * Called with the message type that was received and the buffer to be read.
10527     * Can return a `MessageHandlingError` if the message could not be handled.
10528     */
10529    struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id);
10530    /**
10531     * Gets the list of pending messages which were generated by the custom message
10532     * handler, clearing the list in the process. The first tuple element must
10533     * correspond to the intended recipients node ids. If no connection to one of the
10534     * specified node does not exist, the message is simply not sent to it.
10535     */
10536    struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg);
10537    /**
10538     * Implementation of CustomMessageReader for this object.
10539     */
10540    struct LDKCustomMessageReader CustomMessageReader;
10541    /**
10542     * Frees any resources associated with this object given its this_arg pointer.
10543     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10544     */
10545    void (*free)(void *this_arg);
10546 } LDKCustomMessageHandler;
10547
10548
10549
10550 /**
10551  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
10552  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
10553  */
10554 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
10555    /**
10556     * A pointer to the opaque Rust object.
10557     * Nearly everywhere, inner must be non-null, however in places where
10558     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10559     */
10560    LDKnativeIgnoringMessageHandler *inner;
10561    /**
10562     * Indicates that this is the only struct which contains the same pointer.
10563     * Rust functions which take ownership of an object provided via an argument require
10564     * this to be true and invalidate the object pointed to by inner.
10565     */
10566    bool is_owned;
10567 } LDKIgnoringMessageHandler;
10568
10569
10570
10571 /**
10572  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
10573  * You can provide one of these as the route_handler in a MessageHandler.
10574  */
10575 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
10576    /**
10577     * A pointer to the opaque Rust object.
10578     * Nearly everywhere, inner must be non-null, however in places where
10579     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10580     */
10581    LDKnativeErroringMessageHandler *inner;
10582    /**
10583     * Indicates that this is the only struct which contains the same pointer.
10584     * Rust functions which take ownership of an object provided via an argument require
10585     * this to be true and invalidate the object pointed to by inner.
10586     */
10587    bool is_owned;
10588 } LDKErroringMessageHandler;
10589
10590
10591
10592 /**
10593  * Provides references to trait impls which handle different types of messages.
10594  */
10595 typedef struct MUST_USE_STRUCT LDKMessageHandler {
10596    /**
10597     * A pointer to the opaque Rust object.
10598     * Nearly everywhere, inner must be non-null, however in places where
10599     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10600     */
10601    LDKnativeMessageHandler *inner;
10602    /**
10603     * Indicates that this is the only struct which contains the same pointer.
10604     * Rust functions which take ownership of an object provided via an argument require
10605     * this to be true and invalidate the object pointed to by inner.
10606     */
10607    bool is_owned;
10608 } LDKMessageHandler;
10609
10610 /**
10611  * Provides an object which can be used to send data to and which uniquely identifies a connection
10612  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
10613  * implement Hash to meet the PeerManager API.
10614  *
10615  * For efficiency, Clone should be relatively cheap for this type.
10616  *
10617  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
10618  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
10619  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
10620  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
10621  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
10622  * to simply use another value which is guaranteed to be globally unique instead.
10623  */
10624 typedef struct LDKSocketDescriptor {
10625    /**
10626     * An opaque pointer which is passed to your function implementations as an argument.
10627     * This has no meaning in the LDK, and can be NULL or any other value.
10628     */
10629    void *this_arg;
10630    /**
10631     * Attempts to send some data from the given slice to the peer.
10632     *
10633     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
10634     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
10635     * called and further write attempts may occur until that time.
10636     *
10637     * If the returned size is smaller than `data.len()`, a
10638     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
10639     * written. Additionally, until a `send_data` event completes fully, no further
10640     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
10641     * prevent denial-of-service issues, you should not read or buffer any data from the socket
10642     * until then.
10643     *
10644     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
10645     * (indicating that read events should be paused to prevent DoS in the send buffer),
10646     * `resume_read` may be set indicating that read events on this descriptor should resume. A
10647     * `resume_read` of false carries no meaning, and should not cause any action.
10648     */
10649    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
10650    /**
10651     * Disconnect the socket pointed to by this SocketDescriptor.
10652     *
10653     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
10654     * call (doing so is a noop).
10655     */
10656    void (*disconnect_socket)(void *this_arg);
10657    /**
10658     * Checks if two objects are equal given this object's this_arg pointer and another object.
10659     */
10660    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
10661    /**
10662     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
10663     * This is used, for example, for inclusion of this object in a hash map.
10664     */
10665    uint64_t (*hash)(const void *this_arg);
10666    /**
10667     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
10668     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
10669     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
10670     */
10671    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
10672    /**
10673     * Frees any resources associated with this object given its this_arg pointer.
10674     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10675     */
10676    void (*free)(void *this_arg);
10677 } LDKSocketDescriptor;
10678
10679
10680
10681 /**
10682  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
10683  * socket events into messages which it passes on to its [`MessageHandler`].
10684  *
10685  * Locks are taken internally, so you must never assume that reentrancy from a
10686  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
10687  *
10688  * Calls to [`read_event`] will decode relevant messages and pass them to the
10689  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
10690  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
10691  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
10692  * calls only after previous ones have returned.
10693  *
10694  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
10695  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
10696  * essentially you should default to using a SimpleRefPeerManager, and use a
10697  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
10698  * you're using lightning-net-tokio.
10699  *
10700  * [`read_event`]: PeerManager::read_event
10701  */
10702 typedef struct MUST_USE_STRUCT LDKPeerManager {
10703    /**
10704     * A pointer to the opaque Rust object.
10705     * Nearly everywhere, inner must be non-null, however in places where
10706     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10707     */
10708    LDKnativePeerManager *inner;
10709    /**
10710     * Indicates that this is the only struct which contains the same pointer.
10711     * Rust functions which take ownership of an object provided via an argument require
10712     * this to be true and invalidate the object pointed to by inner.
10713     */
10714    bool is_owned;
10715 } LDKPeerManager;
10716
10717
10718
10719 /**
10720  * Static channel fields used to build transactions given per-commitment fields, organized by
10721  * broadcaster/countersignatory.
10722  *
10723  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
10724  * as_holder_broadcastable and as_counterparty_broadcastable functions.
10725  */
10726 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
10727    /**
10728     * A pointer to the opaque Rust object.
10729     * Nearly everywhere, inner must be non-null, however in places where
10730     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10731     */
10732    LDKnativeDirectedChannelTransactionParameters *inner;
10733    /**
10734     * Indicates that this is the only struct which contains the same pointer.
10735     * Rust functions which take ownership of an object provided via an argument require
10736     * this to be true and invalidate the object pointed to by inner.
10737     */
10738    bool is_owned;
10739 } LDKDirectedChannelTransactionParameters;
10740
10741 /**
10742  * An interface used to score payment channels for path finding.
10743  *
10744  *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
10745  */
10746 typedef struct LDKScore {
10747    /**
10748     * An opaque pointer which is passed to your function implementations as an argument.
10749     * This has no meaning in the LDK, and can be NULL or any other value.
10750     */
10751    void *this_arg;
10752    /**
10753     * Returns the fee in msats willing to be paid to avoid routing through the given channel
10754     * in the direction from `source` to `target`.
10755     */
10756    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);
10757    /**
10758     * Handles updating channel penalties after failing to route through a channel.
10759     */
10760    void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
10761    /**
10762     * Serialize the object into a byte array
10763     */
10764    struct LDKCVec_u8Z (*write)(const void *this_arg);
10765    /**
10766     * Frees any resources associated with this object given its this_arg pointer.
10767     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10768     */
10769    void (*free)(void *this_arg);
10770 } LDKScore;
10771
10772
10773
10774 /**
10775  * A scorer that is accessed under a lock.
10776  *
10777  * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while
10778  * having shared ownership of a scorer but without requiring internal locking in [`Score`]
10779  * implementations. Internal locking would be detrimental to route finding performance and could
10780  * result in [`Score::channel_penalty_msat`] returning a different value for the same channel.
10781  *
10782  * [`find_route`]: crate::routing::router::find_route
10783  */
10784 typedef struct MUST_USE_STRUCT LDKLockableScore {
10785    /**
10786     * A pointer to the opaque Rust object.
10787     * Nearly everywhere, inner must be non-null, however in places where
10788     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10789     */
10790    LDKnativeLockableScore *inner;
10791    /**
10792     * Indicates that this is the only struct which contains the same pointer.
10793     * Rust functions which take ownership of an object provided via an argument require
10794     * this to be true and invalidate the object pointed to by inner.
10795     */
10796    bool is_owned;
10797 } LDKLockableScore;
10798
10799
10800
10801 /**
10802  * A read-only view of [`NetworkGraph`].
10803  */
10804 typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
10805    /**
10806     * A pointer to the opaque Rust object.
10807     * Nearly everywhere, inner must be non-null, however in places where
10808     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10809     */
10810    LDKnativeReadOnlyNetworkGraph *inner;
10811    /**
10812     * Indicates that this is the only struct which contains the same pointer.
10813     * Rust functions which take ownership of an object provided via an argument require
10814     * this to be true and invalidate the object pointed to by inner.
10815     */
10816    bool is_owned;
10817 } LDKReadOnlyNetworkGraph;
10818
10819
10820
10821 /**
10822  * Receives and validates network updates from peers,
10823  * stores authentic and relevant data as a network graph.
10824  * This network graph is then used for routing payments.
10825  * Provides interface to help with initial routing sync by
10826  * serving historical announcements.
10827  *
10828  * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
10829  * [`NetworkGraph`].
10830  */
10831 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
10832    /**
10833     * A pointer to the opaque Rust object.
10834     * Nearly everywhere, inner must be non-null, however in places where
10835     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10836     */
10837    LDKnativeNetGraphMsgHandler *inner;
10838    /**
10839     * Indicates that this is the only struct which contains the same pointer.
10840     * Rust functions which take ownership of an object provided via an argument require
10841     * this to be true and invalidate the object pointed to by inner.
10842     */
10843    bool is_owned;
10844 } LDKNetGraphMsgHandler;
10845
10846
10847
10848 /**
10849  * FilesystemPersister persists channel data on disk, where each channel's
10850  * data is stored in a file named after its funding outpoint.
10851  *
10852  * Warning: this module does the best it can with calls to persist data, but it
10853  * can only guarantee that the data is passed to the drive. It is up to the
10854  * drive manufacturers to do the actual persistence properly, which they often
10855  * don't (especially on consumer-grade hardware). Therefore, it is up to the
10856  * user to validate their entire storage stack, to ensure the writes are
10857  * persistent.
10858  * Corollary: especially when dealing with larger amounts of money, it is best
10859  * practice to have multiple channel data backups and not rely only on one
10860  * FilesystemPersister.
10861  */
10862 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
10863    /**
10864     * A pointer to the opaque Rust object.
10865     * Nearly everywhere, inner must be non-null, however in places where
10866     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10867     */
10868    LDKnativeFilesystemPersister *inner;
10869    /**
10870     * Indicates that this is the only struct which contains the same pointer.
10871     * Rust functions which take ownership of an object provided via an argument require
10872     * this to be true and invalidate the object pointed to by inner.
10873     */
10874    bool is_owned;
10875 } LDKFilesystemPersister;
10876
10877
10878
10879 /**
10880  * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
10881  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
10882  * responsibilities are:
10883  * * Processing [`Event`]s with a user-provided [`EventHandler`].
10884  * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
10885  *   writing it to disk/backups by invoking the callback given to it at startup.
10886  *   [`ChannelManager`] persistence should be done in the background.
10887  * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
10888  *   at the appropriate intervals.
10889  *
10890  * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
10891  * upon as doing so may result in high latency.
10892  *
10893  * # Note
10894  *
10895  * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
10896  * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
10897  * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
10898  * unilateral chain closure fees are at risk.
10899  *
10900  * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
10901  * [`Event`]: lightning::util::events::Event
10902  *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
10903  */
10904 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
10905    /**
10906     * A pointer to the opaque Rust object.
10907     * Nearly everywhere, inner must be non-null, however in places where
10908     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10909     */
10910    LDKnativeBackgroundProcessor *inner;
10911    /**
10912     * Indicates that this is the only struct which contains the same pointer.
10913     * Rust functions which take ownership of an object provided via an argument require
10914     * this to be true and invalidate the object pointed to by inner.
10915     */
10916    bool is_owned;
10917 } LDKBackgroundProcessor;
10918
10919 /**
10920  * Trait which handles persisting a [`ChannelManager`] to disk.
10921  *
10922  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
10923  */
10924 typedef struct LDKChannelManagerPersister {
10925    /**
10926     * An opaque pointer which is passed to your function implementations as an argument.
10927     * This has no meaning in the LDK, and can be NULL or any other value.
10928     */
10929    void *this_arg;
10930    /**
10931     * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed
10932     * (which will cause the [`BackgroundProcessor`] which called this method to exit.
10933     *
10934     * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
10935     */
10936    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
10937    /**
10938     * Frees any resources associated with this object given its this_arg pointer.
10939     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10940     */
10941    void (*free)(void *this_arg);
10942 } LDKChannelManagerPersister;
10943
10944
10945
10946 /**
10947  * Data of the `RawInvoice` that is encoded in the data part
10948  */
10949 typedef struct MUST_USE_STRUCT LDKRawDataPart {
10950    /**
10951     * A pointer to the opaque Rust object.
10952     * Nearly everywhere, inner must be non-null, however in places where
10953     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10954     */
10955    LDKnativeRawDataPart *inner;
10956    /**
10957     * Indicates that this is the only struct which contains the same pointer.
10958     * Rust functions which take ownership of an object provided via an argument require
10959     * this to be true and invalidate the object pointed to by inner.
10960     */
10961    bool is_owned;
10962 } LDKRawDataPart;
10963
10964
10965
10966 /**
10967  * SHA-256 hash
10968  */
10969 typedef struct MUST_USE_STRUCT LDKSha256 {
10970    /**
10971     * A pointer to the opaque Rust object.
10972     * Nearly everywhere, inner must be non-null, however in places where
10973     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10974     */
10975    LDKnativeSha256 *inner;
10976    /**
10977     * Indicates that this is the only struct which contains the same pointer.
10978     * Rust functions which take ownership of an object provided via an argument require
10979     * this to be true and invalidate the object pointed to by inner.
10980     */
10981    bool is_owned;
10982 } LDKSha256;
10983
10984
10985
10986 /**
10987  * `min_final_cltv_expiry` to use for the last HTLC in the route
10988  */
10989 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
10990    /**
10991     * A pointer to the opaque Rust object.
10992     * Nearly everywhere, inner must be non-null, however in places where
10993     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10994     */
10995    LDKnativeMinFinalCltvExpiry *inner;
10996    /**
10997     * Indicates that this is the only struct which contains the same pointer.
10998     * Rust functions which take ownership of an object provided via an argument require
10999     * this to be true and invalidate the object pointed to by inner.
11000     */
11001    bool is_owned;
11002 } LDKMinFinalCltvExpiry;
11003
11004 /**
11005  * Integer in the range `0..32`
11006  */
11007 typedef struct LDKu5 {
11008    uint8_t _0;
11009 } LDKu5;
11010
11011 /**
11012  * A 20-byte byte array.
11013  */
11014 typedef struct LDKTwentyBytes {
11015    /**
11016     * The twenty bytes
11017     */
11018    uint8_t data[20];
11019 } LDKTwentyBytes;
11020
11021 /**
11022  * Fallback address in case no LN payment is possible
11023  */
11024 typedef enum LDKFallback_Tag {
11025    LDKFallback_SegWitProgram,
11026    LDKFallback_PubKeyHash,
11027    LDKFallback_ScriptHash,
11028    /**
11029     * Must be last for serialization purposes
11030     */
11031    LDKFallback_Sentinel,
11032 } LDKFallback_Tag;
11033
11034 typedef struct LDKFallback_LDKSegWitProgram_Body {
11035    struct LDKu5 version;
11036    struct LDKCVec_u8Z program;
11037 } LDKFallback_LDKSegWitProgram_Body;
11038
11039 typedef struct MUST_USE_STRUCT LDKFallback {
11040    LDKFallback_Tag tag;
11041    union {
11042       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
11043       struct {
11044          struct LDKTwentyBytes pub_key_hash;
11045       };
11046       struct {
11047          struct LDKTwentyBytes script_hash;
11048       };
11049    };
11050 } LDKFallback;
11051
11052 /**
11053  * A trait defining behavior of an [`Invoice`] payer.
11054  */
11055 typedef struct LDKPayer {
11056    /**
11057     * An opaque pointer which is passed to your function implementations as an argument.
11058     * This has no meaning in the LDK, and can be NULL or any other value.
11059     */
11060    void *this_arg;
11061    /**
11062     * Returns the payer's node id.
11063     */
11064    struct LDKPublicKey (*node_id)(const void *this_arg);
11065    /**
11066     * Returns the payer's channels.
11067     */
11068    struct LDKCVec_ChannelDetailsZ (*first_hops)(const void *this_arg);
11069    /**
11070     * Sends a payment over the Lightning Network using the given [`Route`].
11071     *
11072     * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
11073     */
11074    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
11075    /**
11076     * Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
11077     */
11078    struct LDKCResult_NonePaymentSendFailureZ (*retry_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
11079    /**
11080     * Frees any resources associated with this object given its this_arg pointer.
11081     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11082     */
11083    void (*free)(void *this_arg);
11084 } LDKPayer;
11085
11086 /**
11087  * A trait defining behavior for routing an [`Invoice`] payment.
11088  */
11089 typedef struct LDKRouter {
11090    /**
11091     * An opaque pointer which is passed to your function implementations as an argument.
11092     * This has no meaning in the LDK, and can be NULL or any other value.
11093     */
11094    void *this_arg;
11095    /**
11096     * Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
11097     *
11098     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
11099     */
11100    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);
11101    /**
11102     * Frees any resources associated with this object given its this_arg pointer.
11103     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11104     */
11105    void (*free)(void *this_arg);
11106 } LDKRouter;
11107
11108
11109
11110 /**
11111  * A utility for paying [`Invoice]`s.
11112  */
11113 typedef struct MUST_USE_STRUCT LDKInvoicePayer {
11114    /**
11115     * A pointer to the opaque Rust object.
11116     * Nearly everywhere, inner must be non-null, however in places where
11117     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11118     */
11119    LDKnativeInvoicePayer *inner;
11120    /**
11121     * Indicates that this is the only struct which contains the same pointer.
11122     * Rust functions which take ownership of an object provided via an argument require
11123     * this to be true and invalidate the object pointed to by inner.
11124     */
11125    bool is_owned;
11126 } LDKInvoicePayer;
11127
11128
11129
11130 /**
11131  * Number of attempts to retry payment path failures for an [`Invoice`].
11132  *
11133  * Note that this is the number of *path* failures, not full payment retries. For multi-path
11134  * payments, if this is less than the total number of paths, we will never even retry all of the
11135  * payment's paths.
11136  */
11137 typedef struct MUST_USE_STRUCT LDKRetryAttempts {
11138    /**
11139     * A pointer to the opaque Rust object.
11140     * Nearly everywhere, inner must be non-null, however in places where
11141     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11142     */
11143    LDKnativeRetryAttempts *inner;
11144    /**
11145     * Indicates that this is the only struct which contains the same pointer.
11146     * Rust functions which take ownership of an object provided via an argument require
11147     * this to be true and invalidate the object pointed to by inner.
11148     */
11149    bool is_owned;
11150 } LDKRetryAttempts;
11151
11152
11153
11154 /**
11155  * A [`Router`] implemented using [`find_route`].
11156  */
11157 typedef struct MUST_USE_STRUCT LDKDefaultRouter {
11158    /**
11159     * A pointer to the opaque Rust object.
11160     * Nearly everywhere, inner must be non-null, however in places where
11161     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11162     */
11163    LDKnativeDefaultRouter *inner;
11164    /**
11165     * Indicates that this is the only struct which contains the same pointer.
11166     * Rust functions which take ownership of an object provided via an argument require
11167     * this to be true and invalidate the object pointed to by inner.
11168     */
11169    bool is_owned;
11170 } LDKDefaultRouter;
11171
11172 extern const uintptr_t MAX_BUF_SIZE;
11173
11174 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
11175
11176 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
11177
11178 extern const uint32_t ANTI_REORG_DELAY;
11179
11180 extern const uint16_t BREAKDOWN_TIMEOUT;
11181
11182 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
11183
11184 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
11185
11186 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
11187
11188 extern const uint64_t DEFAULT_EXPIRY_TIME;
11189
11190 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY;
11191
11192 extern const uint8_t TAG_PAYMENT_HASH;
11193
11194 extern const uint8_t TAG_DESCRIPTION;
11195
11196 extern const uint8_t TAG_PAYEE_PUB_KEY;
11197
11198 extern const uint8_t TAG_DESCRIPTION_HASH;
11199
11200 extern const uint8_t TAG_EXPIRY_TIME;
11201
11202 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
11203
11204 extern const uint8_t TAG_FALLBACK;
11205
11206 extern const uint8_t TAG_PRIVATE_ROUTE;
11207
11208 extern const uint8_t TAG_PAYMENT_SECRET;
11209
11210 extern const uint8_t TAG_FEATURES;
11211
11212 struct LDKStr _ldk_get_compiled_version(void);
11213
11214 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
11215
11216 /**
11217  * Frees the data buffer, if data_is_owned is set and datalen > 0.
11218  */
11219 void Transaction_free(struct LDKTransaction _res);
11220
11221 /**
11222  * Convenience function for constructing a new TxOut
11223  */
11224 struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
11225
11226 /**
11227  * Frees the data pointed to by script_pubkey.
11228  */
11229 void TxOut_free(struct LDKTxOut _res);
11230
11231 /**
11232  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
11233  */
11234 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
11235
11236 /**
11237  * Frees the data buffer, if chars_is_owned is set and len > 0.
11238  */
11239 void Str_free(struct LDKStr _res);
11240
11241 #if defined(LDK_DEBUG_BUILD)
11242 /**
11243  * This function exists for memory safety testing purposes. It should never be used in production
11244  * code
11245  */
11246 const void *__unmangle_inner_ptr(const void *ptr);
11247 #endif
11248
11249 /**
11250  * Creates a new CResult_SecretKeyErrorZ in the success state.
11251  */
11252 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
11253
11254 /**
11255  * Creates a new CResult_SecretKeyErrorZ in the error state.
11256  */
11257 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
11258
11259 /**
11260  * Checks if the given object is currently in the success state
11261  */
11262 bool CResult_SecretKeyErrorZ_is_ok(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR o);
11263
11264 /**
11265  * Frees any resources used by the CResult_SecretKeyErrorZ.
11266  */
11267 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
11268
11269 /**
11270  * Creates a new CResult_PublicKeyErrorZ in the success state.
11271  */
11272 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
11273
11274 /**
11275  * Creates a new CResult_PublicKeyErrorZ in the error state.
11276  */
11277 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
11278
11279 /**
11280  * Checks if the given object is currently in the success state
11281  */
11282 bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o);
11283
11284 /**
11285  * Frees any resources used by the CResult_PublicKeyErrorZ.
11286  */
11287 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
11288
11289 /**
11290  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
11291  * but with all dynamically-allocated buffers duplicated in new buffers.
11292  */
11293 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
11294
11295 /**
11296  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
11297  */
11298 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
11299
11300 /**
11301  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
11302  */
11303 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
11304
11305 /**
11306  * Checks if the given object is currently in the success state
11307  */
11308 bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o);
11309
11310 /**
11311  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
11312  */
11313 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
11314
11315 /**
11316  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
11317  * but with all dynamically-allocated buffers duplicated in new buffers.
11318  */
11319 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
11320
11321 /**
11322  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
11323  */
11324 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
11325
11326 /**
11327  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
11328  */
11329 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
11330
11331 /**
11332  * Checks if the given object is currently in the success state
11333  */
11334 bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o);
11335
11336 /**
11337  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
11338  */
11339 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
11340
11341 /**
11342  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
11343  * but with all dynamically-allocated buffers duplicated in new buffers.
11344  */
11345 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
11346
11347 /**
11348  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
11349  */
11350 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
11351
11352 /**
11353  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
11354  */
11355 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
11356
11357 /**
11358  * Checks if the given object is currently in the success state
11359  */
11360 bool CResult_TxCreationKeysErrorZ_is_ok(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR o);
11361
11362 /**
11363  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
11364  */
11365 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
11366
11367 /**
11368  * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
11369  * but with all dynamically-allocated buffers duplicated in new buffers.
11370  */
11371 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig);
11372
11373 /**
11374  * Constructs a new COption_u32Z containing a u32
11375  */
11376 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
11377
11378 /**
11379  * Constructs a new COption_u32Z containing nothing
11380  */
11381 struct LDKCOption_u32Z COption_u32Z_none(void);
11382
11383 /**
11384  * Frees any resources associated with the u32, if we are in the Some state
11385  */
11386 void COption_u32Z_free(struct LDKCOption_u32Z _res);
11387
11388 /**
11389  * Creates a new COption_u32Z which has the same data as `orig`
11390  * but with all dynamically-allocated buffers duplicated in new buffers.
11391  */
11392 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
11393
11394 /**
11395  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
11396  */
11397 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
11398
11399 /**
11400  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
11401  */
11402 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
11403
11404 /**
11405  * Checks if the given object is currently in the success state
11406  */
11407 bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o);
11408
11409 /**
11410  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
11411  */
11412 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
11413
11414 /**
11415  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
11416  * but with all dynamically-allocated buffers duplicated in new buffers.
11417  */
11418 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
11419
11420 /**
11421  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
11422  */
11423 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
11424
11425 /**
11426  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
11427  */
11428 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
11429
11430 /**
11431  * Checks if the given object is currently in the success state
11432  */
11433 bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
11434
11435 /**
11436  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
11437  */
11438 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
11439
11440 /**
11441  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
11442  * but with all dynamically-allocated buffers duplicated in new buffers.
11443  */
11444 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
11445
11446 /**
11447  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
11448  */
11449 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
11450
11451 /**
11452  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
11453  */
11454 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
11455
11456 /**
11457  * Checks if the given object is currently in the success state
11458  */
11459 bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
11460
11461 /**
11462  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
11463  */
11464 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
11465
11466 /**
11467  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
11468  * but with all dynamically-allocated buffers duplicated in new buffers.
11469  */
11470 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
11471
11472 /**
11473  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11474  */
11475 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
11476
11477 /**
11478  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
11479  */
11480 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
11481
11482 /**
11483  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
11484  */
11485 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
11486
11487 /**
11488  * Checks if the given object is currently in the success state
11489  */
11490 bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
11491
11492 /**
11493  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
11494  */
11495 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
11496
11497 /**
11498  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
11499  * but with all dynamically-allocated buffers duplicated in new buffers.
11500  */
11501 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
11502
11503 /**
11504  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
11505  */
11506 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
11507
11508 /**
11509  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
11510  */
11511 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
11512
11513 /**
11514  * Checks if the given object is currently in the success state
11515  */
11516 bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
11517
11518 /**
11519  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
11520  */
11521 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
11522
11523 /**
11524  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
11525  * but with all dynamically-allocated buffers duplicated in new buffers.
11526  */
11527 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
11528
11529 /**
11530  * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
11531  */
11532 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
11533
11534 /**
11535  * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
11536  */
11537 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
11538
11539 /**
11540  * Checks if the given object is currently in the success state
11541  */
11542 bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o);
11543
11544 /**
11545  * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
11546  */
11547 void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
11548
11549 /**
11550  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
11551  */
11552 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
11553
11554 /**
11555  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
11556  */
11557 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
11558
11559 /**
11560  * Checks if the given object is currently in the success state
11561  */
11562 bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
11563
11564 /**
11565  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
11566  */
11567 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
11568
11569 /**
11570  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
11571  * but with all dynamically-allocated buffers duplicated in new buffers.
11572  */
11573 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
11574
11575 /**
11576  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
11577  */
11578 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
11579
11580 /**
11581  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
11582  */
11583 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
11584
11585 /**
11586  * Checks if the given object is currently in the success state
11587  */
11588 bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o);
11589
11590 /**
11591  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
11592  */
11593 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
11594
11595 /**
11596  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
11597  */
11598 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
11599
11600 /**
11601  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
11602  */
11603 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
11604
11605 /**
11606  * Checks if the given object is currently in the success state
11607  */
11608 bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o);
11609
11610 /**
11611  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
11612  */
11613 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
11614
11615 /**
11616  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
11617  * but with all dynamically-allocated buffers duplicated in new buffers.
11618  */
11619 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
11620
11621 /**
11622  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
11623  */
11624 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
11625
11626 /**
11627  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
11628  */
11629 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
11630
11631 /**
11632  * Checks if the given object is currently in the success state
11633  */
11634 bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o);
11635
11636 /**
11637  * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
11638  */
11639 void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
11640
11641 /**
11642  * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
11643  * but with all dynamically-allocated buffers duplicated in new buffers.
11644  */
11645 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
11646
11647 /**
11648  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
11649  */
11650 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
11651
11652 /**
11653  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
11654  */
11655 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
11656
11657 /**
11658  * Checks if the given object is currently in the success state
11659  */
11660 bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o);
11661
11662 /**
11663  * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
11664  */
11665 void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
11666
11667 /**
11668  * Creates a new CResult_NoneErrorZ in the success state.
11669  */
11670 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
11671
11672 /**
11673  * Creates a new CResult_NoneErrorZ in the error state.
11674  */
11675 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
11676
11677 /**
11678  * Checks if the given object is currently in the success state
11679  */
11680 bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o);
11681
11682 /**
11683  * Frees any resources used by the CResult_NoneErrorZ.
11684  */
11685 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
11686
11687 /**
11688  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
11689  * but with all dynamically-allocated buffers duplicated in new buffers.
11690  */
11691 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
11692
11693 /**
11694  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
11695  */
11696 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
11697
11698 /**
11699  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
11700  */
11701 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
11702
11703 /**
11704  * Checks if the given object is currently in the success state
11705  */
11706 bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o);
11707
11708 /**
11709  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
11710  */
11711 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
11712
11713 /**
11714  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
11715  * but with all dynamically-allocated buffers duplicated in new buffers.
11716  */
11717 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
11718
11719 /**
11720  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11721  */
11722 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
11723
11724 /**
11725  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11726  */
11727 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
11728
11729 /**
11730  * Creates a new CResult_RouteDecodeErrorZ in the success state.
11731  */
11732 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
11733
11734 /**
11735  * Creates a new CResult_RouteDecodeErrorZ in the error state.
11736  */
11737 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
11738
11739 /**
11740  * Checks if the given object is currently in the success state
11741  */
11742 bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o);
11743
11744 /**
11745  * Frees any resources used by the CResult_RouteDecodeErrorZ.
11746  */
11747 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
11748
11749 /**
11750  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
11751  * but with all dynamically-allocated buffers duplicated in new buffers.
11752  */
11753 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
11754
11755 /**
11756  * Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
11757  */
11758 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o);
11759
11760 /**
11761  * Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
11762  */
11763 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e);
11764
11765 /**
11766  * Checks if the given object is currently in the success state
11767  */
11768 bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o);
11769
11770 /**
11771  * Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
11772  */
11773 void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res);
11774
11775 /**
11776  * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
11777  * but with all dynamically-allocated buffers duplicated in new buffers.
11778  */
11779 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig);
11780
11781 /**
11782  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11783  */
11784 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
11785
11786 /**
11787  * Constructs a new COption_u64Z containing a u64
11788  */
11789 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
11790
11791 /**
11792  * Constructs a new COption_u64Z containing nothing
11793  */
11794 struct LDKCOption_u64Z COption_u64Z_none(void);
11795
11796 /**
11797  * Frees any resources associated with the u64, if we are in the Some state
11798  */
11799 void COption_u64Z_free(struct LDKCOption_u64Z _res);
11800
11801 /**
11802  * Creates a new COption_u64Z which has the same data as `orig`
11803  * but with all dynamically-allocated buffers duplicated in new buffers.
11804  */
11805 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
11806
11807 /**
11808  * Creates a new CResult_PayeeDecodeErrorZ in the success state.
11809  */
11810 struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_ok(struct LDKPayee o);
11811
11812 /**
11813  * Creates a new CResult_PayeeDecodeErrorZ in the error state.
11814  */
11815 struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_err(struct LDKDecodeError e);
11816
11817 /**
11818  * Checks if the given object is currently in the success state
11819  */
11820 bool CResult_PayeeDecodeErrorZ_is_ok(const struct LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR o);
11821
11822 /**
11823  * Frees any resources used by the CResult_PayeeDecodeErrorZ.
11824  */
11825 void CResult_PayeeDecodeErrorZ_free(struct LDKCResult_PayeeDecodeErrorZ _res);
11826
11827 /**
11828  * Creates a new CResult_PayeeDecodeErrorZ which has the same data as `orig`
11829  * but with all dynamically-allocated buffers duplicated in new buffers.
11830  */
11831 struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_clone(const struct LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR orig);
11832
11833 /**
11834  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11835  */
11836 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
11837
11838 /**
11839  * Creates a new CResult_RouteHintDecodeErrorZ in the success state.
11840  */
11841 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o);
11842
11843 /**
11844  * Creates a new CResult_RouteHintDecodeErrorZ in the error state.
11845  */
11846 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e);
11847
11848 /**
11849  * Checks if the given object is currently in the success state
11850  */
11851 bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o);
11852
11853 /**
11854  * Frees any resources used by the CResult_RouteHintDecodeErrorZ.
11855  */
11856 void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res);
11857
11858 /**
11859  * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
11860  * but with all dynamically-allocated buffers duplicated in new buffers.
11861  */
11862 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig);
11863
11864 /**
11865  * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
11866  */
11867 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o);
11868
11869 /**
11870  * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
11871  */
11872 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e);
11873
11874 /**
11875  * Checks if the given object is currently in the success state
11876  */
11877 bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o);
11878
11879 /**
11880  * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
11881  */
11882 void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res);
11883
11884 /**
11885  * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
11886  * but with all dynamically-allocated buffers duplicated in new buffers.
11887  */
11888 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
11889
11890 /**
11891  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11892  */
11893 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
11894
11895 /**
11896  * Creates a new CResult_RouteLightningErrorZ in the success state.
11897  */
11898 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
11899
11900 /**
11901  * Creates a new CResult_RouteLightningErrorZ in the error state.
11902  */
11903 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
11904
11905 /**
11906  * Checks if the given object is currently in the success state
11907  */
11908 bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o);
11909
11910 /**
11911  * Frees any resources used by the CResult_RouteLightningErrorZ.
11912  */
11913 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
11914
11915 /**
11916  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
11917  * but with all dynamically-allocated buffers duplicated in new buffers.
11918  */
11919 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
11920
11921 /**
11922  * Creates a new CResult_TxOutAccessErrorZ in the success state.
11923  */
11924 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
11925
11926 /**
11927  * Creates a new CResult_TxOutAccessErrorZ in the error state.
11928  */
11929 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
11930
11931 /**
11932  * Checks if the given object is currently in the success state
11933  */
11934 bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o);
11935
11936 /**
11937  * Frees any resources used by the CResult_TxOutAccessErrorZ.
11938  */
11939 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
11940
11941 /**
11942  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
11943  * but with all dynamically-allocated buffers duplicated in new buffers.
11944  */
11945 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
11946
11947 /**
11948  * Creates a new tuple which has the same data as `orig`
11949  * but with all dynamically-allocated buffers duplicated in new buffers.
11950  */
11951 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
11952
11953 /**
11954  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
11955  */
11956 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
11957
11958 /**
11959  * Frees any resources used by the C2Tuple_usizeTransactionZ.
11960  */
11961 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
11962
11963 /**
11964  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11965  */
11966 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
11967
11968 /**
11969  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11970  */
11971 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
11972
11973 /**
11974  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
11975  */
11976 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
11977
11978 /**
11979  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
11980  */
11981 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
11982
11983 /**
11984  * Checks if the given object is currently in the success state
11985  */
11986 bool CResult_NoneChannelMonitorUpdateErrZ_is_ok(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR o);
11987
11988 /**
11989  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
11990  */
11991 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
11992
11993 /**
11994  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
11995  * but with all dynamically-allocated buffers duplicated in new buffers.
11996  */
11997 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
11998
11999 /**
12000  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12001  */
12002 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
12003
12004 /**
12005  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
12006  */
12007 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
12008
12009 /**
12010  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
12011  */
12012 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
12013
12014 /**
12015  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
12016  */
12017 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
12018
12019 /**
12020  * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
12021  * but with all dynamically-allocated buffers duplicated in new buffers.
12022  */
12023 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
12024
12025 /**
12026  * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
12027  */
12028 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o);
12029
12030 /**
12031  * Constructs a new COption_ClosureReasonZ containing nothing
12032  */
12033 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void);
12034
12035 /**
12036  * Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
12037  */
12038 void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res);
12039
12040 /**
12041  * Creates a new COption_ClosureReasonZ which has the same data as `orig`
12042  * but with all dynamically-allocated buffers duplicated in new buffers.
12043  */
12044 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig);
12045
12046 /**
12047  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
12048  */
12049 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o);
12050
12051 /**
12052  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
12053  */
12054 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e);
12055
12056 /**
12057  * Checks if the given object is currently in the success state
12058  */
12059 bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o);
12060
12061 /**
12062  * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
12063  */
12064 void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res);
12065
12066 /**
12067  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
12068  * but with all dynamically-allocated buffers duplicated in new buffers.
12069  */
12070 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig);
12071
12072 /**
12073  * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
12074  */
12075 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
12076
12077 /**
12078  * Constructs a new COption_NetworkUpdateZ containing nothing
12079  */
12080 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
12081
12082 /**
12083  * Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
12084  */
12085 void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
12086
12087 /**
12088  * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
12089  * but with all dynamically-allocated buffers duplicated in new buffers.
12090  */
12091 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
12092
12093 /**
12094  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12095  */
12096 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
12097
12098 /**
12099  * Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
12100  */
12101 struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o);
12102
12103 /**
12104  * Constructs a new COption_EventZ containing nothing
12105  */
12106 struct LDKCOption_EventZ COption_EventZ_none(void);
12107
12108 /**
12109  * Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
12110  */
12111 void COption_EventZ_free(struct LDKCOption_EventZ _res);
12112
12113 /**
12114  * Creates a new COption_EventZ which has the same data as `orig`
12115  * but with all dynamically-allocated buffers duplicated in new buffers.
12116  */
12117 struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig);
12118
12119 /**
12120  * Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
12121  */
12122 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o);
12123
12124 /**
12125  * Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
12126  */
12127 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e);
12128
12129 /**
12130  * Checks if the given object is currently in the success state
12131  */
12132 bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o);
12133
12134 /**
12135  * Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
12136  */
12137 void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res);
12138
12139 /**
12140  * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
12141  * but with all dynamically-allocated buffers duplicated in new buffers.
12142  */
12143 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig);
12144
12145 /**
12146  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12147  */
12148 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
12149
12150 /**
12151  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
12152  */
12153 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
12154
12155 /**
12156  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
12157  */
12158 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
12159
12160 /**
12161  * Checks if the given object is currently in the success state
12162  */
12163 bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o);
12164
12165 /**
12166  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
12167  */
12168 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
12169
12170 /**
12171  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
12172  */
12173 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
12174
12175 /**
12176  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
12177  */
12178 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
12179
12180 /**
12181  * Checks if the given object is currently in the success state
12182  */
12183 bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o);
12184
12185 /**
12186  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
12187  */
12188 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
12189
12190 /**
12191  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
12192  */
12193 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
12194
12195 /**
12196  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
12197  */
12198 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
12199
12200 /**
12201  * Checks if the given object is currently in the success state
12202  */
12203 bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o);
12204
12205 /**
12206  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
12207  */
12208 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
12209
12210 /**
12211  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
12212  */
12213 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
12214
12215 /**
12216  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
12217  */
12218 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
12219
12220 /**
12221  * Checks if the given object is currently in the success state
12222  */
12223 bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o);
12224
12225 /**
12226  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
12227  */
12228 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
12229
12230 /**
12231  * Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
12232  */
12233 struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_ok(struct LDKScoringParameters o);
12234
12235 /**
12236  * Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
12237  */
12238 struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_err(struct LDKDecodeError e);
12239
12240 /**
12241  * Checks if the given object is currently in the success state
12242  */
12243 bool CResult_ScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR o);
12244
12245 /**
12246  * Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
12247  */
12248 void CResult_ScoringParametersDecodeErrorZ_free(struct LDKCResult_ScoringParametersDecodeErrorZ _res);
12249
12250 /**
12251  * Creates a new CResult_ScorerDecodeErrorZ in the success state.
12252  */
12253 struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_ok(struct LDKScorer o);
12254
12255 /**
12256  * Creates a new CResult_ScorerDecodeErrorZ in the error state.
12257  */
12258 struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_err(struct LDKDecodeError e);
12259
12260 /**
12261  * Checks if the given object is currently in the success state
12262  */
12263 bool CResult_ScorerDecodeErrorZ_is_ok(const struct LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR o);
12264
12265 /**
12266  * Frees any resources used by the CResult_ScorerDecodeErrorZ.
12267  */
12268 void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res);
12269
12270 /**
12271  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
12272  */
12273 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
12274
12275 /**
12276  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
12277  */
12278 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
12279
12280 /**
12281  * Checks if the given object is currently in the success state
12282  */
12283 bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
12284
12285 /**
12286  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
12287  */
12288 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
12289
12290 /**
12291  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
12292  * but with all dynamically-allocated buffers duplicated in new buffers.
12293  */
12294 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
12295
12296 /**
12297  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
12298  */
12299 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
12300
12301 /**
12302  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
12303  */
12304 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
12305
12306 /**
12307  * Checks if the given object is currently in the success state
12308  */
12309 bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
12310
12311 /**
12312  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
12313  */
12314 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
12315
12316 /**
12317  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
12318  * but with all dynamically-allocated buffers duplicated in new buffers.
12319  */
12320 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
12321
12322 /**
12323  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
12324  */
12325 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
12326
12327 /**
12328  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
12329  */
12330 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
12331
12332 /**
12333  * Checks if the given object is currently in the success state
12334  */
12335 bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
12336
12337 /**
12338  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
12339  */
12340 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
12341
12342 /**
12343  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
12344  * but with all dynamically-allocated buffers duplicated in new buffers.
12345  */
12346 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
12347
12348 /**
12349  * Creates a new CResult_NoneNoneZ in the success state.
12350  */
12351 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
12352
12353 /**
12354  * Creates a new CResult_NoneNoneZ in the error state.
12355  */
12356 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
12357
12358 /**
12359  * Checks if the given object is currently in the success state
12360  */
12361 bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o);
12362
12363 /**
12364  * Frees any resources used by the CResult_NoneNoneZ.
12365  */
12366 void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
12367
12368 /**
12369  * Creates a new CResult_NoneNoneZ which has the same data as `orig`
12370  * but with all dynamically-allocated buffers duplicated in new buffers.
12371  */
12372 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
12373
12374 /**
12375  * Creates a new tuple which has the same data as `orig`
12376  * but with all dynamically-allocated buffers duplicated in new buffers.
12377  */
12378 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
12379
12380 /**
12381  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
12382  */
12383 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
12384
12385 /**
12386  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
12387  */
12388 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
12389
12390 /**
12391  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
12392  */
12393 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
12394
12395 /**
12396  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
12397  */
12398 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
12399
12400 /**
12401  * Checks if the given object is currently in the success state
12402  */
12403 bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o);
12404
12405 /**
12406  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
12407  */
12408 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
12409
12410 /**
12411  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
12412  * but with all dynamically-allocated buffers duplicated in new buffers.
12413  */
12414 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
12415
12416 /**
12417  * Creates a new CResult_SignatureNoneZ in the success state.
12418  */
12419 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
12420
12421 /**
12422  * Creates a new CResult_SignatureNoneZ in the error state.
12423  */
12424 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
12425
12426 /**
12427  * Checks if the given object is currently in the success state
12428  */
12429 bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o);
12430
12431 /**
12432  * Frees any resources used by the CResult_SignatureNoneZ.
12433  */
12434 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
12435
12436 /**
12437  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
12438  * but with all dynamically-allocated buffers duplicated in new buffers.
12439  */
12440 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
12441
12442 /**
12443  * Creates a new CResult_SignDecodeErrorZ in the success state.
12444  */
12445 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
12446
12447 /**
12448  * Creates a new CResult_SignDecodeErrorZ in the error state.
12449  */
12450 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
12451
12452 /**
12453  * Checks if the given object is currently in the success state
12454  */
12455 bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o);
12456
12457 /**
12458  * Frees any resources used by the CResult_SignDecodeErrorZ.
12459  */
12460 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
12461
12462 /**
12463  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
12464  * but with all dynamically-allocated buffers duplicated in new buffers.
12465  */
12466 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
12467
12468 /**
12469  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12470  */
12471 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
12472
12473 /**
12474  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
12475  */
12476 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
12477
12478 /**
12479  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
12480  */
12481 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
12482
12483 /**
12484  * Checks if the given object is currently in the success state
12485  */
12486 bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o);
12487
12488 /**
12489  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
12490  */
12491 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
12492
12493 /**
12494  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
12495  * but with all dynamically-allocated buffers duplicated in new buffers.
12496  */
12497 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
12498
12499 /**
12500  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12501  */
12502 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
12503
12504 /**
12505  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
12506  */
12507 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
12508
12509 /**
12510  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
12511  */
12512 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
12513
12514 /**
12515  * Checks if the given object is currently in the success state
12516  */
12517 bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o);
12518
12519 /**
12520  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
12521  */
12522 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
12523
12524 /**
12525  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
12526  * but with all dynamically-allocated buffers duplicated in new buffers.
12527  */
12528 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
12529
12530 /**
12531  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
12532  */
12533 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
12534
12535 /**
12536  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
12537  */
12538 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
12539
12540 /**
12541  * Checks if the given object is currently in the success state
12542  */
12543 bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o);
12544
12545 /**
12546  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
12547  */
12548 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
12549
12550 /**
12551  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
12552  * but with all dynamically-allocated buffers duplicated in new buffers.
12553  */
12554 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
12555
12556 /**
12557  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12558  */
12559 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
12560
12561 /**
12562  * Creates a new CResult_TransactionNoneZ in the success state.
12563  */
12564 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
12565
12566 /**
12567  * Creates a new CResult_TransactionNoneZ in the error state.
12568  */
12569 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
12570
12571 /**
12572  * Checks if the given object is currently in the success state
12573  */
12574 bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o);
12575
12576 /**
12577  * Frees any resources used by the CResult_TransactionNoneZ.
12578  */
12579 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
12580
12581 /**
12582  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
12583  * but with all dynamically-allocated buffers duplicated in new buffers.
12584  */
12585 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
12586
12587 /**
12588  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
12589  */
12590 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
12591
12592 /**
12593  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
12594  */
12595 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
12596
12597 /**
12598  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12599  */
12600 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
12601
12602 /**
12603  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
12604  */
12605 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
12606
12607 /**
12608  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
12609  */
12610 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
12611
12612 /**
12613  * Checks if the given object is currently in the success state
12614  */
12615 bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o);
12616
12617 /**
12618  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
12619  */
12620 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
12621
12622 /**
12623  * Constructs a new COption_u16Z containing a u16
12624  */
12625 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
12626
12627 /**
12628  * Constructs a new COption_u16Z containing nothing
12629  */
12630 struct LDKCOption_u16Z COption_u16Z_none(void);
12631
12632 /**
12633  * Frees any resources associated with the u16, if we are in the Some state
12634  */
12635 void COption_u16Z_free(struct LDKCOption_u16Z _res);
12636
12637 /**
12638  * Creates a new COption_u16Z which has the same data as `orig`
12639  * but with all dynamically-allocated buffers duplicated in new buffers.
12640  */
12641 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
12642
12643 /**
12644  * Creates a new CResult_NoneAPIErrorZ in the success state.
12645  */
12646 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
12647
12648 /**
12649  * Creates a new CResult_NoneAPIErrorZ in the error state.
12650  */
12651 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
12652
12653 /**
12654  * Checks if the given object is currently in the success state
12655  */
12656 bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o);
12657
12658 /**
12659  * Frees any resources used by the CResult_NoneAPIErrorZ.
12660  */
12661 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
12662
12663 /**
12664  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
12665  * but with all dynamically-allocated buffers duplicated in new buffers.
12666  */
12667 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
12668
12669 /**
12670  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12671  */
12672 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
12673
12674 /**
12675  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12676  */
12677 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
12678
12679 /**
12680  * Creates a new CResult__u832APIErrorZ in the success state.
12681  */
12682 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o);
12683
12684 /**
12685  * Creates a new CResult__u832APIErrorZ in the error state.
12686  */
12687 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
12688
12689 /**
12690  * Checks if the given object is currently in the success state
12691  */
12692 bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o);
12693
12694 /**
12695  * Frees any resources used by the CResult__u832APIErrorZ.
12696  */
12697 void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res);
12698
12699 /**
12700  * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
12701  * but with all dynamically-allocated buffers duplicated in new buffers.
12702  */
12703 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig);
12704
12705 /**
12706  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
12707  */
12708 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
12709
12710 /**
12711  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
12712  */
12713 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
12714
12715 /**
12716  * Checks if the given object is currently in the success state
12717  */
12718 bool CResult_PaymentIdPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR o);
12719
12720 /**
12721  * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
12722  */
12723 void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res);
12724
12725 /**
12726  * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
12727  * but with all dynamically-allocated buffers duplicated in new buffers.
12728  */
12729 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig);
12730
12731 /**
12732  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
12733  */
12734 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
12735
12736 /**
12737  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
12738  */
12739 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
12740
12741 /**
12742  * Checks if the given object is currently in the success state
12743  */
12744 bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o);
12745
12746 /**
12747  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
12748  */
12749 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
12750
12751 /**
12752  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
12753  * but with all dynamically-allocated buffers duplicated in new buffers.
12754  */
12755 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
12756
12757 /**
12758  * Creates a new tuple which has the same data as `orig`
12759  * but with all dynamically-allocated buffers duplicated in new buffers.
12760  */
12761 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig);
12762
12763 /**
12764  * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
12765  */
12766 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
12767
12768 /**
12769  * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
12770  */
12771 void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res);
12772
12773 /**
12774  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
12775  */
12776 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o);
12777
12778 /**
12779  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
12780  */
12781 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
12782
12783 /**
12784  * Checks if the given object is currently in the success state
12785  */
12786 bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o);
12787
12788 /**
12789  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
12790  */
12791 void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res);
12792
12793 /**
12794  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
12795  * but with all dynamically-allocated buffers duplicated in new buffers.
12796  */
12797 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig);
12798
12799 /**
12800  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12801  */
12802 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
12803
12804 /**
12805  * Creates a new tuple which has the same data as `orig`
12806  * but with all dynamically-allocated buffers duplicated in new buffers.
12807  */
12808 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
12809
12810 /**
12811  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
12812  */
12813 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
12814
12815 /**
12816  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
12817  */
12818 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
12819
12820 /**
12821  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
12822  */
12823 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
12824
12825 /**
12826  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
12827  */
12828 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
12829
12830 /**
12831  * Checks if the given object is currently in the success state
12832  */
12833 bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o);
12834
12835 /**
12836  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
12837  */
12838 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
12839
12840 /**
12841  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
12842  * but with all dynamically-allocated buffers duplicated in new buffers.
12843  */
12844 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
12845
12846 /**
12847  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12848  */
12849 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
12850
12851 /**
12852  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
12853  */
12854 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
12855
12856 /**
12857  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
12858  */
12859 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
12860
12861 /**
12862  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
12863  */
12864 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
12865
12866 /**
12867  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
12868  */
12869 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
12870
12871 /**
12872  * Checks if the given object is currently in the success state
12873  */
12874 bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o);
12875
12876 /**
12877  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
12878  */
12879 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
12880
12881 /**
12882  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
12883  */
12884 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
12885
12886 /**
12887  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
12888  */
12889 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
12890
12891 /**
12892  * Checks if the given object is currently in the success state
12893  */
12894 bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o);
12895
12896 /**
12897  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
12898  */
12899 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
12900
12901 /**
12902  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
12903  * but with all dynamically-allocated buffers duplicated in new buffers.
12904  */
12905 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
12906
12907 /**
12908  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
12909  */
12910 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
12911
12912 /**
12913  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
12914  */
12915 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
12916
12917 /**
12918  * Checks if the given object is currently in the success state
12919  */
12920 bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o);
12921
12922 /**
12923  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
12924  */
12925 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
12926
12927 /**
12928  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
12929  * but with all dynamically-allocated buffers duplicated in new buffers.
12930  */
12931 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
12932
12933 /**
12934  * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
12935  */
12936 struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
12937
12938 /**
12939  * Constructs a new COption_TypeZ containing nothing
12940  */
12941 struct LDKCOption_TypeZ COption_TypeZ_none(void);
12942
12943 /**
12944  * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
12945  */
12946 void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
12947
12948 /**
12949  * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
12950  */
12951 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
12952
12953 /**
12954  * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
12955  */
12956 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
12957
12958 /**
12959  * Checks if the given object is currently in the success state
12960  */
12961 bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o);
12962
12963 /**
12964  * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
12965  */
12966 void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
12967
12968 /**
12969  * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
12970  */
12971 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
12972
12973 /**
12974  * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
12975  */
12976 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
12977
12978 /**
12979  * Checks if the given object is currently in the success state
12980  */
12981 bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o);
12982
12983 /**
12984  * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
12985  */
12986 void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
12987
12988 /**
12989  * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
12990  * but with all dynamically-allocated buffers duplicated in new buffers.
12991  */
12992 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
12993
12994 /**
12995  * Creates a new CResult_SiPrefixNoneZ in the success state.
12996  */
12997 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o);
12998
12999 /**
13000  * Creates a new CResult_SiPrefixNoneZ in the error state.
13001  */
13002 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void);
13003
13004 /**
13005  * Checks if the given object is currently in the success state
13006  */
13007 bool CResult_SiPrefixNoneZ_is_ok(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR o);
13008
13009 /**
13010  * Frees any resources used by the CResult_SiPrefixNoneZ.
13011  */
13012 void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res);
13013
13014 /**
13015  * Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
13016  * but with all dynamically-allocated buffers duplicated in new buffers.
13017  */
13018 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig);
13019
13020 /**
13021  * Creates a new CResult_InvoiceNoneZ in the success state.
13022  */
13023 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o);
13024
13025 /**
13026  * Creates a new CResult_InvoiceNoneZ in the error state.
13027  */
13028 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void);
13029
13030 /**
13031  * Checks if the given object is currently in the success state
13032  */
13033 bool CResult_InvoiceNoneZ_is_ok(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR o);
13034
13035 /**
13036  * Frees any resources used by the CResult_InvoiceNoneZ.
13037  */
13038 void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res);
13039
13040 /**
13041  * Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
13042  * but with all dynamically-allocated buffers duplicated in new buffers.
13043  */
13044 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig);
13045
13046 /**
13047  * Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
13048  */
13049 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o);
13050
13051 /**
13052  * Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
13053  */
13054 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void);
13055
13056 /**
13057  * Checks if the given object is currently in the success state
13058  */
13059 bool CResult_SignedRawInvoiceNoneZ_is_ok(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR o);
13060
13061 /**
13062  * Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
13063  */
13064 void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res);
13065
13066 /**
13067  * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
13068  * but with all dynamically-allocated buffers duplicated in new buffers.
13069  */
13070 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig);
13071
13072 /**
13073  * Creates a new tuple which has the same data as `orig`
13074  * but with all dynamically-allocated buffers duplicated in new buffers.
13075  */
13076 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
13077
13078 /**
13079  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
13080  */
13081 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
13082
13083 /**
13084  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
13085  */
13086 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
13087
13088 /**
13089  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
13090  */
13091 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
13092
13093 /**
13094  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
13095  */
13096 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
13097
13098 /**
13099  * Checks if the given object is currently in the success state
13100  */
13101 bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o);
13102
13103 /**
13104  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
13105  */
13106 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
13107
13108 /**
13109  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
13110  * but with all dynamically-allocated buffers duplicated in new buffers.
13111  */
13112 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
13113
13114 /**
13115  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13116  */
13117 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
13118
13119 /**
13120  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
13121  */
13122 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
13123
13124 /**
13125  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
13126  */
13127 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
13128
13129 /**
13130  * Checks if the given object is currently in the success state
13131  */
13132 bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o);
13133
13134 /**
13135  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
13136  */
13137 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
13138
13139 /**
13140  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
13141  * but with all dynamically-allocated buffers duplicated in new buffers.
13142  */
13143 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
13144
13145 /**
13146  * Creates a new CResult_NoneSemanticErrorZ in the success state.
13147  */
13148 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
13149
13150 /**
13151  * Creates a new CResult_NoneSemanticErrorZ in the error state.
13152  */
13153 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
13154
13155 /**
13156  * Checks if the given object is currently in the success state
13157  */
13158 bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o);
13159
13160 /**
13161  * Frees any resources used by the CResult_NoneSemanticErrorZ.
13162  */
13163 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
13164
13165 /**
13166  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
13167  * but with all dynamically-allocated buffers duplicated in new buffers.
13168  */
13169 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
13170
13171 /**
13172  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
13173  */
13174 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
13175
13176 /**
13177  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
13178  */
13179 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
13180
13181 /**
13182  * Checks if the given object is currently in the success state
13183  */
13184 bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o);
13185
13186 /**
13187  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
13188  */
13189 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
13190
13191 /**
13192  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
13193  * but with all dynamically-allocated buffers duplicated in new buffers.
13194  */
13195 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
13196
13197 /**
13198  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
13199  */
13200 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
13201
13202 /**
13203  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
13204  */
13205 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
13206
13207 /**
13208  * Checks if the given object is currently in the success state
13209  */
13210 bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o);
13211
13212 /**
13213  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
13214  */
13215 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
13216
13217 /**
13218  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
13219  * but with all dynamically-allocated buffers duplicated in new buffers.
13220  */
13221 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
13222
13223 /**
13224  * Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
13225  */
13226 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_ok(struct LDKExpiryTime o);
13227
13228 /**
13229  * Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
13230  */
13231 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_err(enum LDKCreationError e);
13232
13233 /**
13234  * Checks if the given object is currently in the success state
13235  */
13236 bool CResult_ExpiryTimeCreationErrorZ_is_ok(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR o);
13237
13238 /**
13239  * Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
13240  */
13241 void CResult_ExpiryTimeCreationErrorZ_free(struct LDKCResult_ExpiryTimeCreationErrorZ _res);
13242
13243 /**
13244  * Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
13245  * but with all dynamically-allocated buffers duplicated in new buffers.
13246  */
13247 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_clone(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR orig);
13248
13249 /**
13250  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
13251  */
13252 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
13253
13254 /**
13255  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
13256  */
13257 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
13258
13259 /**
13260  * Checks if the given object is currently in the success state
13261  */
13262 bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o);
13263
13264 /**
13265  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
13266  */
13267 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
13268
13269 /**
13270  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
13271  * but with all dynamically-allocated buffers duplicated in new buffers.
13272  */
13273 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
13274
13275 /**
13276  * Creates a new CResult_StringErrorZ in the success state.
13277  */
13278 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
13279
13280 /**
13281  * Creates a new CResult_StringErrorZ in the error state.
13282  */
13283 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
13284
13285 /**
13286  * Checks if the given object is currently in the success state
13287  */
13288 bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o);
13289
13290 /**
13291  * Frees any resources used by the CResult_StringErrorZ.
13292  */
13293 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
13294
13295 /**
13296  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
13297  */
13298 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
13299
13300 /**
13301  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
13302  */
13303 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
13304
13305 /**
13306  * Checks if the given object is currently in the success state
13307  */
13308 bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o);
13309
13310 /**
13311  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
13312  */
13313 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
13314
13315 /**
13316  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
13317  * but with all dynamically-allocated buffers duplicated in new buffers.
13318  */
13319 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
13320
13321 /**
13322  * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
13323  */
13324 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o);
13325
13326 /**
13327  * Constructs a new COption_MonitorEventZ containing nothing
13328  */
13329 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void);
13330
13331 /**
13332  * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
13333  */
13334 void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res);
13335
13336 /**
13337  * Creates a new COption_MonitorEventZ which has the same data as `orig`
13338  * but with all dynamically-allocated buffers duplicated in new buffers.
13339  */
13340 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig);
13341
13342 /**
13343  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
13344  */
13345 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o);
13346
13347 /**
13348  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
13349  */
13350 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e);
13351
13352 /**
13353  * Checks if the given object is currently in the success state
13354  */
13355 bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o);
13356
13357 /**
13358  * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
13359  */
13360 void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res);
13361
13362 /**
13363  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
13364  * but with all dynamically-allocated buffers duplicated in new buffers.
13365  */
13366 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig);
13367
13368 /**
13369  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
13370  */
13371 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
13372
13373 /**
13374  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
13375  */
13376 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
13377
13378 /**
13379  * Checks if the given object is currently in the success state
13380  */
13381 bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o);
13382
13383 /**
13384  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
13385  */
13386 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
13387
13388 /**
13389  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
13390  * but with all dynamically-allocated buffers duplicated in new buffers.
13391  */
13392 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
13393
13394 /**
13395  * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
13396  */
13397 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
13398
13399 /**
13400  * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
13401  */
13402 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
13403
13404 /**
13405  * Checks if the given object is currently in the success state
13406  */
13407 bool CResult_NoneMonitorUpdateErrorZ_is_ok(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR o);
13408
13409 /**
13410  * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
13411  */
13412 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
13413
13414 /**
13415  * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
13416  * but with all dynamically-allocated buffers duplicated in new buffers.
13417  */
13418 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
13419
13420 /**
13421  * Creates a new tuple which has the same data as `orig`
13422  * but with all dynamically-allocated buffers duplicated in new buffers.
13423  */
13424 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
13425
13426 /**
13427  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
13428  */
13429 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
13430
13431 /**
13432  * Frees any resources used by the C2Tuple_OutPointScriptZ.
13433  */
13434 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
13435
13436 /**
13437  * Creates a new tuple which has the same data as `orig`
13438  * but with all dynamically-allocated buffers duplicated in new buffers.
13439  */
13440 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
13441
13442 /**
13443  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
13444  */
13445 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
13446
13447 /**
13448  * Frees any resources used by the C2Tuple_u32ScriptZ.
13449  */
13450 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
13451
13452 /**
13453  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13454  */
13455 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
13456
13457 /**
13458  * Creates a new tuple which has the same data as `orig`
13459  * but with all dynamically-allocated buffers duplicated in new buffers.
13460  */
13461 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
13462
13463 /**
13464  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
13465  */
13466 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
13467
13468 /**
13469  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
13470  */
13471 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
13472
13473 /**
13474  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13475  */
13476 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
13477
13478 /**
13479  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13480  */
13481 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
13482
13483 /**
13484  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13485  */
13486 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
13487
13488 /**
13489  * Creates a new tuple which has the same data as `orig`
13490  * but with all dynamically-allocated buffers duplicated in new buffers.
13491  */
13492 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
13493
13494 /**
13495  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
13496  */
13497 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
13498
13499 /**
13500  * Frees any resources used by the C2Tuple_u32TxOutZ.
13501  */
13502 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
13503
13504 /**
13505  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13506  */
13507 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
13508
13509 /**
13510  * Creates a new tuple which has the same data as `orig`
13511  * but with all dynamically-allocated buffers duplicated in new buffers.
13512  */
13513 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
13514
13515 /**
13516  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
13517  */
13518 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
13519
13520 /**
13521  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
13522  */
13523 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
13524
13525 /**
13526  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13527  */
13528 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
13529
13530 /**
13531  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13532  */
13533 void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
13534
13535 /**
13536  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
13537  */
13538 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
13539
13540 /**
13541  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
13542  */
13543 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
13544
13545 /**
13546  * Checks if the given object is currently in the success state
13547  */
13548 bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o);
13549
13550 /**
13551  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
13552  */
13553 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
13554
13555 /**
13556  * Creates a new CResult_NoneLightningErrorZ in the success state.
13557  */
13558 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
13559
13560 /**
13561  * Creates a new CResult_NoneLightningErrorZ in the error state.
13562  */
13563 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
13564
13565 /**
13566  * Checks if the given object is currently in the success state
13567  */
13568 bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o);
13569
13570 /**
13571  * Frees any resources used by the CResult_NoneLightningErrorZ.
13572  */
13573 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
13574
13575 /**
13576  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
13577  * but with all dynamically-allocated buffers duplicated in new buffers.
13578  */
13579 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
13580
13581 /**
13582  * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
13583  */
13584 struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
13585
13586 /**
13587  * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
13588  */
13589 void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
13590
13591 /**
13592  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13593  */
13594 void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
13595
13596 /**
13597  * Creates a new CResult_boolLightningErrorZ in the success state.
13598  */
13599 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
13600
13601 /**
13602  * Creates a new CResult_boolLightningErrorZ in the error state.
13603  */
13604 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
13605
13606 /**
13607  * Checks if the given object is currently in the success state
13608  */
13609 bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o);
13610
13611 /**
13612  * Frees any resources used by the CResult_boolLightningErrorZ.
13613  */
13614 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
13615
13616 /**
13617  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
13618  * but with all dynamically-allocated buffers duplicated in new buffers.
13619  */
13620 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
13621
13622 /**
13623  * Creates a new tuple which has the same data as `orig`
13624  * but with all dynamically-allocated buffers duplicated in new buffers.
13625  */
13626 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
13627
13628 /**
13629  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
13630  */
13631 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
13632
13633 /**
13634  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
13635  */
13636 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
13637
13638 /**
13639  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13640  */
13641 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
13642
13643 /**
13644  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13645  */
13646 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
13647
13648 /**
13649  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13650  */
13651 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
13652
13653 /**
13654  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
13655  */
13656 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
13657
13658 /**
13659  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
13660  */
13661 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
13662
13663 /**
13664  * Checks if the given object is currently in the success state
13665  */
13666 bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o);
13667
13668 /**
13669  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
13670  */
13671 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
13672
13673 /**
13674  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
13675  * but with all dynamically-allocated buffers duplicated in new buffers.
13676  */
13677 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
13678
13679 /**
13680  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
13681  */
13682 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
13683
13684 /**
13685  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
13686  */
13687 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
13688
13689 /**
13690  * Checks if the given object is currently in the success state
13691  */
13692 bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o);
13693
13694 /**
13695  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
13696  */
13697 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
13698
13699 /**
13700  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
13701  * but with all dynamically-allocated buffers duplicated in new buffers.
13702  */
13703 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
13704
13705 /**
13706  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
13707  */
13708 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
13709
13710 /**
13711  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
13712  */
13713 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
13714
13715 /**
13716  * Checks if the given object is currently in the success state
13717  */
13718 bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o);
13719
13720 /**
13721  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
13722  */
13723 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
13724
13725 /**
13726  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
13727  * but with all dynamically-allocated buffers duplicated in new buffers.
13728  */
13729 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
13730
13731 /**
13732  * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
13733  */
13734 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
13735
13736 /**
13737  * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
13738  */
13739 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
13740
13741 /**
13742  * Checks if the given object is currently in the success state
13743  */
13744 bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o);
13745
13746 /**
13747  * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
13748  */
13749 void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
13750
13751 /**
13752  * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
13753  * but with all dynamically-allocated buffers duplicated in new buffers.
13754  */
13755 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
13756
13757 /**
13758  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
13759  */
13760 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o);
13761
13762 /**
13763  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
13764  */
13765 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e);
13766
13767 /**
13768  * Checks if the given object is currently in the success state
13769  */
13770 bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o);
13771
13772 /**
13773  * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
13774  */
13775 void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res);
13776
13777 /**
13778  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
13779  * but with all dynamically-allocated buffers duplicated in new buffers.
13780  */
13781 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig);
13782
13783 /**
13784  * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
13785  */
13786 struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o);
13787
13788 /**
13789  * Constructs a new COption_AccessZ containing nothing
13790  */
13791 struct LDKCOption_AccessZ COption_AccessZ_none(void);
13792
13793 /**
13794  * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
13795  */
13796 void COption_AccessZ_free(struct LDKCOption_AccessZ _res);
13797
13798 /**
13799  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
13800  */
13801 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
13802
13803 /**
13804  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
13805  */
13806 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
13807
13808 /**
13809  * Checks if the given object is currently in the success state
13810  */
13811 bool CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR o);
13812
13813 /**
13814  * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
13815  */
13816 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
13817
13818 /**
13819  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
13820  * but with all dynamically-allocated buffers duplicated in new buffers.
13821  */
13822 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
13823
13824 /**
13825  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
13826  */
13827 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
13828
13829 /**
13830  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
13831  */
13832 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
13833
13834 /**
13835  * Checks if the given object is currently in the success state
13836  */
13837 bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o);
13838
13839 /**
13840  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
13841  */
13842 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
13843
13844 /**
13845  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
13846  * but with all dynamically-allocated buffers duplicated in new buffers.
13847  */
13848 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
13849
13850 /**
13851  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
13852  */
13853 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
13854
13855 /**
13856  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
13857  */
13858 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
13859
13860 /**
13861  * Checks if the given object is currently in the success state
13862  */
13863 bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o);
13864
13865 /**
13866  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
13867  */
13868 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
13869
13870 /**
13871  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
13872  * but with all dynamically-allocated buffers duplicated in new buffers.
13873  */
13874 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
13875
13876 /**
13877  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
13878  */
13879 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
13880
13881 /**
13882  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
13883  */
13884 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
13885
13886 /**
13887  * Checks if the given object is currently in the success state
13888  */
13889 bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o);
13890
13891 /**
13892  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
13893  */
13894 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
13895
13896 /**
13897  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
13898  * but with all dynamically-allocated buffers duplicated in new buffers.
13899  */
13900 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
13901
13902 /**
13903  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13904  */
13905 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
13906
13907 /**
13908  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
13909  */
13910 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
13911
13912 /**
13913  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
13914  */
13915 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
13916
13917 /**
13918  * Checks if the given object is currently in the success state
13919  */
13920 bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o);
13921
13922 /**
13923  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
13924  */
13925 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
13926
13927 /**
13928  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
13929  * but with all dynamically-allocated buffers duplicated in new buffers.
13930  */
13931 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
13932
13933 /**
13934  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
13935  */
13936 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
13937
13938 /**
13939  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
13940  */
13941 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
13942
13943 /**
13944  * Checks if the given object is currently in the success state
13945  */
13946 bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o);
13947
13948 /**
13949  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
13950  */
13951 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
13952
13953 /**
13954  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
13955  * but with all dynamically-allocated buffers duplicated in new buffers.
13956  */
13957 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
13958
13959 /**
13960  * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
13961  */
13962 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o);
13963
13964 /**
13965  * Constructs a new COption_CVec_NetAddressZZ containing nothing
13966  */
13967 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void);
13968
13969 /**
13970  * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
13971  */
13972 void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
13973
13974 /**
13975  * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
13976  * but with all dynamically-allocated buffers duplicated in new buffers.
13977  */
13978 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
13979
13980 /**
13981  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
13982  */
13983 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
13984
13985 /**
13986  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
13987  */
13988 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
13989
13990 /**
13991  * Checks if the given object is currently in the success state
13992  */
13993 bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o);
13994
13995 /**
13996  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
13997  */
13998 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
13999
14000 /**
14001  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
14002  * but with all dynamically-allocated buffers duplicated in new buffers.
14003  */
14004 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
14005
14006 /**
14007  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14008  */
14009 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
14010
14011 /**
14012  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14013  */
14014 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
14015
14016 /**
14017  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14018  */
14019 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
14020
14021 /**
14022  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14023  */
14024 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
14025
14026 /**
14027  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
14028  */
14029 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
14030
14031 /**
14032  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
14033  */
14034 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
14035
14036 /**
14037  * Checks if the given object is currently in the success state
14038  */
14039 bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o);
14040
14041 /**
14042  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
14043  */
14044 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
14045
14046 /**
14047  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
14048  * but with all dynamically-allocated buffers duplicated in new buffers.
14049  */
14050 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
14051
14052 /**
14053  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
14054  */
14055 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
14056
14057 /**
14058  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
14059  */
14060 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
14061
14062 /**
14063  * Checks if the given object is currently in the success state
14064  */
14065 bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o);
14066
14067 /**
14068  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
14069  */
14070 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
14071
14072 /**
14073  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
14074  * but with all dynamically-allocated buffers duplicated in new buffers.
14075  */
14076 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
14077
14078 /**
14079  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
14080  */
14081 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
14082
14083 /**
14084  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
14085  */
14086 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
14087
14088 /**
14089  * Checks if the given object is currently in the success state
14090  */
14091 bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o);
14092
14093 /**
14094  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
14095  */
14096 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
14097
14098 /**
14099  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
14100  * but with all dynamically-allocated buffers duplicated in new buffers.
14101  */
14102 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
14103
14104 /**
14105  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
14106  */
14107 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
14108
14109 /**
14110  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
14111  */
14112 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
14113
14114 /**
14115  * Checks if the given object is currently in the success state
14116  */
14117 bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o);
14118
14119 /**
14120  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
14121  */
14122 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
14123
14124 /**
14125  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
14126  * but with all dynamically-allocated buffers duplicated in new buffers.
14127  */
14128 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
14129
14130 /**
14131  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
14132  */
14133 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
14134
14135 /**
14136  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
14137  */
14138 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
14139
14140 /**
14141  * Checks if the given object is currently in the success state
14142  */
14143 bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o);
14144
14145 /**
14146  * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
14147  */
14148 void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
14149
14150 /**
14151  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
14152  * but with all dynamically-allocated buffers duplicated in new buffers.
14153  */
14154 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
14155
14156 /**
14157  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
14158  */
14159 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
14160
14161 /**
14162  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
14163  */
14164 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
14165
14166 /**
14167  * Checks if the given object is currently in the success state
14168  */
14169 bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o);
14170
14171 /**
14172  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
14173  */
14174 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
14175
14176 /**
14177  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
14178  * but with all dynamically-allocated buffers duplicated in new buffers.
14179  */
14180 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
14181
14182 /**
14183  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
14184  */
14185 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
14186
14187 /**
14188  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
14189  */
14190 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
14191
14192 /**
14193  * Checks if the given object is currently in the success state
14194  */
14195 bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o);
14196
14197 /**
14198  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
14199  */
14200 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
14201
14202 /**
14203  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
14204  * but with all dynamically-allocated buffers duplicated in new buffers.
14205  */
14206 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
14207
14208 /**
14209  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
14210  */
14211 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
14212
14213 /**
14214  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
14215  */
14216 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
14217
14218 /**
14219  * Checks if the given object is currently in the success state
14220  */
14221 bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o);
14222
14223 /**
14224  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
14225  */
14226 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
14227
14228 /**
14229  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
14230  * but with all dynamically-allocated buffers duplicated in new buffers.
14231  */
14232 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
14233
14234 /**
14235  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
14236  */
14237 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
14238
14239 /**
14240  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
14241  */
14242 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
14243
14244 /**
14245  * Checks if the given object is currently in the success state
14246  */
14247 bool CResult_FundingLockedDecodeErrorZ_is_ok(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR o);
14248
14249 /**
14250  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
14251  */
14252 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
14253
14254 /**
14255  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
14256  * but with all dynamically-allocated buffers duplicated in new buffers.
14257  */
14258 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
14259
14260 /**
14261  * Creates a new CResult_InitDecodeErrorZ in the success state.
14262  */
14263 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
14264
14265 /**
14266  * Creates a new CResult_InitDecodeErrorZ in the error state.
14267  */
14268 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
14269
14270 /**
14271  * Checks if the given object is currently in the success state
14272  */
14273 bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o);
14274
14275 /**
14276  * Frees any resources used by the CResult_InitDecodeErrorZ.
14277  */
14278 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
14279
14280 /**
14281  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
14282  * but with all dynamically-allocated buffers duplicated in new buffers.
14283  */
14284 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
14285
14286 /**
14287  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
14288  */
14289 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
14290
14291 /**
14292  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
14293  */
14294 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
14295
14296 /**
14297  * Checks if the given object is currently in the success state
14298  */
14299 bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o);
14300
14301 /**
14302  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
14303  */
14304 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
14305
14306 /**
14307  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
14308  * but with all dynamically-allocated buffers duplicated in new buffers.
14309  */
14310 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
14311
14312 /**
14313  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
14314  */
14315 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
14316
14317 /**
14318  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
14319  */
14320 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
14321
14322 /**
14323  * Checks if the given object is currently in the success state
14324  */
14325 bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o);
14326
14327 /**
14328  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
14329  */
14330 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
14331
14332 /**
14333  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
14334  * but with all dynamically-allocated buffers duplicated in new buffers.
14335  */
14336 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
14337
14338 /**
14339  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
14340  */
14341 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
14342
14343 /**
14344  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
14345  */
14346 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
14347
14348 /**
14349  * Checks if the given object is currently in the success state
14350  */
14351 bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o);
14352
14353 /**
14354  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
14355  */
14356 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
14357
14358 /**
14359  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
14360  * but with all dynamically-allocated buffers duplicated in new buffers.
14361  */
14362 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
14363
14364 /**
14365  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
14366  */
14367 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
14368
14369 /**
14370  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
14371  */
14372 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
14373
14374 /**
14375  * Checks if the given object is currently in the success state
14376  */
14377 bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o);
14378
14379 /**
14380  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
14381  */
14382 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
14383
14384 /**
14385  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
14386  * but with all dynamically-allocated buffers duplicated in new buffers.
14387  */
14388 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
14389
14390 /**
14391  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
14392  */
14393 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
14394
14395 /**
14396  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
14397  */
14398 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
14399
14400 /**
14401  * Checks if the given object is currently in the success state
14402  */
14403 bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o);
14404
14405 /**
14406  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
14407  */
14408 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
14409
14410 /**
14411  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
14412  * but with all dynamically-allocated buffers duplicated in new buffers.
14413  */
14414 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
14415
14416 /**
14417  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
14418  */
14419 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
14420
14421 /**
14422  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
14423  */
14424 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
14425
14426 /**
14427  * Checks if the given object is currently in the success state
14428  */
14429 bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o);
14430
14431 /**
14432  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
14433  */
14434 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
14435
14436 /**
14437  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
14438  * but with all dynamically-allocated buffers duplicated in new buffers.
14439  */
14440 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
14441
14442 /**
14443  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
14444  */
14445 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
14446
14447 /**
14448  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
14449  */
14450 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
14451
14452 /**
14453  * Checks if the given object is currently in the success state
14454  */
14455 bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o);
14456
14457 /**
14458  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
14459  */
14460 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
14461
14462 /**
14463  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
14464  * but with all dynamically-allocated buffers duplicated in new buffers.
14465  */
14466 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
14467
14468 /**
14469  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
14470  */
14471 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
14472
14473 /**
14474  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
14475  */
14476 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
14477
14478 /**
14479  * Checks if the given object is currently in the success state
14480  */
14481 bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o);
14482
14483 /**
14484  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
14485  */
14486 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
14487
14488 /**
14489  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
14490  * but with all dynamically-allocated buffers duplicated in new buffers.
14491  */
14492 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
14493
14494 /**
14495  * Creates a new CResult_PingDecodeErrorZ in the success state.
14496  */
14497 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
14498
14499 /**
14500  * Creates a new CResult_PingDecodeErrorZ in the error state.
14501  */
14502 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
14503
14504 /**
14505  * Checks if the given object is currently in the success state
14506  */
14507 bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o);
14508
14509 /**
14510  * Frees any resources used by the CResult_PingDecodeErrorZ.
14511  */
14512 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
14513
14514 /**
14515  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
14516  * but with all dynamically-allocated buffers duplicated in new buffers.
14517  */
14518 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
14519
14520 /**
14521  * Creates a new CResult_PongDecodeErrorZ in the success state.
14522  */
14523 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
14524
14525 /**
14526  * Creates a new CResult_PongDecodeErrorZ in the error state.
14527  */
14528 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
14529
14530 /**
14531  * Checks if the given object is currently in the success state
14532  */
14533 bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o);
14534
14535 /**
14536  * Frees any resources used by the CResult_PongDecodeErrorZ.
14537  */
14538 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
14539
14540 /**
14541  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
14542  * but with all dynamically-allocated buffers duplicated in new buffers.
14543  */
14544 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
14545
14546 /**
14547  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
14548  */
14549 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
14550
14551 /**
14552  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
14553  */
14554 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
14555
14556 /**
14557  * Checks if the given object is currently in the success state
14558  */
14559 bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
14560
14561 /**
14562  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
14563  */
14564 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
14565
14566 /**
14567  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14568  * but with all dynamically-allocated buffers duplicated in new buffers.
14569  */
14570 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
14571
14572 /**
14573  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
14574  */
14575 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
14576
14577 /**
14578  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
14579  */
14580 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
14581
14582 /**
14583  * Checks if the given object is currently in the success state
14584  */
14585 bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
14586
14587 /**
14588  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
14589  */
14590 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
14591
14592 /**
14593  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14594  * but with all dynamically-allocated buffers duplicated in new buffers.
14595  */
14596 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
14597
14598 /**
14599  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
14600  */
14601 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
14602
14603 /**
14604  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
14605  */
14606 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
14607
14608 /**
14609  * Checks if the given object is currently in the success state
14610  */
14611 bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o);
14612
14613 /**
14614  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
14615  */
14616 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
14617
14618 /**
14619  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
14620  * but with all dynamically-allocated buffers duplicated in new buffers.
14621  */
14622 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
14623
14624 /**
14625  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
14626  */
14627 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
14628
14629 /**
14630  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
14631  */
14632 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
14633
14634 /**
14635  * Checks if the given object is currently in the success state
14636  */
14637 bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o);
14638
14639 /**
14640  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
14641  */
14642 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
14643
14644 /**
14645  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
14646  * but with all dynamically-allocated buffers duplicated in new buffers.
14647  */
14648 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
14649
14650 /**
14651  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
14652  */
14653 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
14654
14655 /**
14656  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
14657  */
14658 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
14659
14660 /**
14661  * Checks if the given object is currently in the success state
14662  */
14663 bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o);
14664
14665 /**
14666  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
14667  */
14668 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
14669
14670 /**
14671  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
14672  * but with all dynamically-allocated buffers duplicated in new buffers.
14673  */
14674 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
14675
14676 /**
14677  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
14678  */
14679 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
14680
14681 /**
14682  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
14683  */
14684 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
14685
14686 /**
14687  * Checks if the given object is currently in the success state
14688  */
14689 bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
14690
14691 /**
14692  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
14693  */
14694 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
14695
14696 /**
14697  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
14698  * but with all dynamically-allocated buffers duplicated in new buffers.
14699  */
14700 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
14701
14702 /**
14703  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
14704  */
14705 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
14706
14707 /**
14708  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
14709  */
14710 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
14711
14712 /**
14713  * Checks if the given object is currently in the success state
14714  */
14715 bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
14716
14717 /**
14718  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
14719  */
14720 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
14721
14722 /**
14723  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
14724  * but with all dynamically-allocated buffers duplicated in new buffers.
14725  */
14726 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
14727
14728 /**
14729  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
14730  */
14731 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
14732
14733 /**
14734  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
14735  */
14736 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
14737
14738 /**
14739  * Checks if the given object is currently in the success state
14740  */
14741 bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o);
14742
14743 /**
14744  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
14745  */
14746 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
14747
14748 /**
14749  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
14750  * but with all dynamically-allocated buffers duplicated in new buffers.
14751  */
14752 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
14753
14754 /**
14755  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
14756  */
14757 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
14758
14759 /**
14760  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
14761  */
14762 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
14763
14764 /**
14765  * Checks if the given object is currently in the success state
14766  */
14767 bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o);
14768
14769 /**
14770  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
14771  */
14772 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
14773
14774 /**
14775  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
14776  * but with all dynamically-allocated buffers duplicated in new buffers.
14777  */
14778 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
14779
14780 /**
14781  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
14782  */
14783 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
14784
14785 /**
14786  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
14787  */
14788 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
14789
14790 /**
14791  * Checks if the given object is currently in the success state
14792  */
14793 bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o);
14794
14795 /**
14796  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
14797  */
14798 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
14799
14800 /**
14801  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
14802  * but with all dynamically-allocated buffers duplicated in new buffers.
14803  */
14804 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
14805
14806 /**
14807  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
14808  */
14809 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
14810
14811 /**
14812  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
14813  */
14814 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
14815
14816 /**
14817  * Checks if the given object is currently in the success state
14818  */
14819 bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o);
14820
14821 /**
14822  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
14823  */
14824 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
14825
14826 /**
14827  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
14828  * but with all dynamically-allocated buffers duplicated in new buffers.
14829  */
14830 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
14831
14832 /**
14833  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
14834  */
14835 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
14836
14837 /**
14838  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
14839  */
14840 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
14841
14842 /**
14843  * Checks if the given object is currently in the success state
14844  */
14845 bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o);
14846
14847 /**
14848  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
14849  */
14850 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
14851
14852 /**
14853  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
14854  * but with all dynamically-allocated buffers duplicated in new buffers.
14855  */
14856 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
14857
14858 /**
14859  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
14860  */
14861 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
14862
14863 /**
14864  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
14865  */
14866 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
14867
14868 /**
14869  * Checks if the given object is currently in the success state
14870  */
14871 bool CResult_InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR o);
14872
14873 /**
14874  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
14875  */
14876 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
14877
14878 /**
14879  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
14880  * but with all dynamically-allocated buffers duplicated in new buffers.
14881  */
14882 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
14883
14884 /**
14885  * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
14886  */
14887 struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
14888
14889 /**
14890  * Constructs a new COption_FilterZ containing nothing
14891  */
14892 struct LDKCOption_FilterZ COption_FilterZ_none(void);
14893
14894 /**
14895  * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
14896  */
14897 void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
14898
14899 /**
14900  * Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
14901  */
14902 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o);
14903
14904 /**
14905  * Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
14906  */
14907 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
14908
14909 /**
14910  * Checks if the given object is currently in the success state
14911  */
14912 bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o);
14913
14914 /**
14915  * Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
14916  */
14917 void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res);
14918
14919 /**
14920  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14921  */
14922 void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res);
14923
14924 /**
14925  * Frees any resources used by the PaymentPurpose
14926  */
14927 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
14928
14929 /**
14930  * Creates a copy of the PaymentPurpose
14931  */
14932 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
14933
14934 /**
14935  * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
14936  */
14937 struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t user_payment_id);
14938
14939 /**
14940  * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
14941  */
14942 struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
14943
14944 /**
14945  * Frees any resources used by the ClosureReason
14946  */
14947 void ClosureReason_free(struct LDKClosureReason this_ptr);
14948
14949 /**
14950  * Creates a copy of the ClosureReason
14951  */
14952 struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
14953
14954 /**
14955  * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
14956  */
14957 struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg);
14958
14959 /**
14960  * Utility method to constructs a new HolderForceClosed-variant ClosureReason
14961  */
14962 struct LDKClosureReason ClosureReason_holder_force_closed(void);
14963
14964 /**
14965  * Utility method to constructs a new CooperativeClosure-variant ClosureReason
14966  */
14967 struct LDKClosureReason ClosureReason_cooperative_closure(void);
14968
14969 /**
14970  * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
14971  */
14972 struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
14973
14974 /**
14975  * Utility method to constructs a new ProcessingError-variant ClosureReason
14976  */
14977 struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
14978
14979 /**
14980  * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
14981  */
14982 struct LDKClosureReason ClosureReason_disconnected_peer(void);
14983
14984 /**
14985  * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
14986  */
14987 struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
14988
14989 /**
14990  * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
14991  */
14992 struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
14993
14994 /**
14995  * Read a ClosureReason from a byte array, created by ClosureReason_write
14996  */
14997 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser);
14998
14999 /**
15000  * Frees any resources used by the Event
15001  */
15002 void Event_free(struct LDKEvent this_ptr);
15003
15004 /**
15005  * Creates a copy of the Event
15006  */
15007 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
15008
15009 /**
15010  * Utility method to constructs a new FundingGenerationReady-variant Event
15011  */
15012 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);
15013
15014 /**
15015  * Utility method to constructs a new PaymentReceived-variant Event
15016  */
15017 struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amt, struct LDKPaymentPurpose purpose);
15018
15019 /**
15020  * Utility method to constructs a new PaymentSent-variant Event
15021  */
15022 struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
15023
15024 /**
15025  * Utility method to constructs a new PaymentPathFailed-variant Event
15026  */
15027 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);
15028
15029 /**
15030  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
15031  */
15032 struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
15033
15034 /**
15035  * Utility method to constructs a new SpendableOutputs-variant Event
15036  */
15037 struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
15038
15039 /**
15040  * Utility method to constructs a new PaymentForwarded-variant Event
15041  */
15042 struct LDKEvent Event_payment_forwarded(struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx);
15043
15044 /**
15045  * Utility method to constructs a new ChannelClosed-variant Event
15046  */
15047 struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64_t user_channel_id, struct LDKClosureReason reason);
15048
15049 /**
15050  * Utility method to constructs a new DiscardFunding-variant Event
15051  */
15052 struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
15053
15054 /**
15055  * Serialize the Event object into a byte array which can be read by Event_read
15056  */
15057 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
15058
15059 /**
15060  * Read a Event from a byte array, created by Event_write
15061  */
15062 struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser);
15063
15064 /**
15065  * Frees any resources used by the MessageSendEvent
15066  */
15067 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
15068
15069 /**
15070  * Creates a copy of the MessageSendEvent
15071  */
15072 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
15073
15074 /**
15075  * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
15076  */
15077 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
15078
15079 /**
15080  * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
15081  */
15082 struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
15083
15084 /**
15085  * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
15086  */
15087 struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
15088
15089 /**
15090  * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
15091  */
15092 struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
15093
15094 /**
15095  * Utility method to constructs a new SendFundingLocked-variant MessageSendEvent
15096  */
15097 struct LDKMessageSendEvent MessageSendEvent_send_funding_locked(struct LDKPublicKey node_id, struct LDKFundingLocked msg);
15098
15099 /**
15100  * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
15101  */
15102 struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
15103
15104 /**
15105  * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
15106  */
15107 struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
15108
15109 /**
15110  * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
15111  */
15112 struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
15113
15114 /**
15115  * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
15116  */
15117 struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
15118
15119 /**
15120  * Utility method to constructs a new SendShutdown-variant MessageSendEvent
15121  */
15122 struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
15123
15124 /**
15125  * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
15126  */
15127 struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
15128
15129 /**
15130  * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
15131  */
15132 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
15133
15134 /**
15135  * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
15136  */
15137 struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg);
15138
15139 /**
15140  * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
15141  */
15142 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
15143
15144 /**
15145  * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
15146  */
15147 struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
15148
15149 /**
15150  * Utility method to constructs a new HandleError-variant MessageSendEvent
15151  */
15152 struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
15153
15154 /**
15155  * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
15156  */
15157 struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
15158
15159 /**
15160  * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
15161  */
15162 struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
15163
15164 /**
15165  * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
15166  */
15167 struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
15168
15169 /**
15170  * Calls the free function if one is set
15171  */
15172 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
15173
15174 /**
15175  * Calls the free function if one is set
15176  */
15177 void EventsProvider_free(struct LDKEventsProvider this_ptr);
15178
15179 /**
15180  * Calls the free function if one is set
15181  */
15182 void EventHandler_free(struct LDKEventHandler this_ptr);
15183
15184 /**
15185  * Frees any resources used by the APIError
15186  */
15187 void APIError_free(struct LDKAPIError this_ptr);
15188
15189 /**
15190  * Creates a copy of the APIError
15191  */
15192 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
15193
15194 /**
15195  * Utility method to constructs a new APIMisuseError-variant APIError
15196  */
15197 struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
15198
15199 /**
15200  * Utility method to constructs a new FeeRateTooHigh-variant APIError
15201  */
15202 struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
15203
15204 /**
15205  * Utility method to constructs a new RouteError-variant APIError
15206  */
15207 struct LDKAPIError APIError_route_error(struct LDKStr err);
15208
15209 /**
15210  * Utility method to constructs a new ChannelUnavailable-variant APIError
15211  */
15212 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
15213
15214 /**
15215  * Utility method to constructs a new MonitorUpdateFailed-variant APIError
15216  */
15217 struct LDKAPIError APIError_monitor_update_failed(void);
15218
15219 /**
15220  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
15221  */
15222 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
15223
15224 /**
15225  * Creates a digital signature of a message given a SecretKey, like the node's secret.
15226  * 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.
15227  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
15228  */
15229 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
15230
15231 /**
15232  * Recovers the PublicKey of the signer of the message given the message and the signature.
15233  */
15234 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
15235
15236 /**
15237  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
15238  * and the PublicKey.
15239  */
15240 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
15241
15242 /**
15243  * Creates a copy of the Level
15244  */
15245 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
15246
15247 /**
15248  * Utility method to constructs a new Trace-variant Level
15249  */
15250 enum LDKLevel Level_trace(void);
15251
15252 /**
15253  * Utility method to constructs a new Debug-variant Level
15254  */
15255 enum LDKLevel Level_debug(void);
15256
15257 /**
15258  * Utility method to constructs a new Info-variant Level
15259  */
15260 enum LDKLevel Level_info(void);
15261
15262 /**
15263  * Utility method to constructs a new Warn-variant Level
15264  */
15265 enum LDKLevel Level_warn(void);
15266
15267 /**
15268  * Utility method to constructs a new Error-variant Level
15269  */
15270 enum LDKLevel Level_error(void);
15271
15272 /**
15273  * Checks if two Levels contain equal inner contents.
15274  * This ignores pointers and is_owned flags and looks at the values in fields.
15275  */
15276 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
15277
15278 /**
15279  * Checks if two Levels contain equal inner contents.
15280  */
15281 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
15282
15283 /**
15284  * Returns the most verbose logging level.
15285  */
15286 MUST_USE_RES enum LDKLevel Level_max(void);
15287
15288 /**
15289  * Frees any resources used by the Record, if is_owned is set and inner is non-NULL.
15290  */
15291 void Record_free(struct LDKRecord this_obj);
15292
15293 /**
15294  * The verbosity level of the message.
15295  */
15296 enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr);
15297
15298 /**
15299  * The verbosity level of the message.
15300  */
15301 void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val);
15302
15303 /**
15304  * The message body.
15305  */
15306 struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr);
15307
15308 /**
15309  * The message body.
15310  */
15311 void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
15312
15313 /**
15314  * The module path of the message.
15315  */
15316 struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr);
15317
15318 /**
15319  * The module path of the message.
15320  */
15321 void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
15322
15323 /**
15324  * The source file containing the message.
15325  */
15326 struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr);
15327
15328 /**
15329  * The source file containing the message.
15330  */
15331 void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
15332
15333 /**
15334  * The line containing the message.
15335  */
15336 uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr);
15337
15338 /**
15339  * The line containing the message.
15340  */
15341 void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val);
15342
15343 /**
15344  * Creates a copy of the Record
15345  */
15346 struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig);
15347
15348 /**
15349  * Calls the free function if one is set
15350  */
15351 void Logger_free(struct LDKLogger this_ptr);
15352
15353 /**
15354  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
15355  */
15356 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
15357
15358 /**
15359  * Confirmations we will wait for before considering the channel locked in.
15360  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
15361  * equivalent limit applied to outbound channels).
15362  *
15363  * Default value: 6.
15364  */
15365 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
15366
15367 /**
15368  * Confirmations we will wait for before considering the channel locked in.
15369  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
15370  * equivalent limit applied to outbound channels).
15371  *
15372  * Default value: 6.
15373  */
15374 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
15375
15376 /**
15377  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
15378  * the number of blocks we have to punish our counterparty if they broadcast a revoked
15379  * transaction).
15380  *
15381  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
15382  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
15383  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
15384  * possibly with time in between to RBF the spending transaction).
15385  *
15386  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
15387  * case of an honest unilateral channel close, which implicitly decrease the economic value of
15388  * our channel.
15389  *
15390  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
15391  * can tweak config to ask for more security, not less.
15392  */
15393 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
15394
15395 /**
15396  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
15397  * the number of blocks we have to punish our counterparty if they broadcast a revoked
15398  * transaction).
15399  *
15400  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
15401  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
15402  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
15403  * possibly with time in between to RBF the spending transaction).
15404  *
15405  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
15406  * case of an honest unilateral channel close, which implicitly decrease the economic value of
15407  * our channel.
15408  *
15409  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
15410  * can tweak config to ask for more security, not less.
15411  */
15412 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
15413
15414 /**
15415  * Set to the smallest value HTLC we will accept to process.
15416  *
15417  * This value is sent to our counterparty on channel-open and we close the channel any time
15418  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
15419  *
15420  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
15421  * by the protocol.
15422  */
15423 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
15424
15425 /**
15426  * Set to the smallest value HTLC we will accept to process.
15427  *
15428  * This value is sent to our counterparty on channel-open and we close the channel any time
15429  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
15430  *
15431  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
15432  * by the protocol.
15433  */
15434 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
15435
15436 /**
15437  * Constructs a new ChannelHandshakeConfig given each field
15438  */
15439 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);
15440
15441 /**
15442  * Creates a copy of the ChannelHandshakeConfig
15443  */
15444 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
15445
15446 /**
15447  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
15448  */
15449 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
15450
15451 /**
15452  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
15453  */
15454 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
15455
15456 /**
15457  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
15458  * only applies to inbound channels.
15459  *
15460  * Default value: 0.
15461  */
15462 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
15463
15464 /**
15465  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
15466  * only applies to inbound channels.
15467  *
15468  * Default value: 0.
15469  */
15470 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
15471
15472 /**
15473  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
15474  * you to limit the maximum minimum-size they can require.
15475  *
15476  * Default value: u64::max_value.
15477  */
15478 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
15479
15480 /**
15481  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
15482  * you to limit the maximum minimum-size they can require.
15483  *
15484  * Default value: u64::max_value.
15485  */
15486 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
15487
15488 /**
15489  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
15490  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
15491  *
15492  * Default value: 0.
15493  */
15494 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
15495
15496 /**
15497  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
15498  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
15499  *
15500  * Default value: 0.
15501  */
15502 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
15503
15504 /**
15505  * The remote node will require we keep a certain amount in direct payment to ourselves at all
15506  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
15507  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
15508  *
15509  * Default value: u64::max_value.
15510  */
15511 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
15512
15513 /**
15514  * The remote node will require we keep a certain amount in direct payment to ourselves at all
15515  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
15516  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
15517  *
15518  * Default value: u64::max_value.
15519  */
15520 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
15521
15522 /**
15523  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
15524  * time. This allows you to set a minimum such value.
15525  *
15526  * Default value: 0.
15527  */
15528 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
15529
15530 /**
15531  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
15532  * time. This allows you to set a minimum such value.
15533  *
15534  * Default value: 0.
15535  */
15536 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
15537
15538 /**
15539  * Before a channel is usable the funding transaction will need to be confirmed by at least a
15540  * certain number of blocks, specified by the node which is not the funder (as the funder can
15541  * assume they aren't going to double-spend themselves).
15542  * This config allows you to set a limit on the maximum amount of time to wait.
15543  *
15544  * Default value: 144, or roughly one day and only applies to outbound channels.
15545  */
15546 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
15547
15548 /**
15549  * Before a channel is usable the funding transaction will need to be confirmed by at least a
15550  * certain number of blocks, specified by the node which is not the funder (as the funder can
15551  * assume they aren't going to double-spend themselves).
15552  * This config allows you to set a limit on the maximum amount of time to wait.
15553  *
15554  * Default value: 144, or roughly one day and only applies to outbound channels.
15555  */
15556 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
15557
15558 /**
15559  * Set to force an incoming channel to match our announced channel preference in
15560  * [`ChannelConfig::announced_channel`].
15561  *
15562  * For a node which is not online reliably, this should be set to true and
15563  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
15564  * channels will ever be opened.
15565  *
15566  * Default value: true.
15567  */
15568 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
15569
15570 /**
15571  * Set to force an incoming channel to match our announced channel preference in
15572  * [`ChannelConfig::announced_channel`].
15573  *
15574  * For a node which is not online reliably, this should be set to true and
15575  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
15576  * channels will ever be opened.
15577  *
15578  * Default value: true.
15579  */
15580 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
15581
15582 /**
15583  * Set to the amount of time we're willing to wait to claim money back to us.
15584  *
15585  * Not checking this value would be a security issue, as our peer would be able to set it to
15586  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
15587  *
15588  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
15589  * reduce the loss of having useless locked funds (if your peer accepts)
15590  */
15591 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
15592
15593 /**
15594  * Set to the amount of time we're willing to wait to claim money back to us.
15595  *
15596  * Not checking this value would be a security issue, as our peer would be able to set it to
15597  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
15598  *
15599  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
15600  * reduce the loss of having useless locked funds (if your peer accepts)
15601  */
15602 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
15603
15604 /**
15605  * Constructs a new ChannelHandshakeLimits given each field
15606  */
15607 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);
15608
15609 /**
15610  * Creates a copy of the ChannelHandshakeLimits
15611  */
15612 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
15613
15614 /**
15615  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
15616  */
15617 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
15618
15619 /**
15620  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
15621  */
15622 void ChannelConfig_free(struct LDKChannelConfig this_obj);
15623
15624 /**
15625  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
15626  * over the channel.
15627  * This may be allowed to change at runtime in a later update, however doing so must result in
15628  * update messages sent to notify all nodes of our updated relay fee.
15629  *
15630  * Default value: 0.
15631  */
15632 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
15633
15634 /**
15635  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
15636  * over the channel.
15637  * This may be allowed to change at runtime in a later update, however doing so must result in
15638  * update messages sent to notify all nodes of our updated relay fee.
15639  *
15640  * Default value: 0.
15641  */
15642 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
15643
15644 /**
15645  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
15646  * excess of [`forwarding_fee_proportional_millionths`].
15647  * This may be allowed to change at runtime in a later update, however doing so must result in
15648  * update messages sent to notify all nodes of our updated relay fee.
15649  *
15650  * The default value of a single satoshi roughly matches the market rate on many routing nodes
15651  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
15652  * this node.
15653  *
15654  * Default value: 1000.
15655  *
15656  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
15657  */
15658 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
15659
15660 /**
15661  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
15662  * excess of [`forwarding_fee_proportional_millionths`].
15663  * This may be allowed to change at runtime in a later update, however doing so must result in
15664  * update messages sent to notify all nodes of our updated relay fee.
15665  *
15666  * The default value of a single satoshi roughly matches the market rate on many routing nodes
15667  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
15668  * this node.
15669  *
15670  * Default value: 1000.
15671  *
15672  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
15673  */
15674 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
15675
15676 /**
15677  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
15678  * the channel this config applies to.
15679  *
15680  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
15681  * HTLC balance when a channel appears on-chain whereas
15682  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
15683  * (non-HTLC-encumbered) balance.
15684  *
15685  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
15686  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
15687  * commitment transaction at least once per this many blocks (minus some margin to allow us
15688  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
15689  * the spending transaction).
15690  *
15691  * Default value: 72 (12 hours at an average of 6 blocks/hour).
15692  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
15693  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
15694  *
15695  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
15696  */
15697 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
15698
15699 /**
15700  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
15701  * the channel this config applies to.
15702  *
15703  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
15704  * HTLC balance when a channel appears on-chain whereas
15705  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
15706  * (non-HTLC-encumbered) balance.
15707  *
15708  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
15709  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
15710  * commitment transaction at least once per this many blocks (minus some margin to allow us
15711  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
15712  * the spending transaction).
15713  *
15714  * Default value: 72 (12 hours at an average of 6 blocks/hour).
15715  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
15716  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
15717  *
15718  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
15719  */
15720 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
15721
15722 /**
15723  * Set to announce the channel publicly and notify all nodes that they can route via this
15724  * channel.
15725  *
15726  * This should only be set to true for nodes which expect to be online reliably.
15727  *
15728  * As the node which funds a channel picks this value this will only apply for new outbound
15729  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
15730  *
15731  * This cannot be changed after the initial channel handshake.
15732  *
15733  * Default value: false.
15734  */
15735 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
15736
15737 /**
15738  * Set to announce the channel publicly and notify all nodes that they can route via this
15739  * channel.
15740  *
15741  * This should only be set to true for nodes which expect to be online reliably.
15742  *
15743  * As the node which funds a channel picks this value this will only apply for new outbound
15744  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
15745  *
15746  * This cannot be changed after the initial channel handshake.
15747  *
15748  * Default value: false.
15749  */
15750 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
15751
15752 /**
15753  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
15754  * supports it, they will then enforce the mutual-close output to us matches what we provided
15755  * at intialization, preventing us from closing to an alternate pubkey.
15756  *
15757  * This is set to true by default to provide a slight increase in security, though ultimately
15758  * any attacker who is able to take control of a channel can just as easily send the funds via
15759  * lightning payments, so we never require that our counterparties support this option.
15760  *
15761  * This cannot be changed after a channel has been initialized.
15762  *
15763  * Default value: true.
15764  */
15765 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
15766
15767 /**
15768  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
15769  * supports it, they will then enforce the mutual-close output to us matches what we provided
15770  * at intialization, preventing us from closing to an alternate pubkey.
15771  *
15772  * This is set to true by default to provide a slight increase in security, though ultimately
15773  * any attacker who is able to take control of a channel can just as easily send the funds via
15774  * lightning payments, so we never require that our counterparties support this option.
15775  *
15776  * This cannot be changed after a channel has been initialized.
15777  *
15778  * Default value: true.
15779  */
15780 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
15781
15782 /**
15783  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
15784  * small to claim on-chain.
15785  *
15786  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
15787  * not be claimable on-chain, instead being turned into additional miner fees if either
15788  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
15789  * to such payments may be sustantial if there are many dust HTLCs present when the
15790  * channel is force-closed.
15791  *
15792  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
15793  * exposure across all three types per-channel. Setting this too low may prevent the
15794  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
15795  * important to prevent stealing of dust HTLCs by miners.
15796  *
15797  * Default value: 5_000_000 msat.
15798  */
15799 uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
15800
15801 /**
15802  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
15803  * small to claim on-chain.
15804  *
15805  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
15806  * not be claimable on-chain, instead being turned into additional miner fees if either
15807  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
15808  * to such payments may be sustantial if there are many dust HTLCs present when the
15809  * channel is force-closed.
15810  *
15811  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
15812  * exposure across all three types per-channel. Setting this too low may prevent the
15813  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
15814  * important to prevent stealing of dust HTLCs by miners.
15815  *
15816  * Default value: 5_000_000 msat.
15817  */
15818 void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
15819
15820 /**
15821  * The additional fee we're willing to pay to avoid waiting for the counterparty's
15822  * `to_self_delay` to reclaim funds.
15823  *
15824  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
15825  * closing transaction which both sides find acceptable, ultimately paid by the channel
15826  * funder/initiator.
15827  *
15828  * When we are the funder, because we have to pay the channel closing fee, we bound the
15829  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
15830  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
15831  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
15832  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
15833  * funds.
15834  *
15835  * When we are not the funder, we require the closing transaction fee pay at least our
15836  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
15837  * Thus, this value is ignored when we are not the funder.
15838  *
15839  * Default value: 1000 satoshis.
15840  *
15841  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
15842  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
15843  */
15844 uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
15845
15846 /**
15847  * The additional fee we're willing to pay to avoid waiting for the counterparty's
15848  * `to_self_delay` to reclaim funds.
15849  *
15850  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
15851  * closing transaction which both sides find acceptable, ultimately paid by the channel
15852  * funder/initiator.
15853  *
15854  * When we are the funder, because we have to pay the channel closing fee, we bound the
15855  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
15856  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
15857  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
15858  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
15859  * funds.
15860  *
15861  * When we are not the funder, we require the closing transaction fee pay at least our
15862  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
15863  * Thus, this value is ignored when we are not the funder.
15864  *
15865  * Default value: 1000 satoshis.
15866  *
15867  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
15868  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
15869  */
15870 void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
15871
15872 /**
15873  * Constructs a new ChannelConfig given each field
15874  */
15875 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);
15876
15877 /**
15878  * Creates a copy of the ChannelConfig
15879  */
15880 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
15881
15882 /**
15883  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
15884  */
15885 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
15886
15887 /**
15888  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
15889  */
15890 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
15891
15892 /**
15893  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
15894  */
15895 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
15896
15897 /**
15898  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
15899  */
15900 void UserConfig_free(struct LDKUserConfig this_obj);
15901
15902 /**
15903  * Channel config that we propose to our counterparty.
15904  */
15905 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
15906
15907 /**
15908  * Channel config that we propose to our counterparty.
15909  */
15910 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
15911
15912 /**
15913  * Limits applied to our counterparty's proposed channel config settings.
15914  */
15915 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
15916
15917 /**
15918  * Limits applied to our counterparty's proposed channel config settings.
15919  */
15920 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
15921
15922 /**
15923  * Channel config which affects behavior during channel lifetime.
15924  */
15925 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
15926
15927 /**
15928  * Channel config which affects behavior during channel lifetime.
15929  */
15930 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
15931
15932 /**
15933  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
15934  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
15935  * node which is not online reliably.
15936  *
15937  * For nodes which are not online reliably, you should set all channels to *not* be announced
15938  * (using [`ChannelConfig::announced_channel`] and
15939  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
15940  * ensure you are not exposed to any forwarding risk.
15941  *
15942  * Note that because you cannot change a channel's announced state after creation, there is no
15943  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
15944  * from a publicly-announced forwarding node to a private non-forwarding node you must close
15945  * all your channels and open new ones. For privacy, you should also change your node_id
15946  * (swapping all private and public key material for new ones) at that time.
15947  *
15948  * Default value: false.
15949  */
15950 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
15951
15952 /**
15953  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
15954  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
15955  * node which is not online reliably.
15956  *
15957  * For nodes which are not online reliably, you should set all channels to *not* be announced
15958  * (using [`ChannelConfig::announced_channel`] and
15959  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
15960  * ensure you are not exposed to any forwarding risk.
15961  *
15962  * Note that because you cannot change a channel's announced state after creation, there is no
15963  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
15964  * from a publicly-announced forwarding node to a private non-forwarding node you must close
15965  * all your channels and open new ones. For privacy, you should also change your node_id
15966  * (swapping all private and public key material for new ones) at that time.
15967  *
15968  * Default value: false.
15969  */
15970 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
15971
15972 /**
15973  * Constructs a new UserConfig given each field
15974  */
15975 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);
15976
15977 /**
15978  * Creates a copy of the UserConfig
15979  */
15980 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
15981
15982 /**
15983  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
15984  */
15985 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
15986
15987 /**
15988  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
15989  */
15990 void BestBlock_free(struct LDKBestBlock this_obj);
15991
15992 /**
15993  * Creates a copy of the BestBlock
15994  */
15995 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
15996
15997 /**
15998  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
15999  * network.
16000  */
16001 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
16002
16003 /**
16004  * Returns a `BestBlock` as identified by the given block hash and height.
16005  */
16006 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
16007
16008 /**
16009  * Returns the best block hash.
16010  */
16011 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
16012
16013 /**
16014  * Returns the best block height.
16015  */
16016 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
16017
16018 /**
16019  * Creates a copy of the AccessError
16020  */
16021 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
16022
16023 /**
16024  * Utility method to constructs a new UnknownChain-variant AccessError
16025  */
16026 enum LDKAccessError AccessError_unknown_chain(void);
16027
16028 /**
16029  * Utility method to constructs a new UnknownTx-variant AccessError
16030  */
16031 enum LDKAccessError AccessError_unknown_tx(void);
16032
16033 /**
16034  * Calls the free function if one is set
16035  */
16036 void Access_free(struct LDKAccess this_ptr);
16037
16038 /**
16039  * Calls the free function if one is set
16040  */
16041 void Listen_free(struct LDKListen this_ptr);
16042
16043 /**
16044  * Calls the free function if one is set
16045  */
16046 void Confirm_free(struct LDKConfirm this_ptr);
16047
16048 /**
16049  * Creates a copy of the ChannelMonitorUpdateErr
16050  */
16051 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
16052
16053 /**
16054  * Utility method to constructs a new TemporaryFailure-variant ChannelMonitorUpdateErr
16055  */
16056 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void);
16057
16058 /**
16059  * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateErr
16060  */
16061 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void);
16062
16063 /**
16064  * Calls the free function if one is set
16065  */
16066 void Watch_free(struct LDKWatch this_ptr);
16067
16068 /**
16069  * Calls the free function if one is set
16070  */
16071 void Filter_free(struct LDKFilter this_ptr);
16072
16073 /**
16074  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
16075  */
16076 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
16077
16078 /**
16079  * First block where the transaction output may have been spent.
16080  *
16081  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
16082  */
16083 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
16084
16085 /**
16086  * First block where the transaction output may have been spent.
16087  *
16088  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
16089  */
16090 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16091
16092 /**
16093  * Outpoint identifying the transaction output.
16094  */
16095 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
16096
16097 /**
16098  * Outpoint identifying the transaction output.
16099  */
16100 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
16101
16102 /**
16103  * Spending condition of the transaction output.
16104  */
16105 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
16106
16107 /**
16108  * Spending condition of the transaction output.
16109  */
16110 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
16111
16112 /**
16113  * Constructs a new WatchedOutput given each field
16114  */
16115 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
16116
16117 /**
16118  * Creates a copy of the WatchedOutput
16119  */
16120 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
16121
16122 /**
16123  * Checks if two WatchedOutputs contain equal inner contents.
16124  */
16125 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
16126
16127 /**
16128  * Calls the free function if one is set
16129  */
16130 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
16131
16132 /**
16133  * Creates a copy of the ConfirmationTarget
16134  */
16135 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
16136
16137 /**
16138  * Utility method to constructs a new Background-variant ConfirmationTarget
16139  */
16140 enum LDKConfirmationTarget ConfirmationTarget_background(void);
16141
16142 /**
16143  * Utility method to constructs a new Normal-variant ConfirmationTarget
16144  */
16145 enum LDKConfirmationTarget ConfirmationTarget_normal(void);
16146
16147 /**
16148  * Utility method to constructs a new HighPriority-variant ConfirmationTarget
16149  */
16150 enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
16151
16152 /**
16153  * Checks if two ConfirmationTargets contain equal inner contents.
16154  * This ignores pointers and is_owned flags and looks at the values in fields.
16155  */
16156 bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
16157
16158 /**
16159  * Calls the free function if one is set
16160  */
16161 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
16162
16163 /**
16164  * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
16165  */
16166 void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj);
16167
16168 /**
16169  * Creates a copy of the MonitorUpdateId
16170  */
16171 struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
16172
16173 /**
16174  * Checks if two MonitorUpdateIds contain equal inner contents.
16175  */
16176 uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
16177
16178 /**
16179  * Checks if two MonitorUpdateIds contain equal inner contents.
16180  * This ignores pointers and is_owned flags and looks at the values in fields.
16181  * Two objects with NULL inner values will be considered "equal" here.
16182  */
16183 bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b);
16184
16185 /**
16186  * Calls the free function if one is set
16187  */
16188 void Persist_free(struct LDKPersist this_ptr);
16189
16190 /**
16191  * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL.
16192  */
16193 void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj);
16194
16195 /**
16196  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
16197  */
16198 void ChainMonitor_free(struct LDKChainMonitor this_obj);
16199
16200 /**
16201  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
16202  *
16203  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
16204  * will call back to it indicating transactions and outputs of interest. This allows clients to
16205  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
16206  * always need to fetch full blocks absent another means for determining which blocks contain
16207  * transactions relevant to the watched channels.
16208  */
16209 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
16210
16211 /**
16212  * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
16213  * claims which are awaiting confirmation.
16214  *
16215  * Includes the balances from each [`ChannelMonitor`] *except* those included in
16216  * `ignored_channels`, allowing you to filter out balances from channels which are still open
16217  * (and whose balance should likely be pulled from the [`ChannelDetails`]).
16218  *
16219  * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
16220  * inclusion in the return value.
16221  */
16222 MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
16223
16224 /**
16225  * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no
16226  * such [`ChannelMonitor`] is currently being monitored for.
16227  *
16228  * Note that the result holds a mutex over our monitor set, and should not be held
16229  * indefinitely.
16230  */
16231 MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo);
16232
16233 /**
16234  * Lists the funding outpoint of each [`ChannelMonitor`] being monitored.
16235  *
16236  * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always
16237  * monitoring for on-chain state resolutions.
16238  */
16239 MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
16240
16241 /**
16242  * Indicates the persistence of a [`ChannelMonitor`] has completed after
16243  * [`ChannelMonitorUpdateErr::TemporaryFailure`] was returned from an update operation.
16244  *
16245  * Thus, the anticipated use is, at a high level:
16246  *  1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
16247  *     update to disk and begins updating any remote (e.g. watchtower/backup) copies,
16248  *     returning [`ChannelMonitorUpdateErr::TemporaryFailure`],
16249  *  2) once all remote copies are updated, you call this function with the
16250  *     `completed_update_id` that completed, and once all pending updates have completed the
16251  *     channel will be re-enabled.
16252  *
16253  * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
16254  * registered [`ChannelMonitor`]s.
16255  */
16256 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);
16257
16258 /**
16259  * Constructs a new Listen which calls the relevant methods on this_arg.
16260  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
16261  */
16262 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
16263
16264 /**
16265  * Constructs a new Confirm which calls the relevant methods on this_arg.
16266  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
16267  */
16268 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
16269
16270 /**
16271  * Constructs a new Watch which calls the relevant methods on this_arg.
16272  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
16273  */
16274 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
16275
16276 /**
16277  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
16278  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
16279  */
16280 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
16281
16282 /**
16283  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
16284  */
16285 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
16286
16287 /**
16288  * The sequence number of this update. Updates *must* be replayed in-order according to this
16289  * sequence number (and updates may panic if they are not). The update_id values are strictly
16290  * increasing and increase by one for each new update, with one exception specified below.
16291  *
16292  * This sequence number is also used to track up to which points updates which returned
16293  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
16294  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
16295  *
16296  * The only instance where update_id values are not strictly increasing is the case where we
16297  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
16298  * its docs for more details.
16299  */
16300 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
16301
16302 /**
16303  * The sequence number of this update. Updates *must* be replayed in-order according to this
16304  * sequence number (and updates may panic if they are not). The update_id values are strictly
16305  * increasing and increase by one for each new update, with one exception specified below.
16306  *
16307  * This sequence number is also used to track up to which points updates which returned
16308  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
16309  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
16310  *
16311  * The only instance where update_id values are not strictly increasing is the case where we
16312  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
16313  * its docs for more details.
16314  */
16315 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
16316
16317 /**
16318  * Creates a copy of the ChannelMonitorUpdate
16319  */
16320 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
16321
16322 /**
16323  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
16324  */
16325 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
16326
16327 /**
16328  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
16329  */
16330 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
16331
16332 /**
16333  * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
16334  */
16335 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
16336
16337 struct LDKStr MonitorUpdateError_get_a(const struct LDKMonitorUpdateError *NONNULL_PTR this_ptr);
16338
16339 void MonitorUpdateError_set_a(struct LDKMonitorUpdateError *NONNULL_PTR this_ptr, struct LDKStr val);
16340
16341 /**
16342  * Constructs a new MonitorUpdateError given each field
16343  */
16344 MUST_USE_RES struct LDKMonitorUpdateError MonitorUpdateError_new(struct LDKStr a_arg);
16345
16346 /**
16347  * Creates a copy of the MonitorUpdateError
16348  */
16349 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
16350
16351 /**
16352  * Frees any resources used by the MonitorEvent
16353  */
16354 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
16355
16356 /**
16357  * Creates a copy of the MonitorEvent
16358  */
16359 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
16360
16361 /**
16362  * Utility method to constructs a new HTLCEvent-variant MonitorEvent
16363  */
16364 struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
16365
16366 /**
16367  * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
16368  */
16369 struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
16370
16371 /**
16372  * Utility method to constructs a new UpdateCompleted-variant MonitorEvent
16373  */
16374 struct LDKMonitorEvent MonitorEvent_update_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id);
16375
16376 /**
16377  * Utility method to constructs a new UpdateFailed-variant MonitorEvent
16378  */
16379 struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a);
16380
16381 /**
16382  * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
16383  */
16384 struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj);
16385
16386 /**
16387  * Read a MonitorEvent from a byte array, created by MonitorEvent_write
16388  */
16389 struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser);
16390
16391 /**
16392  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
16393  */
16394 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
16395
16396 /**
16397  * Creates a copy of the HTLCUpdate
16398  */
16399 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
16400
16401 /**
16402  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
16403  */
16404 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
16405
16406 /**
16407  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
16408  */
16409 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
16410
16411 /**
16412  * Frees any resources used by the Balance
16413  */
16414 void Balance_free(struct LDKBalance this_ptr);
16415
16416 /**
16417  * Creates a copy of the Balance
16418  */
16419 struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
16420
16421 /**
16422  * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
16423  */
16424 struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
16425
16426 /**
16427  * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
16428  */
16429 struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
16430
16431 /**
16432  * Utility method to constructs a new ContentiousClaimable-variant Balance
16433  */
16434 struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height);
16435
16436 /**
16437  * Utility method to constructs a new MaybeClaimableHTLCAwaitingTimeout-variant Balance
16438  */
16439 struct LDKBalance Balance_maybe_claimable_htlcawaiting_timeout(uint64_t claimable_amount_satoshis, uint32_t claimable_height);
16440
16441 /**
16442  * Checks if two Balances contain equal inner contents.
16443  * This ignores pointers and is_owned flags and looks at the values in fields.
16444  */
16445 bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
16446
16447 /**
16448  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
16449  */
16450 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
16451
16452 /**
16453  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
16454  */
16455 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
16456
16457 /**
16458  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
16459  * itself.
16460  *
16461  * panics if the given update is not the next update by update_id.
16462  */
16463 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);
16464
16465 /**
16466  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
16467  * ChannelMonitor.
16468  */
16469 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
16470
16471 /**
16472  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
16473  */
16474 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
16475
16476 /**
16477  * Gets a list of txids, with their output scripts (in the order they appear in the
16478  * transaction), which we must learn about spends of via block_connected().
16479  */
16480 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
16481
16482 /**
16483  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
16484  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
16485  * have been registered.
16486  */
16487 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
16488
16489 /**
16490  * Get the list of HTLCs who's status has been updated on chain. This should be called by
16491  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
16492  */
16493 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
16494
16495 /**
16496  * Gets the list of pending events which were generated by previous actions, clearing the list
16497  * in the process.
16498  *
16499  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
16500  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
16501  * no internal locking in ChannelMonitors.
16502  */
16503 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
16504
16505 /**
16506  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
16507  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
16508  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
16509  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
16510  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
16511  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
16512  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
16513  * out-of-band the other node operator to coordinate with him if option is available to you.
16514  * In any-case, choice is up to the user.
16515  */
16516 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);
16517
16518 /**
16519  * Processes transactions in a newly connected block, which may result in any of the following:
16520  * - update the monitor's state against resolved HTLCs
16521  * - punish the counterparty in the case of seeing a revoked commitment transaction
16522  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
16523  * - detect settled outputs for later spending
16524  * - schedule and bump any in-flight claims
16525  *
16526  * Returns any new outputs to watch from `txdata`; after called, these are also included in
16527  * [`get_outputs_to_watch`].
16528  *
16529  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
16530  */
16531 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);
16532
16533 /**
16534  * Determines if the disconnected block contained any transactions of interest and updates
16535  * appropriately.
16536  */
16537 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);
16538
16539 /**
16540  * Processes transactions confirmed in a block with the given header and height, returning new
16541  * outputs to watch. See [`block_connected`] for details.
16542  *
16543  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
16544  * blocks. See [`chain::Confirm`] for calling expectations.
16545  *
16546  * [`block_connected`]: Self::block_connected
16547  */
16548 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);
16549
16550 /**
16551  * Processes a transaction that was reorganized out of the chain.
16552  *
16553  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
16554  * than blocks. See [`chain::Confirm`] for calling expectations.
16555  *
16556  * [`block_disconnected`]: Self::block_disconnected
16557  */
16558 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);
16559
16560 /**
16561  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
16562  * [`block_connected`] for details.
16563  *
16564  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
16565  * blocks. See [`chain::Confirm`] for calling expectations.
16566  *
16567  * [`block_connected`]: Self::block_connected
16568  */
16569 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);
16570
16571 /**
16572  * Returns the set of txids that should be monitored for re-organization out of the chain.
16573  */
16574 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
16575
16576 /**
16577  * Gets the latest best block which was connected either via the [`chain::Listen`] or
16578  * [`chain::Confirm`] interfaces.
16579  */
16580 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
16581
16582 /**
16583  * Gets the balances in this channel which are either claimable by us if we were to
16584  * force-close the channel now or which are claimable on-chain (possibly awaiting
16585  * confirmation).
16586  *
16587  * Any balances in the channel which are available on-chain (excluding on-chain fees) are
16588  * included here until an [`Event::SpendableOutputs`] event has been generated for the
16589  * balance, or until our counterparty has claimed the balance and accrued several
16590  * confirmations on the claim transaction.
16591  *
16592  * Note that the balances available when you or your counterparty have broadcasted revoked
16593  * state(s) may not be fully captured here.
16594  *
16595  * See [`Balance`] for additional details on the types of claimable balances which
16596  * may be returned here and their meanings.
16597  */
16598 MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
16599
16600 /**
16601  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
16602  */
16603 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
16604
16605 /**
16606  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
16607  */
16608 void OutPoint_free(struct LDKOutPoint this_obj);
16609
16610 /**
16611  * The referenced transaction's txid.
16612  */
16613 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
16614
16615 /**
16616  * The referenced transaction's txid.
16617  */
16618 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16619
16620 /**
16621  * The index of the referenced output in its transaction's vout.
16622  */
16623 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
16624
16625 /**
16626  * The index of the referenced output in its transaction's vout.
16627  */
16628 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
16629
16630 /**
16631  * Constructs a new OutPoint given each field
16632  */
16633 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
16634
16635 /**
16636  * Creates a copy of the OutPoint
16637  */
16638 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
16639
16640 /**
16641  * Checks if two OutPoints contain equal inner contents.
16642  * This ignores pointers and is_owned flags and looks at the values in fields.
16643  * Two objects with NULL inner values will be considered "equal" here.
16644  */
16645 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
16646
16647 /**
16648  * Checks if two OutPoints contain equal inner contents.
16649  */
16650 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
16651
16652 /**
16653  * Convert an `OutPoint` to a lightning channel id.
16654  */
16655 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
16656
16657 /**
16658  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
16659  */
16660 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
16661
16662 /**
16663  * Read a OutPoint from a byte array, created by OutPoint_write
16664  */
16665 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
16666
16667 /**
16668  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
16669  */
16670 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
16671
16672 /**
16673  * The outpoint which is spendable
16674  */
16675 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
16676
16677 /**
16678  * The outpoint which is spendable
16679  */
16680 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
16681
16682 /**
16683  * Per commitment point to derive delayed_payment_key by key holder
16684  */
16685 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
16686
16687 /**
16688  * Per commitment point to derive delayed_payment_key by key holder
16689  */
16690 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16691
16692 /**
16693  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
16694  * the witness_script.
16695  */
16696 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
16697
16698 /**
16699  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
16700  * the witness_script.
16701  */
16702 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
16703
16704 /**
16705  * The output which is referenced by the given outpoint
16706  */
16707 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
16708
16709 /**
16710  * The revocation point specific to the commitment transaction which was broadcast. Used to
16711  * derive the witnessScript for this output.
16712  */
16713 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
16714
16715 /**
16716  * The revocation point specific to the commitment transaction which was broadcast. Used to
16717  * derive the witnessScript for this output.
16718  */
16719 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16720
16721 /**
16722  * Arbitrary identification information returned by a call to
16723  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
16724  * the channel to spend the output.
16725  */
16726 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
16727
16728 /**
16729  * Arbitrary identification information returned by a call to
16730  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
16731  * the channel to spend the output.
16732  */
16733 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16734
16735 /**
16736  * The value of the channel which this output originated from, possibly indirectly.
16737  */
16738 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
16739
16740 /**
16741  * The value of the channel which this output originated from, possibly indirectly.
16742  */
16743 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
16744
16745 /**
16746  * Constructs a new DelayedPaymentOutputDescriptor given each field
16747  */
16748 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);
16749
16750 /**
16751  * Creates a copy of the DelayedPaymentOutputDescriptor
16752  */
16753 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
16754
16755 /**
16756  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
16757  */
16758 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
16759
16760 /**
16761  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
16762  */
16763 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
16764
16765 /**
16766  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
16767  */
16768 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
16769
16770 /**
16771  * The outpoint which is spendable
16772  */
16773 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
16774
16775 /**
16776  * The outpoint which is spendable
16777  */
16778 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
16779
16780 /**
16781  * The output which is referenced by the given outpoint
16782  */
16783 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
16784
16785 /**
16786  * Arbitrary identification information returned by a call to
16787  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
16788  * the channel to spend the output.
16789  */
16790 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
16791
16792 /**
16793  * Arbitrary identification information returned by a call to
16794  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
16795  * the channel to spend the output.
16796  */
16797 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16798
16799 /**
16800  * The value of the channel which this transactions spends.
16801  */
16802 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
16803
16804 /**
16805  * The value of the channel which this transactions spends.
16806  */
16807 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
16808
16809 /**
16810  * Constructs a new StaticPaymentOutputDescriptor given each field
16811  */
16812 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);
16813
16814 /**
16815  * Creates a copy of the StaticPaymentOutputDescriptor
16816  */
16817 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
16818
16819 /**
16820  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
16821  */
16822 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
16823
16824 /**
16825  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
16826  */
16827 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
16828
16829 /**
16830  * Frees any resources used by the SpendableOutputDescriptor
16831  */
16832 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
16833
16834 /**
16835  * Creates a copy of the SpendableOutputDescriptor
16836  */
16837 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
16838
16839 /**
16840  * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
16841  */
16842 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output);
16843
16844 /**
16845  * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
16846  */
16847 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a);
16848
16849 /**
16850  * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
16851  */
16852 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
16853
16854 /**
16855  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
16856  */
16857 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
16858
16859 /**
16860  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
16861  */
16862 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
16863
16864 /**
16865  * Calls the free function if one is set
16866  */
16867 void BaseSign_free(struct LDKBaseSign this_ptr);
16868
16869 /**
16870  * Creates a copy of a Sign
16871  */
16872 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
16873
16874 /**
16875  * Calls the free function if one is set
16876  */
16877 void Sign_free(struct LDKSign this_ptr);
16878
16879 /**
16880  * Calls the free function if one is set
16881  */
16882 void KeysInterface_free(struct LDKKeysInterface this_ptr);
16883
16884 /**
16885  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
16886  */
16887 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
16888
16889 /**
16890  * Private key of anchor tx
16891  */
16892 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
16893
16894 /**
16895  * Private key of anchor tx
16896  */
16897 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
16898
16899 /**
16900  * Holder secret key for blinded revocation pubkey
16901  */
16902 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
16903
16904 /**
16905  * Holder secret key for blinded revocation pubkey
16906  */
16907 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
16908
16909 /**
16910  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
16911  */
16912 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
16913
16914 /**
16915  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
16916  */
16917 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
16918
16919 /**
16920  * Holder secret key used in HTLC tx
16921  */
16922 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
16923
16924 /**
16925  * Holder secret key used in HTLC tx
16926  */
16927 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
16928
16929 /**
16930  * Holder htlc secret key used in commitment tx htlc outputs
16931  */
16932 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
16933
16934 /**
16935  * Holder htlc secret key used in commitment tx htlc outputs
16936  */
16937 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
16938
16939 /**
16940  * Commitment seed
16941  */
16942 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
16943
16944 /**
16945  * Commitment seed
16946  */
16947 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16948
16949 /**
16950  * Creates a copy of the InMemorySigner
16951  */
16952 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
16953
16954 /**
16955  * Create a new InMemorySigner
16956  */
16957 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);
16958
16959 /**
16960  * Counterparty pubkeys.
16961  * Will panic if ready_channel wasn't called.
16962  */
16963 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
16964
16965 /**
16966  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
16967  * transactions, ie the amount of time that we have to wait to recover our funds if we
16968  * broadcast a transaction.
16969  * Will panic if ready_channel wasn't called.
16970  */
16971 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
16972
16973 /**
16974  * The contest_delay value specified by us and applied on transactions broadcastable
16975  * by our counterparty, ie the amount of time that they have to wait to recover their funds
16976  * if they broadcast a transaction.
16977  * Will panic if ready_channel wasn't called.
16978  */
16979 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
16980
16981 /**
16982  * Whether the holder is the initiator
16983  * Will panic if ready_channel wasn't called.
16984  */
16985 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
16986
16987 /**
16988  * Funding outpoint
16989  * Will panic if ready_channel wasn't called.
16990  */
16991 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
16992
16993 /**
16994  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
16995  * building transactions.
16996  *
16997  * Will panic if ready_channel wasn't called.
16998  */
16999 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
17000
17001 /**
17002  * Sign the single input of spend_tx at index `input_idx` which spends the output
17003  * described by descriptor, returning the witness stack for the input.
17004  *
17005  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
17006  * or is not spending the outpoint described by `descriptor.outpoint`.
17007  */
17008 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);
17009
17010 /**
17011  * Sign the single input of spend_tx at index `input_idx` which spends the output
17012  * described by descriptor, returning the witness stack for the input.
17013  *
17014  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
17015  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
17016  * sequence set to `descriptor.to_self_delay`.
17017  */
17018 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);
17019
17020 /**
17021  * Constructs a new BaseSign which calls the relevant methods on this_arg.
17022  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
17023  */
17024 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
17025
17026 /**
17027  * Constructs a new Sign which calls the relevant methods on this_arg.
17028  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
17029  */
17030 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
17031
17032 /**
17033  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
17034  */
17035 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
17036
17037 /**
17038  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
17039  */
17040 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
17041
17042 /**
17043  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
17044  */
17045 void KeysManager_free(struct LDKKeysManager this_obj);
17046
17047 /**
17048  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
17049  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
17050  * starting_time isn't strictly required to actually be a time, but it must absolutely,
17051  * without a doubt, be unique to this instance. ie if you start multiple times with the same
17052  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
17053  * simply use the current time (with very high precision).
17054  *
17055  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
17056  * obviously, starting_time should be unique every time you reload the library - it is only
17057  * used to generate new ephemeral key data (which will be stored by the individual channel if
17058  * necessary).
17059  *
17060  * Note that the seed is required to recover certain on-chain funds independent of
17061  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
17062  * channel, and some on-chain during-closing funds.
17063  *
17064  * Note that until the 0.1 release there is no guarantee of backward compatibility between
17065  * versions. Once the library is more fully supported, the docs will be updated to include a
17066  * detailed description of the guarantee.
17067  */
17068 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
17069
17070 /**
17071  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
17072  *
17073  * Key derivation parameters are accessible through a per-channel secrets
17074  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
17075  * onchain output detection for which a corresponding delayed_payment_key must be derived.
17076  */
17077 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]);
17078
17079 /**
17080  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
17081  * output to the given change destination (if sufficient change value remains). The
17082  * transaction will have a feerate, at least, of the given value.
17083  *
17084  * Returns `Err(())` if the output value is greater than the input value minus required fee or
17085  * if a descriptor was duplicated.
17086  *
17087  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
17088  *
17089  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
17090  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
17091  */
17092 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);
17093
17094 /**
17095  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
17096  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
17097  */
17098 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
17099
17100 /**
17101  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
17102  */
17103 void ChannelManager_free(struct LDKChannelManager this_obj);
17104
17105 /**
17106  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
17107  */
17108 void ChainParameters_free(struct LDKChainParameters this_obj);
17109
17110 /**
17111  * The network for determining the `chain_hash` in Lightning messages.
17112  */
17113 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
17114
17115 /**
17116  * The network for determining the `chain_hash` in Lightning messages.
17117  */
17118 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
17119
17120 /**
17121  * The hash and height of the latest block successfully connected.
17122  *
17123  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
17124  */
17125 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
17126
17127 /**
17128  * The hash and height of the latest block successfully connected.
17129  *
17130  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
17131  */
17132 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
17133
17134 /**
17135  * Constructs a new ChainParameters given each field
17136  */
17137 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
17138
17139 /**
17140  * Creates a copy of the ChainParameters
17141  */
17142 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
17143
17144 /**
17145  * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL.
17146  */
17147 void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
17148
17149 /**
17150  * Base routing fee in millisatoshis.
17151  */
17152 uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
17153
17154 /**
17155  * Base routing fee in millisatoshis.
17156  */
17157 void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
17158
17159 /**
17160  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
17161  */
17162 uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
17163
17164 /**
17165  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
17166  */
17167 void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
17168
17169 /**
17170  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
17171  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
17172  * `cltv_expiry_delta` for more details.
17173  */
17174 uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
17175
17176 /**
17177  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
17178  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
17179  * `cltv_expiry_delta` for more details.
17180  */
17181 void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
17182
17183 /**
17184  * Constructs a new CounterpartyForwardingInfo given each field
17185  */
17186 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);
17187
17188 /**
17189  * Creates a copy of the CounterpartyForwardingInfo
17190  */
17191 struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
17192
17193 /**
17194  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
17195  */
17196 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
17197
17198 /**
17199  * The node_id of our counterparty
17200  */
17201 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
17202
17203 /**
17204  * The node_id of our counterparty
17205  */
17206 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17207
17208 /**
17209  * The Features the channel counterparty provided upon last connection.
17210  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
17211  * many routing-relevant features are present in the init context.
17212  */
17213 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
17214
17215 /**
17216  * The Features the channel counterparty provided upon last connection.
17217  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
17218  * many routing-relevant features are present in the init context.
17219  */
17220 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
17221
17222 /**
17223  * The value, in satoshis, that must always be held in the channel for our counterparty. This
17224  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
17225  * claiming at least this value on chain.
17226  *
17227  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
17228  *
17229  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
17230  */
17231 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
17232
17233 /**
17234  * The value, in satoshis, that must always be held in the channel for our counterparty. This
17235  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
17236  * claiming at least this value on chain.
17237  *
17238  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
17239  *
17240  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
17241  */
17242 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
17243
17244 /**
17245  * Information on the fees and requirements that the counterparty requires when forwarding
17246  * payments to us through this channel.
17247  *
17248  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
17249  */
17250 struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
17251
17252 /**
17253  * Information on the fees and requirements that the counterparty requires when forwarding
17254  * payments to us through this channel.
17255  *
17256  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
17257  */
17258 void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
17259
17260 /**
17261  * Constructs a new ChannelCounterparty given each field
17262  */
17263 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);
17264
17265 /**
17266  * Creates a copy of the ChannelCounterparty
17267  */
17268 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
17269
17270 /**
17271  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
17272  */
17273 void ChannelDetails_free(struct LDKChannelDetails this_obj);
17274
17275 /**
17276  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
17277  * thereafter this is the txid of the funding transaction xor the funding transaction output).
17278  * Note that this means this value is *not* persistent - it can change once during the
17279  * lifetime of the channel.
17280  */
17281 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
17282
17283 /**
17284  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
17285  * thereafter this is the txid of the funding transaction xor the funding transaction output).
17286  * Note that this means this value is *not* persistent - it can change once during the
17287  * lifetime of the channel.
17288  */
17289 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17290
17291 /**
17292  * Parameters which apply to our counterparty. See individual fields for more information.
17293  */
17294 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17295
17296 /**
17297  * Parameters which apply to our counterparty. See individual fields for more information.
17298  */
17299 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
17300
17301 /**
17302  * The Channel's funding transaction output, if we've negotiated the funding transaction with
17303  * our counterparty already.
17304  *
17305  * Note that, if this has been set, `channel_id` will be equivalent to
17306  * `funding_txo.unwrap().to_channel_id()`.
17307  *
17308  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
17309  */
17310 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17311
17312 /**
17313  * The Channel's funding transaction output, if we've negotiated the funding transaction with
17314  * our counterparty already.
17315  *
17316  * Note that, if this has been set, `channel_id` will be equivalent to
17317  * `funding_txo.unwrap().to_channel_id()`.
17318  *
17319  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
17320  */
17321 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
17322
17323 /**
17324  * The position of the funding transaction in the chain. None if the funding transaction has
17325  * not yet been confirmed and the channel fully opened.
17326  */
17327 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17328
17329 /**
17330  * The position of the funding transaction in the chain. None if the funding transaction has
17331  * not yet been confirmed and the channel fully opened.
17332  */
17333 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17334
17335 /**
17336  * The value, in satoshis, of this channel as appears in the funding output
17337  */
17338 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17339
17340 /**
17341  * The value, in satoshis, of this channel as appears in the funding output
17342  */
17343 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
17344
17345 /**
17346  * The value, in satoshis, that must always be held in the channel for us. This value ensures
17347  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
17348  * this value on chain.
17349  *
17350  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
17351  *
17352  * This value will be `None` for outbound channels until the counterparty accepts the channel.
17353  *
17354  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
17355  */
17356 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17357
17358 /**
17359  * The value, in satoshis, that must always be held in the channel for us. This value ensures
17360  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
17361  * this value on chain.
17362  *
17363  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
17364  *
17365  * This value will be `None` for outbound channels until the counterparty accepts the channel.
17366  *
17367  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
17368  */
17369 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17370
17371 /**
17372  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
17373  */
17374 uint64_t ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17375
17376 /**
17377  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
17378  */
17379 void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
17380
17381 /**
17382  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
17383  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
17384  * available for inclusion in new outbound HTLCs). This further does not include any pending
17385  * outgoing HTLCs which are awaiting some other resolution to be sent.
17386  *
17387  * This value is not exact. Due to various in-flight changes, feerate changes, and our
17388  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
17389  * should be able to spend nearly this amount.
17390  */
17391 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17392
17393 /**
17394  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
17395  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
17396  * available for inclusion in new outbound HTLCs). This further does not include any pending
17397  * outgoing HTLCs which are awaiting some other resolution to be sent.
17398  *
17399  * This value is not exact. Due to various in-flight changes, feerate changes, and our
17400  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
17401  * should be able to spend nearly this amount.
17402  */
17403 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
17404
17405 /**
17406  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
17407  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
17408  * available for inclusion in new inbound HTLCs).
17409  * Note that there are some corner cases not fully handled here, so the actual available
17410  * inbound capacity may be slightly higher than this.
17411  *
17412  * This value is not exact. Due to various in-flight changes, feerate changes, and our
17413  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
17414  * However, our counterparty should be able to spend nearly this amount.
17415  */
17416 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17417
17418 /**
17419  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
17420  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
17421  * available for inclusion in new inbound HTLCs).
17422  * Note that there are some corner cases not fully handled here, so the actual available
17423  * inbound capacity may be slightly higher than this.
17424  *
17425  * This value is not exact. Due to various in-flight changes, feerate changes, and our
17426  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
17427  * However, our counterparty should be able to spend nearly this amount.
17428  */
17429 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
17430
17431 /**
17432  * The number of required confirmations on the funding transaction before the funding will be
17433  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
17434  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
17435  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
17436  * [`ChannelHandshakeLimits::max_minimum_depth`].
17437  *
17438  * This value will be `None` for outbound channels until the counterparty accepts the channel.
17439  *
17440  * [`is_outbound`]: ChannelDetails::is_outbound
17441  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
17442  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
17443  */
17444 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17445
17446 /**
17447  * The number of required confirmations on the funding transaction before the funding will be
17448  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
17449  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
17450  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
17451  * [`ChannelHandshakeLimits::max_minimum_depth`].
17452  *
17453  * This value will be `None` for outbound channels until the counterparty accepts the channel.
17454  *
17455  * [`is_outbound`]: ChannelDetails::is_outbound
17456  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
17457  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
17458  */
17459 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
17460
17461 /**
17462  * The number of blocks (after our commitment transaction confirms) that we will need to wait
17463  * until we can claim our funds after we force-close the channel. During this time our
17464  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
17465  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
17466  * time to claim our non-HTLC-encumbered funds.
17467  *
17468  * This value will be `None` for outbound channels until the counterparty accepts the channel.
17469  */
17470 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17471
17472 /**
17473  * The number of blocks (after our commitment transaction confirms) that we will need to wait
17474  * until we can claim our funds after we force-close the channel. During this time our
17475  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
17476  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
17477  * time to claim our non-HTLC-encumbered funds.
17478  *
17479  * This value will be `None` for outbound channels until the counterparty accepts the channel.
17480  */
17481 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
17482
17483 /**
17484  * True if the channel was initiated (and thus funded) by us.
17485  */
17486 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17487
17488 /**
17489  * True if the channel was initiated (and thus funded) by us.
17490  */
17491 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
17492
17493 /**
17494  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
17495  * channel is not currently being shut down. `funding_locked` message exchange implies the
17496  * required confirmation count has been reached (and we were connected to the peer at some
17497  * point after the funding transaction received enough confirmations). The required
17498  * confirmation count is provided in [`confirmations_required`].
17499  *
17500  * [`confirmations_required`]: ChannelDetails::confirmations_required
17501  */
17502 bool ChannelDetails_get_is_funding_locked(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17503
17504 /**
17505  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
17506  * channel is not currently being shut down. `funding_locked` message exchange implies the
17507  * required confirmation count has been reached (and we were connected to the peer at some
17508  * point after the funding transaction received enough confirmations). The required
17509  * confirmation count is provided in [`confirmations_required`].
17510  *
17511  * [`confirmations_required`]: ChannelDetails::confirmations_required
17512  */
17513 void ChannelDetails_set_is_funding_locked(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
17514
17515 /**
17516  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
17517  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
17518  *
17519  * This is a strict superset of `is_funding_locked`.
17520  */
17521 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17522
17523 /**
17524  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
17525  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
17526  *
17527  * This is a strict superset of `is_funding_locked`.
17528  */
17529 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
17530
17531 /**
17532  * True if this channel is (or will be) publicly-announced.
17533  */
17534 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
17535
17536 /**
17537  * True if this channel is (or will be) publicly-announced.
17538  */
17539 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
17540
17541 /**
17542  * Constructs a new ChannelDetails given each field
17543  */
17544 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);
17545
17546 /**
17547  * Creates a copy of the ChannelDetails
17548  */
17549 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
17550
17551 /**
17552  * Frees any resources used by the PaymentSendFailure
17553  */
17554 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
17555
17556 /**
17557  * Creates a copy of the PaymentSendFailure
17558  */
17559 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
17560
17561 /**
17562  * Utility method to constructs a new ParameterError-variant PaymentSendFailure
17563  */
17564 struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a);
17565
17566 /**
17567  * Utility method to constructs a new PathParameterError-variant PaymentSendFailure
17568  */
17569 struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a);
17570
17571 /**
17572  * Utility method to constructs a new AllFailedRetrySafe-variant PaymentSendFailure
17573  */
17574 struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDKCVec_APIErrorZ a);
17575
17576 /**
17577  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
17578  */
17579 struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id);
17580
17581 /**
17582  * Constructs a new ChannelManager to hold several channels and route between them.
17583  *
17584  * This is the main \"logic hub\" for all channel-related actions, and implements
17585  * ChannelMessageHandler.
17586  *
17587  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
17588  *
17589  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
17590  *
17591  * Users need to notify the new ChannelManager when a new block is connected or
17592  * disconnected using its `block_connected` and `block_disconnected` methods, starting
17593  * from after `params.latest_hash`.
17594  */
17595 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);
17596
17597 /**
17598  * Gets the current configuration applied to all new channels,  as
17599  */
17600 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
17601
17602 /**
17603  * Creates a new outbound channel to the given remote node and with the given value.
17604  *
17605  * `user_channel_id` will be provided back as in
17606  * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
17607  * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 0
17608  * for inbound channels, so you may wish to avoid using 0 for `user_channel_id` here.
17609  * `user_channel_id` has no meaning inside of LDK, it is simply copied to events and otherwise
17610  * ignored.
17611  *
17612  * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
17613  * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
17614  *
17615  * Note that we do not check if you are currently connected to the given peer. If no
17616  * connection is available, the outbound `open_channel` message may fail to send, resulting in
17617  * the channel eventually being silently forgotten (dropped on reload).
17618  *
17619  * Returns the new Channel's temporary `channel_id`. This ID will appear as
17620  * [`Event::FundingGenerationReady::temporary_channel_id`] and in
17621  * [`ChannelDetails::channel_id`] until after
17622  * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
17623  * one derived from the funding transaction's TXID. If the counterparty rejects the channel
17624  * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
17625  *
17626  * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
17627  * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
17628  * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
17629  *
17630  * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
17631  */
17632 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);
17633
17634 /**
17635  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
17636  * more information.
17637  */
17638 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
17639
17640 /**
17641  * Gets the list of usable channels, in random order. Useful as an argument to
17642  * get_route to ensure non-announced channels are used.
17643  *
17644  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
17645  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
17646  * are.
17647  */
17648 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
17649
17650 /**
17651  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
17652  * will be accepted on the given channel, and after additional timeout/the closing of all
17653  * pending HTLCs, the channel will be closed on chain.
17654  *
17655  *  * If we are the channel initiator, we will pay between our [`Background`] and
17656  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
17657  *    estimate.
17658  *  * If our counterparty is the channel initiator, we will require a channel closing
17659  *    transaction feerate of at least our [`Background`] feerate or the feerate which
17660  *    would appear on a force-closure transaction, whichever is lower. We will allow our
17661  *    counterparty to pay as much fee as they'd like, however.
17662  *
17663  * May generate a SendShutdown message event on success, which should be relayed.
17664  *
17665  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
17666  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
17667  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
17668  */
17669 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
17670
17671 /**
17672  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
17673  * will be accepted on the given channel, and after additional timeout/the closing of all
17674  * pending HTLCs, the channel will be closed on chain.
17675  *
17676  * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
17677  * the channel being closed or not:
17678  *  * If we are the channel initiator, we will pay at least this feerate on the closing
17679  *    transaction. The upper-bound is set by
17680  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
17681  *    estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
17682  *  * If our counterparty is the channel initiator, we will refuse to accept a channel closure
17683  *    transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
17684  *    will appear on a force-closure transaction, whichever is lower).
17685  *
17686  * May generate a SendShutdown message event on success, which should be relayed.
17687  *
17688  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
17689  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
17690  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
17691  */
17692 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);
17693
17694 /**
17695  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
17696  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
17697  */
17698 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
17699
17700 /**
17701  * Force close all channels, immediately broadcasting the latest local commitment transaction
17702  * for each to the chain and rejecting new HTLCs on each.
17703  */
17704 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
17705
17706 /**
17707  * Sends a payment along a given route.
17708  *
17709  * Value parameters are provided via the last hop in route, see documentation for RouteHop
17710  * fields for more info.
17711  *
17712  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
17713  * payment), we don't do anything to stop you! We always try to ensure that if the provided
17714  * next hop knows the preimage to payment_hash they can claim an additional amount as
17715  * specified in the last hop in the route! Thus, you should probably do your own
17716  * payment_preimage tracking (which you should already be doing as they represent \"proof of
17717  * payment\") and prevent double-sends yourself.
17718  *
17719  * May generate SendHTLCs message(s) event on success, which should be relayed.
17720  *
17721  * Each path may have a different return value, and PaymentSendValue may return a Vec with
17722  * each entry matching the corresponding-index entry in the route paths, see
17723  * PaymentSendFailure for more info.
17724  *
17725  * In general, a path may raise:
17726  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
17727  *    node public key) is specified.
17728  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
17729  *    (including due to previous monitor update failure or new permanent monitor update
17730  *    failure).
17731  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
17732  *    relevant updates.
17733  *
17734  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
17735  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
17736  * different route unless you intend to pay twice!
17737  *
17738  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
17739  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
17740  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
17741  * must not contain multiple paths as multi-path payments require a recipient-provided
17742  * payment_secret.
17743  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
17744  * bit set (either as required or as available). If multiple paths are present in the Route,
17745  * we assume the invoice had the basic_mpp feature set.
17746  *
17747  * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
17748  */
17749 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);
17750
17751 /**
17752  * Retries a payment along the given [`Route`].
17753  *
17754  * Errors returned are a superset of those returned from [`send_payment`], so see
17755  * [`send_payment`] documentation for more details on errors. This method will also error if the
17756  * retry amount puts the payment more than 10% over the payment's total amount, or if the payment
17757  * for the given `payment_id` cannot be found (likely due to timeout or success).
17758  *
17759  * [`send_payment`]: [`ChannelManager::send_payment`]
17760  */
17761 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);
17762
17763 /**
17764  * Send a spontaneous payment, which is a payment that does not require the recipient to have
17765  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
17766  * the preimage, it must be a cryptographically secure random value that no intermediate node
17767  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
17768  * never reach the recipient.
17769  *
17770  * See [`send_payment`] documentation for more details on the return value of this function.
17771  *
17772  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
17773  * [`send_payment`] for more information about the risks of duplicate preimage usage.
17774  *
17775  * Note that `route` must have exactly one path.
17776  *
17777  * [`send_payment`]: Self::send_payment
17778  *
17779  * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
17780  */
17781 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);
17782
17783 /**
17784  * Call this upon creation of a funding transaction for the given channel.
17785  *
17786  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
17787  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
17788  *
17789  * Panics if a funding transaction has already been provided for this channel.
17790  *
17791  * May panic if the output found in the funding transaction is duplicative with some other
17792  * channel (note that this should be trivially prevented by using unique funding transaction
17793  * keys per-channel).
17794  *
17795  * Do NOT broadcast the funding transaction yourself. When we have safely received our
17796  * counterparty's signature the funding transaction will automatically be broadcast via the
17797  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
17798  *
17799  * Note that this includes RBF or similar transaction replacement strategies - lightning does
17800  * not currently support replacing a funding transaction on an existing channel. Instead,
17801  * create a new channel with a conflicting funding transaction.
17802  *
17803  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
17804  */
17805 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);
17806
17807 /**
17808  * Regenerates channel_announcements and generates a signed node_announcement from the given
17809  * arguments, providing them in corresponding events via
17810  * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed
17811  * on-chain. This effectively re-broadcasts all channel announcements and sends our node
17812  * announcement to ensure that the lightning P2P network is aware of the channels we have and
17813  * our network addresses.
17814  *
17815  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
17816  * node to humans. They carry no in-protocol meaning.
17817  *
17818  * `addresses` represent the set (possibly empty) of socket addresses on which this node
17819  * accepts incoming connections. These will be included in the node_announcement, publicly
17820  * tying these addresses together and to this node. If you wish to preserve user privacy,
17821  * addresses should likely contain only Tor Onion addresses.
17822  *
17823  * Panics if `addresses` is absurdly large (more than 500).
17824  *
17825  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
17826  */
17827 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
17828
17829 /**
17830  * Processes HTLCs which are pending waiting on random forward delay.
17831  *
17832  * Should only really ever be called in response to a PendingHTLCsForwardable event.
17833  * Will likely generate further events.
17834  */
17835 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
17836
17837 /**
17838  * Performs actions which should happen on startup and roughly once per minute thereafter.
17839  *
17840  * This currently includes:
17841  *  * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
17842  *  * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more
17843  *    than a minute, informing the network that they should no longer attempt to route over
17844  *    the channel.
17845  *
17846  * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate
17847  * estimate fetches.
17848  */
17849 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
17850
17851 /**
17852  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
17853  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
17854  * along the path (including in our own channel on which we received it).
17855  * Returns false if no payment was found to fail backwards, true if the process of failing the
17856  * HTLC backwards has been started.
17857  */
17858 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
17859
17860 /**
17861  * Provides a payment preimage in response to a PaymentReceived event, returning true and
17862  * generating message events for the net layer to claim the payment, if possible. Thus, you
17863  * should probably kick the net layer to go send messages if this returns true!
17864  *
17865  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
17866  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
17867  * event matches your expectation. If you fail to do so and call this method, you may provide
17868  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
17869  *
17870  * May panic if called except in response to a PaymentReceived event.
17871  *
17872  * [`create_inbound_payment`]: Self::create_inbound_payment
17873  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
17874  */
17875 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
17876
17877 /**
17878  * Gets the node_id held by this ChannelManager
17879  */
17880 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
17881
17882 /**
17883  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
17884  * to pay us.
17885  *
17886  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
17887  * [`PaymentHash`] and [`PaymentPreimage`] for you, returning the first and storing the second.
17888  *
17889  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
17890  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
17891  * passed directly to [`claim_funds`].
17892  *
17893  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
17894  *
17895  * [`claim_funds`]: Self::claim_funds
17896  * [`PaymentReceived`]: events::Event::PaymentReceived
17897  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
17898  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
17899  */
17900 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);
17901
17902 /**
17903  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
17904  * stored external to LDK.
17905  *
17906  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
17907  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
17908  * the `min_value_msat` provided here, if one is provided.
17909  *
17910  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) must be globally unique. This
17911  * method may return an Err if another payment with the same payment_hash is still pending.
17912  *
17913  * `user_payment_id` will be provided back in [`PaymentPurpose::InvoicePayment::user_payment_id`] events to
17914  * allow tracking of which events correspond with which calls to this and
17915  * [`create_inbound_payment`]. `user_payment_id` has no meaning inside of LDK, it is simply
17916  * copied to events and otherwise ignored. It may be used to correlate PaymentReceived events
17917  * with invoice metadata stored elsewhere.
17918  *
17919  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
17920  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
17921  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
17922  * sender \"proof-of-payment\" unless they have paid the required amount.
17923  *
17924  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
17925  * in excess of the current time. This should roughly match the expiry time set in the invoice.
17926  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
17927  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
17928  * invoices when no timeout is set.
17929  *
17930  * Note that we use block header time to time-out pending inbound payments (with some margin
17931  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
17932  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
17933  * If you need exact expiry semantics, you should enforce them upon receipt of
17934  * [`PaymentReceived`].
17935  *
17936  * Pending inbound payments are stored in memory and in serialized versions of this
17937  * [`ChannelManager`]. If potentially unbounded numbers of inbound payments may exist and
17938  * space is limited, you may wish to rate-limit inbound payment creation.
17939  *
17940  * May panic if `invoice_expiry_delta_secs` is greater than one year.
17941  *
17942  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
17943  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
17944  *
17945  * [`create_inbound_payment`]: Self::create_inbound_payment
17946  * [`PaymentReceived`]: events::Event::PaymentReceived
17947  * [`PaymentPurpose::InvoicePayment::user_payment_id`]: events::PaymentPurpose::InvoicePayment::user_payment_id
17948  */
17949 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);
17950
17951 /**
17952  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
17953  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
17954  */
17955 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
17956
17957 /**
17958  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
17959  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
17960  */
17961 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
17962
17963 /**
17964  * Constructs a new Listen which calls the relevant methods on this_arg.
17965  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
17966  */
17967 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
17968
17969 /**
17970  * Constructs a new Confirm which calls the relevant methods on this_arg.
17971  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
17972  */
17973 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
17974
17975 /**
17976  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
17977  * indicating whether persistence is necessary. Only one listener on
17978  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
17979  * up.
17980  * Note that the feature `allow_wallclock_use` must be enabled to use this function.
17981  */
17982 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
17983
17984 /**
17985  * Blocks until ChannelManager needs to be persisted. Only one listener on
17986  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
17987  * up.
17988  */
17989 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
17990
17991 /**
17992  * Gets the latest best block which was connected either via the [`chain::Listen`] or
17993  * [`chain::Confirm`] interfaces.
17994  */
17995 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
17996
17997 /**
17998  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
17999  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
18000  */
18001 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
18002
18003 /**
18004  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
18005  */
18006 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
18007
18008 /**
18009  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
18010  */
18011 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
18012
18013 /**
18014  * The keys provider which will give us relevant keys. Some keys will be loaded during
18015  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
18016  * signing data.
18017  */
18018 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
18019
18020 /**
18021  * The keys provider which will give us relevant keys. Some keys will be loaded during
18022  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
18023  * signing data.
18024  */
18025 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
18026
18027 /**
18028  * The fee_estimator for use in the ChannelManager in the future.
18029  *
18030  * No calls to the FeeEstimator will be made during deserialization.
18031  */
18032 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
18033
18034 /**
18035  * The fee_estimator for use in the ChannelManager in the future.
18036  *
18037  * No calls to the FeeEstimator will be made during deserialization.
18038  */
18039 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
18040
18041 /**
18042  * The chain::Watch for use in the ChannelManager in the future.
18043  *
18044  * No calls to the chain::Watch will be made during deserialization. It is assumed that
18045  * you have deserialized ChannelMonitors separately and will add them to your
18046  * chain::Watch after deserializing this ChannelManager.
18047  */
18048 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
18049
18050 /**
18051  * The chain::Watch for use in the ChannelManager in the future.
18052  *
18053  * No calls to the chain::Watch will be made during deserialization. It is assumed that
18054  * you have deserialized ChannelMonitors separately and will add them to your
18055  * chain::Watch after deserializing this ChannelManager.
18056  */
18057 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
18058
18059 /**
18060  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
18061  * used to broadcast the latest local commitment transactions of channels which must be
18062  * force-closed during deserialization.
18063  */
18064 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
18065
18066 /**
18067  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
18068  * used to broadcast the latest local commitment transactions of channels which must be
18069  * force-closed during deserialization.
18070  */
18071 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
18072
18073 /**
18074  * The Logger for use in the ChannelManager and which may be used to log information during
18075  * deserialization.
18076  */
18077 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
18078
18079 /**
18080  * The Logger for use in the ChannelManager and which may be used to log information during
18081  * deserialization.
18082  */
18083 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
18084
18085 /**
18086  * Default settings used for new channels. Any existing channels will continue to use the
18087  * runtime settings which were stored when the ChannelManager was serialized.
18088  */
18089 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
18090
18091 /**
18092  * Default settings used for new channels. Any existing channels will continue to use the
18093  * runtime settings which were stored when the ChannelManager was serialized.
18094  */
18095 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
18096
18097 /**
18098  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
18099  * HashMap for you. This is primarily useful for C bindings where it is not practical to
18100  * populate a HashMap directly from C.
18101  */
18102 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);
18103
18104 /**
18105  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
18106  */
18107 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
18108
18109 /**
18110  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
18111  */
18112 void DecodeError_free(struct LDKDecodeError this_obj);
18113
18114 /**
18115  * Creates a copy of the DecodeError
18116  */
18117 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
18118
18119 /**
18120  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
18121  */
18122 void Init_free(struct LDKInit this_obj);
18123
18124 /**
18125  * The relevant features which the sender supports
18126  */
18127 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
18128
18129 /**
18130  * The relevant features which the sender supports
18131  */
18132 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
18133
18134 /**
18135  * Constructs a new Init given each field
18136  */
18137 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
18138
18139 /**
18140  * Creates a copy of the Init
18141  */
18142 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
18143
18144 /**
18145  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
18146  */
18147 void ErrorMessage_free(struct LDKErrorMessage this_obj);
18148
18149 /**
18150  * The channel ID involved in the error
18151  */
18152 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
18153
18154 /**
18155  * The channel ID involved in the error
18156  */
18157 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18158
18159 /**
18160  * A possibly human-readable error description.
18161  * The string should be sanitized before it is used (e.g. emitted to logs
18162  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
18163  * vulnerability in the terminal emulator or the logging subsystem.
18164  */
18165 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
18166
18167 /**
18168  * A possibly human-readable error description.
18169  * The string should be sanitized before it is used (e.g. emitted to logs
18170  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
18171  * vulnerability in the terminal emulator or the logging subsystem.
18172  */
18173 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
18174
18175 /**
18176  * Constructs a new ErrorMessage given each field
18177  */
18178 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
18179
18180 /**
18181  * Creates a copy of the ErrorMessage
18182  */
18183 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
18184
18185 /**
18186  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
18187  */
18188 void Ping_free(struct LDKPing this_obj);
18189
18190 /**
18191  * The desired response length
18192  */
18193 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
18194
18195 /**
18196  * The desired response length
18197  */
18198 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
18199
18200 /**
18201  * The ping packet size.
18202  * This field is not sent on the wire. byteslen zeros are sent.
18203  */
18204 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
18205
18206 /**
18207  * The ping packet size.
18208  * This field is not sent on the wire. byteslen zeros are sent.
18209  */
18210 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
18211
18212 /**
18213  * Constructs a new Ping given each field
18214  */
18215 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
18216
18217 /**
18218  * Creates a copy of the Ping
18219  */
18220 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
18221
18222 /**
18223  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
18224  */
18225 void Pong_free(struct LDKPong this_obj);
18226
18227 /**
18228  * The pong packet size.
18229  * This field is not sent on the wire. byteslen zeros are sent.
18230  */
18231 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
18232
18233 /**
18234  * The pong packet size.
18235  * This field is not sent on the wire. byteslen zeros are sent.
18236  */
18237 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
18238
18239 /**
18240  * Constructs a new Pong given each field
18241  */
18242 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
18243
18244 /**
18245  * Creates a copy of the Pong
18246  */
18247 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
18248
18249 /**
18250  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
18251  */
18252 void OpenChannel_free(struct LDKOpenChannel this_obj);
18253
18254 /**
18255  * The genesis hash of the blockchain where the channel is to be opened
18256  */
18257 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
18258
18259 /**
18260  * The genesis hash of the blockchain where the channel is to be opened
18261  */
18262 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18263
18264 /**
18265  * A temporary channel ID, until the funding outpoint is announced
18266  */
18267 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
18268
18269 /**
18270  * A temporary channel ID, until the funding outpoint is announced
18271  */
18272 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18273
18274 /**
18275  * The channel value
18276  */
18277 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18278
18279 /**
18280  * The channel value
18281  */
18282 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
18283
18284 /**
18285  * The amount to push to the counterparty as part of the open, in milli-satoshi
18286  */
18287 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18288
18289 /**
18290  * The amount to push to the counterparty as part of the open, in milli-satoshi
18291  */
18292 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
18293
18294 /**
18295  * The threshold below which outputs on transactions broadcast by sender will be omitted
18296  */
18297 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18298
18299 /**
18300  * The threshold below which outputs on transactions broadcast by sender will be omitted
18301  */
18302 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
18303
18304 /**
18305  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
18306  */
18307 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18308
18309 /**
18310  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
18311  */
18312 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
18313
18314 /**
18315  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
18316  */
18317 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18318
18319 /**
18320  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
18321  */
18322 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
18323
18324 /**
18325  * The minimum HTLC size incoming to sender, in milli-satoshi
18326  */
18327 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18328
18329 /**
18330  * The minimum HTLC size incoming to sender, in milli-satoshi
18331  */
18332 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
18333
18334 /**
18335  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
18336  */
18337 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18338
18339 /**
18340  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
18341  */
18342 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
18343
18344 /**
18345  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
18346  */
18347 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18348
18349 /**
18350  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
18351  */
18352 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
18353
18354 /**
18355  * The maximum number of inbound HTLCs towards sender
18356  */
18357 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18358
18359 /**
18360  * The maximum number of inbound HTLCs towards sender
18361  */
18362 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
18363
18364 /**
18365  * The sender's key controlling the funding transaction
18366  */
18367 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18368
18369 /**
18370  * The sender's key controlling the funding transaction
18371  */
18372 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18373
18374 /**
18375  * Used to derive a revocation key for transactions broadcast by counterparty
18376  */
18377 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18378
18379 /**
18380  * Used to derive a revocation key for transactions broadcast by counterparty
18381  */
18382 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18383
18384 /**
18385  * A payment key to sender for transactions broadcast by counterparty
18386  */
18387 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18388
18389 /**
18390  * A payment key to sender for transactions broadcast by counterparty
18391  */
18392 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18393
18394 /**
18395  * Used to derive a payment key to sender for transactions broadcast by sender
18396  */
18397 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18398
18399 /**
18400  * Used to derive a payment key to sender for transactions broadcast by sender
18401  */
18402 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18403
18404 /**
18405  * Used to derive an HTLC payment key to sender
18406  */
18407 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18408
18409 /**
18410  * Used to derive an HTLC payment key to sender
18411  */
18412 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18413
18414 /**
18415  * The first to-be-broadcast-by-sender transaction's per commitment point
18416  */
18417 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18418
18419 /**
18420  * The first to-be-broadcast-by-sender transaction's per commitment point
18421  */
18422 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18423
18424 /**
18425  * Channel flags
18426  */
18427 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
18428
18429 /**
18430  * Channel flags
18431  */
18432 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
18433
18434 /**
18435  * Creates a copy of the OpenChannel
18436  */
18437 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
18438
18439 /**
18440  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
18441  */
18442 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
18443
18444 /**
18445  * A temporary channel ID, until the funding outpoint is announced
18446  */
18447 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
18448
18449 /**
18450  * A temporary channel ID, until the funding outpoint is announced
18451  */
18452 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18453
18454 /**
18455  * The threshold below which outputs on transactions broadcast by sender will be omitted
18456  */
18457 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
18458
18459 /**
18460  * The threshold below which outputs on transactions broadcast by sender will be omitted
18461  */
18462 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
18463
18464 /**
18465  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
18466  */
18467 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
18468
18469 /**
18470  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
18471  */
18472 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
18473
18474 /**
18475  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
18476  */
18477 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
18478
18479 /**
18480  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
18481  */
18482 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
18483
18484 /**
18485  * The minimum HTLC size incoming to sender, in milli-satoshi
18486  */
18487 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
18488
18489 /**
18490  * The minimum HTLC size incoming to sender, in milli-satoshi
18491  */
18492 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
18493
18494 /**
18495  * Minimum depth of the funding transaction before the channel is considered open
18496  */
18497 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
18498
18499 /**
18500  * Minimum depth of the funding transaction before the channel is considered open
18501  */
18502 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
18503
18504 /**
18505  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
18506  */
18507 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
18508
18509 /**
18510  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
18511  */
18512 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
18513
18514 /**
18515  * The maximum number of inbound HTLCs towards sender
18516  */
18517 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
18518
18519 /**
18520  * The maximum number of inbound HTLCs towards sender
18521  */
18522 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
18523
18524 /**
18525  * The sender's key controlling the funding transaction
18526  */
18527 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
18528
18529 /**
18530  * The sender's key controlling the funding transaction
18531  */
18532 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18533
18534 /**
18535  * Used to derive a revocation key for transactions broadcast by counterparty
18536  */
18537 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
18538
18539 /**
18540  * Used to derive a revocation key for transactions broadcast by counterparty
18541  */
18542 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18543
18544 /**
18545  * A payment key to sender for transactions broadcast by counterparty
18546  */
18547 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
18548
18549 /**
18550  * A payment key to sender for transactions broadcast by counterparty
18551  */
18552 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18553
18554 /**
18555  * Used to derive a payment key to sender for transactions broadcast by sender
18556  */
18557 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
18558
18559 /**
18560  * Used to derive a payment key to sender for transactions broadcast by sender
18561  */
18562 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18563
18564 /**
18565  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
18566  */
18567 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
18568
18569 /**
18570  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
18571  */
18572 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18573
18574 /**
18575  * The first to-be-broadcast-by-sender transaction's per commitment point
18576  */
18577 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
18578
18579 /**
18580  * The first to-be-broadcast-by-sender transaction's per commitment point
18581  */
18582 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18583
18584 /**
18585  * Creates a copy of the AcceptChannel
18586  */
18587 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
18588
18589 /**
18590  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
18591  */
18592 void FundingCreated_free(struct LDKFundingCreated this_obj);
18593
18594 /**
18595  * A temporary channel ID, until the funding is established
18596  */
18597 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
18598
18599 /**
18600  * A temporary channel ID, until the funding is established
18601  */
18602 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18603
18604 /**
18605  * The funding transaction ID
18606  */
18607 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
18608
18609 /**
18610  * The funding transaction ID
18611  */
18612 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18613
18614 /**
18615  * The specific output index funding this channel
18616  */
18617 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
18618
18619 /**
18620  * The specific output index funding this channel
18621  */
18622 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
18623
18624 /**
18625  * The signature of the channel initiator (funder) on the initial commitment transaction
18626  */
18627 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
18628
18629 /**
18630  * The signature of the channel initiator (funder) on the initial commitment transaction
18631  */
18632 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
18633
18634 /**
18635  * Constructs a new FundingCreated given each field
18636  */
18637 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);
18638
18639 /**
18640  * Creates a copy of the FundingCreated
18641  */
18642 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
18643
18644 /**
18645  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
18646  */
18647 void FundingSigned_free(struct LDKFundingSigned this_obj);
18648
18649 /**
18650  * The channel ID
18651  */
18652 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
18653
18654 /**
18655  * The channel ID
18656  */
18657 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18658
18659 /**
18660  * The signature of the channel acceptor (fundee) on the initial commitment transaction
18661  */
18662 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
18663
18664 /**
18665  * The signature of the channel acceptor (fundee) on the initial commitment transaction
18666  */
18667 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
18668
18669 /**
18670  * Constructs a new FundingSigned given each field
18671  */
18672 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
18673
18674 /**
18675  * Creates a copy of the FundingSigned
18676  */
18677 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
18678
18679 /**
18680  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
18681  */
18682 void FundingLocked_free(struct LDKFundingLocked this_obj);
18683
18684 /**
18685  * The channel ID
18686  */
18687 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
18688
18689 /**
18690  * The channel ID
18691  */
18692 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18693
18694 /**
18695  * The per-commitment point of the second commitment transaction
18696  */
18697 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
18698
18699 /**
18700  * The per-commitment point of the second commitment transaction
18701  */
18702 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18703
18704 /**
18705  * Constructs a new FundingLocked given each field
18706  */
18707 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
18708
18709 /**
18710  * Creates a copy of the FundingLocked
18711  */
18712 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
18713
18714 /**
18715  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
18716  */
18717 void Shutdown_free(struct LDKShutdown this_obj);
18718
18719 /**
18720  * The channel ID
18721  */
18722 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
18723
18724 /**
18725  * The channel ID
18726  */
18727 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18728
18729 /**
18730  * The destination of this peer's funds on closing.
18731  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
18732  */
18733 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
18734
18735 /**
18736  * The destination of this peer's funds on closing.
18737  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
18738  */
18739 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
18740
18741 /**
18742  * Constructs a new Shutdown given each field
18743  */
18744 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
18745
18746 /**
18747  * Creates a copy of the Shutdown
18748  */
18749 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
18750
18751 /**
18752  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
18753  */
18754 void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
18755
18756 /**
18757  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
18758  * transaction.
18759  */
18760 uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
18761
18762 /**
18763  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
18764  * transaction.
18765  */
18766 void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
18767
18768 /**
18769  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
18770  * transaction.
18771  */
18772 uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
18773
18774 /**
18775  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
18776  * transaction.
18777  */
18778 void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
18779
18780 /**
18781  * Constructs a new ClosingSignedFeeRange given each field
18782  */
18783 MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
18784
18785 /**
18786  * Creates a copy of the ClosingSignedFeeRange
18787  */
18788 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
18789
18790 /**
18791  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
18792  */
18793 void ClosingSigned_free(struct LDKClosingSigned this_obj);
18794
18795 /**
18796  * The channel ID
18797  */
18798 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
18799
18800 /**
18801  * The channel ID
18802  */
18803 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18804
18805 /**
18806  * The proposed total fee for the closing transaction
18807  */
18808 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
18809
18810 /**
18811  * The proposed total fee for the closing transaction
18812  */
18813 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
18814
18815 /**
18816  * A signature on the closing transaction
18817  */
18818 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
18819
18820 /**
18821  * A signature on the closing transaction
18822  */
18823 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
18824
18825 /**
18826  * The minimum and maximum fees which the sender is willing to accept, provided only by new
18827  * nodes.
18828  *
18829  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
18830  */
18831 struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
18832
18833 /**
18834  * The minimum and maximum fees which the sender is willing to accept, provided only by new
18835  * nodes.
18836  *
18837  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
18838  */
18839 void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
18840
18841 /**
18842  * Constructs a new ClosingSigned given each field
18843  */
18844 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);
18845
18846 /**
18847  * Creates a copy of the ClosingSigned
18848  */
18849 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
18850
18851 /**
18852  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
18853  */
18854 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
18855
18856 /**
18857  * The channel ID
18858  */
18859 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
18860
18861 /**
18862  * The channel ID
18863  */
18864 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18865
18866 /**
18867  * The HTLC ID
18868  */
18869 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
18870
18871 /**
18872  * The HTLC ID
18873  */
18874 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
18875
18876 /**
18877  * The HTLC value in milli-satoshi
18878  */
18879 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
18880
18881 /**
18882  * The HTLC value in milli-satoshi
18883  */
18884 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
18885
18886 /**
18887  * The payment hash, the pre-image of which controls HTLC redemption
18888  */
18889 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
18890
18891 /**
18892  * The payment hash, the pre-image of which controls HTLC redemption
18893  */
18894 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18895
18896 /**
18897  * The expiry height of the HTLC
18898  */
18899 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
18900
18901 /**
18902  * The expiry height of the HTLC
18903  */
18904 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
18905
18906 /**
18907  * Creates a copy of the UpdateAddHTLC
18908  */
18909 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
18910
18911 /**
18912  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
18913  */
18914 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
18915
18916 /**
18917  * The channel ID
18918  */
18919 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
18920
18921 /**
18922  * The channel ID
18923  */
18924 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18925
18926 /**
18927  * The HTLC ID
18928  */
18929 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
18930
18931 /**
18932  * The HTLC ID
18933  */
18934 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
18935
18936 /**
18937  * The pre-image of the payment hash, allowing HTLC redemption
18938  */
18939 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
18940
18941 /**
18942  * The pre-image of the payment hash, allowing HTLC redemption
18943  */
18944 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18945
18946 /**
18947  * Constructs a new UpdateFulfillHTLC given each field
18948  */
18949 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
18950
18951 /**
18952  * Creates a copy of the UpdateFulfillHTLC
18953  */
18954 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
18955
18956 /**
18957  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
18958  */
18959 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
18960
18961 /**
18962  * The channel ID
18963  */
18964 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
18965
18966 /**
18967  * The channel ID
18968  */
18969 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18970
18971 /**
18972  * The HTLC ID
18973  */
18974 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
18975
18976 /**
18977  * The HTLC ID
18978  */
18979 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
18980
18981 /**
18982  * Creates a copy of the UpdateFailHTLC
18983  */
18984 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
18985
18986 /**
18987  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
18988  */
18989 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
18990
18991 /**
18992  * The channel ID
18993  */
18994 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
18995
18996 /**
18997  * The channel ID
18998  */
18999 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19000
19001 /**
19002  * The HTLC ID
19003  */
19004 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
19005
19006 /**
19007  * The HTLC ID
19008  */
19009 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
19010
19011 /**
19012  * The failure code
19013  */
19014 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
19015
19016 /**
19017  * The failure code
19018  */
19019 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
19020
19021 /**
19022  * Creates a copy of the UpdateFailMalformedHTLC
19023  */
19024 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
19025
19026 /**
19027  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
19028  */
19029 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
19030
19031 /**
19032  * The channel ID
19033  */
19034 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
19035
19036 /**
19037  * The channel ID
19038  */
19039 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19040
19041 /**
19042  * A signature on the commitment transaction
19043  */
19044 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
19045
19046 /**
19047  * A signature on the commitment transaction
19048  */
19049 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
19050
19051 /**
19052  * Signatures on the HTLC transactions
19053  */
19054 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
19055
19056 /**
19057  * Constructs a new CommitmentSigned given each field
19058  */
19059 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
19060
19061 /**
19062  * Creates a copy of the CommitmentSigned
19063  */
19064 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
19065
19066 /**
19067  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
19068  */
19069 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
19070
19071 /**
19072  * The channel ID
19073  */
19074 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
19075
19076 /**
19077  * The channel ID
19078  */
19079 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19080
19081 /**
19082  * The secret corresponding to the per-commitment point
19083  */
19084 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
19085
19086 /**
19087  * The secret corresponding to the per-commitment point
19088  */
19089 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19090
19091 /**
19092  * The next sender-broadcast commitment transaction's per-commitment point
19093  */
19094 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
19095
19096 /**
19097  * The next sender-broadcast commitment transaction's per-commitment point
19098  */
19099 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19100
19101 /**
19102  * Constructs a new RevokeAndACK given each field
19103  */
19104 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);
19105
19106 /**
19107  * Creates a copy of the RevokeAndACK
19108  */
19109 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
19110
19111 /**
19112  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
19113  */
19114 void UpdateFee_free(struct LDKUpdateFee this_obj);
19115
19116 /**
19117  * The channel ID
19118  */
19119 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
19120
19121 /**
19122  * The channel ID
19123  */
19124 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19125
19126 /**
19127  * Fee rate per 1000-weight of the transaction
19128  */
19129 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
19130
19131 /**
19132  * Fee rate per 1000-weight of the transaction
19133  */
19134 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
19135
19136 /**
19137  * Constructs a new UpdateFee given each field
19138  */
19139 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
19140
19141 /**
19142  * Creates a copy of the UpdateFee
19143  */
19144 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
19145
19146 /**
19147  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
19148  */
19149 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
19150
19151 /**
19152  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
19153  * belonging to the recipient
19154  */
19155 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
19156
19157 /**
19158  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
19159  * belonging to the recipient
19160  */
19161 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19162
19163 /**
19164  * The sender's per-commitment point for their current commitment transaction
19165  */
19166 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
19167
19168 /**
19169  * The sender's per-commitment point for their current commitment transaction
19170  */
19171 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19172
19173 /**
19174  * Constructs a new DataLossProtect given each field
19175  */
19176 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
19177
19178 /**
19179  * Creates a copy of the DataLossProtect
19180  */
19181 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
19182
19183 /**
19184  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
19185  */
19186 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
19187
19188 /**
19189  * The channel ID
19190  */
19191 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
19192
19193 /**
19194  * The channel ID
19195  */
19196 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19197
19198 /**
19199  * The next commitment number for the sender
19200  */
19201 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
19202
19203 /**
19204  * The next commitment number for the sender
19205  */
19206 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
19207
19208 /**
19209  * The next commitment number for the recipient
19210  */
19211 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
19212
19213 /**
19214  * The next commitment number for the recipient
19215  */
19216 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
19217
19218 /**
19219  * Creates a copy of the ChannelReestablish
19220  */
19221 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
19222
19223 /**
19224  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
19225  */
19226 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
19227
19228 /**
19229  * The channel ID
19230  */
19231 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
19232
19233 /**
19234  * The channel ID
19235  */
19236 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19237
19238 /**
19239  * The short channel ID
19240  */
19241 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
19242
19243 /**
19244  * The short channel ID
19245  */
19246 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
19247
19248 /**
19249  * A signature by the node key
19250  */
19251 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
19252
19253 /**
19254  * A signature by the node key
19255  */
19256 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
19257
19258 /**
19259  * A signature by the funding key
19260  */
19261 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
19262
19263 /**
19264  * A signature by the funding key
19265  */
19266 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
19267
19268 /**
19269  * Constructs a new AnnouncementSignatures given each field
19270  */
19271 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);
19272
19273 /**
19274  * Creates a copy of the AnnouncementSignatures
19275  */
19276 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
19277
19278 /**
19279  * Frees any resources used by the NetAddress
19280  */
19281 void NetAddress_free(struct LDKNetAddress this_ptr);
19282
19283 /**
19284  * Creates a copy of the NetAddress
19285  */
19286 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
19287
19288 /**
19289  * Utility method to constructs a new IPv4-variant NetAddress
19290  */
19291 struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port);
19292
19293 /**
19294  * Utility method to constructs a new IPv6-variant NetAddress
19295  */
19296 struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port);
19297
19298 /**
19299  * Utility method to constructs a new OnionV2-variant NetAddress
19300  */
19301 struct LDKNetAddress NetAddress_onion_v2(struct LDKTenBytes addr, uint16_t port);
19302
19303 /**
19304  * Utility method to constructs a new OnionV3-variant NetAddress
19305  */
19306 struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port);
19307
19308 /**
19309  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
19310  */
19311 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
19312
19313 /**
19314  * Read a NetAddress from a byte array, created by NetAddress_write
19315  */
19316 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
19317
19318 /**
19319  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
19320  */
19321 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
19322
19323 /**
19324  * The advertised features
19325  */
19326 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
19327
19328 /**
19329  * The advertised features
19330  */
19331 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
19332
19333 /**
19334  * A strictly monotonic announcement counter, with gaps allowed
19335  */
19336 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
19337
19338 /**
19339  * A strictly monotonic announcement counter, with gaps allowed
19340  */
19341 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
19342
19343 /**
19344  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
19345  * to this node).
19346  */
19347 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
19348
19349 /**
19350  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
19351  * to this node).
19352  */
19353 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19354
19355 /**
19356  * An RGB color for UI purposes
19357  */
19358 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
19359
19360 /**
19361  * An RGB color for UI purposes
19362  */
19363 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
19364
19365 /**
19366  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
19367  * of uniqueness.
19368  */
19369 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
19370
19371 /**
19372  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
19373  * of uniqueness.
19374  */
19375 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19376
19377 /**
19378  * List of addresses on which this node is reachable
19379  */
19380 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
19381
19382 /**
19383  * Creates a copy of the UnsignedNodeAnnouncement
19384  */
19385 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
19386
19387 /**
19388  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
19389  */
19390 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
19391
19392 /**
19393  * The signature by the node key
19394  */
19395 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
19396
19397 /**
19398  * The signature by the node key
19399  */
19400 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
19401
19402 /**
19403  * The actual content of the announcement
19404  */
19405 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
19406
19407 /**
19408  * The actual content of the announcement
19409  */
19410 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
19411
19412 /**
19413  * Constructs a new NodeAnnouncement given each field
19414  */
19415 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
19416
19417 /**
19418  * Creates a copy of the NodeAnnouncement
19419  */
19420 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
19421
19422 /**
19423  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
19424  */
19425 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
19426
19427 /**
19428  * The advertised channel features
19429  */
19430 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
19431
19432 /**
19433  * The advertised channel features
19434  */
19435 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
19436
19437 /**
19438  * The genesis hash of the blockchain where the channel is to be opened
19439  */
19440 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
19441
19442 /**
19443  * The genesis hash of the blockchain where the channel is to be opened
19444  */
19445 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19446
19447 /**
19448  * The short channel ID
19449  */
19450 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
19451
19452 /**
19453  * The short channel ID
19454  */
19455 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
19456
19457 /**
19458  * One of the two node_ids which are endpoints of this channel
19459  */
19460 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
19461
19462 /**
19463  * One of the two node_ids which are endpoints of this channel
19464  */
19465 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19466
19467 /**
19468  * The other of the two node_ids which are endpoints of this channel
19469  */
19470 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
19471
19472 /**
19473  * The other of the two node_ids which are endpoints of this channel
19474  */
19475 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19476
19477 /**
19478  * The funding key for the first node
19479  */
19480 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
19481
19482 /**
19483  * The funding key for the first node
19484  */
19485 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19486
19487 /**
19488  * The funding key for the second node
19489  */
19490 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
19491
19492 /**
19493  * The funding key for the second node
19494  */
19495 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19496
19497 /**
19498  * Creates a copy of the UnsignedChannelAnnouncement
19499  */
19500 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
19501
19502 /**
19503  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
19504  */
19505 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
19506
19507 /**
19508  * Authentication of the announcement by the first public node
19509  */
19510 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
19511
19512 /**
19513  * Authentication of the announcement by the first public node
19514  */
19515 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
19516
19517 /**
19518  * Authentication of the announcement by the second public node
19519  */
19520 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
19521
19522 /**
19523  * Authentication of the announcement by the second public node
19524  */
19525 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
19526
19527 /**
19528  * Proof of funding UTXO ownership by the first public node
19529  */
19530 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
19531
19532 /**
19533  * Proof of funding UTXO ownership by the first public node
19534  */
19535 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
19536
19537 /**
19538  * Proof of funding UTXO ownership by the second public node
19539  */
19540 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
19541
19542 /**
19543  * Proof of funding UTXO ownership by the second public node
19544  */
19545 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
19546
19547 /**
19548  * The actual announcement
19549  */
19550 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
19551
19552 /**
19553  * The actual announcement
19554  */
19555 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
19556
19557 /**
19558  * Constructs a new ChannelAnnouncement given each field
19559  */
19560 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);
19561
19562 /**
19563  * Creates a copy of the ChannelAnnouncement
19564  */
19565 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
19566
19567 /**
19568  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
19569  */
19570 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
19571
19572 /**
19573  * The genesis hash of the blockchain where the channel is to be opened
19574  */
19575 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
19576
19577 /**
19578  * The genesis hash of the blockchain where the channel is to be opened
19579  */
19580 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19581
19582 /**
19583  * The short channel ID
19584  */
19585 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
19586
19587 /**
19588  * The short channel ID
19589  */
19590 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
19591
19592 /**
19593  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
19594  */
19595 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
19596
19597 /**
19598  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
19599  */
19600 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
19601
19602 /**
19603  * Channel flags
19604  */
19605 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
19606
19607 /**
19608  * Channel flags
19609  */
19610 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
19611
19612 /**
19613  * The number of blocks such that if:
19614  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
19615  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
19616  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
19617  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
19618  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
19619  * forwarding. Note that the HTLC sender is the one who originally sets this value when
19620  * constructing the route.
19621  */
19622 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
19623
19624 /**
19625  * The number of blocks such that if:
19626  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
19627  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
19628  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
19629  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
19630  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
19631  * forwarding. Note that the HTLC sender is the one who originally sets this value when
19632  * constructing the route.
19633  */
19634 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
19635
19636 /**
19637  * The minimum HTLC size incoming to sender, in milli-satoshi
19638  */
19639 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
19640
19641 /**
19642  * The minimum HTLC size incoming to sender, in milli-satoshi
19643  */
19644 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
19645
19646 /**
19647  * The base HTLC fee charged by sender, in milli-satoshi
19648  */
19649 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
19650
19651 /**
19652  * The base HTLC fee charged by sender, in milli-satoshi
19653  */
19654 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
19655
19656 /**
19657  * The amount to fee multiplier, in micro-satoshi
19658  */
19659 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
19660
19661 /**
19662  * The amount to fee multiplier, in micro-satoshi
19663  */
19664 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
19665
19666 /**
19667  * Creates a copy of the UnsignedChannelUpdate
19668  */
19669 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
19670
19671 /**
19672  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
19673  */
19674 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
19675
19676 /**
19677  * A signature of the channel update
19678  */
19679 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
19680
19681 /**
19682  * A signature of the channel update
19683  */
19684 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
19685
19686 /**
19687  * The actual channel update
19688  */
19689 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
19690
19691 /**
19692  * The actual channel update
19693  */
19694 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
19695
19696 /**
19697  * Constructs a new ChannelUpdate given each field
19698  */
19699 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
19700
19701 /**
19702  * Creates a copy of the ChannelUpdate
19703  */
19704 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
19705
19706 /**
19707  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
19708  */
19709 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
19710
19711 /**
19712  * The genesis hash of the blockchain being queried
19713  */
19714 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
19715
19716 /**
19717  * The genesis hash of the blockchain being queried
19718  */
19719 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19720
19721 /**
19722  * The height of the first block for the channel UTXOs being queried
19723  */
19724 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
19725
19726 /**
19727  * The height of the first block for the channel UTXOs being queried
19728  */
19729 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
19730
19731 /**
19732  * The number of blocks to include in the query results
19733  */
19734 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
19735
19736 /**
19737  * The number of blocks to include in the query results
19738  */
19739 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
19740
19741 /**
19742  * Constructs a new QueryChannelRange given each field
19743  */
19744 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
19745
19746 /**
19747  * Creates a copy of the QueryChannelRange
19748  */
19749 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
19750
19751 /**
19752  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
19753  */
19754 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
19755
19756 /**
19757  * The genesis hash of the blockchain being queried
19758  */
19759 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
19760
19761 /**
19762  * The genesis hash of the blockchain being queried
19763  */
19764 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19765
19766 /**
19767  * The height of the first block in the range of the reply
19768  */
19769 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
19770
19771 /**
19772  * The height of the first block in the range of the reply
19773  */
19774 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
19775
19776 /**
19777  * The number of blocks included in the range of the reply
19778  */
19779 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
19780
19781 /**
19782  * The number of blocks included in the range of the reply
19783  */
19784 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
19785
19786 /**
19787  * True when this is the final reply for a query
19788  */
19789 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
19790
19791 /**
19792  * True when this is the final reply for a query
19793  */
19794 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
19795
19796 /**
19797  * The short_channel_ids in the channel range
19798  */
19799 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
19800
19801 /**
19802  * Constructs a new ReplyChannelRange given each field
19803  */
19804 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);
19805
19806 /**
19807  * Creates a copy of the ReplyChannelRange
19808  */
19809 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
19810
19811 /**
19812  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
19813  */
19814 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
19815
19816 /**
19817  * The genesis hash of the blockchain being queried
19818  */
19819 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
19820
19821 /**
19822  * The genesis hash of the blockchain being queried
19823  */
19824 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19825
19826 /**
19827  * The short_channel_ids that are being queried
19828  */
19829 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
19830
19831 /**
19832  * Constructs a new QueryShortChannelIds given each field
19833  */
19834 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
19835
19836 /**
19837  * Creates a copy of the QueryShortChannelIds
19838  */
19839 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
19840
19841 /**
19842  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
19843  */
19844 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
19845
19846 /**
19847  * The genesis hash of the blockchain that was queried
19848  */
19849 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
19850
19851 /**
19852  * The genesis hash of the blockchain that was queried
19853  */
19854 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19855
19856 /**
19857  * Indicates if the query recipient maintains up-to-date channel
19858  * information for the chain_hash
19859  */
19860 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
19861
19862 /**
19863  * Indicates if the query recipient maintains up-to-date channel
19864  * information for the chain_hash
19865  */
19866 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
19867
19868 /**
19869  * Constructs a new ReplyShortChannelIdsEnd given each field
19870  */
19871 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
19872
19873 /**
19874  * Creates a copy of the ReplyShortChannelIdsEnd
19875  */
19876 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
19877
19878 /**
19879  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
19880  */
19881 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
19882
19883 /**
19884  * The genesis hash of the blockchain for channel and node information
19885  */
19886 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
19887
19888 /**
19889  * The genesis hash of the blockchain for channel and node information
19890  */
19891 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19892
19893 /**
19894  * The starting unix timestamp
19895  */
19896 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
19897
19898 /**
19899  * The starting unix timestamp
19900  */
19901 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
19902
19903 /**
19904  * The range of information in seconds
19905  */
19906 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
19907
19908 /**
19909  * The range of information in seconds
19910  */
19911 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
19912
19913 /**
19914  * Constructs a new GossipTimestampFilter given each field
19915  */
19916 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
19917
19918 /**
19919  * Creates a copy of the GossipTimestampFilter
19920  */
19921 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
19922
19923 /**
19924  * Frees any resources used by the ErrorAction
19925  */
19926 void ErrorAction_free(struct LDKErrorAction this_ptr);
19927
19928 /**
19929  * Creates a copy of the ErrorAction
19930  */
19931 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
19932
19933 /**
19934  * Utility method to constructs a new DisconnectPeer-variant ErrorAction
19935  */
19936 struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg);
19937
19938 /**
19939  * Utility method to constructs a new IgnoreError-variant ErrorAction
19940  */
19941 struct LDKErrorAction ErrorAction_ignore_error(void);
19942
19943 /**
19944  * Utility method to constructs a new IgnoreAndLog-variant ErrorAction
19945  */
19946 struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
19947
19948 /**
19949  * Utility method to constructs a new SendErrorMessage-variant ErrorAction
19950  */
19951 struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg);
19952
19953 /**
19954  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
19955  */
19956 void LightningError_free(struct LDKLightningError this_obj);
19957
19958 /**
19959  * A human-readable message describing the error
19960  */
19961 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
19962
19963 /**
19964  * A human-readable message describing the error
19965  */
19966 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
19967
19968 /**
19969  * The action which should be taken against the offending peer.
19970  */
19971 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
19972
19973 /**
19974  * The action which should be taken against the offending peer.
19975  */
19976 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
19977
19978 /**
19979  * Constructs a new LightningError given each field
19980  */
19981 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
19982
19983 /**
19984  * Creates a copy of the LightningError
19985  */
19986 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
19987
19988 /**
19989  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
19990  */
19991 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
19992
19993 /**
19994  * update_add_htlc messages which should be sent
19995  */
19996 struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
19997
19998 /**
19999  * update_add_htlc messages which should be sent
20000  */
20001 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
20002
20003 /**
20004  * update_fulfill_htlc messages which should be sent
20005  */
20006 struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
20007
20008 /**
20009  * update_fulfill_htlc messages which should be sent
20010  */
20011 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
20012
20013 /**
20014  * update_fail_htlc messages which should be sent
20015  */
20016 struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
20017
20018 /**
20019  * update_fail_htlc messages which should be sent
20020  */
20021 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
20022
20023 /**
20024  * update_fail_malformed_htlc messages which should be sent
20025  */
20026 struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
20027
20028 /**
20029  * update_fail_malformed_htlc messages which should be sent
20030  */
20031 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
20032
20033 /**
20034  * An update_fee message which should be sent
20035  *
20036  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20037  */
20038 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
20039
20040 /**
20041  * An update_fee message which should be sent
20042  *
20043  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20044  */
20045 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
20046
20047 /**
20048  * Finally, the commitment_signed message which should be sent
20049  */
20050 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
20051
20052 /**
20053  * Finally, the commitment_signed message which should be sent
20054  */
20055 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
20056
20057 /**
20058  * Constructs a new CommitmentUpdate given each field
20059  */
20060 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);
20061
20062 /**
20063  * Creates a copy of the CommitmentUpdate
20064  */
20065 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
20066
20067 /**
20068  * Calls the free function if one is set
20069  */
20070 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
20071
20072 /**
20073  * Calls the free function if one is set
20074  */
20075 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
20076
20077 /**
20078  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
20079  */
20080 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
20081
20082 /**
20083  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
20084  */
20085 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
20086
20087 /**
20088  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
20089  */
20090 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
20091
20092 /**
20093  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
20094  */
20095 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
20096
20097 /**
20098  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
20099  */
20100 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
20101
20102 /**
20103  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
20104  */
20105 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
20106
20107 /**
20108  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
20109  */
20110 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
20111
20112 /**
20113  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
20114  */
20115 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
20116
20117 /**
20118  * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
20119  */
20120 struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
20121
20122 /**
20123  * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
20124  */
20125 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
20126
20127 /**
20128  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
20129  */
20130 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
20131
20132 /**
20133  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
20134  */
20135 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
20136
20137 /**
20138  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
20139  */
20140 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
20141
20142 /**
20143  * Read a FundingCreated from a byte array, created by FundingCreated_write
20144  */
20145 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
20146
20147 /**
20148  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
20149  */
20150 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
20151
20152 /**
20153  * Read a FundingSigned from a byte array, created by FundingSigned_write
20154  */
20155 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
20156
20157 /**
20158  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
20159  */
20160 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
20161
20162 /**
20163  * Read a FundingLocked from a byte array, created by FundingLocked_write
20164  */
20165 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
20166
20167 /**
20168  * Serialize the Init object into a byte array which can be read by Init_read
20169  */
20170 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
20171
20172 /**
20173  * Read a Init from a byte array, created by Init_write
20174  */
20175 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
20176
20177 /**
20178  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
20179  */
20180 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
20181
20182 /**
20183  * Read a OpenChannel from a byte array, created by OpenChannel_write
20184  */
20185 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
20186
20187 /**
20188  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
20189  */
20190 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
20191
20192 /**
20193  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
20194  */
20195 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
20196
20197 /**
20198  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
20199  */
20200 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
20201
20202 /**
20203  * Read a Shutdown from a byte array, created by Shutdown_write
20204  */
20205 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
20206
20207 /**
20208  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
20209  */
20210 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
20211
20212 /**
20213  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
20214  */
20215 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
20216
20217 /**
20218  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
20219  */
20220 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
20221
20222 /**
20223  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
20224  */
20225 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
20226
20227 /**
20228  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
20229  */
20230 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
20231
20232 /**
20233  * Read a UpdateFee from a byte array, created by UpdateFee_write
20234  */
20235 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
20236
20237 /**
20238  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
20239  */
20240 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
20241
20242 /**
20243  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
20244  */
20245 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
20246
20247 /**
20248  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
20249  */
20250 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
20251
20252 /**
20253  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
20254  */
20255 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
20256
20257 /**
20258  * Serialize the Ping object into a byte array which can be read by Ping_read
20259  */
20260 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
20261
20262 /**
20263  * Read a Ping from a byte array, created by Ping_write
20264  */
20265 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
20266
20267 /**
20268  * Serialize the Pong object into a byte array which can be read by Pong_read
20269  */
20270 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
20271
20272 /**
20273  * Read a Pong from a byte array, created by Pong_write
20274  */
20275 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
20276
20277 /**
20278  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
20279  */
20280 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
20281
20282 /**
20283  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
20284  */
20285 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
20286
20287 /**
20288  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
20289  */
20290 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
20291
20292 /**
20293  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
20294  */
20295 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
20296
20297 /**
20298  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
20299  */
20300 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
20301
20302 /**
20303  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
20304  */
20305 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
20306
20307 /**
20308  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
20309  */
20310 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
20311
20312 /**
20313  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
20314  */
20315 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
20316
20317 /**
20318  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
20319  */
20320 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
20321
20322 /**
20323  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
20324  */
20325 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
20326
20327 /**
20328  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
20329  */
20330 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
20331
20332 /**
20333  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
20334  */
20335 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
20336
20337 /**
20338  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
20339  */
20340 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
20341
20342 /**
20343  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
20344  */
20345 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
20346
20347 /**
20348  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
20349  */
20350 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
20351
20352 /**
20353  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
20354  */
20355 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
20356
20357 /**
20358  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
20359  */
20360 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
20361
20362 /**
20363  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
20364  */
20365 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
20366
20367 /**
20368  *\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
20369  */
20370 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
20371
20372 /**
20373  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
20374  */
20375 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
20376
20377 /**
20378  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
20379  */
20380 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
20381
20382 /**
20383  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
20384  */
20385 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
20386
20387 /**
20388  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
20389  */
20390 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
20391
20392 /**
20393  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
20394  */
20395 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
20396
20397 /**
20398  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
20399  */
20400 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
20401
20402 /**
20403  * Calls the free function if one is set
20404  */
20405 void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
20406
20407 /**
20408  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
20409  */
20410 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
20411
20412 /**
20413  * Constructs a new IgnoringMessageHandler given each field
20414  */
20415 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
20416
20417 /**
20418  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
20419  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
20420  */
20421 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
20422
20423 /**
20424  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
20425  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
20426  */
20427 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
20428
20429 /**
20430  * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
20431  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
20432  */
20433 struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
20434
20435 /**
20436  * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg.
20437  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is
20438  */
20439 struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
20440
20441 /**
20442  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
20443  */
20444 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
20445
20446 /**
20447  * Constructs a new ErroringMessageHandler
20448  */
20449 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
20450
20451 /**
20452  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
20453  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
20454  */
20455 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
20456
20457 /**
20458  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
20459  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
20460  */
20461 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
20462
20463 /**
20464  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
20465  */
20466 void MessageHandler_free(struct LDKMessageHandler this_obj);
20467
20468 /**
20469  * A message handler which handles messages specific to channels. Usually this is just a
20470  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
20471  *
20472  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
20473  */
20474 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
20475
20476 /**
20477  * A message handler which handles messages specific to channels. Usually this is just a
20478  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
20479  *
20480  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
20481  */
20482 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
20483
20484 /**
20485  * A message handler which handles messages updating our knowledge of the network channel
20486  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
20487  * [`IgnoringMessageHandler`].
20488  *
20489  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
20490  */
20491 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
20492
20493 /**
20494  * A message handler which handles messages updating our knowledge of the network channel
20495  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
20496  * [`IgnoringMessageHandler`].
20497  *
20498  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
20499  */
20500 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
20501
20502 /**
20503  * Constructs a new MessageHandler given each field
20504  */
20505 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
20506
20507 /**
20508  * Creates a copy of a SocketDescriptor
20509  */
20510 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
20511
20512 /**
20513  * Calls the free function if one is set
20514  */
20515 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
20516
20517 /**
20518  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
20519  */
20520 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
20521
20522 /**
20523  * Used to indicate that we probably can't make any future connections to this peer, implying
20524  * we should go ahead and force-close any channels we have with it.
20525  */
20526 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
20527
20528 /**
20529  * Used to indicate that we probably can't make any future connections to this peer, implying
20530  * we should go ahead and force-close any channels we have with it.
20531  */
20532 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
20533
20534 /**
20535  * Constructs a new PeerHandleError given each field
20536  */
20537 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
20538
20539 /**
20540  * Creates a copy of the PeerHandleError
20541  */
20542 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
20543
20544 /**
20545  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
20546  */
20547 void PeerManager_free(struct LDKPeerManager this_obj);
20548
20549 /**
20550  * Constructs a new PeerManager with the given message handlers and node_id secret key
20551  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
20552  * cryptographically secure random bytes.
20553  */
20554 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);
20555
20556 /**
20557  * Get the list of node ids for peers which have completed the initial handshake.
20558  *
20559  * For outbound connections, this will be the same as the their_node_id parameter passed in to
20560  * new_outbound_connection, however entries will only appear once the initial handshake has
20561  * completed and we are sure the remote peer has the private key for the given node_id.
20562  */
20563 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
20564
20565 /**
20566  * Indicates a new outbound connection has been established to a node with the given node_id.
20567  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
20568  * descriptor but must disconnect the connection immediately.
20569  *
20570  * Returns a small number of bytes to send to the remote node (currently always 50).
20571  *
20572  * Panics if descriptor is duplicative with some other descriptor which has not yet been
20573  * [`socket_disconnected()`].
20574  *
20575  * [`socket_disconnected()`]: PeerManager::socket_disconnected
20576  */
20577 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);
20578
20579 /**
20580  * Indicates a new inbound connection has been established.
20581  *
20582  * May refuse the connection by returning an Err, but will never write bytes to the remote end
20583  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
20584  * call socket_disconnected for the new descriptor but must disconnect the connection
20585  * immediately.
20586  *
20587  * Panics if descriptor is duplicative with some other descriptor which has not yet been
20588  * [`socket_disconnected()`].
20589  *
20590  * [`socket_disconnected()`]: PeerManager::socket_disconnected
20591  */
20592 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
20593
20594 /**
20595  * Indicates that there is room to write data to the given socket descriptor.
20596  *
20597  * May return an Err to indicate that the connection should be closed.
20598  *
20599  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
20600  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
20601  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
20602  * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't
20603  * sufficient!
20604  *
20605  * [`send_data`]: SocketDescriptor::send_data
20606  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
20607  */
20608 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
20609
20610 /**
20611  * Indicates that data was read from the given socket descriptor.
20612  *
20613  * May return an Err to indicate that the connection should be closed.
20614  *
20615  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
20616  * Thus, however, you should call [`process_events`] after any `read_event` to generate
20617  * [`send_data`] calls to handle responses.
20618  *
20619  * If `Ok(true)` is returned, further read_events should not be triggered until a
20620  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
20621  * send buffer).
20622  *
20623  * [`send_data`]: SocketDescriptor::send_data
20624  * [`process_events`]: PeerManager::process_events
20625  */
20626 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);
20627
20628 /**
20629  * Checks for any events generated by our handlers and processes them. Includes sending most
20630  * response messages as well as messages generated by calls to handler functions directly (eg
20631  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
20632  *
20633  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
20634  * issues!
20635  *
20636  * You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
20637  * or one of the other clients provided in our language bindings.
20638  *
20639  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
20640  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
20641  * [`send_data`]: SocketDescriptor::send_data
20642  */
20643 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
20644
20645 /**
20646  * Indicates that the given socket descriptor's connection is now closed.
20647  */
20648 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
20649
20650 /**
20651  * Disconnect a peer given its node id.
20652  *
20653  * Set `no_connection_possible` to true to prevent any further connection with this peer,
20654  * force-closing any channels we have with it.
20655  *
20656  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
20657  * peer. Thus, be very careful about reentrancy issues.
20658  *
20659  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
20660  */
20661 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
20662
20663 /**
20664  * Disconnects all currently-connected peers. This is useful on platforms where there may be
20665  * an indication that TCP sockets have stalled even if we weren't around to time them out
20666  * using regular ping/pongs.
20667  */
20668 void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg);
20669
20670 /**
20671  * Send pings to each peer and disconnect those which did not respond to the last round of
20672  * pings.
20673  *
20674  * This may be called on any timescale you want, however, roughly once every five to ten
20675  * seconds is preferred. The call rate determines both how often we send a ping to our peers
20676  * and how much time they have to respond before we disconnect them.
20677  *
20678  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
20679  * issues!
20680  *
20681  * [`send_data`]: SocketDescriptor::send_data
20682  */
20683 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
20684
20685 /**
20686  * Build the commitment secret from the seed and the commitment number
20687  */
20688 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
20689
20690 /**
20691  * Build a closing transaction
20692  */
20693 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);
20694
20695 /**
20696  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
20697  * from the base secret and the per_commitment_point.
20698  *
20699  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
20700  * generated (ie our own).
20701  */
20702 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
20703
20704 /**
20705  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
20706  * from the base point and the per_commitment_key. This is the public equivalent of
20707  * derive_private_key - using only public keys to derive a public key instead of private keys.
20708  *
20709  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
20710  * generated (ie our own).
20711  */
20712 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
20713
20714 /**
20715  * Derives a per-commitment-transaction revocation key from its constituent parts.
20716  *
20717  * Only the cheating participant owns a valid witness to propagate a revoked
20718  * commitment transaction, thus per_commitment_secret always come from cheater
20719  * and revocation_base_secret always come from punisher, which is the broadcaster
20720  * of the transaction spending with this key knowledge.
20721  *
20722  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
20723  * generated (ie our own).
20724  */
20725 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
20726
20727 /**
20728  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
20729  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
20730  * public key instead of private keys.
20731  *
20732  * Only the cheating participant owns a valid witness to propagate a revoked
20733  * commitment transaction, thus per_commitment_point always come from cheater
20734  * and revocation_base_point always come from punisher, which is the broadcaster
20735  * of the transaction spending with this key knowledge.
20736  *
20737  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
20738  * generated (ie our own).
20739  */
20740 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
20741
20742 /**
20743  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
20744  */
20745 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
20746
20747 /**
20748  * The broadcaster's per-commitment public key which was used to derive the other keys.
20749  */
20750 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
20751
20752 /**
20753  * The broadcaster's per-commitment public key which was used to derive the other keys.
20754  */
20755 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20756
20757 /**
20758  * The revocation key which is used to allow the broadcaster of the commitment
20759  * transaction to provide their counterparty the ability to punish them if they broadcast
20760  * an old state.
20761  */
20762 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
20763
20764 /**
20765  * The revocation key which is used to allow the broadcaster of the commitment
20766  * transaction to provide their counterparty the ability to punish them if they broadcast
20767  * an old state.
20768  */
20769 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20770
20771 /**
20772  * Broadcaster's HTLC Key
20773  */
20774 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
20775
20776 /**
20777  * Broadcaster's HTLC Key
20778  */
20779 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20780
20781 /**
20782  * Countersignatory's HTLC Key
20783  */
20784 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
20785
20786 /**
20787  * Countersignatory's HTLC Key
20788  */
20789 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20790
20791 /**
20792  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
20793  */
20794 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
20795
20796 /**
20797  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
20798  */
20799 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20800
20801 /**
20802  * Constructs a new TxCreationKeys given each field
20803  */
20804 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);
20805
20806 /**
20807  * Creates a copy of the TxCreationKeys
20808  */
20809 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
20810
20811 /**
20812  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
20813  */
20814 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
20815
20816 /**
20817  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
20818  */
20819 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
20820
20821 /**
20822  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
20823  */
20824 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
20825
20826 /**
20827  * The public key which is used to sign all commitment transactions, as it appears in the
20828  * on-chain channel lock-in 2-of-2 multisig output.
20829  */
20830 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
20831
20832 /**
20833  * The public key which is used to sign all commitment transactions, as it appears in the
20834  * on-chain channel lock-in 2-of-2 multisig output.
20835  */
20836 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20837
20838 /**
20839  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
20840  * revocation keys. This is combined with the per-commitment-secret generated by the
20841  * counterparty to create a secret which the counterparty can reveal to revoke previous
20842  * states.
20843  */
20844 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
20845
20846 /**
20847  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
20848  * revocation keys. This is combined with the per-commitment-secret generated by the
20849  * counterparty to create a secret which the counterparty can reveal to revoke previous
20850  * states.
20851  */
20852 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20853
20854 /**
20855  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
20856  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
20857  * static across every commitment transaction.
20858  */
20859 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
20860
20861 /**
20862  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
20863  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
20864  * static across every commitment transaction.
20865  */
20866 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20867
20868 /**
20869  * The base point which is used (with derive_public_key) to derive a per-commitment payment
20870  * public key which receives non-HTLC-encumbered funds which are only available for spending
20871  * after some delay (or can be claimed via the revocation path).
20872  */
20873 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
20874
20875 /**
20876  * The base point which is used (with derive_public_key) to derive a per-commitment payment
20877  * public key which receives non-HTLC-encumbered funds which are only available for spending
20878  * after some delay (or can be claimed via the revocation path).
20879  */
20880 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20881
20882 /**
20883  * The base point which is used (with derive_public_key) to derive a per-commitment public key
20884  * which is used to encumber HTLC-in-flight outputs.
20885  */
20886 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
20887
20888 /**
20889  * The base point which is used (with derive_public_key) to derive a per-commitment public key
20890  * which is used to encumber HTLC-in-flight outputs.
20891  */
20892 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20893
20894 /**
20895  * Constructs a new ChannelPublicKeys given each field
20896  */
20897 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);
20898
20899 /**
20900  * Creates a copy of the ChannelPublicKeys
20901  */
20902 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
20903
20904 /**
20905  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
20906  */
20907 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
20908
20909 /**
20910  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
20911  */
20912 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
20913
20914 /**
20915  * Create per-state keys from channel base points and the per-commitment point.
20916  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
20917  */
20918 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);
20919
20920 /**
20921  * Generate per-state keys from channel static keys.
20922  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
20923  */
20924 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);
20925
20926 /**
20927  * A script either spendable by the revocation
20928  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
20929  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
20930  */
20931 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
20932
20933 /**
20934  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
20935  */
20936 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
20937
20938 /**
20939  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
20940  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
20941  * need to compare this value to whether the commitment transaction in question is that of
20942  * the counterparty or our own.
20943  */
20944 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
20945
20946 /**
20947  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
20948  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
20949  * need to compare this value to whether the commitment transaction in question is that of
20950  * the counterparty or our own.
20951  */
20952 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
20953
20954 /**
20955  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
20956  * this divided by 1000.
20957  */
20958 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
20959
20960 /**
20961  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
20962  * this divided by 1000.
20963  */
20964 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
20965
20966 /**
20967  * The CLTV lock-time at which this HTLC expires.
20968  */
20969 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
20970
20971 /**
20972  * The CLTV lock-time at which this HTLC expires.
20973  */
20974 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
20975
20976 /**
20977  * The hash of the preimage which unlocks this HTLC.
20978  */
20979 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
20980
20981 /**
20982  * The hash of the preimage which unlocks this HTLC.
20983  */
20984 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20985
20986 /**
20987  * The position within the commitment transactions' outputs. This may be None if the value is
20988  * below the dust limit (in which case no output appears in the commitment transaction and the
20989  * value is spent to additional transaction fees).
20990  */
20991 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
20992
20993 /**
20994  * The position within the commitment transactions' outputs. This may be None if the value is
20995  * below the dust limit (in which case no output appears in the commitment transaction and the
20996  * value is spent to additional transaction fees).
20997  */
20998 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
20999
21000 /**
21001  * Constructs a new HTLCOutputInCommitment given each field
21002  */
21003 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);
21004
21005 /**
21006  * Creates a copy of the HTLCOutputInCommitment
21007  */
21008 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
21009
21010 /**
21011  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
21012  */
21013 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
21014
21015 /**
21016  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
21017  */
21018 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
21019
21020 /**
21021  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
21022  * does not need to have its previous_output_index filled.
21023  */
21024 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
21025
21026 /**
21027  * Gets the redeemscript for a funding output from the two funding public keys.
21028  * Note that the order of funding public keys does not matter.
21029  */
21030 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
21031
21032 /**
21033  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
21034  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
21035  * transaction which needs signing, and can be used to construct an HTLC transaction which is
21036  * broadcastable given a counterparty HTLC signature.
21037  *
21038  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
21039  * commitment transaction).
21040  */
21041 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);
21042
21043 /**
21044  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
21045  */
21046 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
21047
21048 /**
21049  * Holder public keys
21050  */
21051 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
21052
21053 /**
21054  * Holder public keys
21055  */
21056 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
21057
21058 /**
21059  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
21060  */
21061 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
21062
21063 /**
21064  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
21065  */
21066 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
21067
21068 /**
21069  * Whether the holder is the initiator of this channel.
21070  * This is an input to the commitment number obscure factor computation.
21071  */
21072 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
21073
21074 /**
21075  * Whether the holder is the initiator of this channel.
21076  * This is an input to the commitment number obscure factor computation.
21077  */
21078 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
21079
21080 /**
21081  * The late-bound counterparty channel transaction parameters.
21082  * These parameters are populated at the point in the protocol where the counterparty provides them.
21083  *
21084  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21085  */
21086 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
21087
21088 /**
21089  * The late-bound counterparty channel transaction parameters.
21090  * These parameters are populated at the point in the protocol where the counterparty provides them.
21091  *
21092  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21093  */
21094 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
21095
21096 /**
21097  * The late-bound funding outpoint
21098  *
21099  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21100  */
21101 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
21102
21103 /**
21104  * The late-bound funding outpoint
21105  *
21106  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21107  */
21108 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
21109
21110 /**
21111  * Constructs a new ChannelTransactionParameters given each field
21112  */
21113 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);
21114
21115 /**
21116  * Creates a copy of the ChannelTransactionParameters
21117  */
21118 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
21119
21120 /**
21121  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
21122  */
21123 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
21124
21125 /**
21126  * Counter-party public keys
21127  */
21128 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
21129
21130 /**
21131  * Counter-party public keys
21132  */
21133 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
21134
21135 /**
21136  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
21137  */
21138 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
21139
21140 /**
21141  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
21142  */
21143 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
21144
21145 /**
21146  * Constructs a new CounterpartyChannelTransactionParameters given each field
21147  */
21148 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
21149
21150 /**
21151  * Creates a copy of the CounterpartyChannelTransactionParameters
21152  */
21153 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
21154
21155 /**
21156  * Whether the late bound parameters are populated.
21157  */
21158 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
21159
21160 /**
21161  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
21162  * given that the holder is the broadcaster.
21163  *
21164  * self.is_populated() must be true before calling this function.
21165  */
21166 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
21167
21168 /**
21169  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
21170  * given that the counterparty is the broadcaster.
21171  *
21172  * self.is_populated() must be true before calling this function.
21173  */
21174 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
21175
21176 /**
21177  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
21178  */
21179 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
21180
21181 /**
21182  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
21183  */
21184 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
21185
21186 /**
21187  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
21188  */
21189 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
21190
21191 /**
21192  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
21193  */
21194 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
21195
21196 /**
21197  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
21198  */
21199 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
21200
21201 /**
21202  * Get the channel pubkeys for the broadcaster
21203  */
21204 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
21205
21206 /**
21207  * Get the channel pubkeys for the countersignatory
21208  */
21209 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
21210
21211 /**
21212  * Get the contest delay applicable to the transactions.
21213  * Note that the contest delay was selected by the countersignatory.
21214  */
21215 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
21216
21217 /**
21218  * Whether the channel is outbound from the broadcaster.
21219  *
21220  * The boolean representing the side that initiated the channel is
21221  * an input to the commitment number obscure factor computation.
21222  */
21223 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
21224
21225 /**
21226  * The funding outpoint
21227  */
21228 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
21229
21230 /**
21231  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
21232  */
21233 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
21234
21235 /**
21236  * Our counterparty's signature for the transaction
21237  */
21238 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
21239
21240 /**
21241  * Our counterparty's signature for the transaction
21242  */
21243 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
21244
21245 /**
21246  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
21247  */
21248 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
21249
21250 /**
21251  * Creates a copy of the HolderCommitmentTransaction
21252  */
21253 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
21254
21255 /**
21256  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
21257  */
21258 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
21259
21260 /**
21261  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
21262  */
21263 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
21264
21265 /**
21266  * Create a new holder transaction with the given counterparty signatures.
21267  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
21268  */
21269 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);
21270
21271 /**
21272  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
21273  */
21274 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
21275
21276 /**
21277  * The commitment transaction
21278  */
21279 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
21280
21281 /**
21282  * The commitment transaction
21283  */
21284 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
21285
21286 /**
21287  * The txid for the commitment transaction.
21288  *
21289  * This is provided as a performance optimization, instead of calling transaction.txid()
21290  * multiple times.
21291  */
21292 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
21293
21294 /**
21295  * The txid for the commitment transaction.
21296  *
21297  * This is provided as a performance optimization, instead of calling transaction.txid()
21298  * multiple times.
21299  */
21300 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21301
21302 /**
21303  * Constructs a new BuiltCommitmentTransaction given each field
21304  */
21305 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
21306
21307 /**
21308  * Creates a copy of the BuiltCommitmentTransaction
21309  */
21310 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
21311
21312 /**
21313  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
21314  */
21315 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
21316
21317 /**
21318  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
21319  */
21320 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
21321
21322 /**
21323  * Get the SIGHASH_ALL sighash value of the transaction.
21324  *
21325  * This can be used to verify a signature.
21326  */
21327 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);
21328
21329 /**
21330  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
21331  * because we are about to broadcast a holder transaction.
21332  */
21333 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);
21334
21335 /**
21336  * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL.
21337  */
21338 void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
21339
21340 /**
21341  * Construct an object of the class
21342  */
21343 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);
21344
21345 /**
21346  * Trust our pre-built transaction.
21347  *
21348  * Applies a wrapper which allows access to the transaction.
21349  *
21350  * This should only be used if you fully trust the builder of this object. It should not
21351  * be used by an external signer - instead use the verify function.
21352  */
21353 MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
21354
21355 /**
21356  * Verify our pre-built transaction.
21357  *
21358  * Applies a wrapper which allows access to the transaction.
21359  *
21360  * An external validating signer must call this method before signing
21361  * or using the built transaction.
21362  */
21363 MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
21364
21365 /**
21366  * The value to be sent to the holder, or zero if the output will be omitted
21367  */
21368 MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
21369
21370 /**
21371  * The value to be sent to the counterparty, or zero if the output will be omitted
21372  */
21373 MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
21374
21375 /**
21376  * The destination of the holder's output
21377  */
21378 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
21379
21380 /**
21381  * The destination of the counterparty's output
21382  */
21383 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
21384
21385 /**
21386  * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL.
21387  */
21388 void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
21389
21390 /**
21391  * The pre-built Bitcoin commitment transaction
21392  */
21393 MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
21394
21395 /**
21396  * Get the SIGHASH_ALL sighash value of the transaction.
21397  *
21398  * This can be used to verify a signature.
21399  */
21400 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);
21401
21402 /**
21403  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
21404  * because we are about to broadcast a holder transaction.
21405  */
21406 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);
21407
21408 /**
21409  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
21410  */
21411 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
21412
21413 /**
21414  * Creates a copy of the CommitmentTransaction
21415  */
21416 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
21417
21418 /**
21419  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
21420  */
21421 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
21422
21423 /**
21424  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
21425  */
21426 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
21427
21428 /**
21429  * The backwards-counting commitment number
21430  */
21431 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
21432
21433 /**
21434  * The value to be sent to the broadcaster
21435  */
21436 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
21437
21438 /**
21439  * The value to be sent to the counterparty
21440  */
21441 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
21442
21443 /**
21444  * The feerate paid per 1000-weight-unit in this commitment transaction.
21445  */
21446 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
21447
21448 /**
21449  * Trust our pre-built transaction and derived transaction creation public keys.
21450  *
21451  * Applies a wrapper which allows access to these fields.
21452  *
21453  * This should only be used if you fully trust the builder of this object.  It should not
21454  * be used by an external signer - instead use the verify function.
21455  */
21456 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
21457
21458 /**
21459  * Verify our pre-built transaction and derived transaction creation public keys.
21460  *
21461  * Applies a wrapper which allows access to these fields.
21462  *
21463  * An external validating signer must call this method before signing
21464  * or using the built transaction.
21465  */
21466 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);
21467
21468 /**
21469  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
21470  */
21471 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
21472
21473 /**
21474  * The transaction ID of the built Bitcoin transaction
21475  */
21476 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
21477
21478 /**
21479  * The pre-built Bitcoin commitment transaction
21480  */
21481 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
21482
21483 /**
21484  * The pre-calculated transaction creation public keys.
21485  */
21486 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
21487
21488 /**
21489  * Get a signature for each HTLC which was included in the commitment transaction (ie for
21490  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
21491  *
21492  * The returned Vec has one entry for each HTLC, and in the same order.
21493  */
21494 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);
21495
21496 /**
21497  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
21498  * shared secret first. This prevents on-chain observers from discovering how many commitment
21499  * transactions occurred in a channel before it was closed.
21500  *
21501  * This function gets the shared secret from relevant channel public keys and can be used to
21502  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
21503  */
21504 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
21505
21506 /**
21507  * Checks if two InitFeaturess contain equal inner contents.
21508  * This ignores pointers and is_owned flags and looks at the values in fields.
21509  * Two objects with NULL inner values will be considered "equal" here.
21510  */
21511 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
21512
21513 /**
21514  * Checks if two NodeFeaturess contain equal inner contents.
21515  * This ignores pointers and is_owned flags and looks at the values in fields.
21516  * Two objects with NULL inner values will be considered "equal" here.
21517  */
21518 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
21519
21520 /**
21521  * Checks if two ChannelFeaturess contain equal inner contents.
21522  * This ignores pointers and is_owned flags and looks at the values in fields.
21523  * Two objects with NULL inner values will be considered "equal" here.
21524  */
21525 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
21526
21527 /**
21528  * Checks if two InvoiceFeaturess contain equal inner contents.
21529  * This ignores pointers and is_owned flags and looks at the values in fields.
21530  * Two objects with NULL inner values will be considered "equal" here.
21531  */
21532 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
21533
21534 /**
21535  * Creates a copy of the InitFeatures
21536  */
21537 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
21538
21539 /**
21540  * Creates a copy of the NodeFeatures
21541  */
21542 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
21543
21544 /**
21545  * Creates a copy of the ChannelFeatures
21546  */
21547 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
21548
21549 /**
21550  * Creates a copy of the InvoiceFeatures
21551  */
21552 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
21553
21554 /**
21555  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
21556  */
21557 void InitFeatures_free(struct LDKInitFeatures this_obj);
21558
21559 /**
21560  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
21561  */
21562 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
21563
21564 /**
21565  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
21566  */
21567 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
21568
21569 /**
21570  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
21571  */
21572 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
21573
21574 /**
21575  * Create a blank Features with no features set
21576  */
21577 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
21578
21579 /**
21580  * Creates a Features with the bits set which are known by the implementation
21581  */
21582 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
21583
21584 /**
21585  * Returns true if this `Features` object contains unknown feature flags which are set as
21586  * \"required\".
21587  */
21588 MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
21589
21590 /**
21591  * Create a blank Features with no features set
21592  */
21593 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
21594
21595 /**
21596  * Creates a Features with the bits set which are known by the implementation
21597  */
21598 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
21599
21600 /**
21601  * Returns true if this `Features` object contains unknown feature flags which are set as
21602  * \"required\".
21603  */
21604 MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
21605
21606 /**
21607  * Create a blank Features with no features set
21608  */
21609 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
21610
21611 /**
21612  * Creates a Features with the bits set which are known by the implementation
21613  */
21614 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
21615
21616 /**
21617  * Returns true if this `Features` object contains unknown feature flags which are set as
21618  * \"required\".
21619  */
21620 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
21621
21622 /**
21623  * Create a blank Features with no features set
21624  */
21625 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
21626
21627 /**
21628  * Creates a Features with the bits set which are known by the implementation
21629  */
21630 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
21631
21632 /**
21633  * Returns true if this `Features` object contains unknown feature flags which are set as
21634  * \"required\".
21635  */
21636 MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
21637
21638 /**
21639  * Returns whether the `payment_secret` feature is supported.
21640  */
21641 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
21642
21643 /**
21644  * Returns whether the `payment_secret` feature is supported.
21645  */
21646 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
21647
21648 /**
21649  * Returns whether the `payment_secret` feature is supported.
21650  */
21651 MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
21652
21653 /**
21654  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
21655  */
21656 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
21657
21658 /**
21659  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
21660  */
21661 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
21662
21663 /**
21664  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
21665  */
21666 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
21667
21668 /**
21669  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
21670  */
21671 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
21672
21673 /**
21674  * Read a InitFeatures from a byte array, created by InitFeatures_write
21675  */
21676 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
21677
21678 /**
21679  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
21680  */
21681 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
21682
21683 /**
21684  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
21685  */
21686 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
21687
21688 /**
21689  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
21690  */
21691 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
21692
21693 /**
21694  * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
21695  */
21696 void ShutdownScript_free(struct LDKShutdownScript this_obj);
21697
21698 /**
21699  * Creates a copy of the ShutdownScript
21700  */
21701 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
21702
21703 /**
21704  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
21705  */
21706 void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
21707
21708 /**
21709  * The script that did not meet the requirements from [BOLT #2].
21710  *
21711  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
21712  */
21713 struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
21714
21715 /**
21716  * The script that did not meet the requirements from [BOLT #2].
21717  *
21718  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
21719  */
21720 void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
21721
21722 /**
21723  * Constructs a new InvalidShutdownScript given each field
21724  */
21725 MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
21726
21727 /**
21728  * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
21729  */
21730 struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
21731
21732 /**
21733  * Read a ShutdownScript from a byte array, created by ShutdownScript_write
21734  */
21735 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
21736
21737 /**
21738  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
21739  */
21740 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
21741
21742 /**
21743  * Generates a P2WSH script pubkey from the given [`WScriptHash`].
21744  */
21745 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
21746
21747 /**
21748  * Generates a witness script pubkey from the given segwit version and program.
21749  *
21750  * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
21751  * [`ShutdownScript::new_p2wsh`] instead.
21752  *
21753  * # Errors
21754  *
21755  * This function may return an error if `program` is invalid for the segwit `version`.
21756  */
21757 MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(uint8_t version, struct LDKu8slice program);
21758
21759 /**
21760  * Converts the shutdown script into the underlying [`Script`].
21761  */
21762 MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
21763
21764 /**
21765  * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
21766  *
21767  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21768  */
21769 MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
21770
21771 /**
21772  * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
21773  *
21774  * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
21775  */
21776 MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
21777
21778 /**
21779  * Calls the free function if one is set
21780  */
21781 void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
21782
21783 /**
21784  * Calls the free function if one is set
21785  */
21786 void Type_free(struct LDKType this_ptr);
21787
21788 /**
21789  * Calls the free function if one is set
21790  */
21791 void Score_free(struct LDKScore this_ptr);
21792
21793 /**
21794  * Frees any resources used by the LockableScore, if is_owned is set and inner is non-NULL.
21795  */
21796 void LockableScore_free(struct LDKLockableScore this_obj);
21797
21798 /**
21799  * Constructs a new LockableScore from a Score
21800  */
21801 MUST_USE_RES struct LDKLockableScore LockableScore_new(struct LDKScore score);
21802
21803 /**
21804  * Serialize the LockableScore object into a byte array which can be read by LockableScore_read
21805  */
21806 struct LDKCVec_u8Z LockableScore_write(const struct LDKLockableScore *NONNULL_PTR obj);
21807
21808 /**
21809  * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
21810  */
21811 void NodeId_free(struct LDKNodeId this_obj);
21812
21813 /**
21814  * Creates a copy of the NodeId
21815  */
21816 struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig);
21817
21818 /**
21819  * Create a new NodeId from a public key
21820  */
21821 MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey);
21822
21823 /**
21824  * Get the public key slice from this NodeId
21825  */
21826 MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
21827
21828 /**
21829  * Checks if two NodeIds contain equal inner contents.
21830  */
21831 uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
21832
21833 /**
21834  * Serialize the NodeId object into a byte array which can be read by NodeId_read
21835  */
21836 struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj);
21837
21838 /**
21839  * Read a NodeId from a byte array, created by NodeId_write
21840  */
21841 struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser);
21842
21843 /**
21844  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
21845  */
21846 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
21847
21848 /**
21849  * Creates a copy of the NetworkGraph
21850  */
21851 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
21852
21853 /**
21854  * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
21855  */
21856 void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
21857
21858 /**
21859  * Frees any resources used by the NetworkUpdate
21860  */
21861 void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
21862
21863 /**
21864  * Creates a copy of the NetworkUpdate
21865  */
21866 struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
21867
21868 /**
21869  * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
21870  */
21871 struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
21872
21873 /**
21874  * Utility method to constructs a new ChannelClosed-variant NetworkUpdate
21875  */
21876 struct LDKNetworkUpdate NetworkUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent);
21877
21878 /**
21879  * Utility method to constructs a new NodeFailure-variant NetworkUpdate
21880  */
21881 struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
21882
21883 /**
21884  * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
21885  */
21886 struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
21887
21888 /**
21889  * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
21890  */
21891 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser);
21892
21893 /**
21894  * Constructs a new EventHandler which calls the relevant methods on this_arg.
21895  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
21896  */
21897 struct LDKEventHandler NetGraphMsgHandler_as_EventHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
21898
21899 /**
21900  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
21901  */
21902 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
21903
21904 /**
21905  * Creates a new tracker of the actual state of the network of channels and nodes,
21906  * assuming an existing Network Graph.
21907  * Chain monitor is used to make sure announced channels exist on-chain,
21908  * channel data is correct, and that the announcement is signed with
21909  * channel owners' keys.
21910  */
21911 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
21912
21913 /**
21914  * Adds a provider used to check new announcements. Does not affect
21915  * existing announcements unless they are updated.
21916  * Add, update or remove the provider would replace the current one.
21917  */
21918 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access);
21919
21920 /**
21921  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
21922  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
21923  */
21924 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
21925
21926 /**
21927  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
21928  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
21929  */
21930 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
21931
21932 /**
21933  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
21934  */
21935 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
21936
21937 /**
21938  * When the last update to the channel direction was issued.
21939  * Value is opaque, as set in the announcement.
21940  */
21941 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
21942
21943 /**
21944  * When the last update to the channel direction was issued.
21945  * Value is opaque, as set in the announcement.
21946  */
21947 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
21948
21949 /**
21950  * Whether the channel can be currently used for payments (in this one direction).
21951  */
21952 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
21953
21954 /**
21955  * Whether the channel can be currently used for payments (in this one direction).
21956  */
21957 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
21958
21959 /**
21960  * The difference in CLTV values that you must have when routing through this channel.
21961  */
21962 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
21963
21964 /**
21965  * The difference in CLTV values that you must have when routing through this channel.
21966  */
21967 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
21968
21969 /**
21970  * The minimum value, which must be relayed to the next hop via the channel
21971  */
21972 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
21973
21974 /**
21975  * The minimum value, which must be relayed to the next hop via the channel
21976  */
21977 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
21978
21979 /**
21980  * The maximum value which may be relayed to the next hop via the channel.
21981  */
21982 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
21983
21984 /**
21985  * The maximum value which may be relayed to the next hop via the channel.
21986  */
21987 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21988
21989 /**
21990  * Fees charged when the channel is used for routing
21991  */
21992 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
21993
21994 /**
21995  * Fees charged when the channel is used for routing
21996  */
21997 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
21998
21999 /**
22000  * Most recent update for the channel received from the network
22001  * Mostly redundant with the data we store in fields explicitly.
22002  * Everything else is useful only for sending out for initial routing sync.
22003  * Not stored if contains excess data to prevent DoS.
22004  *
22005  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22006  */
22007 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
22008
22009 /**
22010  * Most recent update for the channel received from the network
22011  * Mostly redundant with the data we store in fields explicitly.
22012  * Everything else is useful only for sending out for initial routing sync.
22013  * Not stored if contains excess data to prevent DoS.
22014  *
22015  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22016  */
22017 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
22018
22019 /**
22020  * Constructs a new DirectionalChannelInfo given each field
22021  */
22022 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);
22023
22024 /**
22025  * Creates a copy of the DirectionalChannelInfo
22026  */
22027 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
22028
22029 /**
22030  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
22031  */
22032 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
22033
22034 /**
22035  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
22036  */
22037 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
22038
22039 /**
22040  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
22041  */
22042 void ChannelInfo_free(struct LDKChannelInfo this_obj);
22043
22044 /**
22045  * Protocol features of a channel communicated during its announcement
22046  */
22047 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
22048
22049 /**
22050  * Protocol features of a channel communicated during its announcement
22051  */
22052 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
22053
22054 /**
22055  * Source node of the first direction of a channel
22056  */
22057 struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
22058
22059 /**
22060  * Source node of the first direction of a channel
22061  */
22062 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
22063
22064 /**
22065  * Details about the first direction of a channel
22066  *
22067  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22068  */
22069 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
22070
22071 /**
22072  * Details about the first direction of a channel
22073  *
22074  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22075  */
22076 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
22077
22078 /**
22079  * Source node of the second direction of a channel
22080  */
22081 struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
22082
22083 /**
22084  * Source node of the second direction of a channel
22085  */
22086 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
22087
22088 /**
22089  * Details about the second direction of a channel
22090  *
22091  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22092  */
22093 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
22094
22095 /**
22096  * Details about the second direction of a channel
22097  *
22098  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22099  */
22100 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
22101
22102 /**
22103  * The channel capacity as seen on-chain, if chain lookup is available.
22104  */
22105 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
22106
22107 /**
22108  * The channel capacity as seen on-chain, if chain lookup is available.
22109  */
22110 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
22111
22112 /**
22113  * An initial announcement of the channel
22114  * Mostly redundant with the data we store in fields explicitly.
22115  * Everything else is useful only for sending out for initial routing sync.
22116  * Not stored if contains excess data to prevent DoS.
22117  *
22118  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22119  */
22120 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
22121
22122 /**
22123  * An initial announcement of the channel
22124  * Mostly redundant with the data we store in fields explicitly.
22125  * Everything else is useful only for sending out for initial routing sync.
22126  * Not stored if contains excess data to prevent DoS.
22127  *
22128  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22129  */
22130 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
22131
22132 /**
22133  * Constructs a new ChannelInfo given each field
22134  */
22135 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);
22136
22137 /**
22138  * Creates a copy of the ChannelInfo
22139  */
22140 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
22141
22142 /**
22143  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
22144  */
22145 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
22146
22147 /**
22148  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
22149  */
22150 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
22151
22152 /**
22153  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
22154  */
22155 void RoutingFees_free(struct LDKRoutingFees this_obj);
22156
22157 /**
22158  * Flat routing fee in satoshis
22159  */
22160 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
22161
22162 /**
22163  * Flat routing fee in satoshis
22164  */
22165 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
22166
22167 /**
22168  * Liquidity-based routing fee in millionths of a routed amount.
22169  * In other words, 10000 is 1%.
22170  */
22171 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
22172
22173 /**
22174  * Liquidity-based routing fee in millionths of a routed amount.
22175  * In other words, 10000 is 1%.
22176  */
22177 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
22178
22179 /**
22180  * Constructs a new RoutingFees given each field
22181  */
22182 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
22183
22184 /**
22185  * Checks if two RoutingFeess contain equal inner contents.
22186  * This ignores pointers and is_owned flags and looks at the values in fields.
22187  * Two objects with NULL inner values will be considered "equal" here.
22188  */
22189 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
22190
22191 /**
22192  * Creates a copy of the RoutingFees
22193  */
22194 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
22195
22196 /**
22197  * Checks if two RoutingFeess contain equal inner contents.
22198  */
22199 uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
22200
22201 /**
22202  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
22203  */
22204 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
22205
22206 /**
22207  * Read a RoutingFees from a byte array, created by RoutingFees_write
22208  */
22209 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
22210
22211 /**
22212  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
22213  */
22214 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
22215
22216 /**
22217  * Protocol features the node announced support for
22218  */
22219 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
22220
22221 /**
22222  * Protocol features the node announced support for
22223  */
22224 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
22225
22226 /**
22227  * When the last known update to the node state was issued.
22228  * Value is opaque, as set in the announcement.
22229  */
22230 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
22231
22232 /**
22233  * When the last known update to the node state was issued.
22234  * Value is opaque, as set in the announcement.
22235  */
22236 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
22237
22238 /**
22239  * Color assigned to the node
22240  */
22241 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
22242
22243 /**
22244  * Color assigned to the node
22245  */
22246 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
22247
22248 /**
22249  * Moniker assigned to the node.
22250  * May be invalid or malicious (eg control chars),
22251  * should not be exposed to the user.
22252  */
22253 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
22254
22255 /**
22256  * Moniker assigned to the node.
22257  * May be invalid or malicious (eg control chars),
22258  * should not be exposed to the user.
22259  */
22260 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22261
22262 /**
22263  * Internet-level addresses via which one can connect to the node
22264  */
22265 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
22266
22267 /**
22268  * An initial announcement of the node
22269  * Mostly redundant with the data we store in fields explicitly.
22270  * Everything else is useful only for sending out for initial routing sync.
22271  * Not stored if contains excess data to prevent DoS.
22272  *
22273  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22274  */
22275 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
22276
22277 /**
22278  * An initial announcement of the node
22279  * Mostly redundant with the data we store in fields explicitly.
22280  * Everything else is useful only for sending out for initial routing sync.
22281  * Not stored if contains excess data to prevent DoS.
22282  *
22283  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22284  */
22285 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
22286
22287 /**
22288  * Constructs a new NodeAnnouncementInfo given each field
22289  */
22290 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);
22291
22292 /**
22293  * Creates a copy of the NodeAnnouncementInfo
22294  */
22295 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
22296
22297 /**
22298  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
22299  */
22300 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
22301
22302 /**
22303  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
22304  */
22305 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
22306
22307 /**
22308  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
22309  */
22310 void NodeInfo_free(struct LDKNodeInfo this_obj);
22311
22312 /**
22313  * All valid channels a node has announced
22314  */
22315 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
22316
22317 /**
22318  * Lowest fees enabling routing via any of the enabled, known channels to a node.
22319  * The two fields (flat and proportional fee) are independent,
22320  * meaning they don't have to refer to the same channel.
22321  *
22322  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22323  */
22324 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
22325
22326 /**
22327  * Lowest fees enabling routing via any of the enabled, known channels to a node.
22328  * The two fields (flat and proportional fee) are independent,
22329  * meaning they don't have to refer to the same channel.
22330  *
22331  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22332  */
22333 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
22334
22335 /**
22336  * More information about a node from node_announcement.
22337  * Optional because we store a Node entry after learning about it from
22338  * a channel announcement, but before receiving a node announcement.
22339  *
22340  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22341  */
22342 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
22343
22344 /**
22345  * More information about a node from node_announcement.
22346  * Optional because we store a Node entry after learning about it from
22347  * a channel announcement, but before receiving a node announcement.
22348  *
22349  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22350  */
22351 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
22352
22353 /**
22354  * Constructs a new NodeInfo given each field
22355  */
22356 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
22357
22358 /**
22359  * Creates a copy of the NodeInfo
22360  */
22361 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
22362
22363 /**
22364  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
22365  */
22366 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
22367
22368 /**
22369  * Read a NodeInfo from a byte array, created by NodeInfo_write
22370  */
22371 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
22372
22373 /**
22374  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
22375  */
22376 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
22377
22378 /**
22379  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
22380  */
22381 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
22382
22383 /**
22384  * Creates a new, empty, network graph.
22385  */
22386 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
22387
22388 /**
22389  * Returns a read-only view of the network graph.
22390  */
22391 MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
22392
22393 /**
22394  * For an already known node (from channel announcements), update its stored properties from a
22395  * given node announcement.
22396  *
22397  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
22398  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
22399  * routing messages from a source using a protocol other than the lightning P2P protocol.
22400  */
22401 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
22402
22403 /**
22404  * For an already known node (from channel announcements), update its stored properties from a
22405  * given node announcement without verifying the associated signatures. Because we aren't
22406  * given the associated signatures here we cannot relay the node announcement to any of our
22407  * peers.
22408  */
22409 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);
22410
22411 /**
22412  * Store or update channel info from a channel announcement.
22413  *
22414  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
22415  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
22416  * routing messages from a source using a protocol other than the lightning P2P protocol.
22417  *
22418  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
22419  * the corresponding UTXO exists on chain and is correctly-formatted.
22420  */
22421 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);
22422
22423 /**
22424  * Store or update channel info from a channel announcement without verifying the associated
22425  * signatures. Because we aren't given the associated signatures here we cannot relay the
22426  * channel announcement to any of our peers.
22427  *
22428  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
22429  * the corresponding UTXO exists on chain and is correctly-formatted.
22430  */
22431 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);
22432
22433 /**
22434  * Close a channel if a corresponding HTLC fail was sent.
22435  * If permanent, removes a channel from the local storage.
22436  * May cause the removal of nodes too, if this was their last channel.
22437  * If not permanent, makes channels unavailable for routing.
22438  */
22439 void NetworkGraph_close_channel_from_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
22440
22441 /**
22442  * Marks a node in the graph as failed.
22443  */
22444 void NetworkGraph_fail_node(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent);
22445
22446 /**
22447  * For an already known (from announcement) channel, update info about one of the directions
22448  * of the channel.
22449  *
22450  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
22451  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
22452  * routing messages from a source using a protocol other than the lightning P2P protocol.
22453  */
22454 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
22455
22456 /**
22457  * For an already known (from announcement) channel, update info about one of the directions
22458  * of the channel without verifying the associated signatures. Because we aren't given the
22459  * associated signatures here we cannot relay the channel update to any of our peers.
22460  */
22461 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
22462
22463 /**
22464  * Get network addresses by node id.
22465  * Returns None if the requested node is completely unknown,
22466  * or if node announcement for the node was never received.
22467  */
22468 MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey);
22469
22470 /**
22471  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
22472  */
22473 void RouteHop_free(struct LDKRouteHop this_obj);
22474
22475 /**
22476  * The node_id of the node at this hop.
22477  */
22478 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
22479
22480 /**
22481  * The node_id of the node at this hop.
22482  */
22483 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22484
22485 /**
22486  * The node_announcement features of the node at this hop. For the last hop, these may be
22487  * amended to match the features present in the invoice this node generated.
22488  */
22489 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
22490
22491 /**
22492  * The node_announcement features of the node at this hop. For the last hop, these may be
22493  * amended to match the features present in the invoice this node generated.
22494  */
22495 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
22496
22497 /**
22498  * The channel that should be used from the previous hop to reach this node.
22499  */
22500 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
22501
22502 /**
22503  * The channel that should be used from the previous hop to reach this node.
22504  */
22505 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
22506
22507 /**
22508  * The channel_announcement features of the channel that should be used from the previous hop
22509  * to reach this node.
22510  */
22511 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
22512
22513 /**
22514  * The channel_announcement features of the channel that should be used from the previous hop
22515  * to reach this node.
22516  */
22517 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
22518
22519 /**
22520  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
22521  * For the last hop, this should be the full value of the payment (might be more than
22522  * requested if we had to match htlc_minimum_msat).
22523  */
22524 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
22525
22526 /**
22527  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
22528  * For the last hop, this should be the full value of the payment (might be more than
22529  * requested if we had to match htlc_minimum_msat).
22530  */
22531 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
22532
22533 /**
22534  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
22535  * expected at the destination, in excess of the current block height.
22536  */
22537 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
22538
22539 /**
22540  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
22541  * expected at the destination, in excess of the current block height.
22542  */
22543 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
22544
22545 /**
22546  * Constructs a new RouteHop given each field
22547  */
22548 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);
22549
22550 /**
22551  * Creates a copy of the RouteHop
22552  */
22553 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
22554
22555 /**
22556  * Checks if two RouteHops contain equal inner contents.
22557  */
22558 uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
22559
22560 /**
22561  * Checks if two RouteHops contain equal inner contents.
22562  * This ignores pointers and is_owned flags and looks at the values in fields.
22563  * Two objects with NULL inner values will be considered "equal" here.
22564  */
22565 bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
22566
22567 /**
22568  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
22569  */
22570 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
22571
22572 /**
22573  * Read a RouteHop from a byte array, created by RouteHop_write
22574  */
22575 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
22576
22577 /**
22578  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
22579  */
22580 void Route_free(struct LDKRoute this_obj);
22581
22582 /**
22583  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
22584  * last RouteHop in each path must be the same.
22585  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
22586  * destination. Thus, this must always be at least length one. While the maximum length of any
22587  * given path is variable, keeping the length of any path to less than 20 should currently
22588  * ensure it is viable.
22589  */
22590 struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
22591
22592 /**
22593  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
22594  * last RouteHop in each path must be the same.
22595  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
22596  * destination. Thus, this must always be at least length one. While the maximum length of any
22597  * given path is variable, keeping the length of any path to less than 20 should currently
22598  * ensure it is viable.
22599  */
22600 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
22601
22602 /**
22603  * The `payee` parameter passed to [`find_route`].
22604  * This is used by `ChannelManager` to track information which may be required for retries,
22605  * provided back to you via [`Event::PaymentPathFailed`].
22606  *
22607  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
22608  *
22609  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22610  */
22611 struct LDKPayee Route_get_payee(const struct LDKRoute *NONNULL_PTR this_ptr);
22612
22613 /**
22614  * The `payee` parameter passed to [`find_route`].
22615  * This is used by `ChannelManager` to track information which may be required for retries,
22616  * provided back to you via [`Event::PaymentPathFailed`].
22617  *
22618  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
22619  *
22620  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22621  */
22622 void Route_set_payee(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPayee val);
22623
22624 /**
22625  * Constructs a new Route given each field
22626  */
22627 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPayee payee_arg);
22628
22629 /**
22630  * Creates a copy of the Route
22631  */
22632 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
22633
22634 /**
22635  * Checks if two Routes contain equal inner contents.
22636  */
22637 uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
22638
22639 /**
22640  * Checks if two Routes contain equal inner contents.
22641  * This ignores pointers and is_owned flags and looks at the values in fields.
22642  * Two objects with NULL inner values will be considered "equal" here.
22643  */
22644 bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
22645
22646 /**
22647  * Returns the total amount of fees paid on this [`Route`].
22648  *
22649  * This doesn't include any extra payment made to the recipient, which can happen in excess of
22650  * the amount passed to [`find_route`]'s `params.final_value_msat`.
22651  */
22652 MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
22653
22654 /**
22655  * Returns the total amount paid on this [`Route`], excluding the fees.
22656  */
22657 MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
22658
22659 /**
22660  * Serialize the Route object into a byte array which can be read by Route_read
22661  */
22662 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
22663
22664 /**
22665  * Read a Route from a byte array, created by Route_write
22666  */
22667 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
22668
22669 /**
22670  * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL.
22671  */
22672 void RouteParameters_free(struct LDKRouteParameters this_obj);
22673
22674 /**
22675  * The recipient of the failed payment path.
22676  */
22677 struct LDKPayee RouteParameters_get_payee(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
22678
22679 /**
22680  * The recipient of the failed payment path.
22681  */
22682 void RouteParameters_set_payee(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPayee val);
22683
22684 /**
22685  * The amount in msats sent on the failed payment path.
22686  */
22687 uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
22688
22689 /**
22690  * The amount in msats sent on the failed payment path.
22691  */
22692 void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val);
22693
22694 /**
22695  * The CLTV on the final hop of the failed payment path.
22696  */
22697 uint32_t RouteParameters_get_final_cltv_expiry_delta(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
22698
22699 /**
22700  * The CLTV on the final hop of the failed payment path.
22701  */
22702 void RouteParameters_set_final_cltv_expiry_delta(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint32_t val);
22703
22704 /**
22705  * Constructs a new RouteParameters given each field
22706  */
22707 MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPayee payee_arg, uint64_t final_value_msat_arg, uint32_t final_cltv_expiry_delta_arg);
22708
22709 /**
22710  * Creates a copy of the RouteParameters
22711  */
22712 struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig);
22713
22714 /**
22715  * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
22716  */
22717 struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj);
22718
22719 /**
22720  * Read a RouteParameters from a byte array, created by RouteParameters_write
22721  */
22722 struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser);
22723
22724 /**
22725  * Frees any resources used by the Payee, if is_owned is set and inner is non-NULL.
22726  */
22727 void Payee_free(struct LDKPayee this_obj);
22728
22729 /**
22730  * The node id of the payee.
22731  */
22732 struct LDKPublicKey Payee_get_pubkey(const struct LDKPayee *NONNULL_PTR this_ptr);
22733
22734 /**
22735  * The node id of the payee.
22736  */
22737 void Payee_set_pubkey(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22738
22739 /**
22740  * Features supported by the payee.
22741  *
22742  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
22743  * does not contain any features.
22744  *
22745  * [`for_keysend`]: Self::for_keysend
22746  *
22747  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22748  */
22749 struct LDKInvoiceFeatures Payee_get_features(const struct LDKPayee *NONNULL_PTR this_ptr);
22750
22751 /**
22752  * Features supported by the payee.
22753  *
22754  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
22755  * does not contain any features.
22756  *
22757  * [`for_keysend`]: Self::for_keysend
22758  *
22759  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22760  */
22761 void Payee_set_features(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val);
22762
22763 /**
22764  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
22765  */
22766 struct LDKCVec_RouteHintZ Payee_get_route_hints(const struct LDKPayee *NONNULL_PTR this_ptr);
22767
22768 /**
22769  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
22770  */
22771 void Payee_set_route_hints(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val);
22772
22773 /**
22774  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
22775  */
22776 struct LDKCOption_u64Z Payee_get_expiry_time(const struct LDKPayee *NONNULL_PTR this_ptr);
22777
22778 /**
22779  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
22780  */
22781 void Payee_set_expiry_time(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
22782
22783 /**
22784  * Constructs a new Payee given each field
22785  */
22786 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);
22787
22788 /**
22789  * Creates a copy of the Payee
22790  */
22791 struct LDKPayee Payee_clone(const struct LDKPayee *NONNULL_PTR orig);
22792
22793 /**
22794  * Checks if two Payees contain equal inner contents.
22795  */
22796 uint64_t Payee_hash(const struct LDKPayee *NONNULL_PTR o);
22797
22798 /**
22799  * Checks if two Payees contain equal inner contents.
22800  * This ignores pointers and is_owned flags and looks at the values in fields.
22801  * Two objects with NULL inner values will be considered "equal" here.
22802  */
22803 bool Payee_eq(const struct LDKPayee *NONNULL_PTR a, const struct LDKPayee *NONNULL_PTR b);
22804
22805 /**
22806  * Serialize the Payee object into a byte array which can be read by Payee_read
22807  */
22808 struct LDKCVec_u8Z Payee_write(const struct LDKPayee *NONNULL_PTR obj);
22809
22810 /**
22811  * Read a Payee from a byte array, created by Payee_write
22812  */
22813 struct LDKCResult_PayeeDecodeErrorZ Payee_read(struct LDKu8slice ser);
22814
22815 /**
22816  * Creates a payee with the node id of the given `pubkey`.
22817  */
22818 MUST_USE_RES struct LDKPayee Payee_from_node_id(struct LDKPublicKey pubkey);
22819
22820 /**
22821  * Creates a payee with the node id of the given `pubkey` to use for keysend payments.
22822  */
22823 MUST_USE_RES struct LDKPayee Payee_for_keysend(struct LDKPublicKey pubkey);
22824
22825 /**
22826  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
22827  */
22828 void RouteHint_free(struct LDKRouteHint this_obj);
22829
22830 struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr);
22831
22832 void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val);
22833
22834 /**
22835  * Constructs a new RouteHint given each field
22836  */
22837 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg);
22838
22839 /**
22840  * Creates a copy of the RouteHint
22841  */
22842 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
22843
22844 /**
22845  * Checks if two RouteHints contain equal inner contents.
22846  */
22847 uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
22848
22849 /**
22850  * Checks if two RouteHints contain equal inner contents.
22851  * This ignores pointers and is_owned flags and looks at the values in fields.
22852  * Two objects with NULL inner values will be considered "equal" here.
22853  */
22854 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
22855
22856 /**
22857  * Serialize the RouteHint object into a byte array which can be read by RouteHint_read
22858  */
22859 struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj);
22860
22861 /**
22862  * Read a RouteHint from a byte array, created by RouteHint_write
22863  */
22864 struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser);
22865
22866 /**
22867  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
22868  */
22869 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
22870
22871 /**
22872  * The node_id of the non-target end of the route
22873  */
22874 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
22875
22876 /**
22877  * The node_id of the non-target end of the route
22878  */
22879 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22880
22881 /**
22882  * The short_channel_id of this channel
22883  */
22884 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
22885
22886 /**
22887  * The short_channel_id of this channel
22888  */
22889 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
22890
22891 /**
22892  * The fees which must be paid to use this channel
22893  */
22894 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
22895
22896 /**
22897  * The fees which must be paid to use this channel
22898  */
22899 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
22900
22901 /**
22902  * The difference in CLTV values between this node and the next node.
22903  */
22904 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
22905
22906 /**
22907  * The difference in CLTV values between this node and the next node.
22908  */
22909 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
22910
22911 /**
22912  * The minimum value, in msat, which must be relayed to the next hop.
22913  */
22914 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
22915
22916 /**
22917  * The minimum value, in msat, which must be relayed to the next hop.
22918  */
22919 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
22920
22921 /**
22922  * The maximum value in msat available for routing with a single HTLC.
22923  */
22924 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
22925
22926 /**
22927  * The maximum value in msat available for routing with a single HTLC.
22928  */
22929 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
22930
22931 /**
22932  * Constructs a new RouteHintHop given each field
22933  */
22934 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);
22935
22936 /**
22937  * Creates a copy of the RouteHintHop
22938  */
22939 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
22940
22941 /**
22942  * Checks if two RouteHintHops contain equal inner contents.
22943  */
22944 uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
22945
22946 /**
22947  * Checks if two RouteHintHops contain equal inner contents.
22948  * This ignores pointers and is_owned flags and looks at the values in fields.
22949  * Two objects with NULL inner values will be considered "equal" here.
22950  */
22951 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
22952
22953 /**
22954  * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
22955  */
22956 struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj);
22957
22958 /**
22959  * Read a RouteHintHop from a byte array, created by RouteHintHop_write
22960  */
22961 struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser);
22962
22963 /**
22964  * Finds a route from us (payer) to the given target node (payee).
22965  *
22966  * If the payee provided features in their invoice, they should be provided via `params.payee`.
22967  * Without this, MPP will only be used if the payee's features are available in the network graph.
22968  *
22969  * Private routing paths between a public node and the target may be included in `params.payee`.
22970  *
22971  * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
22972  * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of our local
22973  * channels from [`NetworkGraph`] will be ignored, and only those in `first_hops` will be used.
22974  *
22975  * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
22976  * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
22977  * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
22978  *
22979  * # Note
22980  *
22981  * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
22982  * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
22983  * function.
22984  *
22985  * # Panics
22986  *
22987  * Panics if first_hops contains channels without short_channel_ids;
22988  * [`ChannelManager::list_usable_channels`] will never include such channels.
22989  *
22990  * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
22991  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
22992  *
22993  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
22994  */
22995 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);
22996
22997 /**
22998  * Frees any resources used by the Scorer, if is_owned is set and inner is non-NULL.
22999  */
23000 void Scorer_free(struct LDKScorer this_obj);
23001
23002 /**
23003  * Frees any resources used by the ScoringParameters, if is_owned is set and inner is non-NULL.
23004  */
23005 void ScoringParameters_free(struct LDKScoringParameters this_obj);
23006
23007 /**
23008  * A fixed penalty in msats to apply to each channel.
23009  */
23010 uint64_t ScoringParameters_get_base_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
23011
23012 /**
23013  * A fixed penalty in msats to apply to each channel.
23014  */
23015 void ScoringParameters_set_base_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
23016
23017 /**
23018  * A penalty in msats to apply to a channel upon failing to relay a payment.
23019  *
23020  * This accumulates for each failure but may be reduced over time based on
23021  * [`failure_penalty_half_life`].
23022  *
23023  * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
23024  */
23025 uint64_t ScoringParameters_get_failure_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
23026
23027 /**
23028  * A penalty in msats to apply to a channel upon failing to relay a payment.
23029  *
23030  * This accumulates for each failure but may be reduced over time based on
23031  * [`failure_penalty_half_life`].
23032  *
23033  * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
23034  */
23035 void ScoringParameters_set_failure_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
23036
23037 /**
23038  * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
23039  * cut in half.
23040  *
23041  * # Note
23042  *
23043  * When time is an [`Eternity`], as is default when enabling feature `no-std`, it will never
23044  * elapse. Therefore, this penalty will never decay.
23045  *
23046  * [`failure_penalty_msat`]: Self::failure_penalty_msat
23047  */
23048 uint64_t ScoringParameters_get_failure_penalty_half_life(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
23049
23050 /**
23051  * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
23052  * cut in half.
23053  *
23054  * # Note
23055  *
23056  * When time is an [`Eternity`], as is default when enabling feature `no-std`, it will never
23057  * elapse. Therefore, this penalty will never decay.
23058  *
23059  * [`failure_penalty_msat`]: Self::failure_penalty_msat
23060  */
23061 void ScoringParameters_set_failure_penalty_half_life(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
23062
23063 /**
23064  * Constructs a new ScoringParameters given each field
23065  */
23066 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);
23067
23068 /**
23069  * Serialize the ScoringParameters object into a byte array which can be read by ScoringParameters_read
23070  */
23071 struct LDKCVec_u8Z ScoringParameters_write(const struct LDKScoringParameters *NONNULL_PTR obj);
23072
23073 /**
23074  * Read a ScoringParameters from a byte array, created by ScoringParameters_write
23075  */
23076 struct LDKCResult_ScoringParametersDecodeErrorZ ScoringParameters_read(struct LDKu8slice ser);
23077
23078 /**
23079  * Creates a new scorer using the given scoring parameters.
23080  */
23081 MUST_USE_RES struct LDKScorer Scorer_new(struct LDKScoringParameters params);
23082
23083 /**
23084  * Creates a "default" Scorer. See struct and individual field documentaiton for details on which values are used.
23085  */
23086 MUST_USE_RES struct LDKScorer Scorer_default(void);
23087
23088 /**
23089  * Creates a "default" ScoringParameters. See struct and individual field documentaiton for details on which values are used.
23090  */
23091 MUST_USE_RES struct LDKScoringParameters ScoringParameters_default(void);
23092
23093 /**
23094  * Constructs a new Score which calls the relevant methods on this_arg.
23095  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
23096  */
23097 struct LDKScore Scorer_as_Score(const struct LDKScorer *NONNULL_PTR this_arg);
23098
23099 /**
23100  * Serialize the Scorer object into a byte array which can be read by Scorer_read
23101  */
23102 struct LDKCVec_u8Z Scorer_write(const struct LDKScorer *NONNULL_PTR obj);
23103
23104 /**
23105  * Read a Scorer from a byte array, created by Scorer_write
23106  */
23107 struct LDKCResult_ScorerDecodeErrorZ Scorer_read(struct LDKu8slice ser);
23108
23109 /**
23110  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
23111  */
23112 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
23113
23114 /**
23115  * Initialize a new FilesystemPersister and set the path to the individual channels'
23116  * files.
23117  */
23118 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
23119
23120 /**
23121  * Get the directory which was provided when this persister was initialized.
23122  */
23123 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
23124
23125 /**
23126  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
23127  * initialization, within a file called \"manager\".
23128  */
23129 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
23130
23131 /**
23132  * Read `ChannelMonitor`s from disk.
23133  */
23134 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
23135
23136 /**
23137  * Constructs a new Persist which calls the relevant methods on this_arg.
23138  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
23139  */
23140 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
23141
23142 /**
23143  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
23144  */
23145 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
23146
23147 /**
23148  * Calls the free function if one is set
23149  */
23150 void ChannelManagerPersister_free(struct LDKChannelManagerPersister this_ptr);
23151
23152 /**
23153  * Start a background thread that takes care of responsibilities enumerated in the [top-level
23154  * documentation].
23155  *
23156  * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
23157  * `persist_manager` returns an error. In case of an error, the error is retrieved by calling
23158  * either [`join`] or [`stop`].
23159  *
23160  * # Data Persistence
23161  *
23162  * `persist_manager` is responsible for writing out the [`ChannelManager`] to disk, and/or
23163  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
23164  * [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's
23165  * provided implementation.
23166  *
23167  * Typically, users should either implement [`ChannelManagerPersister`] to never return an
23168  * error or call [`join`] and handle any error that may arise. For the latter case,
23169  * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
23170  *
23171  * # Event Handling
23172  *
23173  * `event_handler` is responsible for handling events that users should be notified of (e.g.,
23174  * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
23175  * functionality implemented by other handlers.
23176  * * [`NetGraphMsgHandler`] if given will update the [`NetworkGraph`] based on payment failures.
23177  *
23178  * [top-level documentation]: Self
23179  * [`join`]: Self::join
23180  * [`stop`]: Self::stop
23181  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
23182  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
23183  * [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
23184  * [`NetworkGraph`]: lightning::routing::network_graph::NetworkGraph
23185  *
23186  * Note that net_graph_msg_handler (or a relevant inner pointer) may be NULL or all-0s to represent None
23187  */
23188 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);
23189
23190 /**
23191  * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
23192  * [`ChannelManager`].
23193  *
23194  * # Panics
23195  *
23196  * This function panics if the background thread has panicked such as while persisting or
23197  * handling events.
23198  *
23199  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
23200  */
23201 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
23202
23203 /**
23204  * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
23205  * [`ChannelManager`].
23206  *
23207  * # Panics
23208  *
23209  * This function panics if the background thread has panicked such as while persisting or
23210  * handling events.
23211  *
23212  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
23213  */
23214 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
23215
23216 /**
23217  * **Call this function on startup to ensure that all assumptions about the platform are valid.**
23218  *
23219  * Unfortunately we have to make assumptions about the upper bounds of the `SystemTime` type on
23220  * your platform which we can't fully verify at compile time and which isn't part of it's contract.
23221  * To our best knowledge our assumptions hold for all platforms officially supported by rust, but
23222  * since this check is fast we recommend to do it anyway.
23223  *
23224  * If this function fails this is considered a bug. Please open an issue describing your
23225  * platform and stating your current system time.
23226  *
23227  * # Panics
23228  * If the check fails this function panics. By calling this function on startup you ensure that
23229  * this wont happen at an arbitrary later point in time.
23230  */
23231 void check_platform(void);
23232
23233 /**
23234  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
23235  */
23236 void Invoice_free(struct LDKInvoice this_obj);
23237
23238 /**
23239  * Checks if two Invoices contain equal inner contents.
23240  * This ignores pointers and is_owned flags and looks at the values in fields.
23241  * Two objects with NULL inner values will be considered "equal" here.
23242  */
23243 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
23244
23245 /**
23246  * Creates a copy of the Invoice
23247  */
23248 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
23249
23250 /**
23251  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
23252  */
23253 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
23254
23255 /**
23256  * Checks if two SignedRawInvoices contain equal inner contents.
23257  * This ignores pointers and is_owned flags and looks at the values in fields.
23258  * Two objects with NULL inner values will be considered "equal" here.
23259  */
23260 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
23261
23262 /**
23263  * Creates a copy of the SignedRawInvoice
23264  */
23265 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
23266
23267 /**
23268  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
23269  */
23270 void RawInvoice_free(struct LDKRawInvoice this_obj);
23271
23272 /**
23273  * data part
23274  */
23275 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
23276
23277 /**
23278  * data part
23279  */
23280 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
23281
23282 /**
23283  * Checks if two RawInvoices contain equal inner contents.
23284  * This ignores pointers and is_owned flags and looks at the values in fields.
23285  * Two objects with NULL inner values will be considered "equal" here.
23286  */
23287 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
23288
23289 /**
23290  * Creates a copy of the RawInvoice
23291  */
23292 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
23293
23294 /**
23295  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
23296  */
23297 void RawDataPart_free(struct LDKRawDataPart this_obj);
23298
23299 /**
23300  * generation time of the invoice
23301  */
23302 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
23303
23304 /**
23305  * generation time of the invoice
23306  */
23307 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
23308
23309 /**
23310  * Checks if two RawDataParts contain equal inner contents.
23311  * This ignores pointers and is_owned flags and looks at the values in fields.
23312  * Two objects with NULL inner values will be considered "equal" here.
23313  */
23314 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
23315
23316 /**
23317  * Creates a copy of the RawDataPart
23318  */
23319 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
23320
23321 /**
23322  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
23323  */
23324 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
23325
23326 /**
23327  * Checks if two PositiveTimestamps contain equal inner contents.
23328  * This ignores pointers and is_owned flags and looks at the values in fields.
23329  * Two objects with NULL inner values will be considered "equal" here.
23330  */
23331 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
23332
23333 /**
23334  * Creates a copy of the PositiveTimestamp
23335  */
23336 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
23337
23338 /**
23339  * Creates a copy of the SiPrefix
23340  */
23341 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
23342
23343 /**
23344  * Utility method to constructs a new Milli-variant SiPrefix
23345  */
23346 enum LDKSiPrefix SiPrefix_milli(void);
23347
23348 /**
23349  * Utility method to constructs a new Micro-variant SiPrefix
23350  */
23351 enum LDKSiPrefix SiPrefix_micro(void);
23352
23353 /**
23354  * Utility method to constructs a new Nano-variant SiPrefix
23355  */
23356 enum LDKSiPrefix SiPrefix_nano(void);
23357
23358 /**
23359  * Utility method to constructs a new Pico-variant SiPrefix
23360  */
23361 enum LDKSiPrefix SiPrefix_pico(void);
23362
23363 /**
23364  * Checks if two SiPrefixs contain equal inner contents.
23365  * This ignores pointers and is_owned flags and looks at the values in fields.
23366  */
23367 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
23368
23369 /**
23370  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
23371  * This is effectively 10^12 * the prefix multiplier
23372  */
23373 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
23374
23375 /**
23376  * Creates a copy of the Currency
23377  */
23378 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
23379
23380 /**
23381  * Utility method to constructs a new Bitcoin-variant Currency
23382  */
23383 enum LDKCurrency Currency_bitcoin(void);
23384
23385 /**
23386  * Utility method to constructs a new BitcoinTestnet-variant Currency
23387  */
23388 enum LDKCurrency Currency_bitcoin_testnet(void);
23389
23390 /**
23391  * Utility method to constructs a new Regtest-variant Currency
23392  */
23393 enum LDKCurrency Currency_regtest(void);
23394
23395 /**
23396  * Utility method to constructs a new Simnet-variant Currency
23397  */
23398 enum LDKCurrency Currency_simnet(void);
23399
23400 /**
23401  * Utility method to constructs a new Signet-variant Currency
23402  */
23403 enum LDKCurrency Currency_signet(void);
23404
23405 /**
23406  * Checks if two Currencys contain equal inner contents.
23407  */
23408 uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
23409
23410 /**
23411  * Checks if two Currencys contain equal inner contents.
23412  * This ignores pointers and is_owned flags and looks at the values in fields.
23413  */
23414 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
23415
23416 /**
23417  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
23418  */
23419 void Sha256_free(struct LDKSha256 this_obj);
23420
23421 /**
23422  * Creates a copy of the Sha256
23423  */
23424 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
23425
23426 /**
23427  * Checks if two Sha256s contain equal inner contents.
23428  */
23429 uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
23430
23431 /**
23432  * Checks if two Sha256s contain equal inner contents.
23433  * This ignores pointers and is_owned flags and looks at the values in fields.
23434  * Two objects with NULL inner values will be considered "equal" here.
23435  */
23436 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
23437
23438 /**
23439  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
23440  */
23441 void Description_free(struct LDKDescription this_obj);
23442
23443 /**
23444  * Creates a copy of the Description
23445  */
23446 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
23447
23448 /**
23449  * Checks if two Descriptions contain equal inner contents.
23450  */
23451 uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
23452
23453 /**
23454  * Checks if two Descriptions contain equal inner contents.
23455  * This ignores pointers and is_owned flags and looks at the values in fields.
23456  * Two objects with NULL inner values will be considered "equal" here.
23457  */
23458 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
23459
23460 /**
23461  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
23462  */
23463 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
23464
23465 struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr);
23466
23467 void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23468
23469 /**
23470  * Constructs a new PayeePubKey given each field
23471  */
23472 MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg);
23473
23474 /**
23475  * Creates a copy of the PayeePubKey
23476  */
23477 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
23478
23479 /**
23480  * Checks if two PayeePubKeys contain equal inner contents.
23481  */
23482 uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
23483
23484 /**
23485  * Checks if two PayeePubKeys contain equal inner contents.
23486  * This ignores pointers and is_owned flags and looks at the values in fields.
23487  * Two objects with NULL inner values will be considered "equal" here.
23488  */
23489 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
23490
23491 /**
23492  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
23493  */
23494 void ExpiryTime_free(struct LDKExpiryTime this_obj);
23495
23496 /**
23497  * Creates a copy of the ExpiryTime
23498  */
23499 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
23500
23501 /**
23502  * Checks if two ExpiryTimes contain equal inner contents.
23503  */
23504 uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
23505
23506 /**
23507  * Checks if two ExpiryTimes contain equal inner contents.
23508  * This ignores pointers and is_owned flags and looks at the values in fields.
23509  * Two objects with NULL inner values will be considered "equal" here.
23510  */
23511 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
23512
23513 /**
23514  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
23515  */
23516 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
23517
23518 uint64_t MinFinalCltvExpiry_get_a(const struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr);
23519
23520 void MinFinalCltvExpiry_set_a(struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr, uint64_t val);
23521
23522 /**
23523  * Constructs a new MinFinalCltvExpiry given each field
23524  */
23525 MUST_USE_RES struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_new(uint64_t a_arg);
23526
23527 /**
23528  * Creates a copy of the MinFinalCltvExpiry
23529  */
23530 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
23531
23532 /**
23533  * Checks if two MinFinalCltvExpirys contain equal inner contents.
23534  */
23535 uint64_t MinFinalCltvExpiry_hash(const struct LDKMinFinalCltvExpiry *NONNULL_PTR o);
23536
23537 /**
23538  * Checks if two MinFinalCltvExpirys contain equal inner contents.
23539  * This ignores pointers and is_owned flags and looks at the values in fields.
23540  * Two objects with NULL inner values will be considered "equal" here.
23541  */
23542 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
23543
23544 /**
23545  * Frees any resources used by the Fallback
23546  */
23547 void Fallback_free(struct LDKFallback this_ptr);
23548
23549 /**
23550  * Creates a copy of the Fallback
23551  */
23552 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
23553
23554 /**
23555  * Utility method to constructs a new SegWitProgram-variant Fallback
23556  */
23557 struct LDKFallback Fallback_seg_wit_program(struct LDKu5 version, struct LDKCVec_u8Z program);
23558
23559 /**
23560  * Utility method to constructs a new PubKeyHash-variant Fallback
23561  */
23562 struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a);
23563
23564 /**
23565  * Utility method to constructs a new ScriptHash-variant Fallback
23566  */
23567 struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
23568
23569 /**
23570  * Checks if two Fallbacks contain equal inner contents.
23571  */
23572 uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
23573
23574 /**
23575  * Checks if two Fallbacks contain equal inner contents.
23576  * This ignores pointers and is_owned flags and looks at the values in fields.
23577  */
23578 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
23579
23580 /**
23581  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
23582  */
23583 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
23584
23585 /**
23586  * Creates a copy of the InvoiceSignature
23587  */
23588 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
23589
23590 /**
23591  * Checks if two InvoiceSignatures contain equal inner contents.
23592  * This ignores pointers and is_owned flags and looks at the values in fields.
23593  * Two objects with NULL inner values will be considered "equal" here.
23594  */
23595 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
23596
23597 /**
23598  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
23599  */
23600 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
23601
23602 /**
23603  * Creates a copy of the PrivateRoute
23604  */
23605 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
23606
23607 /**
23608  * Checks if two PrivateRoutes contain equal inner contents.
23609  */
23610 uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
23611
23612 /**
23613  * Checks if two PrivateRoutes contain equal inner contents.
23614  * This ignores pointers and is_owned flags and looks at the values in fields.
23615  * Two objects with NULL inner values will be considered "equal" here.
23616  */
23617 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
23618
23619 /**
23620  * Disassembles the `SignedRawInvoice` into its three parts:
23621  *  1. raw invoice
23622  *  2. hash of the raw invoice
23623  *  3. signature
23624  */
23625 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
23626
23627 /**
23628  * The `RawInvoice` which was signed.
23629  */
23630 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
23631
23632 /**
23633  * The hash of the `RawInvoice` that was signed.
23634  */
23635 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
23636
23637 /**
23638  * InvoiceSignature for the invoice.
23639  */
23640 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
23641
23642 /**
23643  * Recovers the public key used for signing the invoice from the recoverable signature.
23644  */
23645 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
23646
23647 /**
23648  * Checks if the signature is valid for the included payee public key or if none exists if it's
23649  * valid for the recovered signature (which should always be true?).
23650  */
23651 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
23652
23653 /**
23654  * Calculate the hash of the encoded `RawInvoice`
23655  */
23656 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
23657
23658 /**
23659  *
23660  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23661  */
23662 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
23663
23664 /**
23665  *
23666  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23667  */
23668 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
23669
23670 /**
23671  *
23672  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23673  */
23674 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
23675
23676 /**
23677  *
23678  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23679  */
23680 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
23681
23682 /**
23683  *
23684  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23685  */
23686 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
23687
23688 /**
23689  *
23690  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23691  */
23692 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
23693
23694 /**
23695  *
23696  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23697  */
23698 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
23699
23700 /**
23701  *
23702  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23703  */
23704 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
23705
23706 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
23707
23708 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
23709
23710 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
23711
23712 /**
23713  * Create a new `PositiveTimestamp` from a unix timestamp in the Range
23714  * `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
23715  * `CreationError::TimestampOutOfBounds`.
23716  */
23717 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
23718
23719 /**
23720  * Create a new `PositiveTimestamp` from a `SystemTime` with a corresponding unix timestamp in
23721  * the Range `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
23722  * `CreationError::TimestampOutOfBounds`.
23723  */
23724 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
23725
23726 /**
23727  * Returns the UNIX timestamp representing the stored time
23728  */
23729 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
23730
23731 /**
23732  * Returns a reference to the internal `SystemTime` time representation
23733  */
23734 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
23735
23736 /**
23737  * Transform the `Invoice` into it's unchecked version
23738  */
23739 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
23740
23741 /**
23742  * Check that the invoice is signed correctly and that key recovery works
23743  */
23744 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
23745
23746 /**
23747  * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
23748  * ```
23749  * use lightning_invoice::*;
23750  *
23751  * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\
23752  * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\
23753  * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\
23754  * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\
23755  * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\
23756  * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\
23757  * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\
23758  * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\
23759  * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\
23760  * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\
23761  * j5r6drg6k6zcqj0fcwg\";
23762  *
23763  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
23764  *
23765  * assert!(Invoice::from_signed(signed).is_ok());
23766  * ```
23767  */
23768 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
23769
23770 /**
23771  * Returns the `Invoice`'s timestamp (should equal it's creation time)
23772  */
23773 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
23774
23775 /**
23776  * Returns the hash to which we will receive the preimage on completion of the payment
23777  */
23778 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
23779
23780 /**
23781  * Get the payee's public key if one was included in the invoice
23782  *
23783  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23784  */
23785 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
23786
23787 /**
23788  * Get the payment secret if one was included in the invoice
23789  */
23790 MUST_USE_RES const uint8_t (*Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
23791
23792 /**
23793  * Get the invoice features if they were included in the invoice
23794  *
23795  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23796  */
23797 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
23798
23799 /**
23800  * Recover the payee's public key (only to be used if none was included in the invoice)
23801  */
23802 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
23803
23804 /**
23805  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
23806  */
23807 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
23808
23809 /**
23810  * Returns whether the invoice has expired.
23811  */
23812 MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg);
23813
23814 /**
23815  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
23816  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
23817  */
23818 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
23819
23820 /**
23821  * Returns a list of all routes included in the invoice
23822  */
23823 MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
23824
23825 /**
23826  * Returns a list of all routes included in the invoice as the underlying hints
23827  */
23828 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
23829
23830 /**
23831  * Returns the currency for which the invoice was issued
23832  */
23833 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
23834
23835 /**
23836  * Returns the amount if specified in the invoice as millisatoshis.
23837  */
23838 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_milli_satoshis(const struct LDKInvoice *NONNULL_PTR this_arg);
23839
23840 /**
23841  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
23842  * returns `CreationError::DescriptionTooLong` otherwise
23843  *
23844  * Please note that single characters may use more than one byte due to UTF8 encoding.
23845  */
23846 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
23847
23848 /**
23849  * Returns the underlying description `String`
23850  */
23851 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
23852
23853 /**
23854  * Construct an `ExpiryTime` from seconds. If there exists a `PositiveTimestamp` which would
23855  * overflow on adding the `EpiryTime` to it then this function will return a
23856  * `CreationError::ExpiryTimeOutOfBounds`.
23857  */
23858 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_seconds(uint64_t seconds);
23859
23860 /**
23861  * Construct an `ExpiryTime` from a `Duration`. If there exists a `PositiveTimestamp` which
23862  * would overflow on adding the `EpiryTime` to it then this function will return a
23863  * `CreationError::ExpiryTimeOutOfBounds`.
23864  */
23865 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_duration(uint64_t duration);
23866
23867 /**
23868  * Returns the expiry time in seconds
23869  */
23870 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
23871
23872 /**
23873  * Returns a reference to the underlying `Duration` (=expiry time)
23874  */
23875 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
23876
23877 /**
23878  * Creates a new (partial) route from a list of hops
23879  */
23880 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
23881
23882 /**
23883  * Returns the underlying list of hops
23884  */
23885 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
23886
23887 /**
23888  * Creates a copy of the CreationError
23889  */
23890 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
23891
23892 /**
23893  * Utility method to constructs a new DescriptionTooLong-variant CreationError
23894  */
23895 enum LDKCreationError CreationError_description_too_long(void);
23896
23897 /**
23898  * Utility method to constructs a new RouteTooLong-variant CreationError
23899  */
23900 enum LDKCreationError CreationError_route_too_long(void);
23901
23902 /**
23903  * Utility method to constructs a new TimestampOutOfBounds-variant CreationError
23904  */
23905 enum LDKCreationError CreationError_timestamp_out_of_bounds(void);
23906
23907 /**
23908  * Utility method to constructs a new ExpiryTimeOutOfBounds-variant CreationError
23909  */
23910 enum LDKCreationError CreationError_expiry_time_out_of_bounds(void);
23911
23912 /**
23913  * Checks if two CreationErrors contain equal inner contents.
23914  * This ignores pointers and is_owned flags and looks at the values in fields.
23915  */
23916 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
23917
23918 /**
23919  * Get the string representation of a CreationError object
23920  */
23921 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
23922
23923 /**
23924  * Creates a copy of the SemanticError
23925  */
23926 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
23927
23928 /**
23929  * Utility method to constructs a new NoPaymentHash-variant SemanticError
23930  */
23931 enum LDKSemanticError SemanticError_no_payment_hash(void);
23932
23933 /**
23934  * Utility method to constructs a new MultiplePaymentHashes-variant SemanticError
23935  */
23936 enum LDKSemanticError SemanticError_multiple_payment_hashes(void);
23937
23938 /**
23939  * Utility method to constructs a new NoDescription-variant SemanticError
23940  */
23941 enum LDKSemanticError SemanticError_no_description(void);
23942
23943 /**
23944  * Utility method to constructs a new MultipleDescriptions-variant SemanticError
23945  */
23946 enum LDKSemanticError SemanticError_multiple_descriptions(void);
23947
23948 /**
23949  * Utility method to constructs a new NoPaymentSecret-variant SemanticError
23950  */
23951 enum LDKSemanticError SemanticError_no_payment_secret(void);
23952
23953 /**
23954  * Utility method to constructs a new MultiplePaymentSecrets-variant SemanticError
23955  */
23956 enum LDKSemanticError SemanticError_multiple_payment_secrets(void);
23957
23958 /**
23959  * Utility method to constructs a new InvalidFeatures-variant SemanticError
23960  */
23961 enum LDKSemanticError SemanticError_invalid_features(void);
23962
23963 /**
23964  * Utility method to constructs a new InvalidRecoveryId-variant SemanticError
23965  */
23966 enum LDKSemanticError SemanticError_invalid_recovery_id(void);
23967
23968 /**
23969  * Utility method to constructs a new InvalidSignature-variant SemanticError
23970  */
23971 enum LDKSemanticError SemanticError_invalid_signature(void);
23972
23973 /**
23974  * Utility method to constructs a new ImpreciseAmount-variant SemanticError
23975  */
23976 enum LDKSemanticError SemanticError_imprecise_amount(void);
23977
23978 /**
23979  * Checks if two SemanticErrors contain equal inner contents.
23980  * This ignores pointers and is_owned flags and looks at the values in fields.
23981  */
23982 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
23983
23984 /**
23985  * Get the string representation of a SemanticError object
23986  */
23987 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
23988
23989 /**
23990  * Frees any resources used by the SignOrCreationError
23991  */
23992 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
23993
23994 /**
23995  * Creates a copy of the SignOrCreationError
23996  */
23997 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
23998
23999 /**
24000  * Utility method to constructs a new SignError-variant SignOrCreationError
24001  */
24002 struct LDKSignOrCreationError SignOrCreationError_sign_error(void);
24003
24004 /**
24005  * Utility method to constructs a new CreationError-variant SignOrCreationError
24006  */
24007 struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a);
24008
24009 /**
24010  * Checks if two SignOrCreationErrors contain equal inner contents.
24011  * This ignores pointers and is_owned flags and looks at the values in fields.
24012  */
24013 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
24014
24015 /**
24016  * Get the string representation of a SignOrCreationError object
24017  */
24018 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
24019
24020 /**
24021  * Frees any resources used by the InvoicePayer, if is_owned is set and inner is non-NULL.
24022  */
24023 void InvoicePayer_free(struct LDKInvoicePayer this_obj);
24024
24025 /**
24026  * Calls the free function if one is set
24027  */
24028 void Payer_free(struct LDKPayer this_ptr);
24029
24030 /**
24031  * Calls the free function if one is set
24032  */
24033 void Router_free(struct LDKRouter this_ptr);
24034
24035 /**
24036  * Frees any resources used by the RetryAttempts, if is_owned is set and inner is non-NULL.
24037  */
24038 void RetryAttempts_free(struct LDKRetryAttempts this_obj);
24039
24040 uintptr_t RetryAttempts_get_a(const struct LDKRetryAttempts *NONNULL_PTR this_ptr);
24041
24042 void RetryAttempts_set_a(struct LDKRetryAttempts *NONNULL_PTR this_ptr, uintptr_t val);
24043
24044 /**
24045  * Constructs a new RetryAttempts given each field
24046  */
24047 MUST_USE_RES struct LDKRetryAttempts RetryAttempts_new(uintptr_t a_arg);
24048
24049 /**
24050  * Creates a copy of the RetryAttempts
24051  */
24052 struct LDKRetryAttempts RetryAttempts_clone(const struct LDKRetryAttempts *NONNULL_PTR orig);
24053
24054 /**
24055  * Checks if two RetryAttemptss contain equal inner contents.
24056  * This ignores pointers and is_owned flags and looks at the values in fields.
24057  * Two objects with NULL inner values will be considered "equal" here.
24058  */
24059 bool RetryAttempts_eq(const struct LDKRetryAttempts *NONNULL_PTR a, const struct LDKRetryAttempts *NONNULL_PTR b);
24060
24061 /**
24062  * Checks if two RetryAttemptss contain equal inner contents.
24063  */
24064 uint64_t RetryAttempts_hash(const struct LDKRetryAttempts *NONNULL_PTR o);
24065
24066 /**
24067  * Frees any resources used by the PaymentError
24068  */
24069 void PaymentError_free(struct LDKPaymentError this_ptr);
24070
24071 /**
24072  * Creates a copy of the PaymentError
24073  */
24074 struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig);
24075
24076 /**
24077  * Utility method to constructs a new Invoice-variant PaymentError
24078  */
24079 struct LDKPaymentError PaymentError_invoice(struct LDKStr a);
24080
24081 /**
24082  * Utility method to constructs a new Routing-variant PaymentError
24083  */
24084 struct LDKPaymentError PaymentError_routing(struct LDKLightningError a);
24085
24086 /**
24087  * Utility method to constructs a new Sending-variant PaymentError
24088  */
24089 struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a);
24090
24091 /**
24092  * Creates an invoice payer that retries failed payment paths.
24093  *
24094  * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once
24095  * `retry_attempts` has been exceeded for a given [`Invoice`].
24096  */
24097 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);
24098
24099 /**
24100  * Pays the given [`Invoice`], caching it for later use in case a retry is needed.
24101  *
24102  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
24103  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
24104  * for you.
24105  */
24106 MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice);
24107
24108 /**
24109  * Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in
24110  * case a retry is needed.
24111  *
24112  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
24113  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
24114  * for you.
24115  */
24116 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);
24117
24118 /**
24119  * Removes the payment cached by the given payment hash.
24120  *
24121  * Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an
24122  * [`EventHandler`]. Otherwise, calling this method is unnecessary.
24123  */
24124 void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
24125
24126 /**
24127  * Constructs a new EventHandler which calls the relevant methods on this_arg.
24128  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
24129  */
24130 struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg);
24131
24132 /**
24133  * Utility to construct an invoice. Generally, unless you want to do something like a custom
24134  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
24135  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
24136  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
24137  * that the payment secret is valid when the invoice is paid.
24138  */
24139 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);
24140
24141 /**
24142  * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
24143  */
24144 void DefaultRouter_free(struct LDKDefaultRouter this_obj);
24145
24146 /**
24147  * Creates a new router using the given [`NetworkGraph`] and  [`Logger`].
24148  */
24149 MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
24150
24151 /**
24152  * Constructs a new Router which calls the relevant methods on this_arg.
24153  * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
24154  */
24155 struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg);
24156
24157 /**
24158  * Constructs a new Payer which calls the relevant methods on this_arg.
24159  * This copies the `inner` pointer in this_arg and thus the returned Payer must be freed before this_arg is
24160  */
24161 struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_PTR this_arg);
24162
24163 /**
24164  * Read a SiPrefix object from a string
24165  */
24166 struct LDKCResult_SiPrefixNoneZ SiPrefix_from_str(struct LDKStr s);
24167
24168 /**
24169  * Read a Invoice object from a string
24170  */
24171 struct LDKCResult_InvoiceNoneZ Invoice_from_str(struct LDKStr s);
24172
24173 /**
24174  * Read a SignedRawInvoice object from a string
24175  */
24176 struct LDKCResult_SignedRawInvoiceNoneZ SignedRawInvoice_from_str(struct LDKStr s);
24177
24178 /**
24179  * Get the string representation of a Invoice object
24180  */
24181 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
24182
24183 /**
24184  * Get the string representation of a SignedRawInvoice object
24185  */
24186 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
24187
24188 /**
24189  * Get the string representation of a Currency object
24190  */
24191 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
24192
24193 /**
24194  * Get the string representation of a SiPrefix object
24195  */
24196 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
24197
24198 #endif /* LDK_C_BINDINGS_H */
24199
24200 #include "ldk_ver.h"