8b6468cb4dd62e524269446a2e72364cecefa9e1
[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.24.3 */
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 enum which can either contain a  or not
33  */
34 typedef enum LDKCOption_NoneZ {
35    /**
36     * When we're in this state, this COption_NoneZ contains a
37     */
38    LDKCOption_NoneZ_Some,
39    /**
40     * When we're in this state, this COption_NoneZ contains nothing
41     */
42    LDKCOption_NoneZ_None,
43    /**
44     * Must be last for serialization purposes
45     */
46    LDKCOption_NoneZ_Sentinel,
47 } LDKCOption_NoneZ;
48
49 /**
50  * An enum representing the status of a channel monitor update persistence.
51  */
52 typedef enum LDKChannelMonitorUpdateStatus {
53    /**
54     * The update has been durably persisted and all copies of the relevant [`ChannelMonitor`]
55     * have been updated.
56     *
57     * This includes performing any `fsync()` calls required to ensure the update is guaranteed to
58     * be available on restart even if the application crashes.
59     */
60    LDKChannelMonitorUpdateStatus_Completed,
61    /**
62     * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
63     * our state failed, but is expected to succeed at some point in the future).
64     *
65     * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
66     * submitting new commitment transactions to the counterparty. Once the update(s) which failed
67     * have been successfully applied, a [`MonitorEvent::Completed`] can be used to restore the
68     * channel to an operational state.
69     *
70     * Note that a given [`ChannelManager`] will *never* re-generate a [`ChannelMonitorUpdate`].
71     * If you return this error you must ensure that it is written to disk safely before writing
72     * the latest [`ChannelManager`] state, or you should return [`PermanentFailure`] instead.
73     *
74     * Even when a channel has been \"frozen\", updates to the [`ChannelMonitor`] can continue to
75     * occur (e.g. if an inbound HTLC which we forwarded was claimed upstream, resulting in us
76     * attempting to claim it on this channel) and those updates must still be persisted.
77     *
78     * No updates to the channel will be made which could invalidate other [`ChannelMonitor`]s
79     * until a [`MonitorEvent::Completed`] is provided, even if you return no error on a later
80     * monitor update for the same channel.
81     *
82     * For deployments where a copy of ChannelMonitors and other local state are backed up in a
83     * remote location (with local copies persisted immediately), it is anticipated that all
84     * updates will return [`InProgress`] until the remote copies could be updated.
85     *
86     * [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure
87     * [`InProgress`]: ChannelMonitorUpdateStatus::InProgress
88     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
89     */
90    LDKChannelMonitorUpdateStatus_InProgress,
91    /**
92     * Used to indicate no further channel monitor updates will be allowed (likely a disk failure
93     * or a remote copy of this [`ChannelMonitor`] is no longer reachable and thus not updatable).
94     *
95     * When this is returned, [`ChannelManager`] will force-close the channel but *not* broadcast
96     * our current commitment transaction. This avoids a dangerous case where a local disk failure
97     * (e.g. the Linux-default remounting of the disk as read-only) causes [`PermanentFailure`]s
98     * for all monitor updates. If we were to broadcast our latest commitment transaction and then
99     * restart, we could end up reading a previous [`ChannelMonitor`] and [`ChannelManager`],
100     * revoking our now-broadcasted state before seeing it confirm and losing all our funds.
101     *
102     * Note that this is somewhat of a tradeoff - if the disk is really gone and we may have lost
103     * the data permanently, we really should broadcast immediately. If the data can be recovered
104     * with manual intervention, we'd rather close the channel, rejecting future updates to it,
105     * and broadcast the latest state only if we have HTLCs to claim which are timing out (which
106     * we do as long as blocks are connected).
107     *
108     * In order to broadcast the latest local commitment transaction, you'll need to call
109     * [`ChannelMonitor::get_latest_holder_commitment_txn`] and broadcast the resulting
110     * transactions once you've safely ensured no further channel updates can be generated by your
111     * [`ChannelManager`].
112     *
113     * Note that at least one final [`ChannelMonitorUpdate`] may still be provided, which must
114     * still be processed by a running [`ChannelMonitor`]. This final update will mark the
115     * [`ChannelMonitor`] as finalized, ensuring no further updates (e.g. revocation of the latest
116     * commitment transaction) are allowed.
117     *
118     * Note that even if you return a [`PermanentFailure`] due to unavailability of secondary
119     * [`ChannelMonitor`] copies, you should still make an attempt to store the update where
120     * possible to ensure you can claim HTLC outputs on the latest commitment transaction
121     * broadcasted later.
122     *
123     * In case of distributed watchtowers deployment, the new version must be written to disk, as
124     * state may have been stored but rejected due to a block forcing a commitment broadcast. This
125     * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
126     * lagging behind on block processing.
127     *
128     * [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure
129     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
130     */
131    LDKChannelMonitorUpdateStatus_PermanentFailure,
132    /**
133     * Must be last for serialization purposes
134     */
135    LDKChannelMonitorUpdateStatus_Sentinel,
136 } LDKChannelMonitorUpdateStatus;
137
138 /**
139  * An enum that represents the speed at which we want a transaction to confirm used for feerate
140  * estimation.
141  */
142 typedef enum LDKConfirmationTarget {
143    /**
144     * We are happy with this transaction confirming slowly when feerate drops some.
145     */
146    LDKConfirmationTarget_Background,
147    /**
148     * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
149     */
150    LDKConfirmationTarget_Normal,
151    /**
152     * We'd like this transaction to confirm in the next few blocks.
153     */
154    LDKConfirmationTarget_HighPriority,
155    /**
156     * Must be last for serialization purposes
157     */
158    LDKConfirmationTarget_Sentinel,
159 } LDKConfirmationTarget;
160
161 /**
162  * Errors that may occur when constructing a new `RawInvoice` or `Invoice`
163  */
164 typedef enum LDKCreationError {
165    /**
166     * The supplied description string was longer than 639 __bytes__ (see [`Description::new(…)`](./struct.Description.html#method.new))
167     */
168    LDKCreationError_DescriptionTooLong,
169    /**
170     * The specified route has too many hops and can't be encoded
171     */
172    LDKCreationError_RouteTooLong,
173    /**
174     * The Unix timestamp of the supplied date is less than zero or greater than 35-bits
175     */
176    LDKCreationError_TimestampOutOfBounds,
177    /**
178     * The supplied millisatoshi amount was greater than the total bitcoin supply.
179     */
180    LDKCreationError_InvalidAmount,
181    /**
182     * Route hints were required for this invoice and were missing. Applies to
183     * [phantom invoices].
184     *
185     * [phantom invoices]: crate::utils::create_phantom_invoice
186     */
187    LDKCreationError_MissingRouteHints,
188    /**
189     * Must be last for serialization purposes
190     */
191    LDKCreationError_Sentinel,
192 } LDKCreationError;
193
194 /**
195  * Enum representing the crypto currencies (or networks) supported by this library
196  */
197 typedef enum LDKCurrency {
198    /**
199     * Bitcoin mainnet
200     */
201    LDKCurrency_Bitcoin,
202    /**
203     * Bitcoin testnet
204     */
205    LDKCurrency_BitcoinTestnet,
206    /**
207     * Bitcoin regtest
208     */
209    LDKCurrency_Regtest,
210    /**
211     * Bitcoin simnet
212     */
213    LDKCurrency_Simnet,
214    /**
215     * Bitcoin signet
216     */
217    LDKCurrency_Signet,
218    /**
219     * Must be last for serialization purposes
220     */
221    LDKCurrency_Sentinel,
222 } LDKCurrency;
223
224 /**
225  * Represents an IO Error. Note that some information is lost in the conversion from Rust.
226  */
227 typedef enum LDKIOError {
228    LDKIOError_NotFound,
229    LDKIOError_PermissionDenied,
230    LDKIOError_ConnectionRefused,
231    LDKIOError_ConnectionReset,
232    LDKIOError_ConnectionAborted,
233    LDKIOError_NotConnected,
234    LDKIOError_AddrInUse,
235    LDKIOError_AddrNotAvailable,
236    LDKIOError_BrokenPipe,
237    LDKIOError_AlreadyExists,
238    LDKIOError_WouldBlock,
239    LDKIOError_InvalidInput,
240    LDKIOError_InvalidData,
241    LDKIOError_TimedOut,
242    LDKIOError_WriteZero,
243    LDKIOError_Interrupted,
244    LDKIOError_Other,
245    LDKIOError_UnexpectedEof,
246    /**
247     * Must be last for serialization purposes
248     */
249    LDKIOError_Sentinel,
250 } LDKIOError;
251
252 /**
253  * An enum representing the available verbosity levels of the logger.
254  */
255 typedef enum LDKLevel {
256    /**
257     * Designates extremely verbose information, including gossip-induced messages
258     */
259    LDKLevel_Gossip,
260    /**
261     * Designates very low priority, often extremely verbose, information
262     */
263    LDKLevel_Trace,
264    /**
265     * Designates lower priority information
266     */
267    LDKLevel_Debug,
268    /**
269     * Designates useful information
270     */
271    LDKLevel_Info,
272    /**
273     * Designates hazardous situations
274     */
275    LDKLevel_Warn,
276    /**
277     * Designates very serious errors
278     */
279    LDKLevel_Error,
280    /**
281     * Must be last for serialization purposes
282     */
283    LDKLevel_Sentinel,
284 } LDKLevel;
285
286 /**
287  * An enum representing the possible Bitcoin or test networks which we can run on
288  */
289 typedef enum LDKNetwork {
290    /**
291     * The main Bitcoin blockchain.
292     */
293    LDKNetwork_Bitcoin,
294    /**
295     * The testnet3 blockchain.
296     */
297    LDKNetwork_Testnet,
298    /**
299     * A local test blockchain.
300     */
301    LDKNetwork_Regtest,
302    /**
303     * A blockchain on which blocks are signed instead of mined.
304     */
305    LDKNetwork_Signet,
306    /**
307     * Must be last for serialization purposes
308     */
309    LDKNetwork_Sentinel,
310 } LDKNetwork;
311
312 /**
313  * Specifies the recipient of an invoice, to indicate to [`KeysInterface::sign_invoice`] what node
314  * secret key should be used to sign the invoice.
315  */
316 typedef enum LDKRecipient {
317    /**
318     * The invoice should be signed with the local node secret key.
319     */
320    LDKRecipient_Node,
321    /**
322     * The invoice should be signed with the phantom node secret key. This secret key must be the
323     * same for all nodes participating in the [phantom node payment].
324     *
325     * [phantom node payment]: PhantomKeysManager
326     */
327    LDKRecipient_PhantomNode,
328    /**
329     * Must be last for serialization purposes
330     */
331    LDKRecipient_Sentinel,
332 } LDKRecipient;
333
334 /**
335  * Represents an error returned from libsecp256k1 during validation of some secp256k1 data
336  */
337 typedef enum LDKSecp256k1Error {
338    /**
339     * Signature failed verification
340     */
341    LDKSecp256k1Error_IncorrectSignature,
342    /**
343     * Badly sized message ("messages" are actually fixed-sized digests; see the MESSAGE_SIZE constant)
344     */
345    LDKSecp256k1Error_InvalidMessage,
346    /**
347     * Bad public key
348     */
349    LDKSecp256k1Error_InvalidPublicKey,
350    /**
351     * Bad signature
352     */
353    LDKSecp256k1Error_InvalidSignature,
354    /**
355     * Bad secret key
356     */
357    LDKSecp256k1Error_InvalidSecretKey,
358    /**
359     * Bad shared secret.
360     */
361    LDKSecp256k1Error_InvalidSharedSecret,
362    /**
363     * Bad recovery id
364     */
365    LDKSecp256k1Error_InvalidRecoveryId,
366    /**
367     * Invalid tweak for add_assign or mul_assign
368     */
369    LDKSecp256k1Error_InvalidTweak,
370    /**
371     * Didn't pass enough memory to context creation with preallocated memory
372     */
373    LDKSecp256k1Error_NotEnoughMemory,
374    /**
375     * Bad set of public keys.
376     */
377    LDKSecp256k1Error_InvalidPublicKeySum,
378    /**
379     * The only valid parity values are 0 or 1.
380     */
381    LDKSecp256k1Error_InvalidParityValue,
382    /**
383     * Must be last for serialization purposes
384     */
385    LDKSecp256k1Error_Sentinel,
386 } LDKSecp256k1Error;
387
388 /**
389  * Errors that may occur when converting a `RawInvoice` to an `Invoice`. They relate to the
390  * requirements sections in BOLT #11
391  */
392 typedef enum LDKSemanticError {
393    /**
394     * The invoice is missing the mandatory payment hash
395     */
396    LDKSemanticError_NoPaymentHash,
397    /**
398     * The invoice has multiple payment hashes which isn't allowed
399     */
400    LDKSemanticError_MultiplePaymentHashes,
401    /**
402     * No description or description hash are part of the invoice
403     */
404    LDKSemanticError_NoDescription,
405    /**
406     * The invoice contains multiple descriptions and/or description hashes which isn't allowed
407     */
408    LDKSemanticError_MultipleDescriptions,
409    /**
410     * The invoice is missing the mandatory payment secret, which all modern lightning nodes
411     * should provide.
412     */
413    LDKSemanticError_NoPaymentSecret,
414    /**
415     * The invoice contains multiple payment secrets
416     */
417    LDKSemanticError_MultiplePaymentSecrets,
418    /**
419     * The invoice's features are invalid
420     */
421    LDKSemanticError_InvalidFeatures,
422    /**
423     * The recovery id doesn't fit the signature/pub key
424     */
425    LDKSemanticError_InvalidRecoveryId,
426    /**
427     * The invoice's signature is invalid
428     */
429    LDKSemanticError_InvalidSignature,
430    /**
431     * The invoice's amount was not a whole number of millisatoshis
432     */
433    LDKSemanticError_ImpreciseAmount,
434    /**
435     * Must be last for serialization purposes
436     */
437    LDKSemanticError_Sentinel,
438 } LDKSemanticError;
439
440 /**
441  * SI prefixes for the human readable part
442  */
443 typedef enum LDKSiPrefix {
444    /**
445     * 10^-3
446     */
447    LDKSiPrefix_Milli,
448    /**
449     * 10^-6
450     */
451    LDKSiPrefix_Micro,
452    /**
453     * 10^-9
454     */
455    LDKSiPrefix_Nano,
456    /**
457     * 10^-12
458     */
459    LDKSiPrefix_Pico,
460    /**
461     * Must be last for serialization purposes
462     */
463    LDKSiPrefix_Sentinel,
464 } LDKSiPrefix;
465
466 /**
467  * A Rust str object, ie a reference to a UTF8-valid string.
468  * This is *not* null-terminated so cannot be used directly as a C string!
469  */
470 typedef struct LDKStr {
471    /**
472     * A pointer to the string's bytes, in UTF8 encoding
473     */
474    const uint8_t *chars;
475    /**
476     * The number of bytes (not characters!) pointed to by `chars`
477     */
478    uintptr_t len;
479    /**
480     * Whether the data pointed to by `chars` should be freed or not.
481     */
482    bool chars_is_owned;
483 } LDKStr;
484
485 /**
486  * Represents a scalar value between zero and the secp256k1 curve order, in big endian.
487  */
488 typedef struct LDKBigEndianScalar {
489    /**
490     * The bytes of the scalar value.
491     */
492    uint8_t big_endian_bytes[32];
493 } LDKBigEndianScalar;
494
495 /**
496  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
497  * look up the corresponding function in rust-lightning's docs.
498  */
499 typedef struct LDKThirtyTwoBytes {
500    /**
501     * The thirty-two bytes
502     */
503    uint8_t data[32];
504 } LDKThirtyTwoBytes;
505
506 /**
507  * Represents an error returned from the bech32 library during validation of some bech32 data
508  */
509 typedef enum LDKBech32Error_Tag {
510    /**
511     * String does not contain the separator character
512     */
513    LDKBech32Error_MissingSeparator,
514    /**
515     * The checksum does not match the rest of the data
516     */
517    LDKBech32Error_InvalidChecksum,
518    /**
519     * The data or human-readable part is too long or too short
520     */
521    LDKBech32Error_InvalidLength,
522    /**
523     * Some part of the string contains an invalid character
524     */
525    LDKBech32Error_InvalidChar,
526    /**
527     * Some part of the data has an invalid value
528     */
529    LDKBech32Error_InvalidData,
530    /**
531     * The bit conversion failed due to a padding issue
532     */
533    LDKBech32Error_InvalidPadding,
534    /**
535     * The whole string must be of one case
536     */
537    LDKBech32Error_MixedCase,
538    /**
539     * Must be last for serialization purposes
540     */
541    LDKBech32Error_Sentinel,
542 } LDKBech32Error_Tag;
543
544 typedef struct LDKBech32Error {
545    LDKBech32Error_Tag tag;
546    union {
547       struct {
548          uint32_t invalid_char;
549       };
550       struct {
551          uint8_t invalid_data;
552       };
553    };
554 } LDKBech32Error;
555
556 /**
557  * A serialized transaction, in (pointer, length) form.
558  *
559  * This type optionally owns its own memory, and thus the semantics around access change based on
560  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
561  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
562  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
563  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
564  * you would be invalid.
565  *
566  * Note that, while it may change in the future, because transactions on the Rust side are stored
567  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
568  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
569  * `data_is_owned` either set or unset at your discretion.
570  */
571 typedef struct LDKTransaction {
572    /**
573     * The serialized transaction data.
574     *
575     * This is non-const for your convenience, an object passed to Rust is never written to.
576     */
577    uint8_t *data;
578    /**
579     * The length of the serialized transaction
580     */
581    uintptr_t datalen;
582    /**
583     * Whether the data pointed to by `data` should be freed or not.
584     */
585    bool data_is_owned;
586 } LDKTransaction;
587
588 /**
589  * A dynamically-allocated array of u8s of arbitrary size.
590  * This corresponds to std::vector in C++
591  */
592 typedef struct LDKCVec_u8Z {
593    /**
594     * The elements in the array.
595     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
596     */
597    uint8_t *data;
598    /**
599     * The number of elements pointed to by `data`.
600     */
601    uintptr_t datalen;
602 } LDKCVec_u8Z;
603
604 /**
605  * A transaction output including a scriptPubKey and value.
606  * This type *does* own its own memory, so must be free'd appropriately.
607  */
608 typedef struct LDKTxOut {
609    /**
610     * The script_pubkey in this output
611     */
612    struct LDKCVec_u8Z script_pubkey;
613    /**
614     * The value, in satoshis, of this output
615     */
616    uint64_t value;
617 } LDKTxOut;
618
619 /**
620  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
621  */
622 typedef struct LDKPublicKey {
623    /**
624     * The bytes of the public key
625     */
626    uint8_t compressed_form[33];
627 } LDKPublicKey;
628
629 /**
630  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
631  * This corresponds to std::vector in C++
632  */
633 typedef struct LDKCVec_PublicKeyZ {
634    /**
635     * The elements in the array.
636     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
637     */
638    struct LDKPublicKey *data;
639    /**
640     * The number of elements pointed to by `data`.
641     */
642    uintptr_t datalen;
643 } LDKCVec_PublicKeyZ;
644
645
646
647 /**
648  * Onion messages can be sent and received to blinded routes, which serve to hide the identity of
649  * the recipient.
650  */
651 typedef struct MUST_USE_STRUCT LDKBlindedRoute {
652    /**
653     * A pointer to the opaque Rust object.
654     * Nearly everywhere, inner must be non-null, however in places where
655     * the Rust equivalent takes an Option, it may be set to null to indicate None.
656     */
657    LDKnativeBlindedRoute *inner;
658    /**
659     * Indicates that this is the only struct which contains the same pointer.
660     * Rust functions which take ownership of an object provided via an argument require
661     * this to be true and invalidate the object pointed to by inner.
662     */
663    bool is_owned;
664 } LDKBlindedRoute;
665
666 /**
667  * The contents of CResult_BlindedRouteNoneZ
668  */
669 typedef union LDKCResult_BlindedRouteNoneZPtr {
670    /**
671     * A pointer to the contents in the success state.
672     * Reading from this pointer when `result_ok` is not set is undefined.
673     */
674    struct LDKBlindedRoute *result;
675    /**
676     * Note that this value is always NULL, as there are no contents in the Err variant
677     */
678    void *err;
679 } LDKCResult_BlindedRouteNoneZPtr;
680
681 /**
682  * A CResult_BlindedRouteNoneZ represents the result of a fallible operation,
683  * containing a crate::lightning::onion_message::blinded_route::BlindedRoute on success and a () on failure.
684  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
685  */
686 typedef struct LDKCResult_BlindedRouteNoneZ {
687    /**
688     * The contents of this CResult_BlindedRouteNoneZ, accessible via either
689     * `err` or `result` depending on the state of `result_ok`.
690     */
691    union LDKCResult_BlindedRouteNoneZPtr contents;
692    /**
693     * Whether this CResult_BlindedRouteNoneZ represents a success state.
694     */
695    bool result_ok;
696 } LDKCResult_BlindedRouteNoneZ;
697
698 /**
699  * An error in decoding a message or struct.
700  */
701 typedef enum LDKDecodeError_Tag {
702    /**
703     * A version byte specified something we don't know how to handle.
704     * Includes unknown realm byte in an OnionHopData packet
705     */
706    LDKDecodeError_UnknownVersion,
707    /**
708     * Unknown feature mandating we fail to parse message (eg TLV with an even, unknown type)
709     */
710    LDKDecodeError_UnknownRequiredFeature,
711    /**
712     * Value was invalid, eg a byte which was supposed to be a bool was something other than a 0
713     * or 1, a public key/private key/signature was invalid, text wasn't UTF-8, TLV was
714     * syntactically incorrect, etc
715     */
716    LDKDecodeError_InvalidValue,
717    /**
718     * Buffer too short
719     */
720    LDKDecodeError_ShortRead,
721    /**
722     * A length descriptor in the packet didn't describe the later data correctly
723     */
724    LDKDecodeError_BadLengthDescriptor,
725    /**
726     * Error from std::io
727     */
728    LDKDecodeError_Io,
729    /**
730     * The message included zlib-compressed values, which we don't support.
731     */
732    LDKDecodeError_UnsupportedCompression,
733    /**
734     * Must be last for serialization purposes
735     */
736    LDKDecodeError_Sentinel,
737 } LDKDecodeError_Tag;
738
739 typedef struct MUST_USE_STRUCT LDKDecodeError {
740    LDKDecodeError_Tag tag;
741    union {
742       struct {
743          enum LDKIOError io;
744       };
745    };
746 } LDKDecodeError;
747
748 /**
749  * The contents of CResult_BlindedRouteDecodeErrorZ
750  */
751 typedef union LDKCResult_BlindedRouteDecodeErrorZPtr {
752    /**
753     * A pointer to the contents in the success state.
754     * Reading from this pointer when `result_ok` is not set is undefined.
755     */
756    struct LDKBlindedRoute *result;
757    /**
758     * A pointer to the contents in the error state.
759     * Reading from this pointer when `result_ok` is set is undefined.
760     */
761    struct LDKDecodeError *err;
762 } LDKCResult_BlindedRouteDecodeErrorZPtr;
763
764 /**
765  * A CResult_BlindedRouteDecodeErrorZ represents the result of a fallible operation,
766  * containing a crate::lightning::onion_message::blinded_route::BlindedRoute on success and a crate::lightning::ln::msgs::DecodeError on failure.
767  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
768  */
769 typedef struct LDKCResult_BlindedRouteDecodeErrorZ {
770    /**
771     * The contents of this CResult_BlindedRouteDecodeErrorZ, accessible via either
772     * `err` or `result` depending on the state of `result_ok`.
773     */
774    union LDKCResult_BlindedRouteDecodeErrorZPtr contents;
775    /**
776     * Whether this CResult_BlindedRouteDecodeErrorZ represents a success state.
777     */
778    bool result_ok;
779 } LDKCResult_BlindedRouteDecodeErrorZ;
780
781
782
783 /**
784  * Used to construct the blinded hops portion of a blinded route. These hops cannot be identified
785  * by outside observers and thus can be used to hide the identity of the recipient.
786  */
787 typedef struct MUST_USE_STRUCT LDKBlindedHop {
788    /**
789     * A pointer to the opaque Rust object.
790     * Nearly everywhere, inner must be non-null, however in places where
791     * the Rust equivalent takes an Option, it may be set to null to indicate None.
792     */
793    LDKnativeBlindedHop *inner;
794    /**
795     * Indicates that this is the only struct which contains the same pointer.
796     * Rust functions which take ownership of an object provided via an argument require
797     * this to be true and invalidate the object pointed to by inner.
798     */
799    bool is_owned;
800 } LDKBlindedHop;
801
802 /**
803  * The contents of CResult_BlindedHopDecodeErrorZ
804  */
805 typedef union LDKCResult_BlindedHopDecodeErrorZPtr {
806    /**
807     * A pointer to the contents in the success state.
808     * Reading from this pointer when `result_ok` is not set is undefined.
809     */
810    struct LDKBlindedHop *result;
811    /**
812     * A pointer to the contents in the error state.
813     * Reading from this pointer when `result_ok` is set is undefined.
814     */
815    struct LDKDecodeError *err;
816 } LDKCResult_BlindedHopDecodeErrorZPtr;
817
818 /**
819  * A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
820  * containing a crate::lightning::onion_message::blinded_route::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
821  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
822  */
823 typedef struct LDKCResult_BlindedHopDecodeErrorZ {
824    /**
825     * The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
826     * `err` or `result` depending on the state of `result_ok`.
827     */
828    union LDKCResult_BlindedHopDecodeErrorZPtr contents;
829    /**
830     * Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
831     */
832    bool result_ok;
833 } LDKCResult_BlindedHopDecodeErrorZ;
834
835 /**
836  * The contents of CResult_NoneNoneZ
837  */
838 typedef union LDKCResult_NoneNoneZPtr {
839    /**
840     * Note that this value is always NULL, as there are no contents in the OK variant
841     */
842    void *result;
843    /**
844     * Note that this value is always NULL, as there are no contents in the Err variant
845     */
846    void *err;
847 } LDKCResult_NoneNoneZPtr;
848
849 /**
850  * A CResult_NoneNoneZ represents the result of a fallible operation,
851  * containing a () on success and a () on failure.
852  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
853  */
854 typedef struct LDKCResult_NoneNoneZ {
855    /**
856     * The contents of this CResult_NoneNoneZ, accessible via either
857     * `err` or `result` depending on the state of `result_ok`.
858     */
859    union LDKCResult_NoneNoneZPtr contents;
860    /**
861     * Whether this CResult_NoneNoneZ represents a success state.
862     */
863    bool result_ok;
864 } LDKCResult_NoneNoneZ;
865
866
867
868 /**
869  * Implements the per-commitment secret storage scheme from
870  * [BOLT 3](https://github.com/lightning/bolts/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage).
871  *
872  * Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes
873  * or so.
874  */
875 typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets {
876    /**
877     * A pointer to the opaque Rust object.
878     * Nearly everywhere, inner must be non-null, however in places where
879     * the Rust equivalent takes an Option, it may be set to null to indicate None.
880     */
881    LDKnativeCounterpartyCommitmentSecrets *inner;
882    /**
883     * Indicates that this is the only struct which contains the same pointer.
884     * Rust functions which take ownership of an object provided via an argument require
885     * this to be true and invalidate the object pointed to by inner.
886     */
887    bool is_owned;
888 } LDKCounterpartyCommitmentSecrets;
889
890 /**
891  * The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
892  */
893 typedef union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
894    /**
895     * A pointer to the contents in the success state.
896     * Reading from this pointer when `result_ok` is not set is undefined.
897     */
898    struct LDKCounterpartyCommitmentSecrets *result;
899    /**
900     * A pointer to the contents in the error state.
901     * Reading from this pointer when `result_ok` is set is undefined.
902     */
903    struct LDKDecodeError *err;
904 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr;
905
906 /**
907  * A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
908  * containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
909  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
910  */
911 typedef struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ {
912    /**
913     * The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
914     * `err` or `result` depending on the state of `result_ok`.
915     */
916    union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr contents;
917    /**
918     * Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
919     */
920    bool result_ok;
921 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ;
922
923 /**
924  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
925  */
926 typedef struct LDKSecretKey {
927    /**
928     * The bytes of the secret key
929     */
930    uint8_t bytes[32];
931 } LDKSecretKey;
932
933 /**
934  * The contents of CResult_SecretKeyErrorZ
935  */
936 typedef union LDKCResult_SecretKeyErrorZPtr {
937    /**
938     * A pointer to the contents in the success state.
939     * Reading from this pointer when `result_ok` is not set is undefined.
940     */
941    struct LDKSecretKey *result;
942    /**
943     * A pointer to the contents in the error state.
944     * Reading from this pointer when `result_ok` is set is undefined.
945     */
946    enum LDKSecp256k1Error *err;
947 } LDKCResult_SecretKeyErrorZPtr;
948
949 /**
950  * A CResult_SecretKeyErrorZ represents the result of a fallible operation,
951  * containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
952  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
953  */
954 typedef struct LDKCResult_SecretKeyErrorZ {
955    /**
956     * The contents of this CResult_SecretKeyErrorZ, accessible via either
957     * `err` or `result` depending on the state of `result_ok`.
958     */
959    union LDKCResult_SecretKeyErrorZPtr contents;
960    /**
961     * Whether this CResult_SecretKeyErrorZ represents a success state.
962     */
963    bool result_ok;
964 } LDKCResult_SecretKeyErrorZ;
965
966 /**
967  * The contents of CResult_PublicKeyErrorZ
968  */
969 typedef union LDKCResult_PublicKeyErrorZPtr {
970    /**
971     * A pointer to the contents in the success state.
972     * Reading from this pointer when `result_ok` is not set is undefined.
973     */
974    struct LDKPublicKey *result;
975    /**
976     * A pointer to the contents in the error state.
977     * Reading from this pointer when `result_ok` is set is undefined.
978     */
979    enum LDKSecp256k1Error *err;
980 } LDKCResult_PublicKeyErrorZPtr;
981
982 /**
983  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
984  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
985  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
986  */
987 typedef struct LDKCResult_PublicKeyErrorZ {
988    /**
989     * The contents of this CResult_PublicKeyErrorZ, accessible via either
990     * `err` or `result` depending on the state of `result_ok`.
991     */
992    union LDKCResult_PublicKeyErrorZPtr contents;
993    /**
994     * Whether this CResult_PublicKeyErrorZ represents a success state.
995     */
996    bool result_ok;
997 } LDKCResult_PublicKeyErrorZ;
998
999
1000
1001 /**
1002  * The set of public keys which are used in the creation of one commitment transaction.
1003  * These are derived from the channel base keys and per-commitment data.
1004  *
1005  * A broadcaster key is provided from potential broadcaster of the computed transaction.
1006  * A countersignatory key is coming from a protocol participant unable to broadcast the
1007  * transaction.
1008  *
1009  * These keys are assumed to be good, either because the code derived them from
1010  * channel basepoints via the new function, or they were obtained via
1011  * CommitmentTransaction.trust().keys() because we trusted the source of the
1012  * pre-calculated keys.
1013  */
1014 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
1015    /**
1016     * A pointer to the opaque Rust object.
1017     * Nearly everywhere, inner must be non-null, however in places where
1018     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1019     */
1020    LDKnativeTxCreationKeys *inner;
1021    /**
1022     * Indicates that this is the only struct which contains the same pointer.
1023     * Rust functions which take ownership of an object provided via an argument require
1024     * this to be true and invalidate the object pointed to by inner.
1025     */
1026    bool is_owned;
1027 } LDKTxCreationKeys;
1028
1029 /**
1030  * The contents of CResult_TxCreationKeysDecodeErrorZ
1031  */
1032 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
1033    /**
1034     * A pointer to the contents in the success state.
1035     * Reading from this pointer when `result_ok` is not set is undefined.
1036     */
1037    struct LDKTxCreationKeys *result;
1038    /**
1039     * A pointer to the contents in the error state.
1040     * Reading from this pointer when `result_ok` is set is undefined.
1041     */
1042    struct LDKDecodeError *err;
1043 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
1044
1045 /**
1046  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
1047  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
1048  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1049  */
1050 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
1051    /**
1052     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
1053     * `err` or `result` depending on the state of `result_ok`.
1054     */
1055    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
1056    /**
1057     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
1058     */
1059    bool result_ok;
1060 } LDKCResult_TxCreationKeysDecodeErrorZ;
1061
1062
1063
1064 /**
1065  * One counterparty's public keys which do not change over the life of a channel.
1066  */
1067 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
1068    /**
1069     * A pointer to the opaque Rust object.
1070     * Nearly everywhere, inner must be non-null, however in places where
1071     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1072     */
1073    LDKnativeChannelPublicKeys *inner;
1074    /**
1075     * Indicates that this is the only struct which contains the same pointer.
1076     * Rust functions which take ownership of an object provided via an argument require
1077     * this to be true and invalidate the object pointed to by inner.
1078     */
1079    bool is_owned;
1080 } LDKChannelPublicKeys;
1081
1082 /**
1083  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
1084  */
1085 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
1086    /**
1087     * A pointer to the contents in the success state.
1088     * Reading from this pointer when `result_ok` is not set is undefined.
1089     */
1090    struct LDKChannelPublicKeys *result;
1091    /**
1092     * A pointer to the contents in the error state.
1093     * Reading from this pointer when `result_ok` is set is undefined.
1094     */
1095    struct LDKDecodeError *err;
1096 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
1097
1098 /**
1099  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
1100  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
1101  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1102  */
1103 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
1104    /**
1105     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
1106     * `err` or `result` depending on the state of `result_ok`.
1107     */
1108    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
1109    /**
1110     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
1111     */
1112    bool result_ok;
1113 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
1114
1115 /**
1116  * The contents of CResult_TxCreationKeysErrorZ
1117  */
1118 typedef union LDKCResult_TxCreationKeysErrorZPtr {
1119    /**
1120     * A pointer to the contents in the success state.
1121     * Reading from this pointer when `result_ok` is not set is undefined.
1122     */
1123    struct LDKTxCreationKeys *result;
1124    /**
1125     * A pointer to the contents in the error state.
1126     * Reading from this pointer when `result_ok` is set is undefined.
1127     */
1128    enum LDKSecp256k1Error *err;
1129 } LDKCResult_TxCreationKeysErrorZPtr;
1130
1131 /**
1132  * A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
1133  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
1134  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1135  */
1136 typedef struct LDKCResult_TxCreationKeysErrorZ {
1137    /**
1138     * The contents of this CResult_TxCreationKeysErrorZ, accessible via either
1139     * `err` or `result` depending on the state of `result_ok`.
1140     */
1141    union LDKCResult_TxCreationKeysErrorZPtr contents;
1142    /**
1143     * Whether this CResult_TxCreationKeysErrorZ represents a success state.
1144     */
1145    bool result_ok;
1146 } LDKCResult_TxCreationKeysErrorZ;
1147
1148 /**
1149  * An enum which can either contain a u32 or not
1150  */
1151 typedef enum LDKCOption_u32Z_Tag {
1152    /**
1153     * When we're in this state, this COption_u32Z contains a u32
1154     */
1155    LDKCOption_u32Z_Some,
1156    /**
1157     * When we're in this state, this COption_u32Z contains nothing
1158     */
1159    LDKCOption_u32Z_None,
1160    /**
1161     * Must be last for serialization purposes
1162     */
1163    LDKCOption_u32Z_Sentinel,
1164 } LDKCOption_u32Z_Tag;
1165
1166 typedef struct LDKCOption_u32Z {
1167    LDKCOption_u32Z_Tag tag;
1168    union {
1169       struct {
1170          uint32_t some;
1171       };
1172    };
1173 } LDKCOption_u32Z;
1174
1175
1176
1177 /**
1178  * Information about an HTLC as it appears in a commitment transaction
1179  */
1180 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
1181    /**
1182     * A pointer to the opaque Rust object.
1183     * Nearly everywhere, inner must be non-null, however in places where
1184     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1185     */
1186    LDKnativeHTLCOutputInCommitment *inner;
1187    /**
1188     * Indicates that this is the only struct which contains the same pointer.
1189     * Rust functions which take ownership of an object provided via an argument require
1190     * this to be true and invalidate the object pointed to by inner.
1191     */
1192    bool is_owned;
1193 } LDKHTLCOutputInCommitment;
1194
1195 /**
1196  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
1197  */
1198 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
1199    /**
1200     * A pointer to the contents in the success state.
1201     * Reading from this pointer when `result_ok` is not set is undefined.
1202     */
1203    struct LDKHTLCOutputInCommitment *result;
1204    /**
1205     * A pointer to the contents in the error state.
1206     * Reading from this pointer when `result_ok` is set is undefined.
1207     */
1208    struct LDKDecodeError *err;
1209 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
1210
1211 /**
1212  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
1213  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
1214  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1215  */
1216 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
1217    /**
1218     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
1219     * `err` or `result` depending on the state of `result_ok`.
1220     */
1221    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
1222    /**
1223     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
1224     */
1225    bool result_ok;
1226 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
1227
1228
1229
1230 /**
1231  * Late-bound per-channel counterparty data used to build transactions.
1232  */
1233 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
1234    /**
1235     * A pointer to the opaque Rust object.
1236     * Nearly everywhere, inner must be non-null, however in places where
1237     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1238     */
1239    LDKnativeCounterpartyChannelTransactionParameters *inner;
1240    /**
1241     * Indicates that this is the only struct which contains the same pointer.
1242     * Rust functions which take ownership of an object provided via an argument require
1243     * this to be true and invalidate the object pointed to by inner.
1244     */
1245    bool is_owned;
1246 } LDKCounterpartyChannelTransactionParameters;
1247
1248 /**
1249  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
1250  */
1251 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1252    /**
1253     * A pointer to the contents in the success state.
1254     * Reading from this pointer when `result_ok` is not set is undefined.
1255     */
1256    struct LDKCounterpartyChannelTransactionParameters *result;
1257    /**
1258     * A pointer to the contents in the error state.
1259     * Reading from this pointer when `result_ok` is set is undefined.
1260     */
1261    struct LDKDecodeError *err;
1262 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
1263
1264 /**
1265  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1266  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1267  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1268  */
1269 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1270    /**
1271     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
1272     * `err` or `result` depending on the state of `result_ok`.
1273     */
1274    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
1275    /**
1276     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
1277     */
1278    bool result_ok;
1279 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
1280
1281
1282
1283 /**
1284  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
1285  * The fields are organized by holder/counterparty.
1286  *
1287  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
1288  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
1289  */
1290 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
1291    /**
1292     * A pointer to the opaque Rust object.
1293     * Nearly everywhere, inner must be non-null, however in places where
1294     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1295     */
1296    LDKnativeChannelTransactionParameters *inner;
1297    /**
1298     * Indicates that this is the only struct which contains the same pointer.
1299     * Rust functions which take ownership of an object provided via an argument require
1300     * this to be true and invalidate the object pointed to by inner.
1301     */
1302    bool is_owned;
1303 } LDKChannelTransactionParameters;
1304
1305 /**
1306  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
1307  */
1308 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
1309    /**
1310     * A pointer to the contents in the success state.
1311     * Reading from this pointer when `result_ok` is not set is undefined.
1312     */
1313    struct LDKChannelTransactionParameters *result;
1314    /**
1315     * A pointer to the contents in the error state.
1316     * Reading from this pointer when `result_ok` is set is undefined.
1317     */
1318    struct LDKDecodeError *err;
1319 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
1320
1321 /**
1322  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1323  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1324  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1325  */
1326 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
1327    /**
1328     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
1329     * `err` or `result` depending on the state of `result_ok`.
1330     */
1331    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
1332    /**
1333     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
1334     */
1335    bool result_ok;
1336 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
1337
1338 /**
1339  * Represents a secp256k1 signature serialized as two 32-byte numbers
1340  */
1341 typedef struct LDKSignature {
1342    /**
1343     * The bytes of the signature in "compact" form
1344     */
1345    uint8_t compact_form[64];
1346 } LDKSignature;
1347
1348 /**
1349  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1350  * This corresponds to std::vector in C++
1351  */
1352 typedef struct LDKCVec_SignatureZ {
1353    /**
1354     * The elements in the array.
1355     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1356     */
1357    struct LDKSignature *data;
1358    /**
1359     * The number of elements pointed to by `data`.
1360     */
1361    uintptr_t datalen;
1362 } LDKCVec_SignatureZ;
1363
1364
1365
1366 /**
1367  * Information needed to build and sign a holder's commitment transaction.
1368  *
1369  * The transaction is only signed once we are ready to broadcast.
1370  */
1371 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
1372    /**
1373     * A pointer to the opaque Rust object.
1374     * Nearly everywhere, inner must be non-null, however in places where
1375     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1376     */
1377    LDKnativeHolderCommitmentTransaction *inner;
1378    /**
1379     * Indicates that this is the only struct which contains the same pointer.
1380     * Rust functions which take ownership of an object provided via an argument require
1381     * this to be true and invalidate the object pointed to by inner.
1382     */
1383    bool is_owned;
1384 } LDKHolderCommitmentTransaction;
1385
1386 /**
1387  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1388  */
1389 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
1390    /**
1391     * A pointer to the contents in the success state.
1392     * Reading from this pointer when `result_ok` is not set is undefined.
1393     */
1394    struct LDKHolderCommitmentTransaction *result;
1395    /**
1396     * A pointer to the contents in the error state.
1397     * Reading from this pointer when `result_ok` is set is undefined.
1398     */
1399    struct LDKDecodeError *err;
1400 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
1401
1402 /**
1403  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1404  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1405  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1406  */
1407 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
1408    /**
1409     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1410     * `err` or `result` depending on the state of `result_ok`.
1411     */
1412    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
1413    /**
1414     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1415     */
1416    bool result_ok;
1417 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
1418
1419
1420
1421 /**
1422  * A pre-built Bitcoin commitment transaction and its txid.
1423  */
1424 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
1425    /**
1426     * A pointer to the opaque Rust object.
1427     * Nearly everywhere, inner must be non-null, however in places where
1428     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1429     */
1430    LDKnativeBuiltCommitmentTransaction *inner;
1431    /**
1432     * Indicates that this is the only struct which contains the same pointer.
1433     * Rust functions which take ownership of an object provided via an argument require
1434     * this to be true and invalidate the object pointed to by inner.
1435     */
1436    bool is_owned;
1437 } LDKBuiltCommitmentTransaction;
1438
1439 /**
1440  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1441  */
1442 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1443    /**
1444     * A pointer to the contents in the success state.
1445     * Reading from this pointer when `result_ok` is not set is undefined.
1446     */
1447    struct LDKBuiltCommitmentTransaction *result;
1448    /**
1449     * A pointer to the contents in the error state.
1450     * Reading from this pointer when `result_ok` is set is undefined.
1451     */
1452    struct LDKDecodeError *err;
1453 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
1454
1455 /**
1456  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1457  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1458  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1459  */
1460 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
1461    /**
1462     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1463     * `err` or `result` depending on the state of `result_ok`.
1464     */
1465    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
1466    /**
1467     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1468     */
1469    bool result_ok;
1470 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
1471
1472
1473
1474 /**
1475  * A wrapper on ClosingTransaction indicating that the built bitcoin
1476  * transaction is trusted.
1477  *
1478  * See trust() and verify() functions on CommitmentTransaction.
1479  *
1480  * This structure implements Deref.
1481  */
1482 typedef struct MUST_USE_STRUCT LDKTrustedClosingTransaction {
1483    /**
1484     * A pointer to the opaque Rust object.
1485     * Nearly everywhere, inner must be non-null, however in places where
1486     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1487     */
1488    LDKnativeTrustedClosingTransaction *inner;
1489    /**
1490     * Indicates that this is the only struct which contains the same pointer.
1491     * Rust functions which take ownership of an object provided via an argument require
1492     * this to be true and invalidate the object pointed to by inner.
1493     */
1494    bool is_owned;
1495 } LDKTrustedClosingTransaction;
1496
1497 /**
1498  * The contents of CResult_TrustedClosingTransactionNoneZ
1499  */
1500 typedef union LDKCResult_TrustedClosingTransactionNoneZPtr {
1501    /**
1502     * A pointer to the contents in the success state.
1503     * Reading from this pointer when `result_ok` is not set is undefined.
1504     */
1505    struct LDKTrustedClosingTransaction *result;
1506    /**
1507     * Note that this value is always NULL, as there are no contents in the Err variant
1508     */
1509    void *err;
1510 } LDKCResult_TrustedClosingTransactionNoneZPtr;
1511
1512 /**
1513  * A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1514  * containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1515  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1516  */
1517 typedef struct LDKCResult_TrustedClosingTransactionNoneZ {
1518    /**
1519     * The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1520     * `err` or `result` depending on the state of `result_ok`.
1521     */
1522    union LDKCResult_TrustedClosingTransactionNoneZPtr contents;
1523    /**
1524     * Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1525     */
1526    bool result_ok;
1527 } LDKCResult_TrustedClosingTransactionNoneZ;
1528
1529
1530
1531 /**
1532  * This class tracks the per-transaction information needed to build a commitment transaction and will
1533  * actually build it and sign.  It is used for holder transactions that we sign only when needed
1534  * and for transactions we sign for the counterparty.
1535  *
1536  * This class can be used inside a signer implementation to generate a signature given the relevant
1537  * secret key.
1538  */
1539 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1540    /**
1541     * A pointer to the opaque Rust object.
1542     * Nearly everywhere, inner must be non-null, however in places where
1543     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1544     */
1545    LDKnativeCommitmentTransaction *inner;
1546    /**
1547     * Indicates that this is the only struct which contains the same pointer.
1548     * Rust functions which take ownership of an object provided via an argument require
1549     * this to be true and invalidate the object pointed to by inner.
1550     */
1551    bool is_owned;
1552 } LDKCommitmentTransaction;
1553
1554 /**
1555  * The contents of CResult_CommitmentTransactionDecodeErrorZ
1556  */
1557 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
1558    /**
1559     * A pointer to the contents in the success state.
1560     * Reading from this pointer when `result_ok` is not set is undefined.
1561     */
1562    struct LDKCommitmentTransaction *result;
1563    /**
1564     * A pointer to the contents in the error state.
1565     * Reading from this pointer when `result_ok` is set is undefined.
1566     */
1567    struct LDKDecodeError *err;
1568 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
1569
1570 /**
1571  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1572  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1573  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1574  */
1575 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
1576    /**
1577     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1578     * `err` or `result` depending on the state of `result_ok`.
1579     */
1580    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
1581    /**
1582     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1583     */
1584    bool result_ok;
1585 } LDKCResult_CommitmentTransactionDecodeErrorZ;
1586
1587
1588
1589 /**
1590  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1591  * transaction and the transaction creation keys) are trusted.
1592  *
1593  * See trust() and verify() functions on CommitmentTransaction.
1594  *
1595  * This structure implements Deref.
1596  */
1597 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
1598    /**
1599     * A pointer to the opaque Rust object.
1600     * Nearly everywhere, inner must be non-null, however in places where
1601     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1602     */
1603    LDKnativeTrustedCommitmentTransaction *inner;
1604    /**
1605     * Indicates that this is the only struct which contains the same pointer.
1606     * Rust functions which take ownership of an object provided via an argument require
1607     * this to be true and invalidate the object pointed to by inner.
1608     */
1609    bool is_owned;
1610 } LDKTrustedCommitmentTransaction;
1611
1612 /**
1613  * The contents of CResult_TrustedCommitmentTransactionNoneZ
1614  */
1615 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
1616    /**
1617     * A pointer to the contents in the success state.
1618     * Reading from this pointer when `result_ok` is not set is undefined.
1619     */
1620    struct LDKTrustedCommitmentTransaction *result;
1621    /**
1622     * Note that this value is always NULL, as there are no contents in the Err variant
1623     */
1624    void *err;
1625 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
1626
1627 /**
1628  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1629  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1630  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1631  */
1632 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
1633    /**
1634     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1635     * `err` or `result` depending on the state of `result_ok`.
1636     */
1637    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
1638    /**
1639     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1640     */
1641    bool result_ok;
1642 } LDKCResult_TrustedCommitmentTransactionNoneZ;
1643
1644 /**
1645  * The contents of CResult_CVec_SignatureZNoneZ
1646  */
1647 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
1648    /**
1649     * A pointer to the contents in the success state.
1650     * Reading from this pointer when `result_ok` is not set is undefined.
1651     */
1652    struct LDKCVec_SignatureZ *result;
1653    /**
1654     * Note that this value is always NULL, as there are no contents in the Err variant
1655     */
1656    void *err;
1657 } LDKCResult_CVec_SignatureZNoneZPtr;
1658
1659 /**
1660  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1661  * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1662  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1663  */
1664 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1665    /**
1666     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1667     * `err` or `result` depending on the state of `result_ok`.
1668     */
1669    union LDKCResult_CVec_SignatureZNoneZPtr contents;
1670    /**
1671     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1672     */
1673    bool result_ok;
1674 } LDKCResult_CVec_SignatureZNoneZ;
1675
1676
1677
1678 /**
1679  * A script pubkey for shutting down a channel as defined by [BOLT #2].
1680  *
1681  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
1682  */
1683 typedef struct MUST_USE_STRUCT LDKShutdownScript {
1684    /**
1685     * A pointer to the opaque Rust object.
1686     * Nearly everywhere, inner must be non-null, however in places where
1687     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1688     */
1689    LDKnativeShutdownScript *inner;
1690    /**
1691     * Indicates that this is the only struct which contains the same pointer.
1692     * Rust functions which take ownership of an object provided via an argument require
1693     * this to be true and invalidate the object pointed to by inner.
1694     */
1695    bool is_owned;
1696 } LDKShutdownScript;
1697
1698 /**
1699  * The contents of CResult_ShutdownScriptDecodeErrorZ
1700  */
1701 typedef union LDKCResult_ShutdownScriptDecodeErrorZPtr {
1702    /**
1703     * A pointer to the contents in the success state.
1704     * Reading from this pointer when `result_ok` is not set is undefined.
1705     */
1706    struct LDKShutdownScript *result;
1707    /**
1708     * A pointer to the contents in the error state.
1709     * Reading from this pointer when `result_ok` is set is undefined.
1710     */
1711    struct LDKDecodeError *err;
1712 } LDKCResult_ShutdownScriptDecodeErrorZPtr;
1713
1714 /**
1715  * A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1716  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1717  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1718  */
1719 typedef struct LDKCResult_ShutdownScriptDecodeErrorZ {
1720    /**
1721     * The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1722     * `err` or `result` depending on the state of `result_ok`.
1723     */
1724    union LDKCResult_ShutdownScriptDecodeErrorZPtr contents;
1725    /**
1726     * Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1727     */
1728    bool result_ok;
1729 } LDKCResult_ShutdownScriptDecodeErrorZ;
1730
1731
1732
1733 /**
1734  * An error occurring when converting from [`Script`] to [`ShutdownScript`].
1735  */
1736 typedef struct MUST_USE_STRUCT LDKInvalidShutdownScript {
1737    /**
1738     * A pointer to the opaque Rust object.
1739     * Nearly everywhere, inner must be non-null, however in places where
1740     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1741     */
1742    LDKnativeInvalidShutdownScript *inner;
1743    /**
1744     * Indicates that this is the only struct which contains the same pointer.
1745     * Rust functions which take ownership of an object provided via an argument require
1746     * this to be true and invalidate the object pointed to by inner.
1747     */
1748    bool is_owned;
1749 } LDKInvalidShutdownScript;
1750
1751 /**
1752  * The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1753  */
1754 typedef union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr {
1755    /**
1756     * A pointer to the contents in the success state.
1757     * Reading from this pointer when `result_ok` is not set is undefined.
1758     */
1759    struct LDKShutdownScript *result;
1760    /**
1761     * A pointer to the contents in the error state.
1762     * Reading from this pointer when `result_ok` is set is undefined.
1763     */
1764    struct LDKInvalidShutdownScript *err;
1765 } LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr;
1766
1767 /**
1768  * A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1769  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1770  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1771  */
1772 typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ {
1773    /**
1774     * The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1775     * `err` or `result` depending on the state of `result_ok`.
1776     */
1777    union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr contents;
1778    /**
1779     * Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1780     */
1781    bool result_ok;
1782 } LDKCResult_ShutdownScriptInvalidShutdownScriptZ;
1783
1784
1785
1786 /**
1787  * Represents the compressed public key of a node
1788  */
1789 typedef struct MUST_USE_STRUCT LDKNodeId {
1790    /**
1791     * A pointer to the opaque Rust object.
1792     * Nearly everywhere, inner must be non-null, however in places where
1793     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1794     */
1795    LDKnativeNodeId *inner;
1796    /**
1797     * Indicates that this is the only struct which contains the same pointer.
1798     * Rust functions which take ownership of an object provided via an argument require
1799     * this to be true and invalidate the object pointed to by inner.
1800     */
1801    bool is_owned;
1802 } LDKNodeId;
1803
1804
1805
1806 /**
1807  * Proposed use of a channel passed as a parameter to [`Score::channel_penalty_msat`].
1808  */
1809 typedef struct MUST_USE_STRUCT LDKChannelUsage {
1810    /**
1811     * A pointer to the opaque Rust object.
1812     * Nearly everywhere, inner must be non-null, however in places where
1813     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1814     */
1815    LDKnativeChannelUsage *inner;
1816    /**
1817     * Indicates that this is the only struct which contains the same pointer.
1818     * Rust functions which take ownership of an object provided via an argument require
1819     * this to be true and invalidate the object pointed to by inner.
1820     */
1821    bool is_owned;
1822 } LDKChannelUsage;
1823
1824
1825
1826 /**
1827  * A hop in a route
1828  */
1829 typedef struct MUST_USE_STRUCT LDKRouteHop {
1830    /**
1831     * A pointer to the opaque Rust object.
1832     * Nearly everywhere, inner must be non-null, however in places where
1833     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1834     */
1835    LDKnativeRouteHop *inner;
1836    /**
1837     * Indicates that this is the only struct which contains the same pointer.
1838     * Rust functions which take ownership of an object provided via an argument require
1839     * this to be true and invalidate the object pointed to by inner.
1840     */
1841    bool is_owned;
1842 } LDKRouteHop;
1843
1844 /**
1845  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1846  * This corresponds to std::vector in C++
1847  */
1848 typedef struct LDKCVec_RouteHopZ {
1849    /**
1850     * The elements in the array.
1851     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1852     */
1853    struct LDKRouteHop *data;
1854    /**
1855     * The number of elements pointed to by `data`.
1856     */
1857    uintptr_t datalen;
1858 } LDKCVec_RouteHopZ;
1859
1860 /**
1861  * An interface used to score payment channels for path finding.
1862  *
1863  *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
1864  */
1865 typedef struct LDKScore {
1866    /**
1867     * An opaque pointer which is passed to your function implementations as an argument.
1868     * This has no meaning in the LDK, and can be NULL or any other value.
1869     */
1870    void *this_arg;
1871    /**
1872     * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
1873     * given channel in the direction from `source` to `target`.
1874     *
1875     * The channel's capacity (less any other MPP parts that are also being considered for use in
1876     * the same payment) is given by `capacity_msat`. It may be determined from various sources
1877     * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near
1878     * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount.
1879     * Thus, implementations should be overflow-safe.
1880     */
1881    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, struct LDKChannelUsage usage);
1882    /**
1883     * Handles updating channel penalties after failing to route through a channel.
1884     */
1885    void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
1886    /**
1887     * Handles updating channel penalties after successfully routing along a path.
1888     */
1889    void (*payment_path_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
1890    /**
1891     * Handles updating channel penalties after a probe over the given path failed.
1892     */
1893    void (*probe_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
1894    /**
1895     * Handles updating channel penalties after a probe over the given path succeeded.
1896     */
1897    void (*probe_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
1898    /**
1899     * Serialize the object into a byte array
1900     */
1901    struct LDKCVec_u8Z (*write)(const void *this_arg);
1902    /**
1903     * Frees any resources associated with this object given its this_arg pointer.
1904     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
1905     */
1906    void (*free)(void *this_arg);
1907 } LDKScore;
1908
1909 /**
1910  * A scorer that is accessed under a lock.
1911  *
1912  * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while
1913  * having shared ownership of a scorer but without requiring internal locking in [`Score`]
1914  * implementations. Internal locking would be detrimental to route finding performance and could
1915  * result in [`Score::channel_penalty_msat`] returning a different value for the same channel.
1916  *
1917  * [`find_route`]: crate::routing::router::find_route
1918  */
1919 typedef struct LDKLockableScore {
1920    /**
1921     * An opaque pointer which is passed to your function implementations as an argument.
1922     * This has no meaning in the LDK, and can be NULL or any other value.
1923     */
1924    void *this_arg;
1925    /**
1926     * Returns the locked scorer.
1927     */
1928    struct LDKScore (*lock)(const void *this_arg);
1929    /**
1930     * Frees any resources associated with this object given its this_arg pointer.
1931     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
1932     */
1933    void (*free)(void *this_arg);
1934 } LDKLockableScore;
1935
1936 /**
1937  * Refers to a scorer that is accessible under lock and also writeable to disk
1938  *
1939  * We need this trait to be able to pass in a scorer to `lightning-background-processor` that will enable us to
1940  * use the Persister to persist it.
1941  */
1942 typedef struct LDKWriteableScore {
1943    /**
1944     * An opaque pointer which is passed to your function implementations as an argument.
1945     * This has no meaning in the LDK, and can be NULL or any other value.
1946     */
1947    void *this_arg;
1948    /**
1949     * Implementation of LockableScore for this object.
1950     */
1951    struct LDKLockableScore LockableScore;
1952    /**
1953     * Serialize the object into a byte array
1954     */
1955    struct LDKCVec_u8Z (*write)(const void *this_arg);
1956    /**
1957     * Frees any resources associated with this object given its this_arg pointer.
1958     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
1959     */
1960    void (*free)(void *this_arg);
1961 } LDKWriteableScore;
1962
1963 /**
1964  * An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
1965  */
1966 typedef enum LDKCOption_WriteableScoreZ_Tag {
1967    /**
1968     * When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
1969     */
1970    LDKCOption_WriteableScoreZ_Some,
1971    /**
1972     * When we're in this state, this COption_WriteableScoreZ contains nothing
1973     */
1974    LDKCOption_WriteableScoreZ_None,
1975    /**
1976     * Must be last for serialization purposes
1977     */
1978    LDKCOption_WriteableScoreZ_Sentinel,
1979 } LDKCOption_WriteableScoreZ_Tag;
1980
1981 typedef struct LDKCOption_WriteableScoreZ {
1982    LDKCOption_WriteableScoreZ_Tag tag;
1983    union {
1984       struct {
1985          struct LDKWriteableScore some;
1986       };
1987    };
1988 } LDKCOption_WriteableScoreZ;
1989
1990 /**
1991  * The contents of CResult_NoneErrorZ
1992  */
1993 typedef union LDKCResult_NoneErrorZPtr {
1994    /**
1995     * Note that this value is always NULL, as there are no contents in the OK variant
1996     */
1997    void *result;
1998    /**
1999     * A pointer to the contents in the error state.
2000     * Reading from this pointer when `result_ok` is set is undefined.
2001     */
2002    enum LDKIOError *err;
2003 } LDKCResult_NoneErrorZPtr;
2004
2005 /**
2006  * A CResult_NoneErrorZ represents the result of a fallible operation,
2007  * containing a () on success and a crate::c_types::IOError on failure.
2008  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2009  */
2010 typedef struct LDKCResult_NoneErrorZ {
2011    /**
2012     * The contents of this CResult_NoneErrorZ, accessible via either
2013     * `err` or `result` depending on the state of `result_ok`.
2014     */
2015    union LDKCResult_NoneErrorZPtr contents;
2016    /**
2017     * Whether this CResult_NoneErrorZ represents a success state.
2018     */
2019    bool result_ok;
2020 } LDKCResult_NoneErrorZ;
2021
2022 /**
2023  * The contents of CResult_RouteHopDecodeErrorZ
2024  */
2025 typedef union LDKCResult_RouteHopDecodeErrorZPtr {
2026    /**
2027     * A pointer to the contents in the success state.
2028     * Reading from this pointer when `result_ok` is not set is undefined.
2029     */
2030    struct LDKRouteHop *result;
2031    /**
2032     * A pointer to the contents in the error state.
2033     * Reading from this pointer when `result_ok` is set is undefined.
2034     */
2035    struct LDKDecodeError *err;
2036 } LDKCResult_RouteHopDecodeErrorZPtr;
2037
2038 /**
2039  * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
2040  * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2041  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2042  */
2043 typedef struct LDKCResult_RouteHopDecodeErrorZ {
2044    /**
2045     * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
2046     * `err` or `result` depending on the state of `result_ok`.
2047     */
2048    union LDKCResult_RouteHopDecodeErrorZPtr contents;
2049    /**
2050     * Whether this CResult_RouteHopDecodeErrorZ represents a success state.
2051     */
2052    bool result_ok;
2053 } LDKCResult_RouteHopDecodeErrorZ;
2054
2055 /**
2056  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2057  * This corresponds to std::vector in C++
2058  */
2059 typedef struct LDKCVec_CVec_RouteHopZZ {
2060    /**
2061     * The elements in the array.
2062     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2063     */
2064    struct LDKCVec_RouteHopZ *data;
2065    /**
2066     * The number of elements pointed to by `data`.
2067     */
2068    uintptr_t datalen;
2069 } LDKCVec_CVec_RouteHopZZ;
2070
2071
2072
2073 /**
2074  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
2075  * it can take multiple paths. Each path is composed of one or more hops through the network.
2076  */
2077 typedef struct MUST_USE_STRUCT LDKRoute {
2078    /**
2079     * A pointer to the opaque Rust object.
2080     * Nearly everywhere, inner must be non-null, however in places where
2081     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2082     */
2083    LDKnativeRoute *inner;
2084    /**
2085     * Indicates that this is the only struct which contains the same pointer.
2086     * Rust functions which take ownership of an object provided via an argument require
2087     * this to be true and invalidate the object pointed to by inner.
2088     */
2089    bool is_owned;
2090 } LDKRoute;
2091
2092 /**
2093  * The contents of CResult_RouteDecodeErrorZ
2094  */
2095 typedef union LDKCResult_RouteDecodeErrorZPtr {
2096    /**
2097     * A pointer to the contents in the success state.
2098     * Reading from this pointer when `result_ok` is not set is undefined.
2099     */
2100    struct LDKRoute *result;
2101    /**
2102     * A pointer to the contents in the error state.
2103     * Reading from this pointer when `result_ok` is set is undefined.
2104     */
2105    struct LDKDecodeError *err;
2106 } LDKCResult_RouteDecodeErrorZPtr;
2107
2108 /**
2109  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2110  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2111  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2112  */
2113 typedef struct LDKCResult_RouteDecodeErrorZ {
2114    /**
2115     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
2116     * `err` or `result` depending on the state of `result_ok`.
2117     */
2118    union LDKCResult_RouteDecodeErrorZPtr contents;
2119    /**
2120     * Whether this CResult_RouteDecodeErrorZ represents a success state.
2121     */
2122    bool result_ok;
2123 } LDKCResult_RouteDecodeErrorZ;
2124
2125
2126
2127 /**
2128  * Parameters needed to find a [`Route`].
2129  *
2130  * Passed to [`find_route`] and [`build_route_from_hops`], but also provided in
2131  * [`Event::PaymentPathFailed`] for retrying a failed payment path.
2132  *
2133  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
2134  */
2135 typedef struct MUST_USE_STRUCT LDKRouteParameters {
2136    /**
2137     * A pointer to the opaque Rust object.
2138     * Nearly everywhere, inner must be non-null, however in places where
2139     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2140     */
2141    LDKnativeRouteParameters *inner;
2142    /**
2143     * Indicates that this is the only struct which contains the same pointer.
2144     * Rust functions which take ownership of an object provided via an argument require
2145     * this to be true and invalidate the object pointed to by inner.
2146     */
2147    bool is_owned;
2148 } LDKRouteParameters;
2149
2150 /**
2151  * The contents of CResult_RouteParametersDecodeErrorZ
2152  */
2153 typedef union LDKCResult_RouteParametersDecodeErrorZPtr {
2154    /**
2155     * A pointer to the contents in the success state.
2156     * Reading from this pointer when `result_ok` is not set is undefined.
2157     */
2158    struct LDKRouteParameters *result;
2159    /**
2160     * A pointer to the contents in the error state.
2161     * Reading from this pointer when `result_ok` is set is undefined.
2162     */
2163    struct LDKDecodeError *err;
2164 } LDKCResult_RouteParametersDecodeErrorZPtr;
2165
2166 /**
2167  * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2168  * containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2169  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2170  */
2171 typedef struct LDKCResult_RouteParametersDecodeErrorZ {
2172    /**
2173     * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2174     * `err` or `result` depending on the state of `result_ok`.
2175     */
2176    union LDKCResult_RouteParametersDecodeErrorZPtr contents;
2177    /**
2178     * Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2179     */
2180    bool result_ok;
2181 } LDKCResult_RouteParametersDecodeErrorZ;
2182
2183
2184
2185 /**
2186  * A list of hops along a payment path terminating with a channel to the recipient.
2187  */
2188 typedef struct MUST_USE_STRUCT LDKRouteHint {
2189    /**
2190     * A pointer to the opaque Rust object.
2191     * Nearly everywhere, inner must be non-null, however in places where
2192     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2193     */
2194    LDKnativeRouteHint *inner;
2195    /**
2196     * Indicates that this is the only struct which contains the same pointer.
2197     * Rust functions which take ownership of an object provided via an argument require
2198     * this to be true and invalidate the object pointed to by inner.
2199     */
2200    bool is_owned;
2201 } LDKRouteHint;
2202
2203 /**
2204  * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2205  * This corresponds to std::vector in C++
2206  */
2207 typedef struct LDKCVec_RouteHintZ {
2208    /**
2209     * The elements in the array.
2210     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2211     */
2212    struct LDKRouteHint *data;
2213    /**
2214     * The number of elements pointed to by `data`.
2215     */
2216    uintptr_t datalen;
2217 } LDKCVec_RouteHintZ;
2218
2219 /**
2220  * An enum which can either contain a u64 or not
2221  */
2222 typedef enum LDKCOption_u64Z_Tag {
2223    /**
2224     * When we're in this state, this COption_u64Z contains a u64
2225     */
2226    LDKCOption_u64Z_Some,
2227    /**
2228     * When we're in this state, this COption_u64Z contains nothing
2229     */
2230    LDKCOption_u64Z_None,
2231    /**
2232     * Must be last for serialization purposes
2233     */
2234    LDKCOption_u64Z_Sentinel,
2235 } LDKCOption_u64Z_Tag;
2236
2237 typedef struct LDKCOption_u64Z {
2238    LDKCOption_u64Z_Tag tag;
2239    union {
2240       struct {
2241          uint64_t some;
2242       };
2243    };
2244 } LDKCOption_u64Z;
2245
2246 /**
2247  * A dynamically-allocated array of u64s of arbitrary size.
2248  * This corresponds to std::vector in C++
2249  */
2250 typedef struct LDKCVec_u64Z {
2251    /**
2252     * The elements in the array.
2253     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2254     */
2255    uint64_t *data;
2256    /**
2257     * The number of elements pointed to by `data`.
2258     */
2259    uintptr_t datalen;
2260 } LDKCVec_u64Z;
2261
2262
2263
2264 /**
2265  * The recipient of a payment.
2266  */
2267 typedef struct MUST_USE_STRUCT LDKPaymentParameters {
2268    /**
2269     * A pointer to the opaque Rust object.
2270     * Nearly everywhere, inner must be non-null, however in places where
2271     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2272     */
2273    LDKnativePaymentParameters *inner;
2274    /**
2275     * Indicates that this is the only struct which contains the same pointer.
2276     * Rust functions which take ownership of an object provided via an argument require
2277     * this to be true and invalidate the object pointed to by inner.
2278     */
2279    bool is_owned;
2280 } LDKPaymentParameters;
2281
2282 /**
2283  * The contents of CResult_PaymentParametersDecodeErrorZ
2284  */
2285 typedef union LDKCResult_PaymentParametersDecodeErrorZPtr {
2286    /**
2287     * A pointer to the contents in the success state.
2288     * Reading from this pointer when `result_ok` is not set is undefined.
2289     */
2290    struct LDKPaymentParameters *result;
2291    /**
2292     * A pointer to the contents in the error state.
2293     * Reading from this pointer when `result_ok` is set is undefined.
2294     */
2295    struct LDKDecodeError *err;
2296 } LDKCResult_PaymentParametersDecodeErrorZPtr;
2297
2298 /**
2299  * A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2300  * containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2301  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2302  */
2303 typedef struct LDKCResult_PaymentParametersDecodeErrorZ {
2304    /**
2305     * The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2306     * `err` or `result` depending on the state of `result_ok`.
2307     */
2308    union LDKCResult_PaymentParametersDecodeErrorZPtr contents;
2309    /**
2310     * Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2311     */
2312    bool result_ok;
2313 } LDKCResult_PaymentParametersDecodeErrorZ;
2314
2315
2316
2317 /**
2318  * A channel descriptor for a hop along a payment path.
2319  */
2320 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
2321    /**
2322     * A pointer to the opaque Rust object.
2323     * Nearly everywhere, inner must be non-null, however in places where
2324     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2325     */
2326    LDKnativeRouteHintHop *inner;
2327    /**
2328     * Indicates that this is the only struct which contains the same pointer.
2329     * Rust functions which take ownership of an object provided via an argument require
2330     * this to be true and invalidate the object pointed to by inner.
2331     */
2332    bool is_owned;
2333 } LDKRouteHintHop;
2334
2335 /**
2336  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2337  * This corresponds to std::vector in C++
2338  */
2339 typedef struct LDKCVec_RouteHintHopZ {
2340    /**
2341     * The elements in the array.
2342     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2343     */
2344    struct LDKRouteHintHop *data;
2345    /**
2346     * The number of elements pointed to by `data`.
2347     */
2348    uintptr_t datalen;
2349 } LDKCVec_RouteHintHopZ;
2350
2351 /**
2352  * The contents of CResult_RouteHintDecodeErrorZ
2353  */
2354 typedef union LDKCResult_RouteHintDecodeErrorZPtr {
2355    /**
2356     * A pointer to the contents in the success state.
2357     * Reading from this pointer when `result_ok` is not set is undefined.
2358     */
2359    struct LDKRouteHint *result;
2360    /**
2361     * A pointer to the contents in the error state.
2362     * Reading from this pointer when `result_ok` is set is undefined.
2363     */
2364    struct LDKDecodeError *err;
2365 } LDKCResult_RouteHintDecodeErrorZPtr;
2366
2367 /**
2368  * A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2369  * containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2370  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2371  */
2372 typedef struct LDKCResult_RouteHintDecodeErrorZ {
2373    /**
2374     * The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2375     * `err` or `result` depending on the state of `result_ok`.
2376     */
2377    union LDKCResult_RouteHintDecodeErrorZPtr contents;
2378    /**
2379     * Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2380     */
2381    bool result_ok;
2382 } LDKCResult_RouteHintDecodeErrorZ;
2383
2384 /**
2385  * The contents of CResult_RouteHintHopDecodeErrorZ
2386  */
2387 typedef union LDKCResult_RouteHintHopDecodeErrorZPtr {
2388    /**
2389     * A pointer to the contents in the success state.
2390     * Reading from this pointer when `result_ok` is not set is undefined.
2391     */
2392    struct LDKRouteHintHop *result;
2393    /**
2394     * A pointer to the contents in the error state.
2395     * Reading from this pointer when `result_ok` is set is undefined.
2396     */
2397    struct LDKDecodeError *err;
2398 } LDKCResult_RouteHintHopDecodeErrorZPtr;
2399
2400 /**
2401  * A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2402  * containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2403  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2404  */
2405 typedef struct LDKCResult_RouteHintHopDecodeErrorZ {
2406    /**
2407     * The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2408     * `err` or `result` depending on the state of `result_ok`.
2409     */
2410    union LDKCResult_RouteHintHopDecodeErrorZPtr contents;
2411    /**
2412     * Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2413     */
2414    bool result_ok;
2415 } LDKCResult_RouteHintHopDecodeErrorZ;
2416
2417
2418
2419 /**
2420  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
2421  */
2422 typedef struct MUST_USE_STRUCT LDKChannelDetails {
2423    /**
2424     * A pointer to the opaque Rust object.
2425     * Nearly everywhere, inner must be non-null, however in places where
2426     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2427     */
2428    LDKnativeChannelDetails *inner;
2429    /**
2430     * Indicates that this is the only struct which contains the same pointer.
2431     * Rust functions which take ownership of an object provided via an argument require
2432     * this to be true and invalidate the object pointed to by inner.
2433     */
2434    bool is_owned;
2435 } LDKChannelDetails;
2436
2437 /**
2438  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2439  * This corresponds to std::vector in C++
2440  */
2441 typedef struct LDKCVec_ChannelDetailsZ {
2442    /**
2443     * The elements in the array.
2444     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2445     */
2446    struct LDKChannelDetails *data;
2447    /**
2448     * The number of elements pointed to by `data`.
2449     */
2450    uintptr_t datalen;
2451 } LDKCVec_ChannelDetailsZ;
2452
2453
2454
2455 /**
2456  * An Err type for failure to process messages.
2457  */
2458 typedef struct MUST_USE_STRUCT LDKLightningError {
2459    /**
2460     * A pointer to the opaque Rust object.
2461     * Nearly everywhere, inner must be non-null, however in places where
2462     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2463     */
2464    LDKnativeLightningError *inner;
2465    /**
2466     * Indicates that this is the only struct which contains the same pointer.
2467     * Rust functions which take ownership of an object provided via an argument require
2468     * this to be true and invalidate the object pointed to by inner.
2469     */
2470    bool is_owned;
2471 } LDKLightningError;
2472
2473 /**
2474  * The contents of CResult_RouteLightningErrorZ
2475  */
2476 typedef union LDKCResult_RouteLightningErrorZPtr {
2477    /**
2478     * A pointer to the contents in the success state.
2479     * Reading from this pointer when `result_ok` is not set is undefined.
2480     */
2481    struct LDKRoute *result;
2482    /**
2483     * A pointer to the contents in the error state.
2484     * Reading from this pointer when `result_ok` is set is undefined.
2485     */
2486    struct LDKLightningError *err;
2487 } LDKCResult_RouteLightningErrorZPtr;
2488
2489 /**
2490  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2491  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2492  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2493  */
2494 typedef struct LDKCResult_RouteLightningErrorZ {
2495    /**
2496     * The contents of this CResult_RouteLightningErrorZ, accessible via either
2497     * `err` or `result` depending on the state of `result_ok`.
2498     */
2499    union LDKCResult_RouteLightningErrorZPtr contents;
2500    /**
2501     * Whether this CResult_RouteLightningErrorZ represents a success state.
2502     */
2503    bool result_ok;
2504 } LDKCResult_RouteLightningErrorZ;
2505
2506 /**
2507  * Some information provided on receipt of payment depends on whether the payment received is a
2508  * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
2509  */
2510 typedef enum LDKPaymentPurpose_Tag {
2511    /**
2512     * Information for receiving a payment that we generated an invoice for.
2513     */
2514    LDKPaymentPurpose_InvoicePayment,
2515    /**
2516     * Because this is a spontaneous payment, the payer generated their own preimage rather than us
2517     * (the payee) providing a preimage.
2518     */
2519    LDKPaymentPurpose_SpontaneousPayment,
2520    /**
2521     * Must be last for serialization purposes
2522     */
2523    LDKPaymentPurpose_Sentinel,
2524 } LDKPaymentPurpose_Tag;
2525
2526 typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
2527    /**
2528     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
2529     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
2530     * [`ChannelManager::claim_funds`].
2531     *
2532     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2533     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2534     *
2535     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2536     */
2537    struct LDKThirtyTwoBytes payment_preimage;
2538    /**
2539     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
2540     * number of deanonymization attacks during the routing process.
2541     * It is provided here for your reference, however its accuracy is enforced directly by
2542     * [`ChannelManager`] using the values you previously provided to
2543     * [`ChannelManager::create_inbound_payment`] or
2544     * [`ChannelManager::create_inbound_payment_for_hash`].
2545     *
2546     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2547     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2548     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
2549     */
2550    struct LDKThirtyTwoBytes payment_secret;
2551 } LDKPaymentPurpose_LDKInvoicePayment_Body;
2552
2553 typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
2554    LDKPaymentPurpose_Tag tag;
2555    union {
2556       LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
2557       struct {
2558          struct LDKThirtyTwoBytes spontaneous_payment;
2559       };
2560    };
2561 } LDKPaymentPurpose;
2562
2563 /**
2564  * The contents of CResult_PaymentPurposeDecodeErrorZ
2565  */
2566 typedef union LDKCResult_PaymentPurposeDecodeErrorZPtr {
2567    /**
2568     * A pointer to the contents in the success state.
2569     * Reading from this pointer when `result_ok` is not set is undefined.
2570     */
2571    struct LDKPaymentPurpose *result;
2572    /**
2573     * A pointer to the contents in the error state.
2574     * Reading from this pointer when `result_ok` is set is undefined.
2575     */
2576    struct LDKDecodeError *err;
2577 } LDKCResult_PaymentPurposeDecodeErrorZPtr;
2578
2579 /**
2580  * A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
2581  * containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
2582  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2583  */
2584 typedef struct LDKCResult_PaymentPurposeDecodeErrorZ {
2585    /**
2586     * The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
2587     * `err` or `result` depending on the state of `result_ok`.
2588     */
2589    union LDKCResult_PaymentPurposeDecodeErrorZPtr contents;
2590    /**
2591     * Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
2592     */
2593    bool result_ok;
2594 } LDKCResult_PaymentPurposeDecodeErrorZ;
2595
2596 /**
2597  * The reason the channel was closed. See individual variants more details.
2598  */
2599 typedef enum LDKClosureReason_Tag {
2600    /**
2601     * Closure generated from receiving a peer error message.
2602     *
2603     * Our counterparty may have broadcasted their latest commitment state, and we have
2604     * as well.
2605     */
2606    LDKClosureReason_CounterpartyForceClosed,
2607    /**
2608     * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
2609     *
2610     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
2611     */
2612    LDKClosureReason_HolderForceClosed,
2613    /**
2614     * The channel was closed after negotiating a cooperative close and we've now broadcasted
2615     * the cooperative close transaction. Note the shutdown may have been initiated by us.
2616     */
2617    LDKClosureReason_CooperativeClosure,
2618    /**
2619     * A commitment transaction was confirmed on chain, closing the channel. Most likely this
2620     * commitment transaction came from our counterparty, but it may also have come from
2621     * a copy of our own `ChannelMonitor`.
2622     */
2623    LDKClosureReason_CommitmentTxConfirmed,
2624    /**
2625     * The funding transaction failed to confirm in a timely manner on an inbound channel.
2626     */
2627    LDKClosureReason_FundingTimedOut,
2628    /**
2629     * Closure generated from processing an event, likely a HTLC forward/relay/reception.
2630     */
2631    LDKClosureReason_ProcessingError,
2632    /**
2633     * The peer disconnected prior to funding completing. In this case the spec mandates that we
2634     * forget the channel entirely - we can attempt again if the peer reconnects.
2635     *
2636     * This includes cases where we restarted prior to funding completion, including prior to the
2637     * initial [`ChannelMonitor`] persistence completing.
2638     *
2639     * In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the
2640     * peer because of mutual incompatibility between us and our channel counterparty.
2641     *
2642     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
2643     */
2644    LDKClosureReason_DisconnectedPeer,
2645    /**
2646     * Closure generated from `ChannelManager::read` if the [`ChannelMonitor`] is newer than
2647     * the [`ChannelManager`] deserialized.
2648     *
2649     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
2650     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2651     */
2652    LDKClosureReason_OutdatedChannelManager,
2653    /**
2654     * Must be last for serialization purposes
2655     */
2656    LDKClosureReason_Sentinel,
2657 } LDKClosureReason_Tag;
2658
2659 typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
2660    /**
2661     * The error which the peer sent us.
2662     *
2663     * The string should be sanitized before it is used (e.g emitted to logs
2664     * or printed to stdout). Otherwise, a well crafted error message may exploit
2665     * a security vulnerability in the terminal emulator or the logging subsystem.
2666     */
2667    struct LDKStr peer_msg;
2668 } LDKClosureReason_LDKCounterpartyForceClosed_Body;
2669
2670 typedef struct LDKClosureReason_LDKProcessingError_Body {
2671    /**
2672     * A developer-readable error message which we generated.
2673     */
2674    struct LDKStr err;
2675 } LDKClosureReason_LDKProcessingError_Body;
2676
2677 typedef struct MUST_USE_STRUCT LDKClosureReason {
2678    LDKClosureReason_Tag tag;
2679    union {
2680       LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
2681       LDKClosureReason_LDKProcessingError_Body processing_error;
2682    };
2683 } LDKClosureReason;
2684
2685 /**
2686  * An enum which can either contain a crate::lightning::util::events::ClosureReason or not
2687  */
2688 typedef enum LDKCOption_ClosureReasonZ_Tag {
2689    /**
2690     * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
2691     */
2692    LDKCOption_ClosureReasonZ_Some,
2693    /**
2694     * When we're in this state, this COption_ClosureReasonZ contains nothing
2695     */
2696    LDKCOption_ClosureReasonZ_None,
2697    /**
2698     * Must be last for serialization purposes
2699     */
2700    LDKCOption_ClosureReasonZ_Sentinel,
2701 } LDKCOption_ClosureReasonZ_Tag;
2702
2703 typedef struct LDKCOption_ClosureReasonZ {
2704    LDKCOption_ClosureReasonZ_Tag tag;
2705    union {
2706       struct {
2707          struct LDKClosureReason some;
2708       };
2709    };
2710 } LDKCOption_ClosureReasonZ;
2711
2712 /**
2713  * The contents of CResult_COption_ClosureReasonZDecodeErrorZ
2714  */
2715 typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr {
2716    /**
2717     * A pointer to the contents in the success state.
2718     * Reading from this pointer when `result_ok` is not set is undefined.
2719     */
2720    struct LDKCOption_ClosureReasonZ *result;
2721    /**
2722     * A pointer to the contents in the error state.
2723     * Reading from this pointer when `result_ok` is set is undefined.
2724     */
2725    struct LDKDecodeError *err;
2726 } LDKCResult_COption_ClosureReasonZDecodeErrorZPtr;
2727
2728 /**
2729  * A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
2730  * containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2731  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2732  */
2733 typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ {
2734    /**
2735     * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
2736     * `err` or `result` depending on the state of `result_ok`.
2737     */
2738    union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents;
2739    /**
2740     * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
2741     */
2742    bool result_ok;
2743 } LDKCResult_COption_ClosureReasonZDecodeErrorZ;
2744
2745 /**
2746  * Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`].
2747  */
2748 typedef enum LDKHTLCDestination_Tag {
2749    /**
2750     * We tried forwarding to a channel but failed to do so. An example of such an instance is when
2751     * there is insufficient capacity in our outbound channel.
2752     */
2753    LDKHTLCDestination_NextHopChannel,
2754    /**
2755     * Scenario where we are unsure of the next node to forward the HTLC to.
2756     */
2757    LDKHTLCDestination_UnknownNextHop,
2758    /**
2759     * Failure scenario where an HTLC may have been forwarded to be intended for us,
2760     * but is invalid for some reason, so we reject it.
2761     *
2762     * Some of the reasons may include:
2763     * * HTLC Timeouts
2764     * * Expected MPP amount to claim does not equal HTLC total
2765     * * Claimable amount does not match expected amount
2766     */
2767    LDKHTLCDestination_FailedPayment,
2768    /**
2769     * Must be last for serialization purposes
2770     */
2771    LDKHTLCDestination_Sentinel,
2772 } LDKHTLCDestination_Tag;
2773
2774 typedef struct LDKHTLCDestination_LDKNextHopChannel_Body {
2775    /**
2776     * The `node_id` of the next node. For backwards compatibility, this field is
2777     * marked as optional, versions prior to 0.0.110 may not always be able to provide
2778     * counterparty node information.
2779     *
2780     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2781     */
2782    struct LDKPublicKey node_id;
2783    /**
2784     * The outgoing `channel_id` between us and the next node.
2785     */
2786    struct LDKThirtyTwoBytes channel_id;
2787 } LDKHTLCDestination_LDKNextHopChannel_Body;
2788
2789 typedef struct LDKHTLCDestination_LDKUnknownNextHop_Body {
2790    /**
2791     * Short channel id we are requesting to forward an HTLC to.
2792     */
2793    uint64_t requested_forward_scid;
2794 } LDKHTLCDestination_LDKUnknownNextHop_Body;
2795
2796 typedef struct LDKHTLCDestination_LDKFailedPayment_Body {
2797    /**
2798     * The payment hash of the payment we attempted to process.
2799     */
2800    struct LDKThirtyTwoBytes payment_hash;
2801 } LDKHTLCDestination_LDKFailedPayment_Body;
2802
2803 typedef struct MUST_USE_STRUCT LDKHTLCDestination {
2804    LDKHTLCDestination_Tag tag;
2805    union {
2806       LDKHTLCDestination_LDKNextHopChannel_Body next_hop_channel;
2807       LDKHTLCDestination_LDKUnknownNextHop_Body unknown_next_hop;
2808       LDKHTLCDestination_LDKFailedPayment_Body failed_payment;
2809    };
2810 } LDKHTLCDestination;
2811
2812 /**
2813  * An enum which can either contain a crate::lightning::util::events::HTLCDestination or not
2814  */
2815 typedef enum LDKCOption_HTLCDestinationZ_Tag {
2816    /**
2817     * When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::util::events::HTLCDestination
2818     */
2819    LDKCOption_HTLCDestinationZ_Some,
2820    /**
2821     * When we're in this state, this COption_HTLCDestinationZ contains nothing
2822     */
2823    LDKCOption_HTLCDestinationZ_None,
2824    /**
2825     * Must be last for serialization purposes
2826     */
2827    LDKCOption_HTLCDestinationZ_Sentinel,
2828 } LDKCOption_HTLCDestinationZ_Tag;
2829
2830 typedef struct LDKCOption_HTLCDestinationZ {
2831    LDKCOption_HTLCDestinationZ_Tag tag;
2832    union {
2833       struct {
2834          struct LDKHTLCDestination some;
2835       };
2836    };
2837 } LDKCOption_HTLCDestinationZ;
2838
2839 /**
2840  * The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
2841  */
2842 typedef union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr {
2843    /**
2844     * A pointer to the contents in the success state.
2845     * Reading from this pointer when `result_ok` is not set is undefined.
2846     */
2847    struct LDKCOption_HTLCDestinationZ *result;
2848    /**
2849     * A pointer to the contents in the error state.
2850     * Reading from this pointer when `result_ok` is set is undefined.
2851     */
2852    struct LDKDecodeError *err;
2853 } LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr;
2854
2855 /**
2856  * A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
2857  * containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2858  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2859  */
2860 typedef struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ {
2861    /**
2862     * The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
2863     * `err` or `result` depending on the state of `result_ok`.
2864     */
2865    union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr contents;
2866    /**
2867     * Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
2868     */
2869    bool result_ok;
2870 } LDKCResult_COption_HTLCDestinationZDecodeErrorZ;
2871
2872
2873
2874 /**
2875  * A channel_update message to be sent or received from a peer
2876  */
2877 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
2878    /**
2879     * A pointer to the opaque Rust object.
2880     * Nearly everywhere, inner must be non-null, however in places where
2881     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2882     */
2883    LDKnativeChannelUpdate *inner;
2884    /**
2885     * Indicates that this is the only struct which contains the same pointer.
2886     * Rust functions which take ownership of an object provided via an argument require
2887     * this to be true and invalidate the object pointed to by inner.
2888     */
2889    bool is_owned;
2890 } LDKChannelUpdate;
2891
2892 /**
2893  * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
2894  * return packet by a node along the route. See [BOLT #4] for details.
2895  *
2896  * [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md
2897  */
2898 typedef enum LDKNetworkUpdate_Tag {
2899    /**
2900     * An error indicating a `channel_update` messages should be applied via
2901     * [`NetworkGraph::update_channel`].
2902     */
2903    LDKNetworkUpdate_ChannelUpdateMessage,
2904    /**
2905     * An error indicating that a channel failed to route a payment, which should be applied via
2906     * [`NetworkGraph::channel_failed`].
2907     */
2908    LDKNetworkUpdate_ChannelFailure,
2909    /**
2910     * An error indicating that a node failed to route a payment, which should be applied via
2911     * [`NetworkGraph::node_failed_permanent`] if permanent.
2912     */
2913    LDKNetworkUpdate_NodeFailure,
2914    /**
2915     * Must be last for serialization purposes
2916     */
2917    LDKNetworkUpdate_Sentinel,
2918 } LDKNetworkUpdate_Tag;
2919
2920 typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body {
2921    /**
2922     * The update to apply via [`NetworkGraph::update_channel`].
2923     */
2924    struct LDKChannelUpdate msg;
2925 } LDKNetworkUpdate_LDKChannelUpdateMessage_Body;
2926
2927 typedef struct LDKNetworkUpdate_LDKChannelFailure_Body {
2928    /**
2929     * The short channel id of the closed channel.
2930     */
2931    uint64_t short_channel_id;
2932    /**
2933     * Whether the channel should be permanently removed or temporarily disabled until a new
2934     * `channel_update` message is received.
2935     */
2936    bool is_permanent;
2937 } LDKNetworkUpdate_LDKChannelFailure_Body;
2938
2939 typedef struct LDKNetworkUpdate_LDKNodeFailure_Body {
2940    /**
2941     * The node id of the failed node.
2942     */
2943    struct LDKPublicKey node_id;
2944    /**
2945     * Whether the node should be permanently removed from consideration or can be restored
2946     * when a new `channel_update` message is received.
2947     */
2948    bool is_permanent;
2949 } LDKNetworkUpdate_LDKNodeFailure_Body;
2950
2951 typedef struct MUST_USE_STRUCT LDKNetworkUpdate {
2952    LDKNetworkUpdate_Tag tag;
2953    union {
2954       LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message;
2955       LDKNetworkUpdate_LDKChannelFailure_Body channel_failure;
2956       LDKNetworkUpdate_LDKNodeFailure_Body node_failure;
2957    };
2958 } LDKNetworkUpdate;
2959
2960 /**
2961  * An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
2962  */
2963 typedef enum LDKCOption_NetworkUpdateZ_Tag {
2964    /**
2965     * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
2966     */
2967    LDKCOption_NetworkUpdateZ_Some,
2968    /**
2969     * When we're in this state, this COption_NetworkUpdateZ contains nothing
2970     */
2971    LDKCOption_NetworkUpdateZ_None,
2972    /**
2973     * Must be last for serialization purposes
2974     */
2975    LDKCOption_NetworkUpdateZ_Sentinel,
2976 } LDKCOption_NetworkUpdateZ_Tag;
2977
2978 typedef struct LDKCOption_NetworkUpdateZ {
2979    LDKCOption_NetworkUpdateZ_Tag tag;
2980    union {
2981       struct {
2982          struct LDKNetworkUpdate some;
2983       };
2984    };
2985 } LDKCOption_NetworkUpdateZ;
2986
2987
2988
2989 /**
2990  * A reference to a transaction output.
2991  *
2992  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
2993  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
2994  */
2995 typedef struct MUST_USE_STRUCT LDKOutPoint {
2996    /**
2997     * A pointer to the opaque Rust object.
2998     * Nearly everywhere, inner must be non-null, however in places where
2999     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3000     */
3001    LDKnativeOutPoint *inner;
3002    /**
3003     * Indicates that this is the only struct which contains the same pointer.
3004     * Rust functions which take ownership of an object provided via an argument require
3005     * this to be true and invalidate the object pointed to by inner.
3006     */
3007    bool is_owned;
3008 } LDKOutPoint;
3009
3010
3011
3012 /**
3013  * Information about a spendable output to a P2WSH script. See
3014  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
3015  */
3016 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
3017    /**
3018     * A pointer to the opaque Rust object.
3019     * Nearly everywhere, inner must be non-null, however in places where
3020     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3021     */
3022    LDKnativeDelayedPaymentOutputDescriptor *inner;
3023    /**
3024     * Indicates that this is the only struct which contains the same pointer.
3025     * Rust functions which take ownership of an object provided via an argument require
3026     * this to be true and invalidate the object pointed to by inner.
3027     */
3028    bool is_owned;
3029 } LDKDelayedPaymentOutputDescriptor;
3030
3031
3032
3033 /**
3034  * Information about a spendable output to our \"payment key\". See
3035  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
3036  */
3037 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
3038    /**
3039     * A pointer to the opaque Rust object.
3040     * Nearly everywhere, inner must be non-null, however in places where
3041     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3042     */
3043    LDKnativeStaticPaymentOutputDescriptor *inner;
3044    /**
3045     * Indicates that this is the only struct which contains the same pointer.
3046     * Rust functions which take ownership of an object provided via an argument require
3047     * this to be true and invalidate the object pointed to by inner.
3048     */
3049    bool is_owned;
3050 } LDKStaticPaymentOutputDescriptor;
3051
3052 /**
3053  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
3054  * claim at any point in the future) an event is generated which you must track and be able to
3055  * spend on-chain. The information needed to do this is provided in this enum, including the
3056  * outpoint describing which txid and output index is available, the full output which exists at
3057  * that txid/index, and any keys or other information required to sign.
3058  */
3059 typedef enum LDKSpendableOutputDescriptor_Tag {
3060    /**
3061     * An output to a script which was provided via KeysInterface directly, either from
3062     * `get_destination_script()` or `get_shutdown_scriptpubkey()`, thus you should already know
3063     * how to spend it. No secret keys are provided as rust-lightning was never given any key.
3064     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
3065     * on-chain using the payment preimage or after it has timed out.
3066     */
3067    LDKSpendableOutputDescriptor_StaticOutput,
3068    /**
3069     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
3070     *
3071     * The witness in the spending input should be:
3072     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
3073     *
3074     * Note that the nSequence field in the spending input must be set to to_self_delay
3075     * (which means the transaction is not broadcastable until at least to_self_delay
3076     * blocks after the outpoint confirms).
3077     *
3078     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
3079     * it is an output from an old state which we broadcast (which should never happen).
3080     *
3081     * To derive the delayed_payment key which is used to sign for this input, you must pass the
3082     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
3083     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
3084     * chan_utils::derive_private_key. The public key can be generated without the secret key
3085     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
3086     * Sign::pubkeys().
3087     *
3088     * To derive the revocation_pubkey provided here (which is used in the witness
3089     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
3090     * call to Sign::ready_channel) and the provided per_commitment point
3091     * to chan_utils::derive_public_revocation_key.
3092     *
3093     * The witness script which is hashed and included in the output script_pubkey may be
3094     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
3095     * (derived as above), and the to_self_delay contained here to
3096     * chan_utils::get_revokeable_redeemscript.
3097     */
3098    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
3099    /**
3100     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
3101     * corresponds to the public key in Sign::pubkeys().payment_point).
3102     * The witness in the spending input, is, thus, simply:
3103     * <BIP 143 signature> <payment key>
3104     *
3105     * These are generally the result of our counterparty having broadcast the current state,
3106     * allowing us to claim the non-HTLC-encumbered outputs immediately.
3107     */
3108    LDKSpendableOutputDescriptor_StaticPaymentOutput,
3109    /**
3110     * Must be last for serialization purposes
3111     */
3112    LDKSpendableOutputDescriptor_Sentinel,
3113 } LDKSpendableOutputDescriptor_Tag;
3114
3115 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
3116    /**
3117     * The outpoint which is spendable
3118     */
3119    struct LDKOutPoint outpoint;
3120    /**
3121     * The output which is referenced by the given outpoint.
3122     */
3123    struct LDKTxOut output;
3124 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
3125
3126 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
3127    LDKSpendableOutputDescriptor_Tag tag;
3128    union {
3129       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
3130       struct {
3131          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
3132       };
3133       struct {
3134          struct LDKStaticPaymentOutputDescriptor static_payment_output;
3135       };
3136    };
3137 } LDKSpendableOutputDescriptor;
3138
3139 /**
3140  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3141  * This corresponds to std::vector in C++
3142  */
3143 typedef struct LDKCVec_SpendableOutputDescriptorZ {
3144    /**
3145     * The elements in the array.
3146     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3147     */
3148    struct LDKSpendableOutputDescriptor *data;
3149    /**
3150     * The number of elements pointed to by `data`.
3151     */
3152    uintptr_t datalen;
3153 } LDKCVec_SpendableOutputDescriptorZ;
3154
3155
3156
3157 /**
3158  * Features used within the channel_type field in an OpenChannel message.
3159  *
3160  * A channel is always of some known \"type\", describing the transaction formats used and the exact
3161  * semantics of our interaction with our peer.
3162  *
3163  * Note that because a channel is a specific type which is proposed by the opener and accepted by
3164  * the counterparty, only required features are allowed here.
3165  *
3166  * This is serialized differently from other feature types - it is not prefixed by a length, and
3167  * thus must only appear inside a TLV where its length is known in advance.
3168  */
3169 typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures {
3170    /**
3171     * A pointer to the opaque Rust object.
3172     * Nearly everywhere, inner must be non-null, however in places where
3173     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3174     */
3175    LDKnativeChannelTypeFeatures *inner;
3176    /**
3177     * Indicates that this is the only struct which contains the same pointer.
3178     * Rust functions which take ownership of an object provided via an argument require
3179     * this to be true and invalidate the object pointed to by inner.
3180     */
3181    bool is_owned;
3182 } LDKChannelTypeFeatures;
3183
3184 /**
3185  * An Event which you should probably take some action in response to.
3186  *
3187  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
3188  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
3189  * written as it makes no sense to respond to it after reconnecting to peers).
3190  */
3191 typedef enum LDKEvent_Tag {
3192    /**
3193     * Used to indicate that the client should generate a funding transaction with the given
3194     * parameters and then call [`ChannelManager::funding_transaction_generated`].
3195     * Generated in [`ChannelManager`] message handling.
3196     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
3197     * counterparty can steal your funds!
3198     *
3199     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
3200     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
3201     */
3202    LDKEvent_FundingGenerationReady,
3203    /**
3204     * Indicates we've received (an offer of) money! Just gotta dig out that payment preimage and
3205     * feed it to [`ChannelManager::claim_funds`] to get it....
3206     *
3207     * Note that if the preimage is not known, you should call
3208     * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
3209     * network congestion.
3210     * If you fail to call either [`ChannelManager::claim_funds`] or
3211     * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
3212     * automatically failed.
3213     *
3214     * # Note
3215     * LDK will not stop an inbound payment from being paid multiple times, so multiple
3216     * `PaymentReceived` events may be generated for the same payment.
3217     *
3218     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
3219     * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
3220     */
3221    LDKEvent_PaymentReceived,
3222    /**
3223     * Indicates a payment has been claimed and we've received money!
3224     *
3225     * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response
3226     * to an [`Event::PaymentReceived`]. However, if we previously crashed during a
3227     * [`ChannelManager::claim_funds`] call you may see this event without a corresponding
3228     * [`Event::PaymentReceived`] event.
3229     *
3230     * # Note
3231     * LDK will not stop an inbound payment from being paid multiple times, so multiple
3232     * `PaymentReceived` events may be generated for the same payment. If you then call
3233     * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentReceived`] you may get
3234     * multiple `PaymentClaimed` events.
3235     *
3236     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
3237     */
3238    LDKEvent_PaymentClaimed,
3239    /**
3240     * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
3241     * and we got back the payment preimage for it).
3242     *
3243     * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
3244     * event. In this situation, you SHOULD treat this payment as having succeeded.
3245     */
3246    LDKEvent_PaymentSent,
3247    /**
3248     * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
3249     * provide failure information for each MPP part in the payment.
3250     *
3251     * This event is provided once there are no further pending HTLCs for the payment and the
3252     * payment is no longer retryable, either due to a several-block timeout or because
3253     * [`ChannelManager::abandon_payment`] was previously called for the corresponding payment.
3254     *
3255     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3256     */
3257    LDKEvent_PaymentFailed,
3258    /**
3259     * Indicates that a path for an outbound payment was successful.
3260     *
3261     * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
3262     * [`Event::PaymentSent`] for obtaining the payment preimage.
3263     */
3264    LDKEvent_PaymentPathSuccessful,
3265    /**
3266     * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped
3267     * something. You may wish to retry with a different route.
3268     *
3269     * Note that this does *not* indicate that all paths for an MPP payment have failed, see
3270     * [`Event::PaymentFailed`] and [`all_paths_failed`].
3271     *
3272     * [`all_paths_failed`]: Self::PaymentPathFailed::all_paths_failed
3273     */
3274    LDKEvent_PaymentPathFailed,
3275    /**
3276     * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination.
3277     */
3278    LDKEvent_ProbeSuccessful,
3279    /**
3280     * Indicates that a probe payment we sent failed at an intermediary node on the path.
3281     */
3282    LDKEvent_ProbeFailed,
3283    /**
3284     * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
3285     * a time in the future.
3286     *
3287     * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
3288     */
3289    LDKEvent_PendingHTLCsForwardable,
3290    /**
3291     * Used to indicate that an output which you should know how to spend was confirmed on chain
3292     * and is now spendable.
3293     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
3294     * counterparty spending them due to some kind of timeout. Thus, you need to store them
3295     * somewhere and spend them when you create on-chain transactions.
3296     */
3297    LDKEvent_SpendableOutputs,
3298    /**
3299     * This event is generated when a payment has been successfully forwarded through us and a
3300     * forwarding fee earned.
3301     */
3302    LDKEvent_PaymentForwarded,
3303    /**
3304     * Used to indicate that a previously opened channel with the given `channel_id` is in the
3305     * process of closure.
3306     */
3307    LDKEvent_ChannelClosed,
3308    /**
3309     * Used to indicate to the user that they can abandon the funding transaction and recycle the
3310     * inputs for another purpose.
3311     */
3312    LDKEvent_DiscardFunding,
3313    /**
3314     * Indicates a request to open a new channel by a peer.
3315     *
3316     * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the
3317     * request, call [`ChannelManager::force_close_without_broadcasting_txn`].
3318     *
3319     * The event is only triggered when a new open channel request is received and the
3320     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
3321     *
3322     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3323     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
3324     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
3325     */
3326    LDKEvent_OpenChannelRequest,
3327    /**
3328     * Indicates that the HTLC was accepted, but could not be processed when or after attempting to
3329     * forward it.
3330     *
3331     * Some scenarios where this event may be sent include:
3332     * * Insufficient capacity in the outbound channel
3333     * * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes
3334     * * When an unknown SCID is requested for forwarding a payment.
3335     * * Claiming an amount for an MPP payment that exceeds the HTLC total
3336     * * The HTLC has timed out
3337     *
3338     * This event, however, does not get generated if an HTLC fails to meet the forwarding
3339     * requirements (i.e. insufficient fees paid, or a CLTV that is too soon).
3340     */
3341    LDKEvent_HTLCHandlingFailed,
3342    /**
3343     * Must be last for serialization purposes
3344     */
3345    LDKEvent_Sentinel,
3346 } LDKEvent_Tag;
3347
3348 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
3349    /**
3350     * The random channel_id we picked which you'll need to pass into
3351     * [`ChannelManager::funding_transaction_generated`].
3352     *
3353     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
3354     */
3355    struct LDKThirtyTwoBytes temporary_channel_id;
3356    /**
3357     * The counterparty's node_id, which you'll need to pass back into
3358     * [`ChannelManager::funding_transaction_generated`].
3359     *
3360     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
3361     */
3362    struct LDKPublicKey counterparty_node_id;
3363    /**
3364     * The value, in satoshis, that the output should have.
3365     */
3366    uint64_t channel_value_satoshis;
3367    /**
3368     * The script which should be used in the transaction output.
3369     */
3370    struct LDKCVec_u8Z output_script;
3371    /**
3372     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
3373     * an inbound channel.
3374     *
3375     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
3376     */
3377    uint64_t user_channel_id;
3378 } LDKEvent_LDKFundingGenerationReady_Body;
3379
3380 typedef struct LDKEvent_LDKPaymentReceived_Body {
3381    /**
3382     * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
3383     * not stop you from registering duplicate payment hashes for inbound payments.
3384     */
3385    struct LDKThirtyTwoBytes payment_hash;
3386    /**
3387     * The value, in thousandths of a satoshi, that this payment is for.
3388     */
3389    uint64_t amount_msat;
3390    /**
3391     * Information for claiming this received payment, based on whether the purpose of the
3392     * payment is to pay an invoice or to send a spontaneous payment.
3393     */
3394    struct LDKPaymentPurpose purpose;
3395 } LDKEvent_LDKPaymentReceived_Body;
3396
3397 typedef struct LDKEvent_LDKPaymentClaimed_Body {
3398    /**
3399     * The payment hash of the claimed payment. Note that LDK will not stop you from
3400     * registering duplicate payment hashes for inbound payments.
3401     */
3402    struct LDKThirtyTwoBytes payment_hash;
3403    /**
3404     * The value, in thousandths of a satoshi, that this payment is for.
3405     */
3406    uint64_t amount_msat;
3407    /**
3408     * The purpose of this claimed payment, i.e. whether the payment was for an invoice or a
3409     * spontaneous payment.
3410     */
3411    struct LDKPaymentPurpose purpose;
3412 } LDKEvent_LDKPaymentClaimed_Body;
3413
3414 typedef struct LDKEvent_LDKPaymentSent_Body {
3415    /**
3416     * The id returned by [`ChannelManager::send_payment`] and used with
3417     * [`ChannelManager::retry_payment`].
3418     *
3419     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3420     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3421     *
3422     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3423     */
3424    struct LDKThirtyTwoBytes payment_id;
3425    /**
3426     * The preimage to the hash given to ChannelManager::send_payment.
3427     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
3428     * store it somehow!
3429     */
3430    struct LDKThirtyTwoBytes payment_preimage;
3431    /**
3432     * The hash that was given to [`ChannelManager::send_payment`].
3433     *
3434     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3435     */
3436    struct LDKThirtyTwoBytes payment_hash;
3437    /**
3438     * The total fee which was spent at intermediate hops in this payment, across all paths.
3439     *
3440     * Note that, like [`Route::get_total_fees`] this does *not* include any potential
3441     * overpayment to the recipient node.
3442     *
3443     * If the recipient or an intermediate node misbehaves and gives us free money, this may
3444     * overstate the amount paid, though this is unlikely.
3445     *
3446     * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
3447     */
3448    struct LDKCOption_u64Z fee_paid_msat;
3449 } LDKEvent_LDKPaymentSent_Body;
3450
3451 typedef struct LDKEvent_LDKPaymentFailed_Body {
3452    /**
3453     * The id returned by [`ChannelManager::send_payment`] and used with
3454     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
3455     *
3456     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3457     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3458     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3459     */
3460    struct LDKThirtyTwoBytes payment_id;
3461    /**
3462     * The hash that was given to [`ChannelManager::send_payment`].
3463     *
3464     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3465     */
3466    struct LDKThirtyTwoBytes payment_hash;
3467 } LDKEvent_LDKPaymentFailed_Body;
3468
3469 typedef struct LDKEvent_LDKPaymentPathSuccessful_Body {
3470    /**
3471     * The id returned by [`ChannelManager::send_payment`] and used with
3472     * [`ChannelManager::retry_payment`].
3473     *
3474     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3475     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3476     */
3477    struct LDKThirtyTwoBytes payment_id;
3478    /**
3479     * The hash that was given to [`ChannelManager::send_payment`].
3480     *
3481     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3482     *
3483     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3484     */
3485    struct LDKThirtyTwoBytes payment_hash;
3486    /**
3487     * The payment path that was successful.
3488     *
3489     * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
3490     */
3491    struct LDKCVec_RouteHopZ path;
3492 } LDKEvent_LDKPaymentPathSuccessful_Body;
3493
3494 typedef struct LDKEvent_LDKPaymentPathFailed_Body {
3495    /**
3496     * The id returned by [`ChannelManager::send_payment`] and used with
3497     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
3498     *
3499     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3500     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3501     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3502     *
3503     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3504     */
3505    struct LDKThirtyTwoBytes payment_id;
3506    /**
3507     * The hash that was given to [`ChannelManager::send_payment`].
3508     *
3509     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3510     */
3511    struct LDKThirtyTwoBytes payment_hash;
3512    /**
3513     * Indicates the payment was rejected for some reason by the recipient. This implies that
3514     * the payment has failed, not just the route in question. If this is not set, you may
3515     * retry the payment via a different route.
3516     */
3517    bool payment_failed_permanently;
3518    /**
3519     * Any failure information conveyed via the Onion return packet by a node along the failed
3520     * payment route.
3521     *
3522     * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
3523     * account the update.
3524     *
3525     * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
3526     */
3527    struct LDKCOption_NetworkUpdateZ network_update;
3528    /**
3529     * For both single-path and multi-path payments, this is set if all paths of the payment have
3530     * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
3531     * larger MPP payment were still in flight when this event was generated.
3532     *
3533     * Note that if you are retrying individual MPP parts, using this value to determine if a
3534     * payment has fully failed is race-y. Because multiple failures can happen prior to events
3535     * being processed, you may retry in response to a first failure, with a second failure
3536     * (with `all_paths_failed` set) still pending. Then, when the second failure is processed
3537     * you will see `all_paths_failed` set even though the retry of the first failure still
3538     * has an associated in-flight HTLC. See (1) for an example of such a failure.
3539     *
3540     * If you wish to retry individual MPP parts and learn when a payment has failed, you must
3541     * call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event.
3542     *
3543     * (1) <https://github.com/lightningdevkit/rust-lightning/issues/1164>
3544     *
3545     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3546     */
3547    bool all_paths_failed;
3548    /**
3549     * The payment path that failed.
3550     */
3551    struct LDKCVec_RouteHopZ path;
3552    /**
3553     * The channel responsible for the failed payment path.
3554     *
3555     * Note that for route hints or for the first hop in a path this may be an SCID alias and
3556     * may not refer to a channel in the public network graph. These aliases may also collide
3557     * with channels in the public network graph.
3558     *
3559     * If this is `Some`, then the corresponding channel should be avoided when the payment is
3560     * retried. May be `None` for older [`Event`] serializations.
3561     */
3562    struct LDKCOption_u64Z short_channel_id;
3563    /**
3564     * Parameters needed to compute a new [`Route`] when retrying the failed payment path.
3565     *
3566     * See [`find_route`] for details.
3567     *
3568     * [`Route`]: crate::routing::router::Route
3569     * [`find_route`]: crate::routing::router::find_route
3570     *
3571     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3572     */
3573    struct LDKRouteParameters retry;
3574 } LDKEvent_LDKPaymentPathFailed_Body;
3575
3576 typedef struct LDKEvent_LDKProbeSuccessful_Body {
3577    /**
3578     * The id returned by [`ChannelManager::send_probe`].
3579     *
3580     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
3581     */
3582    struct LDKThirtyTwoBytes payment_id;
3583    /**
3584     * The hash generated by [`ChannelManager::send_probe`].
3585     *
3586     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
3587     */
3588    struct LDKThirtyTwoBytes payment_hash;
3589    /**
3590     * The payment path that was successful.
3591     */
3592    struct LDKCVec_RouteHopZ path;
3593 } LDKEvent_LDKProbeSuccessful_Body;
3594
3595 typedef struct LDKEvent_LDKProbeFailed_Body {
3596    /**
3597     * The id returned by [`ChannelManager::send_probe`].
3598     *
3599     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
3600     */
3601    struct LDKThirtyTwoBytes payment_id;
3602    /**
3603     * The hash generated by [`ChannelManager::send_probe`].
3604     *
3605     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
3606     */
3607    struct LDKThirtyTwoBytes payment_hash;
3608    /**
3609     * The payment path that failed.
3610     */
3611    struct LDKCVec_RouteHopZ path;
3612    /**
3613     * The channel responsible for the failed probe.
3614     *
3615     * Note that for route hints or for the first hop in a path this may be an SCID alias and
3616     * may not refer to a channel in the public network graph. These aliases may also collide
3617     * with channels in the public network graph.
3618     */
3619    struct LDKCOption_u64Z short_channel_id;
3620 } LDKEvent_LDKProbeFailed_Body;
3621
3622 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
3623    /**
3624     * The minimum amount of time that should be waited prior to calling
3625     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
3626     * you should wait a random amount of time in roughly the range (now + time_forwardable,
3627     * now + 5*time_forwardable).
3628     */
3629    uint64_t time_forwardable;
3630 } LDKEvent_LDKPendingHTLCsForwardable_Body;
3631
3632 typedef struct LDKEvent_LDKSpendableOutputs_Body {
3633    /**
3634     * The outputs which you should store as spendable by you.
3635     */
3636    struct LDKCVec_SpendableOutputDescriptorZ outputs;
3637 } LDKEvent_LDKSpendableOutputs_Body;
3638
3639 typedef struct LDKEvent_LDKPaymentForwarded_Body {
3640    /**
3641     * The incoming channel between the previous node and us. This is only `None` for events
3642     * generated or serialized by versions prior to 0.0.107.
3643     *
3644     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3645     */
3646    struct LDKThirtyTwoBytes prev_channel_id;
3647    /**
3648     * The outgoing channel between the next node and us. This is only `None` for events
3649     * generated or serialized by versions prior to 0.0.107.
3650     *
3651     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3652     */
3653    struct LDKThirtyTwoBytes next_channel_id;
3654    /**
3655     * The fee, in milli-satoshis, which was earned as a result of the payment.
3656     *
3657     * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
3658     * was pending, the amount the next hop claimed will have been rounded down to the nearest
3659     * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
3660     * claimed the full value in millisatoshis from the source. In this case,
3661     * `claim_from_onchain_tx` will be set.
3662     *
3663     * If the channel which sent us the payment has been force-closed, we will claim the funds
3664     * via an on-chain transaction. In that case we do not yet know the on-chain transaction
3665     * fees which we will spend and will instead set this to `None`. It is possible duplicate
3666     * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
3667     * `None`.
3668     */
3669    struct LDKCOption_u64Z fee_earned_msat;
3670    /**
3671     * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
3672     * transaction.
3673     */
3674    bool claim_from_onchain_tx;
3675 } LDKEvent_LDKPaymentForwarded_Body;
3676
3677 typedef struct LDKEvent_LDKChannelClosed_Body {
3678    /**
3679     * The channel_id of the channel which has been closed. Note that on-chain transactions
3680     * resolving the channel are likely still awaiting confirmation.
3681     */
3682    struct LDKThirtyTwoBytes channel_id;
3683    /**
3684     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
3685     * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
3686     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
3687     * `user_channel_id` will be 0 for an inbound channel.
3688     * This will always be zero for objects serialized with LDK versions prior to 0.0.102.
3689     *
3690     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
3691     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3692     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
3693     */
3694    uint64_t user_channel_id;
3695    /**
3696     * The reason the channel was closed.
3697     */
3698    struct LDKClosureReason reason;
3699 } LDKEvent_LDKChannelClosed_Body;
3700
3701 typedef struct LDKEvent_LDKDiscardFunding_Body {
3702    /**
3703     * The channel_id of the channel which has been closed.
3704     */
3705    struct LDKThirtyTwoBytes channel_id;
3706    /**
3707     * The full transaction received from the user
3708     */
3709    struct LDKTransaction transaction;
3710 } LDKEvent_LDKDiscardFunding_Body;
3711
3712 typedef struct LDKEvent_LDKOpenChannelRequest_Body {
3713    /**
3714     * The temporary channel ID of the channel requested to be opened.
3715     *
3716     * When responding to the request, the `temporary_channel_id` should be passed
3717     * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
3718     * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject.
3719     *
3720     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3721     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
3722     */
3723    struct LDKThirtyTwoBytes temporary_channel_id;
3724    /**
3725     * The node_id of the counterparty requesting to open the channel.
3726     *
3727     * When responding to the request, the `counterparty_node_id` should be passed
3728     * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
3729     * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
3730     * request.
3731     *
3732     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3733     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
3734     */
3735    struct LDKPublicKey counterparty_node_id;
3736    /**
3737     * The channel value of the requested channel.
3738     */
3739    uint64_t funding_satoshis;
3740    /**
3741     * Our starting balance in the channel if the request is accepted, in milli-satoshi.
3742     */
3743    uint64_t push_msat;
3744    /**
3745     * The features that this channel will operate with. If you reject the channel, a
3746     * well-behaved counterparty may automatically re-attempt the channel with a new set of
3747     * feature flags.
3748     *
3749     * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
3750     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
3751     * 0.0.106.
3752     *
3753     * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
3754     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
3755     * 0.0.107. Channels setting this type also need to get manually accepted via
3756     * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
3757     * or will be rejected otherwise.
3758     *
3759     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
3760     */
3761    struct LDKChannelTypeFeatures channel_type;
3762 } LDKEvent_LDKOpenChannelRequest_Body;
3763
3764 typedef struct LDKEvent_LDKHTLCHandlingFailed_Body {
3765    /**
3766     * The channel over which the HTLC was received.
3767     */
3768    struct LDKThirtyTwoBytes prev_channel_id;
3769    /**
3770     * Destination of the HTLC that failed to be processed.
3771     */
3772    struct LDKHTLCDestination failed_next_destination;
3773 } LDKEvent_LDKHTLCHandlingFailed_Body;
3774
3775 typedef struct MUST_USE_STRUCT LDKEvent {
3776    LDKEvent_Tag tag;
3777    union {
3778       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
3779       LDKEvent_LDKPaymentReceived_Body payment_received;
3780       LDKEvent_LDKPaymentClaimed_Body payment_claimed;
3781       LDKEvent_LDKPaymentSent_Body payment_sent;
3782       LDKEvent_LDKPaymentFailed_Body payment_failed;
3783       LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful;
3784       LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
3785       LDKEvent_LDKProbeSuccessful_Body probe_successful;
3786       LDKEvent_LDKProbeFailed_Body probe_failed;
3787       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
3788       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
3789       LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
3790       LDKEvent_LDKChannelClosed_Body channel_closed;
3791       LDKEvent_LDKDiscardFunding_Body discard_funding;
3792       LDKEvent_LDKOpenChannelRequest_Body open_channel_request;
3793       LDKEvent_LDKHTLCHandlingFailed_Body htlc_handling_failed;
3794    };
3795 } LDKEvent;
3796
3797 /**
3798  * An enum which can either contain a crate::lightning::util::events::Event or not
3799  */
3800 typedef enum LDKCOption_EventZ_Tag {
3801    /**
3802     * When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3803     */
3804    LDKCOption_EventZ_Some,
3805    /**
3806     * When we're in this state, this COption_EventZ contains nothing
3807     */
3808    LDKCOption_EventZ_None,
3809    /**
3810     * Must be last for serialization purposes
3811     */
3812    LDKCOption_EventZ_Sentinel,
3813 } LDKCOption_EventZ_Tag;
3814
3815 typedef struct LDKCOption_EventZ {
3816    LDKCOption_EventZ_Tag tag;
3817    union {
3818       struct {
3819          struct LDKEvent some;
3820       };
3821    };
3822 } LDKCOption_EventZ;
3823
3824 /**
3825  * The contents of CResult_COption_EventZDecodeErrorZ
3826  */
3827 typedef union LDKCResult_COption_EventZDecodeErrorZPtr {
3828    /**
3829     * A pointer to the contents in the success state.
3830     * Reading from this pointer when `result_ok` is not set is undefined.
3831     */
3832    struct LDKCOption_EventZ *result;
3833    /**
3834     * A pointer to the contents in the error state.
3835     * Reading from this pointer when `result_ok` is set is undefined.
3836     */
3837    struct LDKDecodeError *err;
3838 } LDKCResult_COption_EventZDecodeErrorZPtr;
3839
3840 /**
3841  * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3842  * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3843  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3844  */
3845 typedef struct LDKCResult_COption_EventZDecodeErrorZ {
3846    /**
3847     * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3848     * `err` or `result` depending on the state of `result_ok`.
3849     */
3850    union LDKCResult_COption_EventZDecodeErrorZPtr contents;
3851    /**
3852     * Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3853     */
3854    bool result_ok;
3855 } LDKCResult_COption_EventZDecodeErrorZ;
3856
3857
3858
3859 /**
3860  * An accept_channel message to be sent or received from a peer
3861  */
3862 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
3863    /**
3864     * A pointer to the opaque Rust object.
3865     * Nearly everywhere, inner must be non-null, however in places where
3866     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3867     */
3868    LDKnativeAcceptChannel *inner;
3869    /**
3870     * Indicates that this is the only struct which contains the same pointer.
3871     * Rust functions which take ownership of an object provided via an argument require
3872     * this to be true and invalidate the object pointed to by inner.
3873     */
3874    bool is_owned;
3875 } LDKAcceptChannel;
3876
3877
3878
3879 /**
3880  * An open_channel message to be sent or received from a peer
3881  */
3882 typedef struct MUST_USE_STRUCT LDKOpenChannel {
3883    /**
3884     * A pointer to the opaque Rust object.
3885     * Nearly everywhere, inner must be non-null, however in places where
3886     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3887     */
3888    LDKnativeOpenChannel *inner;
3889    /**
3890     * Indicates that this is the only struct which contains the same pointer.
3891     * Rust functions which take ownership of an object provided via an argument require
3892     * this to be true and invalidate the object pointed to by inner.
3893     */
3894    bool is_owned;
3895 } LDKOpenChannel;
3896
3897
3898
3899 /**
3900  * A funding_created message to be sent or received from a peer
3901  */
3902 typedef struct MUST_USE_STRUCT LDKFundingCreated {
3903    /**
3904     * A pointer to the opaque Rust object.
3905     * Nearly everywhere, inner must be non-null, however in places where
3906     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3907     */
3908    LDKnativeFundingCreated *inner;
3909    /**
3910     * Indicates that this is the only struct which contains the same pointer.
3911     * Rust functions which take ownership of an object provided via an argument require
3912     * this to be true and invalidate the object pointed to by inner.
3913     */
3914    bool is_owned;
3915 } LDKFundingCreated;
3916
3917
3918
3919 /**
3920  * A funding_signed message to be sent or received from a peer
3921  */
3922 typedef struct MUST_USE_STRUCT LDKFundingSigned {
3923    /**
3924     * A pointer to the opaque Rust object.
3925     * Nearly everywhere, inner must be non-null, however in places where
3926     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3927     */
3928    LDKnativeFundingSigned *inner;
3929    /**
3930     * Indicates that this is the only struct which contains the same pointer.
3931     * Rust functions which take ownership of an object provided via an argument require
3932     * this to be true and invalidate the object pointed to by inner.
3933     */
3934    bool is_owned;
3935 } LDKFundingSigned;
3936
3937
3938
3939 /**
3940  * A channel_ready message to be sent or received from a peer
3941  */
3942 typedef struct MUST_USE_STRUCT LDKChannelReady {
3943    /**
3944     * A pointer to the opaque Rust object.
3945     * Nearly everywhere, inner must be non-null, however in places where
3946     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3947     */
3948    LDKnativeChannelReady *inner;
3949    /**
3950     * Indicates that this is the only struct which contains the same pointer.
3951     * Rust functions which take ownership of an object provided via an argument require
3952     * this to be true and invalidate the object pointed to by inner.
3953     */
3954    bool is_owned;
3955 } LDKChannelReady;
3956
3957
3958
3959 /**
3960  * An announcement_signatures message to be sent or received from a peer
3961  */
3962 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
3963    /**
3964     * A pointer to the opaque Rust object.
3965     * Nearly everywhere, inner must be non-null, however in places where
3966     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3967     */
3968    LDKnativeAnnouncementSignatures *inner;
3969    /**
3970     * Indicates that this is the only struct which contains the same pointer.
3971     * Rust functions which take ownership of an object provided via an argument require
3972     * this to be true and invalidate the object pointed to by inner.
3973     */
3974    bool is_owned;
3975 } LDKAnnouncementSignatures;
3976
3977
3978
3979 /**
3980  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
3981  * transaction updates if they were pending.
3982  */
3983 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
3984    /**
3985     * A pointer to the opaque Rust object.
3986     * Nearly everywhere, inner must be non-null, however in places where
3987     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3988     */
3989    LDKnativeCommitmentUpdate *inner;
3990    /**
3991     * Indicates that this is the only struct which contains the same pointer.
3992     * Rust functions which take ownership of an object provided via an argument require
3993     * this to be true and invalidate the object pointed to by inner.
3994     */
3995    bool is_owned;
3996 } LDKCommitmentUpdate;
3997
3998
3999
4000 /**
4001  * A revoke_and_ack message to be sent or received from a peer
4002  */
4003 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
4004    /**
4005     * A pointer to the opaque Rust object.
4006     * Nearly everywhere, inner must be non-null, however in places where
4007     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4008     */
4009    LDKnativeRevokeAndACK *inner;
4010    /**
4011     * Indicates that this is the only struct which contains the same pointer.
4012     * Rust functions which take ownership of an object provided via an argument require
4013     * this to be true and invalidate the object pointed to by inner.
4014     */
4015    bool is_owned;
4016 } LDKRevokeAndACK;
4017
4018
4019
4020 /**
4021  * A closing_signed message to be sent or received from a peer
4022  */
4023 typedef struct MUST_USE_STRUCT LDKClosingSigned {
4024    /**
4025     * A pointer to the opaque Rust object.
4026     * Nearly everywhere, inner must be non-null, however in places where
4027     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4028     */
4029    LDKnativeClosingSigned *inner;
4030    /**
4031     * Indicates that this is the only struct which contains the same pointer.
4032     * Rust functions which take ownership of an object provided via an argument require
4033     * this to be true and invalidate the object pointed to by inner.
4034     */
4035    bool is_owned;
4036 } LDKClosingSigned;
4037
4038
4039
4040 /**
4041  * A shutdown message to be sent or received from a peer
4042  */
4043 typedef struct MUST_USE_STRUCT LDKShutdown {
4044    /**
4045     * A pointer to the opaque Rust object.
4046     * Nearly everywhere, inner must be non-null, however in places where
4047     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4048     */
4049    LDKnativeShutdown *inner;
4050    /**
4051     * Indicates that this is the only struct which contains the same pointer.
4052     * Rust functions which take ownership of an object provided via an argument require
4053     * this to be true and invalidate the object pointed to by inner.
4054     */
4055    bool is_owned;
4056 } LDKShutdown;
4057
4058
4059
4060 /**
4061  * A channel_reestablish message to be sent or received from a peer
4062  */
4063 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
4064    /**
4065     * A pointer to the opaque Rust object.
4066     * Nearly everywhere, inner must be non-null, however in places where
4067     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4068     */
4069    LDKnativeChannelReestablish *inner;
4070    /**
4071     * Indicates that this is the only struct which contains the same pointer.
4072     * Rust functions which take ownership of an object provided via an argument require
4073     * this to be true and invalidate the object pointed to by inner.
4074     */
4075    bool is_owned;
4076 } LDKChannelReestablish;
4077
4078
4079
4080 /**
4081  * A channel_announcement message to be sent or received from a peer
4082  */
4083 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
4084    /**
4085     * A pointer to the opaque Rust object.
4086     * Nearly everywhere, inner must be non-null, however in places where
4087     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4088     */
4089    LDKnativeChannelAnnouncement *inner;
4090    /**
4091     * Indicates that this is the only struct which contains the same pointer.
4092     * Rust functions which take ownership of an object provided via an argument require
4093     * this to be true and invalidate the object pointed to by inner.
4094     */
4095    bool is_owned;
4096 } LDKChannelAnnouncement;
4097
4098
4099
4100 /**
4101  * An error message to be sent or received from a peer
4102  */
4103 typedef struct MUST_USE_STRUCT LDKErrorMessage {
4104    /**
4105     * A pointer to the opaque Rust object.
4106     * Nearly everywhere, inner must be non-null, however in places where
4107     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4108     */
4109    LDKnativeErrorMessage *inner;
4110    /**
4111     * Indicates that this is the only struct which contains the same pointer.
4112     * Rust functions which take ownership of an object provided via an argument require
4113     * this to be true and invalidate the object pointed to by inner.
4114     */
4115    bool is_owned;
4116 } LDKErrorMessage;
4117
4118
4119
4120 /**
4121  * A warning message to be sent or received from a peer
4122  */
4123 typedef struct MUST_USE_STRUCT LDKWarningMessage {
4124    /**
4125     * A pointer to the opaque Rust object.
4126     * Nearly everywhere, inner must be non-null, however in places where
4127     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4128     */
4129    LDKnativeWarningMessage *inner;
4130    /**
4131     * Indicates that this is the only struct which contains the same pointer.
4132     * Rust functions which take ownership of an object provided via an argument require
4133     * this to be true and invalidate the object pointed to by inner.
4134     */
4135    bool is_owned;
4136 } LDKWarningMessage;
4137
4138 /**
4139  * Used to put an error message in a LightningError
4140  */
4141 typedef enum LDKErrorAction_Tag {
4142    /**
4143     * The peer took some action which made us think they were useless. Disconnect them.
4144     */
4145    LDKErrorAction_DisconnectPeer,
4146    /**
4147     * The peer did something harmless that we weren't able to process, just log and ignore
4148     */
4149    LDKErrorAction_IgnoreError,
4150    /**
4151     * The peer did something harmless that we weren't able to meaningfully process.
4152     * If the error is logged, log it at the given level.
4153     */
4154    LDKErrorAction_IgnoreAndLog,
4155    /**
4156     * The peer provided us with a gossip message which we'd already seen. In most cases this
4157     * should be ignored, but it may result in the message being forwarded if it is a duplicate of
4158     * our own channel announcements.
4159     */
4160    LDKErrorAction_IgnoreDuplicateGossip,
4161    /**
4162     * The peer did something incorrect. Tell them.
4163     */
4164    LDKErrorAction_SendErrorMessage,
4165    /**
4166     * The peer did something incorrect. Tell them without closing any channels.
4167     */
4168    LDKErrorAction_SendWarningMessage,
4169    /**
4170     * Must be last for serialization purposes
4171     */
4172    LDKErrorAction_Sentinel,
4173 } LDKErrorAction_Tag;
4174
4175 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
4176    /**
4177     * An error message which we should make an effort to send before we disconnect.
4178     *
4179     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
4180     */
4181    struct LDKErrorMessage msg;
4182 } LDKErrorAction_LDKDisconnectPeer_Body;
4183
4184 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
4185    /**
4186     * The message to send.
4187     */
4188    struct LDKErrorMessage msg;
4189 } LDKErrorAction_LDKSendErrorMessage_Body;
4190
4191 typedef struct LDKErrorAction_LDKSendWarningMessage_Body {
4192    /**
4193     * The message to send.
4194     */
4195    struct LDKWarningMessage msg;
4196    /**
4197     * The peer may have done something harmless that we weren't able to meaningfully process,
4198     * though we should still tell them about it.
4199     * If this event is logged, log it at the given level.
4200     */
4201    enum LDKLevel log_level;
4202 } LDKErrorAction_LDKSendWarningMessage_Body;
4203
4204 typedef struct MUST_USE_STRUCT LDKErrorAction {
4205    LDKErrorAction_Tag tag;
4206    union {
4207       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
4208       struct {
4209          enum LDKLevel ignore_and_log;
4210       };
4211       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
4212       LDKErrorAction_LDKSendWarningMessage_Body send_warning_message;
4213    };
4214 } LDKErrorAction;
4215
4216
4217
4218 /**
4219  * A query_channel_range message is used to query a peer for channel
4220  * UTXOs in a range of blocks. The recipient of a query makes a best
4221  * effort to reply to the query using one or more reply_channel_range
4222  * messages.
4223  */
4224 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
4225    /**
4226     * A pointer to the opaque Rust object.
4227     * Nearly everywhere, inner must be non-null, however in places where
4228     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4229     */
4230    LDKnativeQueryChannelRange *inner;
4231    /**
4232     * Indicates that this is the only struct which contains the same pointer.
4233     * Rust functions which take ownership of an object provided via an argument require
4234     * this to be true and invalidate the object pointed to by inner.
4235     */
4236    bool is_owned;
4237 } LDKQueryChannelRange;
4238
4239
4240
4241 /**
4242  * A query_short_channel_ids message is used to query a peer for
4243  * routing gossip messages related to one or more short_channel_ids.
4244  * The query recipient will reply with the latest, if available,
4245  * channel_announcement, channel_update and node_announcement messages
4246  * it maintains for the requested short_channel_ids followed by a
4247  * reply_short_channel_ids_end message. The short_channel_ids sent in
4248  * this query are encoded. We only support encoding_type=0 uncompressed
4249  * serialization and do not support encoding_type=1 zlib serialization.
4250  */
4251 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
4252    /**
4253     * A pointer to the opaque Rust object.
4254     * Nearly everywhere, inner must be non-null, however in places where
4255     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4256     */
4257    LDKnativeQueryShortChannelIds *inner;
4258    /**
4259     * Indicates that this is the only struct which contains the same pointer.
4260     * Rust functions which take ownership of an object provided via an argument require
4261     * this to be true and invalidate the object pointed to by inner.
4262     */
4263    bool is_owned;
4264 } LDKQueryShortChannelIds;
4265
4266
4267
4268 /**
4269  * A reply_channel_range message is a reply to a query_channel_range
4270  * message. Multiple reply_channel_range messages can be sent in reply
4271  * to a single query_channel_range message. The query recipient makes a
4272  * best effort to respond based on their local network view which may
4273  * not be a perfect view of the network. The short_channel_ids in the
4274  * reply are encoded. We only support encoding_type=0 uncompressed
4275  * serialization and do not support encoding_type=1 zlib serialization.
4276  */
4277 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
4278    /**
4279     * A pointer to the opaque Rust object.
4280     * Nearly everywhere, inner must be non-null, however in places where
4281     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4282     */
4283    LDKnativeReplyChannelRange *inner;
4284    /**
4285     * Indicates that this is the only struct which contains the same pointer.
4286     * Rust functions which take ownership of an object provided via an argument require
4287     * this to be true and invalidate the object pointed to by inner.
4288     */
4289    bool is_owned;
4290 } LDKReplyChannelRange;
4291
4292
4293
4294 /**
4295  * A gossip_timestamp_filter message is used by a node to request
4296  * gossip relay for messages in the requested time range when the
4297  * gossip_queries feature has been negotiated.
4298  */
4299 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
4300    /**
4301     * A pointer to the opaque Rust object.
4302     * Nearly everywhere, inner must be non-null, however in places where
4303     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4304     */
4305    LDKnativeGossipTimestampFilter *inner;
4306    /**
4307     * Indicates that this is the only struct which contains the same pointer.
4308     * Rust functions which take ownership of an object provided via an argument require
4309     * this to be true and invalidate the object pointed to by inner.
4310     */
4311    bool is_owned;
4312 } LDKGossipTimestampFilter;
4313
4314 /**
4315  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
4316  * broadcast to most peers).
4317  * These events are handled by PeerManager::process_events if you are using a PeerManager.
4318  */
4319 typedef enum LDKMessageSendEvent_Tag {
4320    /**
4321     * Used to indicate that we've accepted a channel open and should send the accept_channel
4322     * message provided to the given peer.
4323     */
4324    LDKMessageSendEvent_SendAcceptChannel,
4325    /**
4326     * Used to indicate that we've initiated a channel open and should send the open_channel
4327     * message provided to the given peer.
4328     */
4329    LDKMessageSendEvent_SendOpenChannel,
4330    /**
4331     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
4332     */
4333    LDKMessageSendEvent_SendFundingCreated,
4334    /**
4335     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
4336     */
4337    LDKMessageSendEvent_SendFundingSigned,
4338    /**
4339     * Used to indicate that a channel_ready message should be sent to the peer with the given node_id.
4340     */
4341    LDKMessageSendEvent_SendChannelReady,
4342    /**
4343     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
4344     */
4345    LDKMessageSendEvent_SendAnnouncementSignatures,
4346    /**
4347     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
4348     * message should be sent to the peer with the given node_id.
4349     */
4350    LDKMessageSendEvent_UpdateHTLCs,
4351    /**
4352     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
4353     */
4354    LDKMessageSendEvent_SendRevokeAndACK,
4355    /**
4356     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
4357     */
4358    LDKMessageSendEvent_SendClosingSigned,
4359    /**
4360     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
4361     */
4362    LDKMessageSendEvent_SendShutdown,
4363    /**
4364     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
4365     */
4366    LDKMessageSendEvent_SendChannelReestablish,
4367    /**
4368     * Used to send a channel_announcement and channel_update to a specific peer, likely on
4369     * initial connection to ensure our peers know about our channels.
4370     */
4371    LDKMessageSendEvent_SendChannelAnnouncement,
4372    /**
4373     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
4374     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
4375     *
4376     * Note that after doing so, you very likely (unless you did so very recently) want to
4377     * broadcast a node_announcement (e.g. via [`PeerManager::broadcast_node_announcement`]). This
4378     * ensures that any nodes which see our channel_announcement also have a relevant
4379     * node_announcement, including relevant feature flags which may be important for routing
4380     * through or to us.
4381     *
4382     * [`PeerManager::broadcast_node_announcement`]: crate::ln::peer_handler::PeerManager::broadcast_node_announcement
4383     */
4384    LDKMessageSendEvent_BroadcastChannelAnnouncement,
4385    /**
4386     * Used to indicate that a channel_update should be broadcast to all peers.
4387     */
4388    LDKMessageSendEvent_BroadcastChannelUpdate,
4389    /**
4390     * Used to indicate that a channel_update should be sent to a single peer.
4391     * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
4392     * private channel and we shouldn't be informing all of our peers of channel parameters.
4393     */
4394    LDKMessageSendEvent_SendChannelUpdate,
4395    /**
4396     * Broadcast an error downstream to be handled
4397     */
4398    LDKMessageSendEvent_HandleError,
4399    /**
4400     * Query a peer for channels with funding transaction UTXOs in a block range.
4401     */
4402    LDKMessageSendEvent_SendChannelRangeQuery,
4403    /**
4404     * Request routing gossip messages from a peer for a list of channels identified by
4405     * their short_channel_ids.
4406     */
4407    LDKMessageSendEvent_SendShortIdsQuery,
4408    /**
4409     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
4410     * emitted during processing of the query.
4411     */
4412    LDKMessageSendEvent_SendReplyChannelRange,
4413    /**
4414     * Sends a timestamp filter for inbound gossip. This should be sent on each new connection to
4415     * enable receiving gossip messages from the peer.
4416     */
4417    LDKMessageSendEvent_SendGossipTimestampFilter,
4418    /**
4419     * Must be last for serialization purposes
4420     */
4421    LDKMessageSendEvent_Sentinel,
4422 } LDKMessageSendEvent_Tag;
4423
4424 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
4425    /**
4426     * The node_id of the node which should receive this message
4427     */
4428    struct LDKPublicKey node_id;
4429    /**
4430     * The message which should be sent.
4431     */
4432    struct LDKAcceptChannel msg;
4433 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
4434
4435 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
4436    /**
4437     * The node_id of the node which should receive this message
4438     */
4439    struct LDKPublicKey node_id;
4440    /**
4441     * The message which should be sent.
4442     */
4443    struct LDKOpenChannel msg;
4444 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
4445
4446 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
4447    /**
4448     * The node_id of the node which should receive this message
4449     */
4450    struct LDKPublicKey node_id;
4451    /**
4452     * The message which should be sent.
4453     */
4454    struct LDKFundingCreated msg;
4455 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
4456
4457 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
4458    /**
4459     * The node_id of the node which should receive this message
4460     */
4461    struct LDKPublicKey node_id;
4462    /**
4463     * The message which should be sent.
4464     */
4465    struct LDKFundingSigned msg;
4466 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
4467
4468 typedef struct LDKMessageSendEvent_LDKSendChannelReady_Body {
4469    /**
4470     * The node_id of the node which should receive these message(s)
4471     */
4472    struct LDKPublicKey node_id;
4473    /**
4474     * The channel_ready message which should be sent.
4475     */
4476    struct LDKChannelReady msg;
4477 } LDKMessageSendEvent_LDKSendChannelReady_Body;
4478
4479 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
4480    /**
4481     * The node_id of the node which should receive these message(s)
4482     */
4483    struct LDKPublicKey node_id;
4484    /**
4485     * The announcement_signatures message which should be sent.
4486     */
4487    struct LDKAnnouncementSignatures msg;
4488 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
4489
4490 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
4491    /**
4492     * The node_id of the node which should receive these message(s)
4493     */
4494    struct LDKPublicKey node_id;
4495    /**
4496     * The update messages which should be sent. ALL messages in the struct should be sent!
4497     */
4498    struct LDKCommitmentUpdate updates;
4499 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
4500
4501 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
4502    /**
4503     * The node_id of the node which should receive this message
4504     */
4505    struct LDKPublicKey node_id;
4506    /**
4507     * The message which should be sent.
4508     */
4509    struct LDKRevokeAndACK msg;
4510 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
4511
4512 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
4513    /**
4514     * The node_id of the node which should receive this message
4515     */
4516    struct LDKPublicKey node_id;
4517    /**
4518     * The message which should be sent.
4519     */
4520    struct LDKClosingSigned msg;
4521 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
4522
4523 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
4524    /**
4525     * The node_id of the node which should receive this message
4526     */
4527    struct LDKPublicKey node_id;
4528    /**
4529     * The message which should be sent.
4530     */
4531    struct LDKShutdown msg;
4532 } LDKMessageSendEvent_LDKSendShutdown_Body;
4533
4534 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
4535    /**
4536     * The node_id of the node which should receive this message
4537     */
4538    struct LDKPublicKey node_id;
4539    /**
4540     * The message which should be sent.
4541     */
4542    struct LDKChannelReestablish msg;
4543 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
4544
4545 typedef struct LDKMessageSendEvent_LDKSendChannelAnnouncement_Body {
4546    /**
4547     * The node_id of the node which should receive this message
4548     */
4549    struct LDKPublicKey node_id;
4550    /**
4551     * The channel_announcement which should be sent.
4552     */
4553    struct LDKChannelAnnouncement msg;
4554    /**
4555     * The followup channel_update which should be sent.
4556     */
4557    struct LDKChannelUpdate update_msg;
4558 } LDKMessageSendEvent_LDKSendChannelAnnouncement_Body;
4559
4560 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
4561    /**
4562     * The channel_announcement which should be sent.
4563     */
4564    struct LDKChannelAnnouncement msg;
4565    /**
4566     * The followup channel_update which should be sent.
4567     */
4568    struct LDKChannelUpdate update_msg;
4569 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
4570
4571 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
4572    /**
4573     * The channel_update which should be sent.
4574     */
4575    struct LDKChannelUpdate msg;
4576 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
4577
4578 typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
4579    /**
4580     * The node_id of the node which should receive this message
4581     */
4582    struct LDKPublicKey node_id;
4583    /**
4584     * The channel_update which should be sent.
4585     */
4586    struct LDKChannelUpdate msg;
4587 } LDKMessageSendEvent_LDKSendChannelUpdate_Body;
4588
4589 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
4590    /**
4591     * The node_id of the node which should receive this message
4592     */
4593    struct LDKPublicKey node_id;
4594    /**
4595     * The action which should be taken.
4596     */
4597    struct LDKErrorAction action;
4598 } LDKMessageSendEvent_LDKHandleError_Body;
4599
4600 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
4601    /**
4602     * The node_id of this message recipient
4603     */
4604    struct LDKPublicKey node_id;
4605    /**
4606     * The query_channel_range which should be sent.
4607     */
4608    struct LDKQueryChannelRange msg;
4609 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
4610
4611 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
4612    /**
4613     * The node_id of this message recipient
4614     */
4615    struct LDKPublicKey node_id;
4616    /**
4617     * The query_short_channel_ids which should be sent.
4618     */
4619    struct LDKQueryShortChannelIds msg;
4620 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
4621
4622 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
4623    /**
4624     * The node_id of this message recipient
4625     */
4626    struct LDKPublicKey node_id;
4627    /**
4628     * The reply_channel_range which should be sent.
4629     */
4630    struct LDKReplyChannelRange msg;
4631 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
4632
4633 typedef struct LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body {
4634    /**
4635     * The node_id of this message recipient
4636     */
4637    struct LDKPublicKey node_id;
4638    /**
4639     * The gossip_timestamp_filter which should be sent.
4640     */
4641    struct LDKGossipTimestampFilter msg;
4642 } LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body;
4643
4644 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
4645    LDKMessageSendEvent_Tag tag;
4646    union {
4647       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
4648       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
4649       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
4650       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
4651       LDKMessageSendEvent_LDKSendChannelReady_Body send_channel_ready;
4652       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
4653       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
4654       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
4655       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
4656       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
4657       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
4658       LDKMessageSendEvent_LDKSendChannelAnnouncement_Body send_channel_announcement;
4659       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
4660       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
4661       LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
4662       LDKMessageSendEvent_LDKHandleError_Body handle_error;
4663       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
4664       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
4665       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
4666       LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body send_gossip_timestamp_filter;
4667    };
4668 } LDKMessageSendEvent;
4669
4670 /**
4671  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
4672  * This corresponds to std::vector in C++
4673  */
4674 typedef struct LDKCVec_MessageSendEventZ {
4675    /**
4676     * The elements in the array.
4677     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4678     */
4679    struct LDKMessageSendEvent *data;
4680    /**
4681     * The number of elements pointed to by `data`.
4682     */
4683    uintptr_t datalen;
4684 } LDKCVec_MessageSendEventZ;
4685
4686 /**
4687  * The contents of CResult_TxOutAccessErrorZ
4688  */
4689 typedef union LDKCResult_TxOutAccessErrorZPtr {
4690    /**
4691     * A pointer to the contents in the success state.
4692     * Reading from this pointer when `result_ok` is not set is undefined.
4693     */
4694    struct LDKTxOut *result;
4695    /**
4696     * A pointer to the contents in the error state.
4697     * Reading from this pointer when `result_ok` is set is undefined.
4698     */
4699    enum LDKAccessError *err;
4700 } LDKCResult_TxOutAccessErrorZPtr;
4701
4702 /**
4703  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
4704  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
4705  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4706  */
4707 typedef struct LDKCResult_TxOutAccessErrorZ {
4708    /**
4709     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
4710     * `err` or `result` depending on the state of `result_ok`.
4711     */
4712    union LDKCResult_TxOutAccessErrorZPtr contents;
4713    /**
4714     * Whether this CResult_TxOutAccessErrorZ represents a success state.
4715     */
4716    bool result_ok;
4717 } LDKCResult_TxOutAccessErrorZ;
4718
4719 /**
4720  * A tuple of 2 elements. See the individual fields for the types contained.
4721  */
4722 typedef struct LDKC2Tuple_usizeTransactionZ {
4723    /**
4724     * The element at position 0
4725     */
4726    uintptr_t a;
4727    /**
4728     * The element at position 1
4729     */
4730    struct LDKTransaction b;
4731 } LDKC2Tuple_usizeTransactionZ;
4732
4733 /**
4734  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
4735  * This corresponds to std::vector in C++
4736  */
4737 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
4738    /**
4739     * The elements in the array.
4740     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4741     */
4742    struct LDKC2Tuple_usizeTransactionZ *data;
4743    /**
4744     * The number of elements pointed to by `data`.
4745     */
4746    uintptr_t datalen;
4747 } LDKCVec_C2Tuple_usizeTransactionZZ;
4748
4749 /**
4750  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4751  * This corresponds to std::vector in C++
4752  */
4753 typedef struct LDKCVec_TxidZ {
4754    /**
4755     * The elements in the array.
4756     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4757     */
4758    struct LDKThirtyTwoBytes *data;
4759    /**
4760     * The number of elements pointed to by `data`.
4761     */
4762    uintptr_t datalen;
4763 } LDKCVec_TxidZ;
4764
4765
4766
4767 /**
4768  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
4769  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
4770  * preimage claim backward will lead to loss of funds.
4771  */
4772 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
4773    /**
4774     * A pointer to the opaque Rust object.
4775     * Nearly everywhere, inner must be non-null, however in places where
4776     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4777     */
4778    LDKnativeHTLCUpdate *inner;
4779    /**
4780     * Indicates that this is the only struct which contains the same pointer.
4781     * Rust functions which take ownership of an object provided via an argument require
4782     * this to be true and invalidate the object pointed to by inner.
4783     */
4784    bool is_owned;
4785 } LDKHTLCUpdate;
4786
4787 /**
4788  * An event to be processed by the ChannelManager.
4789  */
4790 typedef enum LDKMonitorEvent_Tag {
4791    /**
4792     * A monitor event containing an HTLCUpdate.
4793     */
4794    LDKMonitorEvent_HTLCEvent,
4795    /**
4796     * A monitor event that the Channel's commitment transaction was confirmed.
4797     */
4798    LDKMonitorEvent_CommitmentTxConfirmed,
4799    /**
4800     * Indicates a [`ChannelMonitor`] update has completed. See
4801     * [`ChannelMonitorUpdateStatus::InProgress`] for more information on how this is used.
4802     *
4803     * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
4804     */
4805    LDKMonitorEvent_Completed,
4806    /**
4807     * Indicates a [`ChannelMonitor`] update has failed. See
4808     * [`ChannelMonitorUpdateStatus::PermanentFailure`] for more information on how this is used.
4809     *
4810     * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure
4811     */
4812    LDKMonitorEvent_UpdateFailed,
4813    /**
4814     * Must be last for serialization purposes
4815     */
4816    LDKMonitorEvent_Sentinel,
4817 } LDKMonitorEvent_Tag;
4818
4819 typedef struct LDKMonitorEvent_LDKCompleted_Body {
4820    /**
4821     * The funding outpoint of the [`ChannelMonitor`] that was updated
4822     */
4823    struct LDKOutPoint funding_txo;
4824    /**
4825     * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
4826     * [`ChannelMonitor::get_latest_update_id`].
4827     *
4828     * Note that this should only be set to a given update's ID if all previous updates for the
4829     * same [`ChannelMonitor`] have been applied and persisted.
4830     */
4831    uint64_t monitor_update_id;
4832 } LDKMonitorEvent_LDKCompleted_Body;
4833
4834 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
4835    LDKMonitorEvent_Tag tag;
4836    union {
4837       struct {
4838          struct LDKHTLCUpdate htlc_event;
4839       };
4840       struct {
4841          struct LDKOutPoint commitment_tx_confirmed;
4842       };
4843       LDKMonitorEvent_LDKCompleted_Body completed;
4844       struct {
4845          struct LDKOutPoint update_failed;
4846       };
4847    };
4848 } LDKMonitorEvent;
4849
4850 /**
4851  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
4852  * This corresponds to std::vector in C++
4853  */
4854 typedef struct LDKCVec_MonitorEventZ {
4855    /**
4856     * The elements in the array.
4857     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4858     */
4859    struct LDKMonitorEvent *data;
4860    /**
4861     * The number of elements pointed to by `data`.
4862     */
4863    uintptr_t datalen;
4864 } LDKCVec_MonitorEventZ;
4865
4866 /**
4867  * A tuple of 3 elements. See the individual fields for the types contained.
4868  */
4869 typedef struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4870    /**
4871     * The element at position 0
4872     */
4873    struct LDKOutPoint a;
4874    /**
4875     * The element at position 1
4876     */
4877    struct LDKCVec_MonitorEventZ b;
4878    /**
4879     * The element at position 2
4880     */
4881    struct LDKPublicKey c;
4882 } LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ;
4883
4884 /**
4885  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
4886  * This corresponds to std::vector in C++
4887  */
4888 typedef struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4889    /**
4890     * The elements in the array.
4891     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4892     */
4893    struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *data;
4894    /**
4895     * The number of elements pointed to by `data`.
4896     */
4897    uintptr_t datalen;
4898 } LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ;
4899
4900
4901
4902 /**
4903  * [`Score`] implementation that uses a fixed penalty.
4904  */
4905 typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer {
4906    /**
4907     * A pointer to the opaque Rust object.
4908     * Nearly everywhere, inner must be non-null, however in places where
4909     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4910     */
4911    LDKnativeFixedPenaltyScorer *inner;
4912    /**
4913     * Indicates that this is the only struct which contains the same pointer.
4914     * Rust functions which take ownership of an object provided via an argument require
4915     * this to be true and invalidate the object pointed to by inner.
4916     */
4917    bool is_owned;
4918 } LDKFixedPenaltyScorer;
4919
4920 /**
4921  * The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4922  */
4923 typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr {
4924    /**
4925     * A pointer to the contents in the success state.
4926     * Reading from this pointer when `result_ok` is not set is undefined.
4927     */
4928    struct LDKFixedPenaltyScorer *result;
4929    /**
4930     * A pointer to the contents in the error state.
4931     * Reading from this pointer when `result_ok` is set is undefined.
4932     */
4933    struct LDKDecodeError *err;
4934 } LDKCResult_FixedPenaltyScorerDecodeErrorZPtr;
4935
4936 /**
4937  * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4938  * containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4939  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4940  */
4941 typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ {
4942    /**
4943     * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4944     * `err` or `result` depending on the state of `result_ok`.
4945     */
4946    union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents;
4947    /**
4948     * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4949     */
4950    bool result_ok;
4951 } LDKCResult_FixedPenaltyScorerDecodeErrorZ;
4952
4953 /**
4954  * A tuple of 2 elements. See the individual fields for the types contained.
4955  */
4956 typedef struct LDKC2Tuple_u64u64Z {
4957    /**
4958     * The element at position 0
4959     */
4960    uint64_t a;
4961    /**
4962     * The element at position 1
4963     */
4964    uint64_t b;
4965 } LDKC2Tuple_u64u64Z;
4966
4967 /**
4968  * An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4969  */
4970 typedef enum LDKCOption_C2Tuple_u64u64ZZ_Tag {
4971    /**
4972     * When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4973     */
4974    LDKCOption_C2Tuple_u64u64ZZ_Some,
4975    /**
4976     * When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4977     */
4978    LDKCOption_C2Tuple_u64u64ZZ_None,
4979    /**
4980     * Must be last for serialization purposes
4981     */
4982    LDKCOption_C2Tuple_u64u64ZZ_Sentinel,
4983 } LDKCOption_C2Tuple_u64u64ZZ_Tag;
4984
4985 typedef struct LDKCOption_C2Tuple_u64u64ZZ {
4986    LDKCOption_C2Tuple_u64u64ZZ_Tag tag;
4987    union {
4988       struct {
4989          struct LDKC2Tuple_u64u64Z some;
4990       };
4991    };
4992 } LDKCOption_C2Tuple_u64u64ZZ;
4993
4994 /**
4995  * A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4996  * This corresponds to std::vector in C++
4997  */
4998 typedef struct LDKCVec_NodeIdZ {
4999    /**
5000     * The elements in the array.
5001     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5002     */
5003    struct LDKNodeId *data;
5004    /**
5005     * The number of elements pointed to by `data`.
5006     */
5007    uintptr_t datalen;
5008 } LDKCVec_NodeIdZ;
5009
5010
5011
5012 /**
5013  * A Record, unit of logging output with Metadata to enable filtering
5014  * Module_path, file, line to inform on log's source
5015  */
5016 typedef struct MUST_USE_STRUCT LDKRecord {
5017    /**
5018     * A pointer to the opaque Rust object.
5019     * Nearly everywhere, inner must be non-null, however in places where
5020     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5021     */
5022    LDKnativeRecord *inner;
5023    /**
5024     * Indicates that this is the only struct which contains the same pointer.
5025     * Rust functions which take ownership of an object provided via an argument require
5026     * this to be true and invalidate the object pointed to by inner.
5027     */
5028    bool is_owned;
5029 } LDKRecord;
5030
5031 /**
5032  * A trait encapsulating the operations required of a logger
5033  */
5034 typedef struct LDKLogger {
5035    /**
5036     * An opaque pointer which is passed to your function implementations as an argument.
5037     * This has no meaning in the LDK, and can be NULL or any other value.
5038     */
5039    void *this_arg;
5040    /**
5041     * Logs the `Record`
5042     */
5043    void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record);
5044    /**
5045     * Frees any resources associated with this object given its this_arg pointer.
5046     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5047     */
5048    void (*free)(void *this_arg);
5049 } LDKLogger;
5050
5051
5052
5053 /**
5054  * Represents the network as nodes and channels between them
5055  */
5056 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
5057    /**
5058     * A pointer to the opaque Rust object.
5059     * Nearly everywhere, inner must be non-null, however in places where
5060     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5061     */
5062    LDKnativeNetworkGraph *inner;
5063    /**
5064     * Indicates that this is the only struct which contains the same pointer.
5065     * Rust functions which take ownership of an object provided via an argument require
5066     * this to be true and invalidate the object pointed to by inner.
5067     */
5068    bool is_owned;
5069 } LDKNetworkGraph;
5070
5071
5072
5073 /**
5074  * [`Score`] implementation using channel success probability distributions.
5075  *
5076  * Channels are tracked with upper and lower liquidity bounds - when an HTLC fails at a channel,
5077  * we learn that the upper-bound on the available liquidity is lower than the amount of the HTLC.
5078  * When a payment is forwarded through a channel (but fails later in the route), we learn the
5079  * lower-bound on the channel's available liquidity must be at least the value of the HTLC.
5080  *
5081  * These bounds are then used to determine a success probability using the formula from
5082  * *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
5083  * and Stefan Richter [[1]] (i.e. `(upper_bound - payment_amount) / (upper_bound - lower_bound)`).
5084  *
5085  * This probability is combined with the [`liquidity_penalty_multiplier_msat`] and
5086  * [`liquidity_penalty_amount_multiplier_msat`] parameters to calculate a concrete penalty in
5087  * milli-satoshis. The penalties, when added across all hops, have the property of being linear in
5088  * terms of the entire path's success probability. This allows the router to directly compare
5089  * penalties for different paths. See the documentation of those parameters for the exact formulas.
5090  *
5091  * The liquidity bounds are decayed by halving them every [`liquidity_offset_half_life`].
5092  *
5093  * Further, we track the history of our upper and lower liquidity bounds for each channel,
5094  * allowing us to assign a second penalty (using [`historical_liquidity_penalty_multiplier_msat`]
5095  * and [`historical_liquidity_penalty_amount_multiplier_msat`]) based on the same probability
5096  * formula, but using the history of a channel rather than our latest estimates for the liquidity
5097  * bounds.
5098  *
5099  * # Note
5100  *
5101  * Mixing the `no-std` feature between serialization and deserialization results in undefined
5102  * behavior.
5103  *
5104  * [1]: https://arxiv.org/abs/2107.05322
5105  * [`liquidity_penalty_multiplier_msat`]: ProbabilisticScoringParameters::liquidity_penalty_multiplier_msat
5106  * [`liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringParameters::liquidity_penalty_amount_multiplier_msat
5107  * [`liquidity_offset_half_life`]: ProbabilisticScoringParameters::liquidity_offset_half_life
5108  * [`historical_liquidity_penalty_multiplier_msat`]: ProbabilisticScoringParameters::historical_liquidity_penalty_multiplier_msat
5109  * [`historical_liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringParameters::historical_liquidity_penalty_amount_multiplier_msat
5110  */
5111 typedef struct MUST_USE_STRUCT LDKProbabilisticScorer {
5112    /**
5113     * A pointer to the opaque Rust object.
5114     * Nearly everywhere, inner must be non-null, however in places where
5115     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5116     */
5117    LDKnativeProbabilisticScorer *inner;
5118    /**
5119     * Indicates that this is the only struct which contains the same pointer.
5120     * Rust functions which take ownership of an object provided via an argument require
5121     * this to be true and invalidate the object pointed to by inner.
5122     */
5123    bool is_owned;
5124 } LDKProbabilisticScorer;
5125
5126 /**
5127  * The contents of CResult_ProbabilisticScorerDecodeErrorZ
5128  */
5129 typedef union LDKCResult_ProbabilisticScorerDecodeErrorZPtr {
5130    /**
5131     * A pointer to the contents in the success state.
5132     * Reading from this pointer when `result_ok` is not set is undefined.
5133     */
5134    struct LDKProbabilisticScorer *result;
5135    /**
5136     * A pointer to the contents in the error state.
5137     * Reading from this pointer when `result_ok` is set is undefined.
5138     */
5139    struct LDKDecodeError *err;
5140 } LDKCResult_ProbabilisticScorerDecodeErrorZPtr;
5141
5142 /**
5143  * A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
5144  * containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
5145  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5146  */
5147 typedef struct LDKCResult_ProbabilisticScorerDecodeErrorZ {
5148    /**
5149     * The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
5150     * `err` or `result` depending on the state of `result_ok`.
5151     */
5152    union LDKCResult_ProbabilisticScorerDecodeErrorZPtr contents;
5153    /**
5154     * Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
5155     */
5156    bool result_ok;
5157 } LDKCResult_ProbabilisticScorerDecodeErrorZ;
5158
5159
5160
5161 /**
5162  * Features used within an `init` message.
5163  */
5164 typedef struct MUST_USE_STRUCT LDKInitFeatures {
5165    /**
5166     * A pointer to the opaque Rust object.
5167     * Nearly everywhere, inner must be non-null, however in places where
5168     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5169     */
5170    LDKnativeInitFeatures *inner;
5171    /**
5172     * Indicates that this is the only struct which contains the same pointer.
5173     * Rust functions which take ownership of an object provided via an argument require
5174     * this to be true and invalidate the object pointed to by inner.
5175     */
5176    bool is_owned;
5177 } LDKInitFeatures;
5178
5179 /**
5180  * The contents of CResult_InitFeaturesDecodeErrorZ
5181  */
5182 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
5183    /**
5184     * A pointer to the contents in the success state.
5185     * Reading from this pointer when `result_ok` is not set is undefined.
5186     */
5187    struct LDKInitFeatures *result;
5188    /**
5189     * A pointer to the contents in the error state.
5190     * Reading from this pointer when `result_ok` is set is undefined.
5191     */
5192    struct LDKDecodeError *err;
5193 } LDKCResult_InitFeaturesDecodeErrorZPtr;
5194
5195 /**
5196  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
5197  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5198  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5199  */
5200 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
5201    /**
5202     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
5203     * `err` or `result` depending on the state of `result_ok`.
5204     */
5205    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
5206    /**
5207     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
5208     */
5209    bool result_ok;
5210 } LDKCResult_InitFeaturesDecodeErrorZ;
5211
5212
5213
5214 /**
5215  * Features used within a `channel_announcement` message.
5216  */
5217 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
5218    /**
5219     * A pointer to the opaque Rust object.
5220     * Nearly everywhere, inner must be non-null, however in places where
5221     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5222     */
5223    LDKnativeChannelFeatures *inner;
5224    /**
5225     * Indicates that this is the only struct which contains the same pointer.
5226     * Rust functions which take ownership of an object provided via an argument require
5227     * this to be true and invalidate the object pointed to by inner.
5228     */
5229    bool is_owned;
5230 } LDKChannelFeatures;
5231
5232 /**
5233  * The contents of CResult_ChannelFeaturesDecodeErrorZ
5234  */
5235 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
5236    /**
5237     * A pointer to the contents in the success state.
5238     * Reading from this pointer when `result_ok` is not set is undefined.
5239     */
5240    struct LDKChannelFeatures *result;
5241    /**
5242     * A pointer to the contents in the error state.
5243     * Reading from this pointer when `result_ok` is set is undefined.
5244     */
5245    struct LDKDecodeError *err;
5246 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
5247
5248 /**
5249  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
5250  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5251  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5252  */
5253 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
5254    /**
5255     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
5256     * `err` or `result` depending on the state of `result_ok`.
5257     */
5258    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
5259    /**
5260     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
5261     */
5262    bool result_ok;
5263 } LDKCResult_ChannelFeaturesDecodeErrorZ;
5264
5265
5266
5267 /**
5268  * Features used within a `node_announcement` message.
5269  */
5270 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
5271    /**
5272     * A pointer to the opaque Rust object.
5273     * Nearly everywhere, inner must be non-null, however in places where
5274     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5275     */
5276    LDKnativeNodeFeatures *inner;
5277    /**
5278     * Indicates that this is the only struct which contains the same pointer.
5279     * Rust functions which take ownership of an object provided via an argument require
5280     * this to be true and invalidate the object pointed to by inner.
5281     */
5282    bool is_owned;
5283 } LDKNodeFeatures;
5284
5285 /**
5286  * The contents of CResult_NodeFeaturesDecodeErrorZ
5287  */
5288 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
5289    /**
5290     * A pointer to the contents in the success state.
5291     * Reading from this pointer when `result_ok` is not set is undefined.
5292     */
5293    struct LDKNodeFeatures *result;
5294    /**
5295     * A pointer to the contents in the error state.
5296     * Reading from this pointer when `result_ok` is set is undefined.
5297     */
5298    struct LDKDecodeError *err;
5299 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
5300
5301 /**
5302  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5303  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5304  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5305  */
5306 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
5307    /**
5308     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
5309     * `err` or `result` depending on the state of `result_ok`.
5310     */
5311    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
5312    /**
5313     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
5314     */
5315    bool result_ok;
5316 } LDKCResult_NodeFeaturesDecodeErrorZ;
5317
5318
5319
5320 /**
5321  * Features used within an invoice.
5322  */
5323 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
5324    /**
5325     * A pointer to the opaque Rust object.
5326     * Nearly everywhere, inner must be non-null, however in places where
5327     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5328     */
5329    LDKnativeInvoiceFeatures *inner;
5330    /**
5331     * Indicates that this is the only struct which contains the same pointer.
5332     * Rust functions which take ownership of an object provided via an argument require
5333     * this to be true and invalidate the object pointed to by inner.
5334     */
5335    bool is_owned;
5336 } LDKInvoiceFeatures;
5337
5338 /**
5339  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
5340  */
5341 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
5342    /**
5343     * A pointer to the contents in the success state.
5344     * Reading from this pointer when `result_ok` is not set is undefined.
5345     */
5346    struct LDKInvoiceFeatures *result;
5347    /**
5348     * A pointer to the contents in the error state.
5349     * Reading from this pointer when `result_ok` is set is undefined.
5350     */
5351    struct LDKDecodeError *err;
5352 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
5353
5354 /**
5355  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5356  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5357  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5358  */
5359 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
5360    /**
5361     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
5362     * `err` or `result` depending on the state of `result_ok`.
5363     */
5364    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
5365    /**
5366     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
5367     */
5368    bool result_ok;
5369 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
5370
5371 /**
5372  * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
5373  */
5374 typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr {
5375    /**
5376     * A pointer to the contents in the success state.
5377     * Reading from this pointer when `result_ok` is not set is undefined.
5378     */
5379    struct LDKChannelTypeFeatures *result;
5380    /**
5381     * A pointer to the contents in the error state.
5382     * Reading from this pointer when `result_ok` is set is undefined.
5383     */
5384    struct LDKDecodeError *err;
5385 } LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr;
5386
5387 /**
5388  * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
5389  * containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5390  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5391  */
5392 typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ {
5393    /**
5394     * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
5395     * `err` or `result` depending on the state of `result_ok`.
5396     */
5397    union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents;
5398    /**
5399     * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
5400     */
5401    bool result_ok;
5402 } LDKCResult_ChannelTypeFeaturesDecodeErrorZ;
5403
5404 /**
5405  * The contents of CResult_NodeIdDecodeErrorZ
5406  */
5407 typedef union LDKCResult_NodeIdDecodeErrorZPtr {
5408    /**
5409     * A pointer to the contents in the success state.
5410     * Reading from this pointer when `result_ok` is not set is undefined.
5411     */
5412    struct LDKNodeId *result;
5413    /**
5414     * A pointer to the contents in the error state.
5415     * Reading from this pointer when `result_ok` is set is undefined.
5416     */
5417    struct LDKDecodeError *err;
5418 } LDKCResult_NodeIdDecodeErrorZPtr;
5419
5420 /**
5421  * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
5422  * containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
5423  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5424  */
5425 typedef struct LDKCResult_NodeIdDecodeErrorZ {
5426    /**
5427     * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
5428     * `err` or `result` depending on the state of `result_ok`.
5429     */
5430    union LDKCResult_NodeIdDecodeErrorZPtr contents;
5431    /**
5432     * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
5433     */
5434    bool result_ok;
5435 } LDKCResult_NodeIdDecodeErrorZ;
5436
5437 /**
5438  * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
5439  */
5440 typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr {
5441    /**
5442     * A pointer to the contents in the success state.
5443     * Reading from this pointer when `result_ok` is not set is undefined.
5444     */
5445    struct LDKCOption_NetworkUpdateZ *result;
5446    /**
5447     * A pointer to the contents in the error state.
5448     * Reading from this pointer when `result_ok` is set is undefined.
5449     */
5450    struct LDKDecodeError *err;
5451 } LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr;
5452
5453 /**
5454  * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
5455  * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5456  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5457  */
5458 typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ {
5459    /**
5460     * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
5461     * `err` or `result` depending on the state of `result_ok`.
5462     */
5463    union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents;
5464    /**
5465     * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
5466     */
5467    bool result_ok;
5468 } LDKCResult_COption_NetworkUpdateZDecodeErrorZ;
5469
5470 /**
5471  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
5472  * UTXOs.
5473  */
5474 typedef struct LDKAccess {
5475    /**
5476     * An opaque pointer which is passed to your function implementations as an argument.
5477     * This has no meaning in the LDK, and can be NULL or any other value.
5478     */
5479    void *this_arg;
5480    /**
5481     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
5482     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
5483     * is unknown.
5484     *
5485     * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id
5486     */
5487    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
5488    /**
5489     * Frees any resources associated with this object given its this_arg pointer.
5490     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5491     */
5492    void (*free)(void *this_arg);
5493 } LDKAccess;
5494
5495 /**
5496  * An enum which can either contain a crate::lightning::chain::Access or not
5497  */
5498 typedef enum LDKCOption_AccessZ_Tag {
5499    /**
5500     * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
5501     */
5502    LDKCOption_AccessZ_Some,
5503    /**
5504     * When we're in this state, this COption_AccessZ contains nothing
5505     */
5506    LDKCOption_AccessZ_None,
5507    /**
5508     * Must be last for serialization purposes
5509     */
5510    LDKCOption_AccessZ_Sentinel,
5511 } LDKCOption_AccessZ_Tag;
5512
5513 typedef struct LDKCOption_AccessZ {
5514    LDKCOption_AccessZ_Tag tag;
5515    union {
5516       struct {
5517          struct LDKAccess some;
5518       };
5519    };
5520 } LDKCOption_AccessZ;
5521
5522 /**
5523  * The contents of CResult_boolLightningErrorZ
5524  */
5525 typedef union LDKCResult_boolLightningErrorZPtr {
5526    /**
5527     * A pointer to the contents in the success state.
5528     * Reading from this pointer when `result_ok` is not set is undefined.
5529     */
5530    bool *result;
5531    /**
5532     * A pointer to the contents in the error state.
5533     * Reading from this pointer when `result_ok` is set is undefined.
5534     */
5535    struct LDKLightningError *err;
5536 } LDKCResult_boolLightningErrorZPtr;
5537
5538 /**
5539  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
5540  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
5541  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5542  */
5543 typedef struct LDKCResult_boolLightningErrorZ {
5544    /**
5545     * The contents of this CResult_boolLightningErrorZ, accessible via either
5546     * `err` or `result` depending on the state of `result_ok`.
5547     */
5548    union LDKCResult_boolLightningErrorZPtr contents;
5549    /**
5550     * Whether this CResult_boolLightningErrorZ represents a success state.
5551     */
5552    bool result_ok;
5553 } LDKCResult_boolLightningErrorZ;
5554
5555 /**
5556  * A tuple of 3 elements. See the individual fields for the types contained.
5557  */
5558 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5559    /**
5560     * The element at position 0
5561     */
5562    struct LDKChannelAnnouncement a;
5563    /**
5564     * The element at position 1
5565     */
5566    struct LDKChannelUpdate b;
5567    /**
5568     * The element at position 2
5569     */
5570    struct LDKChannelUpdate c;
5571 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
5572
5573 /**
5574  * An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
5575  */
5576 typedef enum LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag {
5577    /**
5578     * When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
5579     */
5580    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some,
5581    /**
5582     * When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
5583     */
5584    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None,
5585    /**
5586     * Must be last for serialization purposes
5587     */
5588    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Sentinel,
5589 } LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag;
5590
5591 typedef struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5592    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag tag;
5593    union {
5594       struct {
5595          struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ some;
5596       };
5597    };
5598 } LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
5599
5600 /**
5601  * The contents of CResult_NoneLightningErrorZ
5602  */
5603 typedef union LDKCResult_NoneLightningErrorZPtr {
5604    /**
5605     * Note that this value is always NULL, as there are no contents in the OK variant
5606     */
5607    void *result;
5608    /**
5609     * A pointer to the contents in the error state.
5610     * Reading from this pointer when `result_ok` is set is undefined.
5611     */
5612    struct LDKLightningError *err;
5613 } LDKCResult_NoneLightningErrorZPtr;
5614
5615 /**
5616  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5617  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5618  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5619  */
5620 typedef struct LDKCResult_NoneLightningErrorZ {
5621    /**
5622     * The contents of this CResult_NoneLightningErrorZ, accessible via either
5623     * `err` or `result` depending on the state of `result_ok`.
5624     */
5625    union LDKCResult_NoneLightningErrorZPtr contents;
5626    /**
5627     * Whether this CResult_NoneLightningErrorZ represents a success state.
5628     */
5629    bool result_ok;
5630 } LDKCResult_NoneLightningErrorZ;
5631
5632
5633
5634 /**
5635  * Details about one direction of a channel as received within a [`ChannelUpdate`].
5636  */
5637 typedef struct MUST_USE_STRUCT LDKChannelUpdateInfo {
5638    /**
5639     * A pointer to the opaque Rust object.
5640     * Nearly everywhere, inner must be non-null, however in places where
5641     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5642     */
5643    LDKnativeChannelUpdateInfo *inner;
5644    /**
5645     * Indicates that this is the only struct which contains the same pointer.
5646     * Rust functions which take ownership of an object provided via an argument require
5647     * this to be true and invalidate the object pointed to by inner.
5648     */
5649    bool is_owned;
5650 } LDKChannelUpdateInfo;
5651
5652 /**
5653  * The contents of CResult_ChannelUpdateInfoDecodeErrorZ
5654  */
5655 typedef union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr {
5656    /**
5657     * A pointer to the contents in the success state.
5658     * Reading from this pointer when `result_ok` is not set is undefined.
5659     */
5660    struct LDKChannelUpdateInfo *result;
5661    /**
5662     * A pointer to the contents in the error state.
5663     * Reading from this pointer when `result_ok` is set is undefined.
5664     */
5665    struct LDKDecodeError *err;
5666 } LDKCResult_ChannelUpdateInfoDecodeErrorZPtr;
5667
5668 /**
5669  * A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
5670  * containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5671  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5672  */
5673 typedef struct LDKCResult_ChannelUpdateInfoDecodeErrorZ {
5674    /**
5675     * The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
5676     * `err` or `result` depending on the state of `result_ok`.
5677     */
5678    union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr contents;
5679    /**
5680     * Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
5681     */
5682    bool result_ok;
5683 } LDKCResult_ChannelUpdateInfoDecodeErrorZ;
5684
5685
5686
5687 /**
5688  * Details about a channel (both directions).
5689  * Received within a channel announcement.
5690  */
5691 typedef struct MUST_USE_STRUCT LDKChannelInfo {
5692    /**
5693     * A pointer to the opaque Rust object.
5694     * Nearly everywhere, inner must be non-null, however in places where
5695     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5696     */
5697    LDKnativeChannelInfo *inner;
5698    /**
5699     * Indicates that this is the only struct which contains the same pointer.
5700     * Rust functions which take ownership of an object provided via an argument require
5701     * this to be true and invalidate the object pointed to by inner.
5702     */
5703    bool is_owned;
5704 } LDKChannelInfo;
5705
5706 /**
5707  * The contents of CResult_ChannelInfoDecodeErrorZ
5708  */
5709 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
5710    /**
5711     * A pointer to the contents in the success state.
5712     * Reading from this pointer when `result_ok` is not set is undefined.
5713     */
5714    struct LDKChannelInfo *result;
5715    /**
5716     * A pointer to the contents in the error state.
5717     * Reading from this pointer when `result_ok` is set is undefined.
5718     */
5719    struct LDKDecodeError *err;
5720 } LDKCResult_ChannelInfoDecodeErrorZPtr;
5721
5722 /**
5723  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5724  * containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5725  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5726  */
5727 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
5728    /**
5729     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5730     * `err` or `result` depending on the state of `result_ok`.
5731     */
5732    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
5733    /**
5734     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5735     */
5736    bool result_ok;
5737 } LDKCResult_ChannelInfoDecodeErrorZ;
5738
5739
5740
5741 /**
5742  * Fees for routing via a given channel or a node
5743  */
5744 typedef struct MUST_USE_STRUCT LDKRoutingFees {
5745    /**
5746     * A pointer to the opaque Rust object.
5747     * Nearly everywhere, inner must be non-null, however in places where
5748     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5749     */
5750    LDKnativeRoutingFees *inner;
5751    /**
5752     * Indicates that this is the only struct which contains the same pointer.
5753     * Rust functions which take ownership of an object provided via an argument require
5754     * this to be true and invalidate the object pointed to by inner.
5755     */
5756    bool is_owned;
5757 } LDKRoutingFees;
5758
5759 /**
5760  * The contents of CResult_RoutingFeesDecodeErrorZ
5761  */
5762 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
5763    /**
5764     * A pointer to the contents in the success state.
5765     * Reading from this pointer when `result_ok` is not set is undefined.
5766     */
5767    struct LDKRoutingFees *result;
5768    /**
5769     * A pointer to the contents in the error state.
5770     * Reading from this pointer when `result_ok` is set is undefined.
5771     */
5772    struct LDKDecodeError *err;
5773 } LDKCResult_RoutingFeesDecodeErrorZPtr;
5774
5775 /**
5776  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
5777  * containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
5778  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5779  */
5780 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
5781    /**
5782     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
5783     * `err` or `result` depending on the state of `result_ok`.
5784     */
5785    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
5786    /**
5787     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
5788     */
5789    bool result_ok;
5790 } LDKCResult_RoutingFeesDecodeErrorZ;
5791
5792 /**
5793  * A 4-byte byte array.
5794  */
5795 typedef struct LDKFourBytes {
5796    /**
5797     * The four bytes
5798     */
5799    uint8_t data[4];
5800 } LDKFourBytes;
5801
5802 /**
5803  * A 16-byte byte array.
5804  */
5805 typedef struct LDKSixteenBytes {
5806    /**
5807     * The sixteen bytes
5808     */
5809    uint8_t data[16];
5810 } LDKSixteenBytes;
5811
5812 /**
5813  * A 12-byte byte array.
5814  */
5815 typedef struct LDKTwelveBytes {
5816    /**
5817     * The twelve bytes
5818     */
5819    uint8_t data[12];
5820 } LDKTwelveBytes;
5821
5822
5823
5824 /**
5825  * Represents a hostname for serialization purposes.
5826  * Only the character set and length will be validated.
5827  * The character set consists of ASCII alphanumeric characters, hyphens, and periods.
5828  * Its length is guaranteed to be representable by a single byte.
5829  * This serialization is used by BOLT 7 hostnames.
5830  */
5831 typedef struct MUST_USE_STRUCT LDKHostname {
5832    /**
5833     * A pointer to the opaque Rust object.
5834     * Nearly everywhere, inner must be non-null, however in places where
5835     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5836     */
5837    LDKnativeHostname *inner;
5838    /**
5839     * Indicates that this is the only struct which contains the same pointer.
5840     * Rust functions which take ownership of an object provided via an argument require
5841     * this to be true and invalidate the object pointed to by inner.
5842     */
5843    bool is_owned;
5844 } LDKHostname;
5845
5846 /**
5847  * An address which can be used to connect to a remote peer
5848  */
5849 typedef enum LDKNetAddress_Tag {
5850    /**
5851     * An IPv4 address/port on which the peer is listening.
5852     */
5853    LDKNetAddress_IPv4,
5854    /**
5855     * An IPv6 address/port on which the peer is listening.
5856     */
5857    LDKNetAddress_IPv6,
5858    /**
5859     * An old-style Tor onion address/port on which the peer is listening.
5860     *
5861     * This field is deprecated and the Tor network generally no longer supports V2 Onion
5862     * addresses. Thus, the details are not parsed here.
5863     */
5864    LDKNetAddress_OnionV2,
5865    /**
5866     * A new-style Tor onion address/port on which the peer is listening.
5867     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
5868     * wrap as base32 and append \".onion\".
5869     */
5870    LDKNetAddress_OnionV3,
5871    /**
5872     * A hostname/port on which the peer is listening.
5873     */
5874    LDKNetAddress_Hostname,
5875    /**
5876     * Must be last for serialization purposes
5877     */
5878    LDKNetAddress_Sentinel,
5879 } LDKNetAddress_Tag;
5880
5881 typedef struct LDKNetAddress_LDKIPv4_Body {
5882    /**
5883     * The 4-byte IPv4 address
5884     */
5885    struct LDKFourBytes addr;
5886    /**
5887     * The port on which the node is listening
5888     */
5889    uint16_t port;
5890 } LDKNetAddress_LDKIPv4_Body;
5891
5892 typedef struct LDKNetAddress_LDKIPv6_Body {
5893    /**
5894     * The 16-byte IPv6 address
5895     */
5896    struct LDKSixteenBytes addr;
5897    /**
5898     * The port on which the node is listening
5899     */
5900    uint16_t port;
5901 } LDKNetAddress_LDKIPv6_Body;
5902
5903 typedef struct LDKNetAddress_LDKOnionV3_Body {
5904    /**
5905     * The ed25519 long-term public key of the peer
5906     */
5907    struct LDKThirtyTwoBytes ed25519_pubkey;
5908    /**
5909     * The checksum of the pubkey and version, as included in the onion address
5910     */
5911    uint16_t checksum;
5912    /**
5913     * The version byte, as defined by the Tor Onion v3 spec.
5914     */
5915    uint8_t version;
5916    /**
5917     * The port on which the node is listening
5918     */
5919    uint16_t port;
5920 } LDKNetAddress_LDKOnionV3_Body;
5921
5922 typedef struct LDKNetAddress_LDKHostname_Body {
5923    /**
5924     * The hostname on which the node is listening.
5925     */
5926    struct LDKHostname hostname;
5927    /**
5928     * The port on which the node is listening.
5929     */
5930    uint16_t port;
5931 } LDKNetAddress_LDKHostname_Body;
5932
5933 typedef struct MUST_USE_STRUCT LDKNetAddress {
5934    LDKNetAddress_Tag tag;
5935    union {
5936       LDKNetAddress_LDKIPv4_Body i_pv4;
5937       LDKNetAddress_LDKIPv6_Body i_pv6;
5938       struct {
5939          struct LDKTwelveBytes onion_v2;
5940       };
5941       LDKNetAddress_LDKOnionV3_Body onion_v3;
5942       LDKNetAddress_LDKHostname_Body hostname;
5943    };
5944 } LDKNetAddress;
5945
5946 /**
5947  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5948  * This corresponds to std::vector in C++
5949  */
5950 typedef struct LDKCVec_NetAddressZ {
5951    /**
5952     * The elements in the array.
5953     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5954     */
5955    struct LDKNetAddress *data;
5956    /**
5957     * The number of elements pointed to by `data`.
5958     */
5959    uintptr_t datalen;
5960 } LDKCVec_NetAddressZ;
5961
5962
5963
5964 /**
5965  * Information received in the latest node_announcement from this node.
5966  */
5967 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
5968    /**
5969     * A pointer to the opaque Rust object.
5970     * Nearly everywhere, inner must be non-null, however in places where
5971     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5972     */
5973    LDKnativeNodeAnnouncementInfo *inner;
5974    /**
5975     * Indicates that this is the only struct which contains the same pointer.
5976     * Rust functions which take ownership of an object provided via an argument require
5977     * this to be true and invalidate the object pointed to by inner.
5978     */
5979    bool is_owned;
5980 } LDKNodeAnnouncementInfo;
5981
5982 /**
5983  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5984  */
5985 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
5986    /**
5987     * A pointer to the contents in the success state.
5988     * Reading from this pointer when `result_ok` is not set is undefined.
5989     */
5990    struct LDKNodeAnnouncementInfo *result;
5991    /**
5992     * A pointer to the contents in the error state.
5993     * Reading from this pointer when `result_ok` is set is undefined.
5994     */
5995    struct LDKDecodeError *err;
5996 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
5997
5998 /**
5999  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
6000  * containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6001  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6002  */
6003 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
6004    /**
6005     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
6006     * `err` or `result` depending on the state of `result_ok`.
6007     */
6008    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
6009    /**
6010     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
6011     */
6012    bool result_ok;
6013 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
6014
6015
6016
6017 /**
6018  * A user-defined name for a node, which may be used when displaying the node in a graph.
6019  *
6020  * Since node aliases are provided by third parties, they are a potential avenue for injection
6021  * attacks. Care must be taken when processing.
6022  */
6023 typedef struct MUST_USE_STRUCT LDKNodeAlias {
6024    /**
6025     * A pointer to the opaque Rust object.
6026     * Nearly everywhere, inner must be non-null, however in places where
6027     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6028     */
6029    LDKnativeNodeAlias *inner;
6030    /**
6031     * Indicates that this is the only struct which contains the same pointer.
6032     * Rust functions which take ownership of an object provided via an argument require
6033     * this to be true and invalidate the object pointed to by inner.
6034     */
6035    bool is_owned;
6036 } LDKNodeAlias;
6037
6038 /**
6039  * The contents of CResult_NodeAliasDecodeErrorZ
6040  */
6041 typedef union LDKCResult_NodeAliasDecodeErrorZPtr {
6042    /**
6043     * A pointer to the contents in the success state.
6044     * Reading from this pointer when `result_ok` is not set is undefined.
6045     */
6046    struct LDKNodeAlias *result;
6047    /**
6048     * A pointer to the contents in the error state.
6049     * Reading from this pointer when `result_ok` is set is undefined.
6050     */
6051    struct LDKDecodeError *err;
6052 } LDKCResult_NodeAliasDecodeErrorZPtr;
6053
6054 /**
6055  * A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
6056  * containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
6057  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6058  */
6059 typedef struct LDKCResult_NodeAliasDecodeErrorZ {
6060    /**
6061     * The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
6062     * `err` or `result` depending on the state of `result_ok`.
6063     */
6064    union LDKCResult_NodeAliasDecodeErrorZPtr contents;
6065    /**
6066     * Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
6067     */
6068    bool result_ok;
6069 } LDKCResult_NodeAliasDecodeErrorZ;
6070
6071
6072
6073 /**
6074  * Details about a node in the network, known from the network announcement.
6075  */
6076 typedef struct MUST_USE_STRUCT LDKNodeInfo {
6077    /**
6078     * A pointer to the opaque Rust object.
6079     * Nearly everywhere, inner must be non-null, however in places where
6080     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6081     */
6082    LDKnativeNodeInfo *inner;
6083    /**
6084     * Indicates that this is the only struct which contains the same pointer.
6085     * Rust functions which take ownership of an object provided via an argument require
6086     * this to be true and invalidate the object pointed to by inner.
6087     */
6088    bool is_owned;
6089 } LDKNodeInfo;
6090
6091 /**
6092  * The contents of CResult_NodeInfoDecodeErrorZ
6093  */
6094 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
6095    /**
6096     * A pointer to the contents in the success state.
6097     * Reading from this pointer when `result_ok` is not set is undefined.
6098     */
6099    struct LDKNodeInfo *result;
6100    /**
6101     * A pointer to the contents in the error state.
6102     * Reading from this pointer when `result_ok` is set is undefined.
6103     */
6104    struct LDKDecodeError *err;
6105 } LDKCResult_NodeInfoDecodeErrorZPtr;
6106
6107 /**
6108  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
6109  * containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6110  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6111  */
6112 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
6113    /**
6114     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
6115     * `err` or `result` depending on the state of `result_ok`.
6116     */
6117    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
6118    /**
6119     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
6120     */
6121    bool result_ok;
6122 } LDKCResult_NodeInfoDecodeErrorZ;
6123
6124 /**
6125  * The contents of CResult_NetworkGraphDecodeErrorZ
6126  */
6127 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
6128    /**
6129     * A pointer to the contents in the success state.
6130     * Reading from this pointer when `result_ok` is not set is undefined.
6131     */
6132    struct LDKNetworkGraph *result;
6133    /**
6134     * A pointer to the contents in the error state.
6135     * Reading from this pointer when `result_ok` is set is undefined.
6136     */
6137    struct LDKDecodeError *err;
6138 } LDKCResult_NetworkGraphDecodeErrorZPtr;
6139
6140 /**
6141  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
6142  * containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
6143  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6144  */
6145 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
6146    /**
6147     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
6148     * `err` or `result` depending on the state of `result_ok`.
6149     */
6150    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
6151    /**
6152     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
6153     */
6154    bool result_ok;
6155 } LDKCResult_NetworkGraphDecodeErrorZ;
6156
6157 /**
6158  * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
6159  */
6160 typedef enum LDKCOption_CVec_NetAddressZZ_Tag {
6161    /**
6162     * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
6163     */
6164    LDKCOption_CVec_NetAddressZZ_Some,
6165    /**
6166     * When we're in this state, this COption_CVec_NetAddressZZ contains nothing
6167     */
6168    LDKCOption_CVec_NetAddressZZ_None,
6169    /**
6170     * Must be last for serialization purposes
6171     */
6172    LDKCOption_CVec_NetAddressZZ_Sentinel,
6173 } LDKCOption_CVec_NetAddressZZ_Tag;
6174
6175 typedef struct LDKCOption_CVec_NetAddressZZ {
6176    LDKCOption_CVec_NetAddressZZ_Tag tag;
6177    union {
6178       struct {
6179          struct LDKCVec_NetAddressZ some;
6180       };
6181    };
6182 } LDKCOption_CVec_NetAddressZZ;
6183
6184 /**
6185  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
6186  */
6187 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6188    /**
6189     * A pointer to the contents in the success state.
6190     * Reading from this pointer when `result_ok` is not set is undefined.
6191     */
6192    struct LDKDelayedPaymentOutputDescriptor *result;
6193    /**
6194     * A pointer to the contents in the error state.
6195     * Reading from this pointer when `result_ok` is set is undefined.
6196     */
6197    struct LDKDecodeError *err;
6198 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
6199
6200 /**
6201  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6202  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6203  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6204  */
6205 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6206    /**
6207     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
6208     * `err` or `result` depending on the state of `result_ok`.
6209     */
6210    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
6211    /**
6212     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
6213     */
6214    bool result_ok;
6215 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
6216
6217 /**
6218  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
6219  */
6220 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6221    /**
6222     * A pointer to the contents in the success state.
6223     * Reading from this pointer when `result_ok` is not set is undefined.
6224     */
6225    struct LDKStaticPaymentOutputDescriptor *result;
6226    /**
6227     * A pointer to the contents in the error state.
6228     * Reading from this pointer when `result_ok` is set is undefined.
6229     */
6230    struct LDKDecodeError *err;
6231 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
6232
6233 /**
6234  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6235  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6236  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6237  */
6238 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6239    /**
6240     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
6241     * `err` or `result` depending on the state of `result_ok`.
6242     */
6243    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
6244    /**
6245     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
6246     */
6247    bool result_ok;
6248 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
6249
6250 /**
6251  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
6252  */
6253 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
6254    /**
6255     * A pointer to the contents in the success state.
6256     * Reading from this pointer when `result_ok` is not set is undefined.
6257     */
6258    struct LDKSpendableOutputDescriptor *result;
6259    /**
6260     * A pointer to the contents in the error state.
6261     * Reading from this pointer when `result_ok` is set is undefined.
6262     */
6263    struct LDKDecodeError *err;
6264 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
6265
6266 /**
6267  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6268  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6269  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6270  */
6271 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
6272    /**
6273     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
6274     * `err` or `result` depending on the state of `result_ok`.
6275     */
6276    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
6277    /**
6278     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
6279     */
6280    bool result_ok;
6281 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
6282
6283 /**
6284  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
6285  * This corresponds to std::vector in C++
6286  */
6287 typedef struct LDKCVec_PaymentPreimageZ {
6288    /**
6289     * The elements in the array.
6290     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6291     */
6292    struct LDKThirtyTwoBytes *data;
6293    /**
6294     * The number of elements pointed to by `data`.
6295     */
6296    uintptr_t datalen;
6297 } LDKCVec_PaymentPreimageZ;
6298
6299 /**
6300  * A tuple of 2 elements. See the individual fields for the types contained.
6301  */
6302 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
6303    /**
6304     * The element at position 0
6305     */
6306    struct LDKSignature a;
6307    /**
6308     * The element at position 1
6309     */
6310    struct LDKCVec_SignatureZ b;
6311 } LDKC2Tuple_SignatureCVec_SignatureZZ;
6312
6313 /**
6314  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
6315  */
6316 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6317    /**
6318     * A pointer to the contents in the success state.
6319     * Reading from this pointer when `result_ok` is not set is undefined.
6320     */
6321    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
6322    /**
6323     * Note that this value is always NULL, as there are no contents in the Err variant
6324     */
6325    void *err;
6326 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
6327
6328 /**
6329  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
6330  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
6331  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6332  */
6333 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6334    /**
6335     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
6336     * `err` or `result` depending on the state of `result_ok`.
6337     */
6338    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
6339    /**
6340     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
6341     */
6342    bool result_ok;
6343 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
6344
6345 /**
6346  * The contents of CResult_SignatureNoneZ
6347  */
6348 typedef union LDKCResult_SignatureNoneZPtr {
6349    /**
6350     * A pointer to the contents in the success state.
6351     * Reading from this pointer when `result_ok` is not set is undefined.
6352     */
6353    struct LDKSignature *result;
6354    /**
6355     * Note that this value is always NULL, as there are no contents in the Err variant
6356     */
6357    void *err;
6358 } LDKCResult_SignatureNoneZPtr;
6359
6360 /**
6361  * A CResult_SignatureNoneZ represents the result of a fallible operation,
6362  * containing a crate::c_types::Signature on success and a () on failure.
6363  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6364  */
6365 typedef struct LDKCResult_SignatureNoneZ {
6366    /**
6367     * The contents of this CResult_SignatureNoneZ, accessible via either
6368     * `err` or `result` depending on the state of `result_ok`.
6369     */
6370    union LDKCResult_SignatureNoneZPtr contents;
6371    /**
6372     * Whether this CResult_SignatureNoneZ represents a success state.
6373     */
6374    bool result_ok;
6375 } LDKCResult_SignatureNoneZ;
6376
6377 /**
6378  * A tuple of 2 elements. See the individual fields for the types contained.
6379  */
6380 typedef struct LDKC2Tuple_SignatureSignatureZ {
6381    /**
6382     * The element at position 0
6383     */
6384    struct LDKSignature a;
6385    /**
6386     * The element at position 1
6387     */
6388    struct LDKSignature b;
6389 } LDKC2Tuple_SignatureSignatureZ;
6390
6391 /**
6392  * The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
6393  */
6394 typedef union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr {
6395    /**
6396     * A pointer to the contents in the success state.
6397     * Reading from this pointer when `result_ok` is not set is undefined.
6398     */
6399    struct LDKC2Tuple_SignatureSignatureZ *result;
6400    /**
6401     * Note that this value is always NULL, as there are no contents in the Err variant
6402     */
6403    void *err;
6404 } LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr;
6405
6406 /**
6407  * A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
6408  * containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
6409  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6410  */
6411 typedef struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ {
6412    /**
6413     * The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
6414     * `err` or `result` depending on the state of `result_ok`.
6415     */
6416    union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr contents;
6417    /**
6418     * Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
6419     */
6420    bool result_ok;
6421 } LDKCResult_C2Tuple_SignatureSignatureZNoneZ;
6422
6423 /**
6424  * The contents of CResult_SecretKeyNoneZ
6425  */
6426 typedef union LDKCResult_SecretKeyNoneZPtr {
6427    /**
6428     * A pointer to the contents in the success state.
6429     * Reading from this pointer when `result_ok` is not set is undefined.
6430     */
6431    struct LDKSecretKey *result;
6432    /**
6433     * Note that this value is always NULL, as there are no contents in the Err variant
6434     */
6435    void *err;
6436 } LDKCResult_SecretKeyNoneZPtr;
6437
6438 /**
6439  * A CResult_SecretKeyNoneZ represents the result of a fallible operation,
6440  * containing a crate::c_types::SecretKey on success and a () on failure.
6441  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6442  */
6443 typedef struct LDKCResult_SecretKeyNoneZ {
6444    /**
6445     * The contents of this CResult_SecretKeyNoneZ, accessible via either
6446     * `err` or `result` depending on the state of `result_ok`.
6447     */
6448    union LDKCResult_SecretKeyNoneZPtr contents;
6449    /**
6450     * Whether this CResult_SecretKeyNoneZ represents a success state.
6451     */
6452    bool result_ok;
6453 } LDKCResult_SecretKeyNoneZ;
6454
6455 /**
6456  * The contents of CResult_PublicKeyNoneZ
6457  */
6458 typedef union LDKCResult_PublicKeyNoneZPtr {
6459    /**
6460     * A pointer to the contents in the success state.
6461     * Reading from this pointer when `result_ok` is not set is undefined.
6462     */
6463    struct LDKPublicKey *result;
6464    /**
6465     * Note that this value is always NULL, as there are no contents in the Err variant
6466     */
6467    void *err;
6468 } LDKCResult_PublicKeyNoneZPtr;
6469
6470 /**
6471  * A CResult_PublicKeyNoneZ represents the result of a fallible operation,
6472  * containing a crate::c_types::PublicKey on success and a () on failure.
6473  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6474  */
6475 typedef struct LDKCResult_PublicKeyNoneZ {
6476    /**
6477     * The contents of this CResult_PublicKeyNoneZ, accessible via either
6478     * `err` or `result` depending on the state of `result_ok`.
6479     */
6480    union LDKCResult_PublicKeyNoneZPtr contents;
6481    /**
6482     * Whether this CResult_PublicKeyNoneZ represents a success state.
6483     */
6484    bool result_ok;
6485 } LDKCResult_PublicKeyNoneZ;
6486
6487 /**
6488  * An enum which can either contain a crate::c_types::BigEndianScalar or not
6489  */
6490 typedef enum LDKCOption_ScalarZ_Tag {
6491    /**
6492     * When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar
6493     */
6494    LDKCOption_ScalarZ_Some,
6495    /**
6496     * When we're in this state, this COption_ScalarZ contains nothing
6497     */
6498    LDKCOption_ScalarZ_None,
6499    /**
6500     * Must be last for serialization purposes
6501     */
6502    LDKCOption_ScalarZ_Sentinel,
6503 } LDKCOption_ScalarZ_Tag;
6504
6505 typedef struct LDKCOption_ScalarZ {
6506    LDKCOption_ScalarZ_Tag tag;
6507    union {
6508       struct {
6509          struct LDKBigEndianScalar some;
6510       };
6511    };
6512 } LDKCOption_ScalarZ;
6513
6514 /**
6515  * The contents of CResult_SharedSecretNoneZ
6516  */
6517 typedef union LDKCResult_SharedSecretNoneZPtr {
6518    /**
6519     * A pointer to the contents in the success state.
6520     * Reading from this pointer when `result_ok` is not set is undefined.
6521     */
6522    struct LDKThirtyTwoBytes *result;
6523    /**
6524     * Note that this value is always NULL, as there are no contents in the Err variant
6525     */
6526    void *err;
6527 } LDKCResult_SharedSecretNoneZPtr;
6528
6529 /**
6530  * A CResult_SharedSecretNoneZ represents the result of a fallible operation,
6531  * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6532  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6533  */
6534 typedef struct LDKCResult_SharedSecretNoneZ {
6535    /**
6536     * The contents of this CResult_SharedSecretNoneZ, accessible via either
6537     * `err` or `result` depending on the state of `result_ok`.
6538     */
6539    union LDKCResult_SharedSecretNoneZPtr contents;
6540    /**
6541     * Whether this CResult_SharedSecretNoneZ represents a success state.
6542     */
6543    bool result_ok;
6544 } LDKCResult_SharedSecretNoneZ;
6545
6546
6547
6548 /**
6549  * This class tracks the per-transaction information needed to build a closing transaction and will
6550  * actually build it and sign.
6551  *
6552  * This class can be used inside a signer implementation to generate a signature given the relevant
6553  * secret key.
6554  */
6555 typedef struct MUST_USE_STRUCT LDKClosingTransaction {
6556    /**
6557     * A pointer to the opaque Rust object.
6558     * Nearly everywhere, inner must be non-null, however in places where
6559     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6560     */
6561    LDKnativeClosingTransaction *inner;
6562    /**
6563     * Indicates that this is the only struct which contains the same pointer.
6564     * Rust functions which take ownership of an object provided via an argument require
6565     * this to be true and invalidate the object pointed to by inner.
6566     */
6567    bool is_owned;
6568 } LDKClosingTransaction;
6569
6570
6571
6572 /**
6573  * The unsigned part of a channel_announcement
6574  */
6575 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
6576    /**
6577     * A pointer to the opaque Rust object.
6578     * Nearly everywhere, inner must be non-null, however in places where
6579     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6580     */
6581    LDKnativeUnsignedChannelAnnouncement *inner;
6582    /**
6583     * Indicates that this is the only struct which contains the same pointer.
6584     * Rust functions which take ownership of an object provided via an argument require
6585     * this to be true and invalidate the object pointed to by inner.
6586     */
6587    bool is_owned;
6588 } LDKUnsignedChannelAnnouncement;
6589
6590 /**
6591  * A trait to sign lightning channel transactions as described in BOLT 3.
6592  *
6593  * Signing services could be implemented on a hardware wallet. In this case,
6594  * the current Sign would be a front-end on top of a communication
6595  * channel connected to your secure device and lightning key material wouldn't
6596  * reside on a hot server. Nevertheless, a this deployment would still need
6597  * to trust the ChannelManager to avoid loss of funds as this latest component
6598  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
6599  *
6600  * A more secure iteration would be to use hashlock (or payment points) to pair
6601  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
6602  * at the price of more state and computation on the hardware wallet side. In the future,
6603  * we are looking forward to design such interface.
6604  *
6605  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
6606  * to act, as liveness and breach reply correctness are always going to be hard requirements
6607  * of LN security model, orthogonal of key management issues.
6608  */
6609 typedef struct LDKBaseSign {
6610    /**
6611     * An opaque pointer which is passed to your function implementations as an argument.
6612     * This has no meaning in the LDK, and can be NULL or any other value.
6613     */
6614    void *this_arg;
6615    /**
6616     * Gets the per-commitment point for a specific commitment number
6617     *
6618     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
6619     */
6620    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
6621    /**
6622     * Gets the commitment secret for a specific commitment number as part of the revocation process
6623     *
6624     * An external signer implementation should error here if the commitment was already signed
6625     * and should refuse to sign it in the future.
6626     *
6627     * May be called more than once for the same index.
6628     *
6629     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
6630     */
6631    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
6632    /**
6633     * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
6634     *
6635     * This is required in order for the signer to make sure that releasing a commitment
6636     * secret won't leave us without a broadcastable holder transaction.
6637     * Policy checks should be implemented in this function, including checking the amount
6638     * sent to us and checking the HTLCs.
6639     *
6640     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
6641     * A validating signer should ensure that an HTLC output is removed only when the matching
6642     * preimage is provided, or when the value to holder is restored.
6643     *
6644     * NOTE: all the relevant preimages will be provided, but there may also be additional
6645     * irrelevant or duplicate preimages.
6646     */
6647    struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages);
6648    /**
6649     * Gets the holder's channel public keys and basepoints
6650     */
6651    struct LDKChannelPublicKeys pubkeys;
6652    /**
6653     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
6654     * Note that this takes a pointer to this object, not the this_ptr like other methods do
6655     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
6656     */
6657    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
6658    /**
6659     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
6660     * some SpendableOutputDescriptor types. This should be sufficient to identify this
6661     * Sign object uniquely and lookup or re-derive its keys.
6662     */
6663    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
6664    /**
6665     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
6666     *
6667     * Note that if signing fails or is rejected, the channel will be force-closed.
6668     *
6669     * Policy checks should be implemented in this function, including checking the amount
6670     * sent to us and checking the HTLCs.
6671     *
6672     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
6673     * A validating signer should ensure that an HTLC output is removed only when the matching
6674     * preimage is provided, or when the value to holder is restored.
6675     *
6676     * NOTE: all the relevant preimages will be provided, but there may also be additional
6677     * irrelevant or duplicate preimages.
6678     */
6679    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages);
6680    /**
6681     * Validate the counterparty's revocation.
6682     *
6683     * This is required in order for the signer to make sure that the state has moved
6684     * forward and it is safe to sign the next counterparty commitment.
6685     */
6686    struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
6687    /**
6688     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
6689     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
6690     * latest commitment_tx when we initiate a force-close.
6691     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
6692     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
6693     * the latest.
6694     * This may be called multiple times for the same transaction.
6695     *
6696     * An external signer implementation should check that the commitment has not been revoked.
6697     *
6698     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
6699     */
6700    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
6701    /**
6702     * Create a signature for the given input in a transaction spending an HTLC transaction output
6703     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
6704     *
6705     * A justice transaction may claim multiple outputs at the same time if timelocks are
6706     * similar, but only a signature for the input at index `input` should be signed for here.
6707     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
6708     * to an upcoming timelock expiration.
6709     *
6710     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
6711     *
6712     * per_commitment_key is revocation secret which was provided by our counterparty when they
6713     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
6714     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
6715     * so).
6716     */
6717    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]);
6718    /**
6719     * Create a signature for the given input in a transaction spending a commitment transaction
6720     * HTLC output when our counterparty broadcasts an old state.
6721     *
6722     * A justice transaction may claim multiple outputs at the same time if timelocks are
6723     * similar, but only a signature for the input at index `input` should be signed for here.
6724     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
6725     * to an upcoming timelock expiration.
6726     *
6727     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
6728     *
6729     * per_commitment_key is revocation secret which was provided by our counterparty when they
6730     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
6731     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
6732     * so).
6733     *
6734     * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
6735     * (which is committed to in the BIP 143 signatures).
6736     */
6737    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);
6738    /**
6739     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
6740     * transaction, either offered or received.
6741     *
6742     * Such a transaction may claim multiples offered outputs at same time if we know the
6743     * preimage for each when we create it, but only the input at index `input` should be
6744     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
6745     * needed with regards to an upcoming timelock expiration.
6746     *
6747     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
6748     * outputs.
6749     *
6750     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
6751     *
6752     * Per_commitment_point is the dynamic point corresponding to the channel state
6753     * detected onchain. It has been generated by our counterparty and is used to derive
6754     * channel state keys, which are then included in the witness script and committed to in the
6755     * BIP 143 signature.
6756     */
6757    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);
6758    /**
6759     * Create a signature for a (proposed) closing transaction.
6760     *
6761     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
6762     * chosen to forgo their output as dust.
6763     */
6764    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
6765    /**
6766     * Computes the signature for a commitment transaction's anchor output used as an
6767     * input within `anchor_tx`, which spends the commitment transaction, at index `input`.
6768     */
6769    struct LDKCResult_SignatureNoneZ (*sign_holder_anchor_input)(const void *this_arg, struct LDKTransaction anchor_tx, uintptr_t input);
6770    /**
6771     * Signs a channel announcement message with our funding key and our node secret key (aka
6772     * node_id or network_key), proving it comes from one of the channel participants.
6773     *
6774     * The first returned signature should be from our node secret key, the second from our
6775     * funding key.
6776     *
6777     * Note that if this fails or is rejected, the channel will not be publicly announced and
6778     * our counterparty may (though likely will not) close the channel on us for violating the
6779     * protocol.
6780     */
6781    struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
6782    /**
6783     * Set the counterparty static channel data, including basepoints,
6784     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
6785     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
6786     * they MUST NOT be allowed to change to different values once set.
6787     *
6788     * channel_parameters.is_populated() MUST be true.
6789     *
6790     * We bind holder_selected_contest_delay late here for API convenience.
6791     *
6792     * Will be called before any signatures are applied.
6793     */
6794    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
6795    /**
6796     * Frees any resources associated with this object given its this_arg pointer.
6797     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6798     */
6799    void (*free)(void *this_arg);
6800 } LDKBaseSign;
6801
6802 /**
6803  * A cloneable signer.
6804  *
6805  * Although we require signers to be cloneable, it may be useful for developers to be able to use
6806  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
6807  * which implies Sized, into this derived trait.
6808  */
6809 typedef struct LDKSign {
6810    /**
6811     * An opaque pointer which is passed to your function implementations as an argument.
6812     * This has no meaning in the LDK, and can be NULL or any other value.
6813     */
6814    void *this_arg;
6815    /**
6816     * Implementation of BaseSign for this object.
6817     */
6818    struct LDKBaseSign BaseSign;
6819    /**
6820     * Serialize the object into a byte array
6821     */
6822    struct LDKCVec_u8Z (*write)(const void *this_arg);
6823    /**
6824     * Called, if set, after this Sign has been cloned into a duplicate object.
6825     * The new Sign is provided, and should be mutated as needed to perform a
6826     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
6827     */
6828    void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign);
6829    /**
6830     * Frees any resources associated with this object given its this_arg pointer.
6831     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6832     */
6833    void (*free)(void *this_arg);
6834 } LDKSign;
6835
6836 /**
6837  * The contents of CResult_SignDecodeErrorZ
6838  */
6839 typedef union LDKCResult_SignDecodeErrorZPtr {
6840    /**
6841     * A pointer to the contents in the success state.
6842     * Reading from this pointer when `result_ok` is not set is undefined.
6843     */
6844    struct LDKSign *result;
6845    /**
6846     * A pointer to the contents in the error state.
6847     * Reading from this pointer when `result_ok` is set is undefined.
6848     */
6849    struct LDKDecodeError *err;
6850 } LDKCResult_SignDecodeErrorZPtr;
6851
6852 /**
6853  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
6854  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
6855  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6856  */
6857 typedef struct LDKCResult_SignDecodeErrorZ {
6858    /**
6859     * The contents of this CResult_SignDecodeErrorZ, accessible via either
6860     * `err` or `result` depending on the state of `result_ok`.
6861     */
6862    union LDKCResult_SignDecodeErrorZPtr contents;
6863    /**
6864     * Whether this CResult_SignDecodeErrorZ represents a success state.
6865     */
6866    bool result_ok;
6867 } LDKCResult_SignDecodeErrorZ;
6868
6869 /**
6870  * Integer in the range `0..32`
6871  */
6872 typedef struct LDKu5 {
6873    uint8_t _0;
6874 } LDKu5;
6875
6876 /**
6877  * A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
6878  * This corresponds to std::vector in C++
6879  */
6880 typedef struct LDKCVec_u5Z {
6881    /**
6882     * The elements in the array.
6883     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6884     */
6885    struct LDKu5 *data;
6886    /**
6887     * The number of elements pointed to by `data`.
6888     */
6889    uintptr_t datalen;
6890 } LDKCVec_u5Z;
6891
6892 /**
6893  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
6894  * allows recovering the exact public key which created the signature given the message.
6895  */
6896 typedef struct LDKRecoverableSignature {
6897    /**
6898     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
6899     * recovery.
6900     */
6901    uint8_t serialized_form[68];
6902 } LDKRecoverableSignature;
6903
6904 /**
6905  * The contents of CResult_RecoverableSignatureNoneZ
6906  */
6907 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
6908    /**
6909     * A pointer to the contents in the success state.
6910     * Reading from this pointer when `result_ok` is not set is undefined.
6911     */
6912    struct LDKRecoverableSignature *result;
6913    /**
6914     * Note that this value is always NULL, as there are no contents in the Err variant
6915     */
6916    void *err;
6917 } LDKCResult_RecoverableSignatureNoneZPtr;
6918
6919 /**
6920  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
6921  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
6922  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6923  */
6924 typedef struct LDKCResult_RecoverableSignatureNoneZ {
6925    /**
6926     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
6927     * `err` or `result` depending on the state of `result_ok`.
6928     */
6929    union LDKCResult_RecoverableSignatureNoneZPtr contents;
6930    /**
6931     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
6932     */
6933    bool result_ok;
6934 } LDKCResult_RecoverableSignatureNoneZ;
6935
6936 /**
6937  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
6938  * This corresponds to std::vector in C++
6939  */
6940 typedef struct LDKCVec_CVec_u8ZZ {
6941    /**
6942     * The elements in the array.
6943     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6944     */
6945    struct LDKCVec_u8Z *data;
6946    /**
6947     * The number of elements pointed to by `data`.
6948     */
6949    uintptr_t datalen;
6950 } LDKCVec_CVec_u8ZZ;
6951
6952 /**
6953  * The contents of CResult_CVec_CVec_u8ZZNoneZ
6954  */
6955 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
6956    /**
6957     * A pointer to the contents in the success state.
6958     * Reading from this pointer when `result_ok` is not set is undefined.
6959     */
6960    struct LDKCVec_CVec_u8ZZ *result;
6961    /**
6962     * Note that this value is always NULL, as there are no contents in the Err variant
6963     */
6964    void *err;
6965 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
6966
6967 /**
6968  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
6969  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
6970  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6971  */
6972 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
6973    /**
6974     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
6975     * `err` or `result` depending on the state of `result_ok`.
6976     */
6977    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
6978    /**
6979     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
6980     */
6981    bool result_ok;
6982 } LDKCResult_CVec_CVec_u8ZZNoneZ;
6983
6984
6985
6986 /**
6987  * A simple implementation of Sign that just keeps the private keys in memory.
6988  *
6989  * This implementation performs no policy checks and is insufficient by itself as
6990  * a secure external signer.
6991  */
6992 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
6993    /**
6994     * A pointer to the opaque Rust object.
6995     * Nearly everywhere, inner must be non-null, however in places where
6996     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6997     */
6998    LDKnativeInMemorySigner *inner;
6999    /**
7000     * Indicates that this is the only struct which contains the same pointer.
7001     * Rust functions which take ownership of an object provided via an argument require
7002     * this to be true and invalidate the object pointed to by inner.
7003     */
7004    bool is_owned;
7005 } LDKInMemorySigner;
7006
7007 /**
7008  * The contents of CResult_InMemorySignerDecodeErrorZ
7009  */
7010 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
7011    /**
7012     * A pointer to the contents in the success state.
7013     * Reading from this pointer when `result_ok` is not set is undefined.
7014     */
7015    struct LDKInMemorySigner *result;
7016    /**
7017     * A pointer to the contents in the error state.
7018     * Reading from this pointer when `result_ok` is set is undefined.
7019     */
7020    struct LDKDecodeError *err;
7021 } LDKCResult_InMemorySignerDecodeErrorZPtr;
7022
7023 /**
7024  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
7025  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
7026  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7027  */
7028 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
7029    /**
7030     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
7031     * `err` or `result` depending on the state of `result_ok`.
7032     */
7033    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
7034    /**
7035     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
7036     */
7037    bool result_ok;
7038 } LDKCResult_InMemorySignerDecodeErrorZ;
7039
7040 /**
7041  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
7042  * This corresponds to std::vector in C++
7043  */
7044 typedef struct LDKCVec_TxOutZ {
7045    /**
7046     * The elements in the array.
7047     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7048     */
7049    struct LDKTxOut *data;
7050    /**
7051     * The number of elements pointed to by `data`.
7052     */
7053    uintptr_t datalen;
7054 } LDKCVec_TxOutZ;
7055
7056 /**
7057  * The contents of CResult_TransactionNoneZ
7058  */
7059 typedef union LDKCResult_TransactionNoneZPtr {
7060    /**
7061     * A pointer to the contents in the success state.
7062     * Reading from this pointer when `result_ok` is not set is undefined.
7063     */
7064    struct LDKTransaction *result;
7065    /**
7066     * Note that this value is always NULL, as there are no contents in the Err variant
7067     */
7068    void *err;
7069 } LDKCResult_TransactionNoneZPtr;
7070
7071 /**
7072  * A CResult_TransactionNoneZ represents the result of a fallible operation,
7073  * containing a crate::c_types::Transaction on success and a () on failure.
7074  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7075  */
7076 typedef struct LDKCResult_TransactionNoneZ {
7077    /**
7078     * The contents of this CResult_TransactionNoneZ, accessible via either
7079     * `err` or `result` depending on the state of `result_ok`.
7080     */
7081    union LDKCResult_TransactionNoneZPtr contents;
7082    /**
7083     * Whether this CResult_TransactionNoneZ represents a success state.
7084     */
7085    bool result_ok;
7086 } LDKCResult_TransactionNoneZ;
7087
7088
7089
7090 /**
7091  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
7092  * on-chain transactions to ensure no loss of funds occurs.
7093  *
7094  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
7095  * information and are actively monitoring the chain.
7096  *
7097  * Pending Events or updated HTLCs which have not yet been read out by
7098  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
7099  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
7100  * gotten are fully handled before re-serializing the new state.
7101  *
7102  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
7103  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
7104  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
7105  * returned block hash and the the current chain and then reconnecting blocks to get to the
7106  * best chain) upon deserializing the object!
7107  */
7108 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
7109    /**
7110     * A pointer to the opaque Rust object.
7111     * Nearly everywhere, inner must be non-null, however in places where
7112     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7113     */
7114    LDKnativeChannelMonitor *inner;
7115    /**
7116     * Indicates that this is the only struct which contains the same pointer.
7117     * Rust functions which take ownership of an object provided via an argument require
7118     * this to be true and invalidate the object pointed to by inner.
7119     */
7120    bool is_owned;
7121 } LDKChannelMonitor;
7122
7123 /**
7124  * A tuple of 2 elements. See the individual fields for the types contained.
7125  */
7126 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
7127    /**
7128     * The element at position 0
7129     */
7130    struct LDKThirtyTwoBytes a;
7131    /**
7132     * The element at position 1
7133     */
7134    struct LDKChannelMonitor b;
7135 } LDKC2Tuple_BlockHashChannelMonitorZ;
7136
7137 /**
7138  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
7139  * This corresponds to std::vector in C++
7140  */
7141 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
7142    /**
7143     * The elements in the array.
7144     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7145     */
7146    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
7147    /**
7148     * The number of elements pointed to by `data`.
7149     */
7150    uintptr_t datalen;
7151 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
7152
7153 /**
7154  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
7155  */
7156 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7157    /**
7158     * A pointer to the contents in the success state.
7159     * Reading from this pointer when `result_ok` is not set is undefined.
7160     */
7161    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
7162    /**
7163     * A pointer to the contents in the error state.
7164     * Reading from this pointer when `result_ok` is set is undefined.
7165     */
7166    enum LDKIOError *err;
7167 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
7168
7169 /**
7170  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
7171  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
7172  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7173  */
7174 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7175    /**
7176     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
7177     * `err` or `result` depending on the state of `result_ok`.
7178     */
7179    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
7180    /**
7181     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
7182     */
7183    bool result_ok;
7184 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
7185
7186 /**
7187  * An enum which can either contain a u16 or not
7188  */
7189 typedef enum LDKCOption_u16Z_Tag {
7190    /**
7191     * When we're in this state, this COption_u16Z contains a u16
7192     */
7193    LDKCOption_u16Z_Some,
7194    /**
7195     * When we're in this state, this COption_u16Z contains nothing
7196     */
7197    LDKCOption_u16Z_None,
7198    /**
7199     * Must be last for serialization purposes
7200     */
7201    LDKCOption_u16Z_Sentinel,
7202 } LDKCOption_u16Z_Tag;
7203
7204 typedef struct LDKCOption_u16Z {
7205    LDKCOption_u16Z_Tag tag;
7206    union {
7207       struct {
7208          uint16_t some;
7209       };
7210    };
7211 } LDKCOption_u16Z;
7212
7213 /**
7214  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
7215  * too-high values)
7216  */
7217 typedef enum LDKAPIError_Tag {
7218    /**
7219     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
7220     * are documented, but generally indicates some precondition of a function was violated.
7221     */
7222    LDKAPIError_APIMisuseError,
7223    /**
7224     * Due to a high feerate, we were unable to complete the request.
7225     * For example, this may be returned if the feerate implies we cannot open a channel at the
7226     * requested value, but opening a larger channel would succeed.
7227     */
7228    LDKAPIError_FeeRateTooHigh,
7229    /**
7230     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
7231     * too-many-hops, etc).
7232     */
7233    LDKAPIError_RouteError,
7234    /**
7235     * We were unable to complete the request as the Channel required to do so is unable to
7236     * complete the request (or was not found). This can take many forms, including disconnected
7237     * peer, channel at capacity, channel shutting down, etc.
7238     */
7239    LDKAPIError_ChannelUnavailable,
7240    /**
7241     * An attempt to call [`chain::Watch::watch_channel`]/[`chain::Watch::update_channel`]
7242     * returned a [`ChannelMonitorUpdateStatus::InProgress`] indicating the persistence of a
7243     * monitor update is awaiting async resolution. Once it resolves the attempted action should
7244     * complete automatically.
7245     *
7246     * [`chain::Watch::watch_channel`]: crate::chain::Watch::watch_channel
7247     * [`chain::Watch::update_channel`]: crate::chain::Watch::update_channel
7248     * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress
7249     */
7250    LDKAPIError_MonitorUpdateInProgress,
7251    /**
7252     * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
7253     * with the channel counterparty as negotiated in [`InitFeatures`].
7254     *
7255     * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
7256     * a channel or cooperatively close one with this peer (and will have to force-close instead).
7257     *
7258     * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
7259     * [`InitFeatures`]: crate::ln::features::InitFeatures
7260     */
7261    LDKAPIError_IncompatibleShutdownScript,
7262    /**
7263     * Must be last for serialization purposes
7264     */
7265    LDKAPIError_Sentinel,
7266 } LDKAPIError_Tag;
7267
7268 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
7269    /**
7270     * A human-readable error message
7271     */
7272    struct LDKStr err;
7273 } LDKAPIError_LDKAPIMisuseError_Body;
7274
7275 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
7276    /**
7277     * A human-readable error message
7278     */
7279    struct LDKStr err;
7280    /**
7281     * The feerate which was too high.
7282     */
7283    uint32_t feerate;
7284 } LDKAPIError_LDKFeeRateTooHigh_Body;
7285
7286 typedef struct LDKAPIError_LDKRouteError_Body {
7287    /**
7288     * A human-readable error message
7289     */
7290    struct LDKStr err;
7291 } LDKAPIError_LDKRouteError_Body;
7292
7293 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
7294    /**
7295     * A human-readable error message
7296     */
7297    struct LDKStr err;
7298 } LDKAPIError_LDKChannelUnavailable_Body;
7299
7300 typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
7301    /**
7302     * The incompatible shutdown script.
7303     */
7304    struct LDKShutdownScript script;
7305 } LDKAPIError_LDKIncompatibleShutdownScript_Body;
7306
7307 typedef struct MUST_USE_STRUCT LDKAPIError {
7308    LDKAPIError_Tag tag;
7309    union {
7310       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
7311       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
7312       LDKAPIError_LDKRouteError_Body route_error;
7313       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
7314       LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
7315    };
7316 } LDKAPIError;
7317
7318 /**
7319  * The contents of CResult_NoneAPIErrorZ
7320  */
7321 typedef union LDKCResult_NoneAPIErrorZPtr {
7322    /**
7323     * Note that this value is always NULL, as there are no contents in the OK variant
7324     */
7325    void *result;
7326    /**
7327     * A pointer to the contents in the error state.
7328     * Reading from this pointer when `result_ok` is set is undefined.
7329     */
7330    struct LDKAPIError *err;
7331 } LDKCResult_NoneAPIErrorZPtr;
7332
7333 /**
7334  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
7335  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
7336  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7337  */
7338 typedef struct LDKCResult_NoneAPIErrorZ {
7339    /**
7340     * The contents of this CResult_NoneAPIErrorZ, accessible via either
7341     * `err` or `result` depending on the state of `result_ok`.
7342     */
7343    union LDKCResult_NoneAPIErrorZPtr contents;
7344    /**
7345     * Whether this CResult_NoneAPIErrorZ represents a success state.
7346     */
7347    bool result_ok;
7348 } LDKCResult_NoneAPIErrorZ;
7349
7350 /**
7351  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
7352  * This corresponds to std::vector in C++
7353  */
7354 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
7355    /**
7356     * The elements in the array.
7357     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7358     */
7359    struct LDKCResult_NoneAPIErrorZ *data;
7360    /**
7361     * The number of elements pointed to by `data`.
7362     */
7363    uintptr_t datalen;
7364 } LDKCVec_CResult_NoneAPIErrorZZ;
7365
7366 /**
7367  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
7368  * This corresponds to std::vector in C++
7369  */
7370 typedef struct LDKCVec_APIErrorZ {
7371    /**
7372     * The elements in the array.
7373     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7374     */
7375    struct LDKAPIError *data;
7376    /**
7377     * The number of elements pointed to by `data`.
7378     */
7379    uintptr_t datalen;
7380 } LDKCVec_APIErrorZ;
7381
7382 /**
7383  * The contents of CResult__u832APIErrorZ
7384  */
7385 typedef union LDKCResult__u832APIErrorZPtr {
7386    /**
7387     * A pointer to the contents in the success state.
7388     * Reading from this pointer when `result_ok` is not set is undefined.
7389     */
7390    struct LDKThirtyTwoBytes *result;
7391    /**
7392     * A pointer to the contents in the error state.
7393     * Reading from this pointer when `result_ok` is set is undefined.
7394     */
7395    struct LDKAPIError *err;
7396 } LDKCResult__u832APIErrorZPtr;
7397
7398 /**
7399  * A CResult__u832APIErrorZ represents the result of a fallible operation,
7400  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7401  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7402  */
7403 typedef struct LDKCResult__u832APIErrorZ {
7404    /**
7405     * The contents of this CResult__u832APIErrorZ, accessible via either
7406     * `err` or `result` depending on the state of `result_ok`.
7407     */
7408    union LDKCResult__u832APIErrorZPtr contents;
7409    /**
7410     * Whether this CResult__u832APIErrorZ represents a success state.
7411     */
7412    bool result_ok;
7413 } LDKCResult__u832APIErrorZ;
7414
7415 /**
7416  * If a payment fails to send, it can be in one of several states. This enum is returned as the
7417  * Err() type describing which state the payment is in, see the description of individual enum
7418  * states for more.
7419  */
7420 typedef enum LDKPaymentSendFailure_Tag {
7421    /**
7422     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
7423     * send the payment at all. No channel state has been changed or messages sent to peers, and
7424     * once you've changed the parameter at error, you can freely retry the payment in full.
7425     */
7426    LDKPaymentSendFailure_ParameterError,
7427    /**
7428     * A parameter in a single path which was passed to send_payment was invalid, preventing us
7429     * from attempting to send the payment at all. No channel state has been changed or messages
7430     * sent to peers, and once you've changed the parameter at error, you can freely retry the
7431     * payment in full.
7432     *
7433     * The results here are ordered the same as the paths in the route object which was passed to
7434     * send_payment.
7435     */
7436    LDKPaymentSendFailure_PathParameterError,
7437    /**
7438     * All paths which were attempted failed to send, with no channel state change taking place.
7439     * You can freely retry the payment in full (though you probably want to do so over different
7440     * paths than the ones selected).
7441     */
7442    LDKPaymentSendFailure_AllFailedRetrySafe,
7443    /**
7444     * Some paths which were attempted failed to send, though possibly not all. At least some
7445     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
7446     * in over-/re-payment.
7447     *
7448     * The results here are ordered the same as the paths in the route object which was passed to
7449     * send_payment, and any `Err`s which are not [`APIError::MonitorUpdateInProgress`] can be
7450     * safely retried via [`ChannelManager::retry_payment`].
7451     *
7452     * Any entries which contain `Err(APIError::MonitorUpdateInprogress)` or `Ok(())` MUST NOT be
7453     * retried as they will result in over-/re-payment. These HTLCs all either successfully sent
7454     * (in the case of `Ok(())`) or will send once a [`MonitorEvent::Completed`] is provided for
7455     * the next-hop channel with the latest update_id.
7456     */
7457    LDKPaymentSendFailure_PartialFailure,
7458    /**
7459     * Must be last for serialization purposes
7460     */
7461    LDKPaymentSendFailure_Sentinel,
7462 } LDKPaymentSendFailure_Tag;
7463
7464 typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
7465    /**
7466     * The errors themselves, in the same order as the route hops.
7467     */
7468    struct LDKCVec_CResult_NoneAPIErrorZZ results;
7469    /**
7470     * If some paths failed without irrevocably committing to the new HTLC(s), this will
7471     * contain a [`RouteParameters`] object which can be used to calculate a new route that
7472     * will pay all remaining unpaid balance.
7473     *
7474     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
7475     */
7476    struct LDKRouteParameters failed_paths_retry;
7477    /**
7478     * The payment id for the payment, which is now at least partially pending.
7479     */
7480    struct LDKThirtyTwoBytes payment_id;
7481 } LDKPaymentSendFailure_LDKPartialFailure_Body;
7482
7483 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
7484    LDKPaymentSendFailure_Tag tag;
7485    union {
7486       struct {
7487          struct LDKAPIError parameter_error;
7488       };
7489       struct {
7490          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
7491       };
7492       struct {
7493          struct LDKCVec_APIErrorZ all_failed_retry_safe;
7494       };
7495       LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
7496    };
7497 } LDKPaymentSendFailure;
7498
7499 /**
7500  * The contents of CResult_PaymentIdPaymentSendFailureZ
7501  */
7502 typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr {
7503    /**
7504     * A pointer to the contents in the success state.
7505     * Reading from this pointer when `result_ok` is not set is undefined.
7506     */
7507    struct LDKThirtyTwoBytes *result;
7508    /**
7509     * A pointer to the contents in the error state.
7510     * Reading from this pointer when `result_ok` is set is undefined.
7511     */
7512    struct LDKPaymentSendFailure *err;
7513 } LDKCResult_PaymentIdPaymentSendFailureZPtr;
7514
7515 /**
7516  * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
7517  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7518  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7519  */
7520 typedef struct LDKCResult_PaymentIdPaymentSendFailureZ {
7521    /**
7522     * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
7523     * `err` or `result` depending on the state of `result_ok`.
7524     */
7525    union LDKCResult_PaymentIdPaymentSendFailureZPtr contents;
7526    /**
7527     * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
7528     */
7529    bool result_ok;
7530 } LDKCResult_PaymentIdPaymentSendFailureZ;
7531
7532 /**
7533  * The contents of CResult_NonePaymentSendFailureZ
7534  */
7535 typedef union LDKCResult_NonePaymentSendFailureZPtr {
7536    /**
7537     * Note that this value is always NULL, as there are no contents in the OK variant
7538     */
7539    void *result;
7540    /**
7541     * A pointer to the contents in the error state.
7542     * Reading from this pointer when `result_ok` is set is undefined.
7543     */
7544    struct LDKPaymentSendFailure *err;
7545 } LDKCResult_NonePaymentSendFailureZPtr;
7546
7547 /**
7548  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
7549  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7550  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7551  */
7552 typedef struct LDKCResult_NonePaymentSendFailureZ {
7553    /**
7554     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
7555     * `err` or `result` depending on the state of `result_ok`.
7556     */
7557    union LDKCResult_NonePaymentSendFailureZPtr contents;
7558    /**
7559     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
7560     */
7561    bool result_ok;
7562 } LDKCResult_NonePaymentSendFailureZ;
7563
7564 /**
7565  * A tuple of 2 elements. See the individual fields for the types contained.
7566  */
7567 typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
7568    /**
7569     * The element at position 0
7570     */
7571    struct LDKThirtyTwoBytes a;
7572    /**
7573     * The element at position 1
7574     */
7575    struct LDKThirtyTwoBytes b;
7576 } LDKC2Tuple_PaymentHashPaymentIdZ;
7577
7578 /**
7579  * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
7580  */
7581 typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7582    /**
7583     * A pointer to the contents in the success state.
7584     * Reading from this pointer when `result_ok` is not set is undefined.
7585     */
7586    struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
7587    /**
7588     * A pointer to the contents in the error state.
7589     * Reading from this pointer when `result_ok` is set is undefined.
7590     */
7591    struct LDKPaymentSendFailure *err;
7592 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
7593
7594 /**
7595  * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
7596  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7597  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7598  */
7599 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7600    /**
7601     * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
7602     * `err` or `result` depending on the state of `result_ok`.
7603     */
7604    union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
7605    /**
7606     * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
7607     */
7608    bool result_ok;
7609 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
7610
7611 /**
7612  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
7613  * This corresponds to std::vector in C++
7614  */
7615 typedef struct LDKCVec_ThirtyTwoBytesZ {
7616    /**
7617     * The elements in the array.
7618     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7619     */
7620    struct LDKThirtyTwoBytes *data;
7621    /**
7622     * The number of elements pointed to by `data`.
7623     */
7624    uintptr_t datalen;
7625 } LDKCVec_ThirtyTwoBytesZ;
7626
7627 /**
7628  * A tuple of 2 elements. See the individual fields for the types contained.
7629  */
7630 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
7631    /**
7632     * The element at position 0
7633     */
7634    struct LDKThirtyTwoBytes a;
7635    /**
7636     * The element at position 1
7637     */
7638    struct LDKThirtyTwoBytes b;
7639 } LDKC2Tuple_PaymentHashPaymentSecretZ;
7640
7641 /**
7642  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
7643  */
7644 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
7645    /**
7646     * A pointer to the contents in the success state.
7647     * Reading from this pointer when `result_ok` is not set is undefined.
7648     */
7649    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
7650    /**
7651     * Note that this value is always NULL, as there are no contents in the Err variant
7652     */
7653    void *err;
7654 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr;
7655
7656 /**
7657  * A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
7658  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
7659  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7660  */
7661 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
7662    /**
7663     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
7664     * `err` or `result` depending on the state of `result_ok`.
7665     */
7666    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents;
7667    /**
7668     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
7669     */
7670    bool result_ok;
7671 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ;
7672
7673 /**
7674  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
7675  */
7676 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
7677    /**
7678     * A pointer to the contents in the success state.
7679     * Reading from this pointer when `result_ok` is not set is undefined.
7680     */
7681    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
7682    /**
7683     * A pointer to the contents in the error state.
7684     * Reading from this pointer when `result_ok` is set is undefined.
7685     */
7686    struct LDKAPIError *err;
7687 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr;
7688
7689 /**
7690  * A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
7691  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
7692  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7693  */
7694 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
7695    /**
7696     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
7697     * `err` or `result` depending on the state of `result_ok`.
7698     */
7699    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr contents;
7700    /**
7701     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
7702     */
7703    bool result_ok;
7704 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ;
7705
7706 /**
7707  * The contents of CResult_PaymentSecretNoneZ
7708  */
7709 typedef union LDKCResult_PaymentSecretNoneZPtr {
7710    /**
7711     * A pointer to the contents in the success state.
7712     * Reading from this pointer when `result_ok` is not set is undefined.
7713     */
7714    struct LDKThirtyTwoBytes *result;
7715    /**
7716     * Note that this value is always NULL, as there are no contents in the Err variant
7717     */
7718    void *err;
7719 } LDKCResult_PaymentSecretNoneZPtr;
7720
7721 /**
7722  * A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
7723  * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
7724  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7725  */
7726 typedef struct LDKCResult_PaymentSecretNoneZ {
7727    /**
7728     * The contents of this CResult_PaymentSecretNoneZ, accessible via either
7729     * `err` or `result` depending on the state of `result_ok`.
7730     */
7731    union LDKCResult_PaymentSecretNoneZPtr contents;
7732    /**
7733     * Whether this CResult_PaymentSecretNoneZ represents a success state.
7734     */
7735    bool result_ok;
7736 } LDKCResult_PaymentSecretNoneZ;
7737
7738 /**
7739  * The contents of CResult_PaymentSecretAPIErrorZ
7740  */
7741 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
7742    /**
7743     * A pointer to the contents in the success state.
7744     * Reading from this pointer when `result_ok` is not set is undefined.
7745     */
7746    struct LDKThirtyTwoBytes *result;
7747    /**
7748     * A pointer to the contents in the error state.
7749     * Reading from this pointer when `result_ok` is set is undefined.
7750     */
7751    struct LDKAPIError *err;
7752 } LDKCResult_PaymentSecretAPIErrorZPtr;
7753
7754 /**
7755  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
7756  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7757  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7758  */
7759 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
7760    /**
7761     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
7762     * `err` or `result` depending on the state of `result_ok`.
7763     */
7764    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
7765    /**
7766     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
7767     */
7768    bool result_ok;
7769 } LDKCResult_PaymentSecretAPIErrorZ;
7770
7771 /**
7772  * The contents of CResult_PaymentPreimageAPIErrorZ
7773  */
7774 typedef union LDKCResult_PaymentPreimageAPIErrorZPtr {
7775    /**
7776     * A pointer to the contents in the success state.
7777     * Reading from this pointer when `result_ok` is not set is undefined.
7778     */
7779    struct LDKThirtyTwoBytes *result;
7780    /**
7781     * A pointer to the contents in the error state.
7782     * Reading from this pointer when `result_ok` is set is undefined.
7783     */
7784    struct LDKAPIError *err;
7785 } LDKCResult_PaymentPreimageAPIErrorZPtr;
7786
7787 /**
7788  * A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
7789  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7790  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7791  */
7792 typedef struct LDKCResult_PaymentPreimageAPIErrorZ {
7793    /**
7794     * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
7795     * `err` or `result` depending on the state of `result_ok`.
7796     */
7797    union LDKCResult_PaymentPreimageAPIErrorZPtr contents;
7798    /**
7799     * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
7800     */
7801    bool result_ok;
7802 } LDKCResult_PaymentPreimageAPIErrorZ;
7803
7804
7805
7806 /**
7807  * Information needed for constructing an invoice route hint for this channel.
7808  */
7809 typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
7810    /**
7811     * A pointer to the opaque Rust object.
7812     * Nearly everywhere, inner must be non-null, however in places where
7813     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7814     */
7815    LDKnativeCounterpartyForwardingInfo *inner;
7816    /**
7817     * Indicates that this is the only struct which contains the same pointer.
7818     * Rust functions which take ownership of an object provided via an argument require
7819     * this to be true and invalidate the object pointed to by inner.
7820     */
7821    bool is_owned;
7822 } LDKCounterpartyForwardingInfo;
7823
7824 /**
7825  * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
7826  */
7827 typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7828    /**
7829     * A pointer to the contents in the success state.
7830     * Reading from this pointer when `result_ok` is not set is undefined.
7831     */
7832    struct LDKCounterpartyForwardingInfo *result;
7833    /**
7834     * A pointer to the contents in the error state.
7835     * Reading from this pointer when `result_ok` is set is undefined.
7836     */
7837    struct LDKDecodeError *err;
7838 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr;
7839
7840 /**
7841  * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
7842  * containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7843  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7844  */
7845 typedef struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ {
7846    /**
7847     * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
7848     * `err` or `result` depending on the state of `result_ok`.
7849     */
7850    union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents;
7851    /**
7852     * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
7853     */
7854    bool result_ok;
7855 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZ;
7856
7857
7858
7859 /**
7860  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
7861  * to better separate parameters.
7862  */
7863 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
7864    /**
7865     * A pointer to the opaque Rust object.
7866     * Nearly everywhere, inner must be non-null, however in places where
7867     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7868     */
7869    LDKnativeChannelCounterparty *inner;
7870    /**
7871     * Indicates that this is the only struct which contains the same pointer.
7872     * Rust functions which take ownership of an object provided via an argument require
7873     * this to be true and invalidate the object pointed to by inner.
7874     */
7875    bool is_owned;
7876 } LDKChannelCounterparty;
7877
7878 /**
7879  * The contents of CResult_ChannelCounterpartyDecodeErrorZ
7880  */
7881 typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr {
7882    /**
7883     * A pointer to the contents in the success state.
7884     * Reading from this pointer when `result_ok` is not set is undefined.
7885     */
7886    struct LDKChannelCounterparty *result;
7887    /**
7888     * A pointer to the contents in the error state.
7889     * Reading from this pointer when `result_ok` is set is undefined.
7890     */
7891    struct LDKDecodeError *err;
7892 } LDKCResult_ChannelCounterpartyDecodeErrorZPtr;
7893
7894 /**
7895  * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
7896  * containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
7897  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7898  */
7899 typedef struct LDKCResult_ChannelCounterpartyDecodeErrorZ {
7900    /**
7901     * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
7902     * `err` or `result` depending on the state of `result_ok`.
7903     */
7904    union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents;
7905    /**
7906     * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
7907     */
7908    bool result_ok;
7909 } LDKCResult_ChannelCounterpartyDecodeErrorZ;
7910
7911 /**
7912  * The contents of CResult_ChannelDetailsDecodeErrorZ
7913  */
7914 typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr {
7915    /**
7916     * A pointer to the contents in the success state.
7917     * Reading from this pointer when `result_ok` is not set is undefined.
7918     */
7919    struct LDKChannelDetails *result;
7920    /**
7921     * A pointer to the contents in the error state.
7922     * Reading from this pointer when `result_ok` is set is undefined.
7923     */
7924    struct LDKDecodeError *err;
7925 } LDKCResult_ChannelDetailsDecodeErrorZPtr;
7926
7927 /**
7928  * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
7929  * containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
7930  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7931  */
7932 typedef struct LDKCResult_ChannelDetailsDecodeErrorZ {
7933    /**
7934     * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
7935     * `err` or `result` depending on the state of `result_ok`.
7936     */
7937    union LDKCResult_ChannelDetailsDecodeErrorZPtr contents;
7938    /**
7939     * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
7940     */
7941    bool result_ok;
7942 } LDKCResult_ChannelDetailsDecodeErrorZ;
7943
7944
7945
7946 /**
7947  * Route hints used in constructing invoices for [phantom node payents].
7948  *
7949  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
7950  */
7951 typedef struct MUST_USE_STRUCT LDKPhantomRouteHints {
7952    /**
7953     * A pointer to the opaque Rust object.
7954     * Nearly everywhere, inner must be non-null, however in places where
7955     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7956     */
7957    LDKnativePhantomRouteHints *inner;
7958    /**
7959     * Indicates that this is the only struct which contains the same pointer.
7960     * Rust functions which take ownership of an object provided via an argument require
7961     * this to be true and invalidate the object pointed to by inner.
7962     */
7963    bool is_owned;
7964 } LDKPhantomRouteHints;
7965
7966 /**
7967  * The contents of CResult_PhantomRouteHintsDecodeErrorZ
7968  */
7969 typedef union LDKCResult_PhantomRouteHintsDecodeErrorZPtr {
7970    /**
7971     * A pointer to the contents in the success state.
7972     * Reading from this pointer when `result_ok` is not set is undefined.
7973     */
7974    struct LDKPhantomRouteHints *result;
7975    /**
7976     * A pointer to the contents in the error state.
7977     * Reading from this pointer when `result_ok` is set is undefined.
7978     */
7979    struct LDKDecodeError *err;
7980 } LDKCResult_PhantomRouteHintsDecodeErrorZPtr;
7981
7982 /**
7983  * A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
7984  * containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
7985  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7986  */
7987 typedef struct LDKCResult_PhantomRouteHintsDecodeErrorZ {
7988    /**
7989     * The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
7990     * `err` or `result` depending on the state of `result_ok`.
7991     */
7992    union LDKCResult_PhantomRouteHintsDecodeErrorZPtr contents;
7993    /**
7994     * Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
7995     */
7996    bool result_ok;
7997 } LDKCResult_PhantomRouteHintsDecodeErrorZ;
7998
7999 /**
8000  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
8001  * This corresponds to std::vector in C++
8002  */
8003 typedef struct LDKCVec_ChannelMonitorZ {
8004    /**
8005     * The elements in the array.
8006     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8007     */
8008    struct LDKChannelMonitor *data;
8009    /**
8010     * The number of elements pointed to by `data`.
8011     */
8012    uintptr_t datalen;
8013 } LDKCVec_ChannelMonitorZ;
8014
8015
8016
8017 /**
8018  * An update generated by the underlying channel itself which contains some new information the
8019  * [`ChannelMonitor`] should be made aware of.
8020  *
8021  * Because this represents only a small number of updates to the underlying state, it is generally
8022  * much smaller than a full [`ChannelMonitor`]. However, for large single commitment transaction
8023  * updates (e.g. ones during which there are hundreds of HTLCs pending on the commitment
8024  * transaction), a single update may reach upwards of 1 MiB in serialized size.
8025  */
8026 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
8027    /**
8028     * A pointer to the opaque Rust object.
8029     * Nearly everywhere, inner must be non-null, however in places where
8030     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8031     */
8032    LDKnativeChannelMonitorUpdate *inner;
8033    /**
8034     * Indicates that this is the only struct which contains the same pointer.
8035     * Rust functions which take ownership of an object provided via an argument require
8036     * this to be true and invalidate the object pointed to by inner.
8037     */
8038    bool is_owned;
8039 } LDKChannelMonitorUpdate;
8040
8041 /**
8042  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
8043  * blocks are connected and disconnected.
8044  *
8045  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
8046  * responsible for maintaining a set of monitors such that they can be updated accordingly as
8047  * channel state changes and HTLCs are resolved. See method documentation for specific
8048  * requirements.
8049  *
8050  * Implementations **must** ensure that updates are successfully applied and persisted upon method
8051  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
8052  * without taking any further action such as persisting the current state.
8053  *
8054  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
8055  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
8056  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
8057  * funds in the channel. See [`ChannelMonitorUpdateStatus`] for more details about how to handle
8058  * multiple instances.
8059  *
8060  * [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure
8061  */
8062 typedef struct LDKWatch {
8063    /**
8064     * An opaque pointer which is passed to your function implementations as an argument.
8065     * This has no meaning in the LDK, and can be NULL or any other value.
8066     */
8067    void *this_arg;
8068    /**
8069     * Watches a channel identified by `funding_txo` using `monitor`.
8070     *
8071     * Implementations are responsible for watching the chain for the funding transaction along
8072     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
8073     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
8074     *
8075     * Note: this interface MUST error with [`ChannelMonitorUpdateStatus::PermanentFailure`] if
8076     * the given `funding_txo` has previously been registered via `watch_channel`.
8077     *
8078     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
8079     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
8080     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
8081     */
8082    enum LDKChannelMonitorUpdateStatus (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
8083    /**
8084     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
8085     *
8086     * Implementations must call [`update_monitor`] with the given update. See
8087     * [`ChannelMonitorUpdateStatus`] for invariants around returning an error.
8088     *
8089     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
8090     */
8091    enum LDKChannelMonitorUpdateStatus (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
8092    /**
8093     * Returns any monitor events since the last call. Subsequent calls must only return new
8094     * events.
8095     *
8096     * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
8097     * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
8098     * to disk.
8099     *
8100     * For details on asynchronous [`ChannelMonitor`] updating and returning
8101     * [`MonitorEvent::Completed`] here, see [`ChannelMonitorUpdateStatus::InProgress`].
8102     */
8103    struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ (*release_pending_monitor_events)(const void *this_arg);
8104    /**
8105     * Frees any resources associated with this object given its this_arg pointer.
8106     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8107     */
8108    void (*free)(void *this_arg);
8109 } LDKWatch;
8110
8111 /**
8112  * An interface to send a transaction to the Bitcoin network.
8113  */
8114 typedef struct LDKBroadcasterInterface {
8115    /**
8116     * An opaque pointer which is passed to your function implementations as an argument.
8117     * This has no meaning in the LDK, and can be NULL or any other value.
8118     */
8119    void *this_arg;
8120    /**
8121     * Sends a transaction out to (hopefully) be mined.
8122     */
8123    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
8124    /**
8125     * Frees any resources associated with this object given its this_arg pointer.
8126     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8127     */
8128    void (*free)(void *this_arg);
8129 } LDKBroadcasterInterface;
8130
8131 /**
8132  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
8133  * own the memory pointed to by data.
8134  */
8135 typedef struct LDKu8slice {
8136    /**
8137     * A pointer to the byte buffer
8138     */
8139    const uint8_t *data;
8140    /**
8141     * The number of bytes pointed to by `data`.
8142     */
8143    uintptr_t datalen;
8144 } LDKu8slice;
8145
8146 /**
8147  * A trait to describe an object which can get user secrets and key material.
8148  */
8149 typedef struct LDKKeysInterface {
8150    /**
8151     * An opaque pointer which is passed to your function implementations as an argument.
8152     * This has no meaning in the LDK, and can be NULL or any other value.
8153     */
8154    void *this_arg;
8155    /**
8156     * Get node secret key based on the provided [`Recipient`].
8157     *
8158     * The node_id/network_key is the public key that corresponds to this secret key.
8159     *
8160     * This method must return the same value each time it is called with a given `Recipient`
8161     * parameter.
8162     *
8163     * Errors if the `Recipient` variant is not supported by the implementation.
8164     */
8165    struct LDKCResult_SecretKeyNoneZ (*get_node_secret)(const void *this_arg, enum LDKRecipient recipient);
8166    /**
8167     * Get node id based on the provided [`Recipient`]. This public key corresponds to the secret in
8168     * [`get_node_secret`].
8169     *
8170     * This method must return the same value each time it is called with a given `Recipient`
8171     * parameter.
8172     *
8173     * Errors if the `Recipient` variant is not supported by the implementation.
8174     *
8175     * [`get_node_secret`]: KeysInterface::get_node_secret
8176     */
8177    struct LDKCResult_PublicKeyNoneZ (*get_node_id)(const void *this_arg, enum LDKRecipient recipient);
8178    /**
8179     * Gets the ECDH shared secret of our [`node secret`] and `other_key`, multiplying by `tweak` if
8180     * one is provided. Note that this tweak can be applied to `other_key` instead of our node
8181     * secret, though this is less efficient.
8182     *
8183     * Errors if the `Recipient` variant is not supported by the implementation.
8184     *
8185     * [`node secret`]: Self::get_node_secret
8186     */
8187    struct LDKCResult_SharedSecretNoneZ (*ecdh)(const void *this_arg, enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_ScalarZ tweak);
8188    /**
8189     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
8190     *
8191     * This method should return a different value each time it is called, to avoid linking
8192     * on-chain funds across channels as controlled to the same user.
8193     */
8194    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
8195    /**
8196     * Get a script pubkey which we will send funds to when closing a channel.
8197     *
8198     * This method should return a different value each time it is called, to avoid linking
8199     * on-chain funds across channels as controlled to the same user.
8200     */
8201    struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
8202    /**
8203     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
8204     * restarted with some stale data!
8205     *
8206     * This method must return a different value each time it is called.
8207     */
8208    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
8209    /**
8210     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
8211     * onion packets and for temporary channel IDs. There is no requirement that these be
8212     * persisted anywhere, though they must be unique across restarts.
8213     *
8214     * This method must return a different value each time it is called.
8215     */
8216    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
8217    /**
8218     * Reads a `Signer` for this `KeysInterface` from the given input stream.
8219     * This is only called during deserialization of other objects which contain
8220     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
8221     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
8222     * contain no versioning scheme. You may wish to include your own version prefix and ensure
8223     * you've read all of the provided bytes to ensure no corruption occurred.
8224     */
8225    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
8226    /**
8227     * Sign an invoice.
8228     * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of
8229     * this trait to parse the invoice and make sure they're signing what they expect, rather than
8230     * blindly signing the hash.
8231     * The hrp is ascii bytes, while the invoice data is base32.
8232     *
8233     * The secret key used to sign the invoice is dependent on the [`Recipient`].
8234     *
8235     * Errors if the `Recipient` variant is not supported by the implementation.
8236     */
8237    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z invoice_data, enum LDKRecipient receipient);
8238    /**
8239     * Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
8240     *
8241     * If the implementor of this trait supports [phantom node payments], then every node that is
8242     * intended to be included in the phantom invoice route hints must return the same value from
8243     * this method.
8244     *
8245     * This method must return the same value each time it is called.
8246     *
8247     * [phantom node payments]: PhantomKeysManager
8248     */
8249    struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg);
8250    /**
8251     * Frees any resources associated with this object given its this_arg pointer.
8252     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8253     */
8254    void (*free)(void *this_arg);
8255 } LDKKeysInterface;
8256
8257 /**
8258  * A trait which should be implemented to provide feerate information on a number of time
8259  * horizons.
8260  *
8261  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
8262  * called from inside the library in response to chain events, P2P events, or timer events).
8263  */
8264 typedef struct LDKFeeEstimator {
8265    /**
8266     * An opaque pointer which is passed to your function implementations as an argument.
8267     * This has no meaning in the LDK, and can be NULL or any other value.
8268     */
8269    void *this_arg;
8270    /**
8271     * Gets estimated satoshis of fee required per 1000 Weight-Units.
8272     *
8273     * LDK will wrap this method and ensure that the value returned is no smaller than 253
8274     * (ie 1 satoshi-per-byte rounded up to ensure later round-downs don't put us below 1 satoshi-per-byte).
8275     *
8276     * The following unit conversions can be used to convert to sats/KW:
8277     *  * satoshis-per-byte * 250
8278     *  * satoshis-per-kbyte / 4
8279     */
8280    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
8281    /**
8282     * Frees any resources associated with this object given its this_arg pointer.
8283     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8284     */
8285    void (*free)(void *this_arg);
8286 } LDKFeeEstimator;
8287
8288
8289
8290 /**
8291  * Manager which keeps track of a number of channels and sends messages to the appropriate
8292  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
8293  *
8294  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
8295  * to individual Channels.
8296  *
8297  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
8298  * all peers during write/read (though does not modify this instance, only the instance being
8299  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
8300  * called funding_transaction_generated for outbound channels).
8301  *
8302  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
8303  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
8304  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
8305  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
8306  * the serialization process). If the deserialized version is out-of-date compared to the
8307  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
8308  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
8309  *
8310  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
8311  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
8312  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
8313  * block_connected() to step towards your best block) upon deserialization before using the
8314  * object!
8315  *
8316  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
8317  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
8318  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
8319  * offline for a full minute. In order to track this, you must call
8320  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
8321  *
8322  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
8323  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
8324  * essentially you should default to using a SimpleRefChannelManager, and use a
8325  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
8326  * you're using lightning-net-tokio.
8327  */
8328 typedef struct MUST_USE_STRUCT LDKChannelManager {
8329    /**
8330     * A pointer to the opaque Rust object.
8331     * Nearly everywhere, inner must be non-null, however in places where
8332     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8333     */
8334    LDKnativeChannelManager *inner;
8335    /**
8336     * Indicates that this is the only struct which contains the same pointer.
8337     * Rust functions which take ownership of an object provided via an argument require
8338     * this to be true and invalidate the object pointed to by inner.
8339     */
8340    bool is_owned;
8341 } LDKChannelManager;
8342
8343 /**
8344  * A tuple of 2 elements. See the individual fields for the types contained.
8345  */
8346 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
8347    /**
8348     * The element at position 0
8349     */
8350    struct LDKThirtyTwoBytes a;
8351    /**
8352     * The element at position 1
8353     */
8354    struct LDKChannelManager b;
8355 } LDKC2Tuple_BlockHashChannelManagerZ;
8356
8357 /**
8358  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
8359  */
8360 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
8361    /**
8362     * A pointer to the contents in the success state.
8363     * Reading from this pointer when `result_ok` is not set is undefined.
8364     */
8365    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
8366    /**
8367     * A pointer to the contents in the error state.
8368     * Reading from this pointer when `result_ok` is set is undefined.
8369     */
8370    struct LDKDecodeError *err;
8371 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
8372
8373 /**
8374  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
8375  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8376  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8377  */
8378 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8379    /**
8380     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
8381     * `err` or `result` depending on the state of `result_ok`.
8382     */
8383    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
8384    /**
8385     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
8386     */
8387    bool result_ok;
8388 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
8389
8390
8391
8392 /**
8393  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
8394  * with our counterparty.
8395  */
8396 typedef struct MUST_USE_STRUCT LDKChannelConfig {
8397    /**
8398     * A pointer to the opaque Rust object.
8399     * Nearly everywhere, inner must be non-null, however in places where
8400     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8401     */
8402    LDKnativeChannelConfig *inner;
8403    /**
8404     * Indicates that this is the only struct which contains the same pointer.
8405     * Rust functions which take ownership of an object provided via an argument require
8406     * this to be true and invalidate the object pointed to by inner.
8407     */
8408    bool is_owned;
8409 } LDKChannelConfig;
8410
8411 /**
8412  * The contents of CResult_ChannelConfigDecodeErrorZ
8413  */
8414 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
8415    /**
8416     * A pointer to the contents in the success state.
8417     * Reading from this pointer when `result_ok` is not set is undefined.
8418     */
8419    struct LDKChannelConfig *result;
8420    /**
8421     * A pointer to the contents in the error state.
8422     * Reading from this pointer when `result_ok` is set is undefined.
8423     */
8424    struct LDKDecodeError *err;
8425 } LDKCResult_ChannelConfigDecodeErrorZPtr;
8426
8427 /**
8428  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
8429  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
8430  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8431  */
8432 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
8433    /**
8434     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
8435     * `err` or `result` depending on the state of `result_ok`.
8436     */
8437    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
8438    /**
8439     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
8440     */
8441    bool result_ok;
8442 } LDKCResult_ChannelConfigDecodeErrorZ;
8443
8444 /**
8445  * The contents of CResult_OutPointDecodeErrorZ
8446  */
8447 typedef union LDKCResult_OutPointDecodeErrorZPtr {
8448    /**
8449     * A pointer to the contents in the success state.
8450     * Reading from this pointer when `result_ok` is not set is undefined.
8451     */
8452    struct LDKOutPoint *result;
8453    /**
8454     * A pointer to the contents in the error state.
8455     * Reading from this pointer when `result_ok` is set is undefined.
8456     */
8457    struct LDKDecodeError *err;
8458 } LDKCResult_OutPointDecodeErrorZPtr;
8459
8460 /**
8461  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
8462  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
8463  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8464  */
8465 typedef struct LDKCResult_OutPointDecodeErrorZ {
8466    /**
8467     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
8468     * `err` or `result` depending on the state of `result_ok`.
8469     */
8470    union LDKCResult_OutPointDecodeErrorZPtr contents;
8471    /**
8472     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
8473     */
8474    bool result_ok;
8475 } LDKCResult_OutPointDecodeErrorZ;
8476
8477 /**
8478  * Defines a type identifier for sending messages over the wire.
8479  *
8480  * Messages implementing this trait specify a type and must be [`Writeable`].
8481  */
8482 typedef struct LDKType {
8483    /**
8484     * An opaque pointer which is passed to your function implementations as an argument.
8485     * This has no meaning in the LDK, and can be NULL or any other value.
8486     */
8487    void *this_arg;
8488    /**
8489     * Returns the type identifying the message payload.
8490     */
8491    uint16_t (*type_id)(const void *this_arg);
8492    /**
8493     * Return a human-readable "debug" string describing this object
8494     */
8495    struct LDKStr (*debug_str)(const void *this_arg);
8496    /**
8497     * Serialize the object into a byte array
8498     */
8499    struct LDKCVec_u8Z (*write)(const void *this_arg);
8500    /**
8501     * Frees any resources associated with this object given its this_arg pointer.
8502     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8503     */
8504    void (*free)(void *this_arg);
8505 } LDKType;
8506
8507 /**
8508  * An enum which can either contain a crate::lightning::ln::wire::Type or not
8509  */
8510 typedef enum LDKCOption_TypeZ_Tag {
8511    /**
8512     * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
8513     */
8514    LDKCOption_TypeZ_Some,
8515    /**
8516     * When we're in this state, this COption_TypeZ contains nothing
8517     */
8518    LDKCOption_TypeZ_None,
8519    /**
8520     * Must be last for serialization purposes
8521     */
8522    LDKCOption_TypeZ_Sentinel,
8523 } LDKCOption_TypeZ_Tag;
8524
8525 typedef struct LDKCOption_TypeZ {
8526    LDKCOption_TypeZ_Tag tag;
8527    union {
8528       struct {
8529          struct LDKType some;
8530       };
8531    };
8532 } LDKCOption_TypeZ;
8533
8534 /**
8535  * The contents of CResult_COption_TypeZDecodeErrorZ
8536  */
8537 typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
8538    /**
8539     * A pointer to the contents in the success state.
8540     * Reading from this pointer when `result_ok` is not set is undefined.
8541     */
8542    struct LDKCOption_TypeZ *result;
8543    /**
8544     * A pointer to the contents in the error state.
8545     * Reading from this pointer when `result_ok` is set is undefined.
8546     */
8547    struct LDKDecodeError *err;
8548 } LDKCResult_COption_TypeZDecodeErrorZPtr;
8549
8550 /**
8551  * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
8552  * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8553  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8554  */
8555 typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
8556    /**
8557     * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
8558     * `err` or `result` depending on the state of `result_ok`.
8559     */
8560    union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
8561    /**
8562     * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
8563     */
8564    bool result_ok;
8565 } LDKCResult_COption_TypeZDecodeErrorZ;
8566
8567 /**
8568  * An error that may occur when making a payment.
8569  */
8570 typedef enum LDKPaymentError_Tag {
8571    /**
8572     * An error resulting from the provided [`Invoice`] or payment hash.
8573     */
8574    LDKPaymentError_Invoice,
8575    /**
8576     * An error occurring when finding a route.
8577     */
8578    LDKPaymentError_Routing,
8579    /**
8580     * An error occurring when sending a payment.
8581     */
8582    LDKPaymentError_Sending,
8583    /**
8584     * Must be last for serialization purposes
8585     */
8586    LDKPaymentError_Sentinel,
8587 } LDKPaymentError_Tag;
8588
8589 typedef struct MUST_USE_STRUCT LDKPaymentError {
8590    LDKPaymentError_Tag tag;
8591    union {
8592       struct {
8593          struct LDKStr invoice;
8594       };
8595       struct {
8596          struct LDKLightningError routing;
8597       };
8598       struct {
8599          struct LDKPaymentSendFailure sending;
8600       };
8601    };
8602 } LDKPaymentError;
8603
8604 /**
8605  * The contents of CResult_PaymentIdPaymentErrorZ
8606  */
8607 typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
8608    /**
8609     * A pointer to the contents in the success state.
8610     * Reading from this pointer when `result_ok` is not set is undefined.
8611     */
8612    struct LDKThirtyTwoBytes *result;
8613    /**
8614     * A pointer to the contents in the error state.
8615     * Reading from this pointer when `result_ok` is set is undefined.
8616     */
8617    struct LDKPaymentError *err;
8618 } LDKCResult_PaymentIdPaymentErrorZPtr;
8619
8620 /**
8621  * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
8622  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
8623  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8624  */
8625 typedef struct LDKCResult_PaymentIdPaymentErrorZ {
8626    /**
8627     * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
8628     * `err` or `result` depending on the state of `result_ok`.
8629     */
8630    union LDKCResult_PaymentIdPaymentErrorZPtr contents;
8631    /**
8632     * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
8633     */
8634    bool result_ok;
8635 } LDKCResult_PaymentIdPaymentErrorZ;
8636
8637
8638
8639 /**
8640  * A map with liquidity value (in msat) keyed by a short channel id and the direction the HTLC
8641  * is traveling in. The direction boolean is determined by checking if the HTLC source's public
8642  * key is less than its destination. See [`InFlightHtlcs::used_liquidity_msat`] for more
8643  * details.
8644  */
8645 typedef struct MUST_USE_STRUCT LDKInFlightHtlcs {
8646    /**
8647     * A pointer to the opaque Rust object.
8648     * Nearly everywhere, inner must be non-null, however in places where
8649     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8650     */
8651    LDKnativeInFlightHtlcs *inner;
8652    /**
8653     * Indicates that this is the only struct which contains the same pointer.
8654     * Rust functions which take ownership of an object provided via an argument require
8655     * this to be true and invalidate the object pointed to by inner.
8656     */
8657    bool is_owned;
8658 } LDKInFlightHtlcs;
8659
8660 /**
8661  * The contents of CResult_InFlightHtlcsDecodeErrorZ
8662  */
8663 typedef union LDKCResult_InFlightHtlcsDecodeErrorZPtr {
8664    /**
8665     * A pointer to the contents in the success state.
8666     * Reading from this pointer when `result_ok` is not set is undefined.
8667     */
8668    struct LDKInFlightHtlcs *result;
8669    /**
8670     * A pointer to the contents in the error state.
8671     * Reading from this pointer when `result_ok` is set is undefined.
8672     */
8673    struct LDKDecodeError *err;
8674 } LDKCResult_InFlightHtlcsDecodeErrorZPtr;
8675
8676 /**
8677  * A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
8678  * containing a crate::lightning_invoice::payment::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
8679  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8680  */
8681 typedef struct LDKCResult_InFlightHtlcsDecodeErrorZ {
8682    /**
8683     * The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
8684     * `err` or `result` depending on the state of `result_ok`.
8685     */
8686    union LDKCResult_InFlightHtlcsDecodeErrorZPtr contents;
8687    /**
8688     * Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
8689     */
8690    bool result_ok;
8691 } LDKCResult_InFlightHtlcsDecodeErrorZ;
8692
8693 /**
8694  * Sub-errors which don't have specific information in them use this type.
8695  */
8696 typedef struct LDKError {
8697    /**
8698     * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here
8699     */
8700    uint8_t _dummy;
8701 } LDKError;
8702
8703 /**
8704  * Errors that indicate what is wrong with the invoice. They have some granularity for debug
8705  * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user.
8706  */
8707 typedef enum LDKParseError_Tag {
8708    LDKParseError_Bech32Error,
8709    LDKParseError_ParseAmountError,
8710    LDKParseError_MalformedSignature,
8711    LDKParseError_BadPrefix,
8712    LDKParseError_UnknownCurrency,
8713    LDKParseError_UnknownSiPrefix,
8714    LDKParseError_MalformedHRP,
8715    LDKParseError_TooShortDataPart,
8716    LDKParseError_UnexpectedEndOfTaggedFields,
8717    LDKParseError_DescriptionDecodeError,
8718    LDKParseError_PaddingError,
8719    LDKParseError_IntegerOverflowError,
8720    LDKParseError_InvalidSegWitProgramLength,
8721    LDKParseError_InvalidPubKeyHashLength,
8722    LDKParseError_InvalidScriptHashLength,
8723    LDKParseError_InvalidRecoveryId,
8724    LDKParseError_InvalidSliceLength,
8725    /**
8726     * Not an error, but used internally to signal that a part of the invoice should be ignored
8727     * according to BOLT11
8728     */
8729    LDKParseError_Skip,
8730    /**
8731     * Must be last for serialization purposes
8732     */
8733    LDKParseError_Sentinel,
8734 } LDKParseError_Tag;
8735
8736 typedef struct MUST_USE_STRUCT LDKParseError {
8737    LDKParseError_Tag tag;
8738    union {
8739       struct {
8740          struct LDKBech32Error bech32_error;
8741       };
8742       struct {
8743          struct LDKError parse_amount_error;
8744       };
8745       struct {
8746          enum LDKSecp256k1Error malformed_signature;
8747       };
8748       struct {
8749          struct LDKError description_decode_error;
8750       };
8751       struct {
8752          struct LDKStr invalid_slice_length;
8753       };
8754    };
8755 } LDKParseError;
8756
8757 /**
8758  * The contents of CResult_SiPrefixParseErrorZ
8759  */
8760 typedef union LDKCResult_SiPrefixParseErrorZPtr {
8761    /**
8762     * A pointer to the contents in the success state.
8763     * Reading from this pointer when `result_ok` is not set is undefined.
8764     */
8765    enum LDKSiPrefix *result;
8766    /**
8767     * A pointer to the contents in the error state.
8768     * Reading from this pointer when `result_ok` is set is undefined.
8769     */
8770    struct LDKParseError *err;
8771 } LDKCResult_SiPrefixParseErrorZPtr;
8772
8773 /**
8774  * A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
8775  * containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
8776  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8777  */
8778 typedef struct LDKCResult_SiPrefixParseErrorZ {
8779    /**
8780     * The contents of this CResult_SiPrefixParseErrorZ, accessible via either
8781     * `err` or `result` depending on the state of `result_ok`.
8782     */
8783    union LDKCResult_SiPrefixParseErrorZPtr contents;
8784    /**
8785     * Whether this CResult_SiPrefixParseErrorZ represents a success state.
8786     */
8787    bool result_ok;
8788 } LDKCResult_SiPrefixParseErrorZ;
8789
8790
8791
8792 /**
8793  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
8794  *
8795  * There are three ways to construct an `Invoice`:
8796  *  1. using `InvoiceBuilder`
8797  *  2. using `Invoice::from_signed(SignedRawInvoice)`
8798  *  3. using `str::parse::<Invoice>(&str)`
8799  */
8800 typedef struct MUST_USE_STRUCT LDKInvoice {
8801    /**
8802     * A pointer to the opaque Rust object.
8803     * Nearly everywhere, inner must be non-null, however in places where
8804     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8805     */
8806    LDKnativeInvoice *inner;
8807    /**
8808     * Indicates that this is the only struct which contains the same pointer.
8809     * Rust functions which take ownership of an object provided via an argument require
8810     * this to be true and invalidate the object pointed to by inner.
8811     */
8812    bool is_owned;
8813 } LDKInvoice;
8814
8815 /**
8816  * Indicates that something went wrong while parsing or validating the invoice. Parsing errors
8817  * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors
8818  * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
8819  */
8820 typedef enum LDKParseOrSemanticError_Tag {
8821    /**
8822     * The invoice couldn't be decoded
8823     */
8824    LDKParseOrSemanticError_ParseError,
8825    /**
8826     * The invoice could be decoded but violates the BOLT11 standard
8827     */
8828    LDKParseOrSemanticError_SemanticError,
8829    /**
8830     * Must be last for serialization purposes
8831     */
8832    LDKParseOrSemanticError_Sentinel,
8833 } LDKParseOrSemanticError_Tag;
8834
8835 typedef struct MUST_USE_STRUCT LDKParseOrSemanticError {
8836    LDKParseOrSemanticError_Tag tag;
8837    union {
8838       struct {
8839          struct LDKParseError parse_error;
8840       };
8841       struct {
8842          enum LDKSemanticError semantic_error;
8843       };
8844    };
8845 } LDKParseOrSemanticError;
8846
8847 /**
8848  * The contents of CResult_InvoiceParseOrSemanticErrorZ
8849  */
8850 typedef union LDKCResult_InvoiceParseOrSemanticErrorZPtr {
8851    /**
8852     * A pointer to the contents in the success state.
8853     * Reading from this pointer when `result_ok` is not set is undefined.
8854     */
8855    struct LDKInvoice *result;
8856    /**
8857     * A pointer to the contents in the error state.
8858     * Reading from this pointer when `result_ok` is set is undefined.
8859     */
8860    struct LDKParseOrSemanticError *err;
8861 } LDKCResult_InvoiceParseOrSemanticErrorZPtr;
8862
8863 /**
8864  * A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
8865  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
8866  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8867  */
8868 typedef struct LDKCResult_InvoiceParseOrSemanticErrorZ {
8869    /**
8870     * The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
8871     * `err` or `result` depending on the state of `result_ok`.
8872     */
8873    union LDKCResult_InvoiceParseOrSemanticErrorZPtr contents;
8874    /**
8875     * Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
8876     */
8877    bool result_ok;
8878 } LDKCResult_InvoiceParseOrSemanticErrorZ;
8879
8880
8881
8882 /**
8883  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
8884  * invalid.
8885  *
8886  * # Invariants
8887  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
8888  */
8889 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
8890    /**
8891     * A pointer to the opaque Rust object.
8892     * Nearly everywhere, inner must be non-null, however in places where
8893     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8894     */
8895    LDKnativeSignedRawInvoice *inner;
8896    /**
8897     * Indicates that this is the only struct which contains the same pointer.
8898     * Rust functions which take ownership of an object provided via an argument require
8899     * this to be true and invalidate the object pointed to by inner.
8900     */
8901    bool is_owned;
8902 } LDKSignedRawInvoice;
8903
8904 /**
8905  * The contents of CResult_SignedRawInvoiceParseErrorZ
8906  */
8907 typedef union LDKCResult_SignedRawInvoiceParseErrorZPtr {
8908    /**
8909     * A pointer to the contents in the success state.
8910     * Reading from this pointer when `result_ok` is not set is undefined.
8911     */
8912    struct LDKSignedRawInvoice *result;
8913    /**
8914     * A pointer to the contents in the error state.
8915     * Reading from this pointer when `result_ok` is set is undefined.
8916     */
8917    struct LDKParseError *err;
8918 } LDKCResult_SignedRawInvoiceParseErrorZPtr;
8919
8920 /**
8921  * A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
8922  * containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
8923  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8924  */
8925 typedef struct LDKCResult_SignedRawInvoiceParseErrorZ {
8926    /**
8927     * The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
8928     * `err` or `result` depending on the state of `result_ok`.
8929     */
8930    union LDKCResult_SignedRawInvoiceParseErrorZPtr contents;
8931    /**
8932     * Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
8933     */
8934    bool result_ok;
8935 } LDKCResult_SignedRawInvoiceParseErrorZ;
8936
8937
8938
8939 /**
8940  * Represents an syntactically correct Invoice for a payment on the lightning network,
8941  * but without the signature information.
8942  * De- and encoding should not lead to information loss but may lead to different hashes.
8943  *
8944  * For methods without docs see the corresponding methods in `Invoice`.
8945  */
8946 typedef struct MUST_USE_STRUCT LDKRawInvoice {
8947    /**
8948     * A pointer to the opaque Rust object.
8949     * Nearly everywhere, inner must be non-null, however in places where
8950     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8951     */
8952    LDKnativeRawInvoice *inner;
8953    /**
8954     * Indicates that this is the only struct which contains the same pointer.
8955     * Rust functions which take ownership of an object provided via an argument require
8956     * this to be true and invalidate the object pointed to by inner.
8957     */
8958    bool is_owned;
8959 } LDKRawInvoice;
8960
8961
8962
8963 /**
8964  * Recoverable signature
8965  */
8966 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
8967    /**
8968     * A pointer to the opaque Rust object.
8969     * Nearly everywhere, inner must be non-null, however in places where
8970     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8971     */
8972    LDKnativeInvoiceSignature *inner;
8973    /**
8974     * Indicates that this is the only struct which contains the same pointer.
8975     * Rust functions which take ownership of an object provided via an argument require
8976     * this to be true and invalidate the object pointed to by inner.
8977     */
8978    bool is_owned;
8979 } LDKInvoiceSignature;
8980
8981 /**
8982  * A tuple of 3 elements. See the individual fields for the types contained.
8983  */
8984 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
8985    /**
8986     * The element at position 0
8987     */
8988    struct LDKRawInvoice a;
8989    /**
8990     * The element at position 1
8991     */
8992    struct LDKThirtyTwoBytes b;
8993    /**
8994     * The element at position 2
8995     */
8996    struct LDKInvoiceSignature c;
8997 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
8998
8999
9000
9001 /**
9002  * Payee public key
9003  */
9004 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
9005    /**
9006     * A pointer to the opaque Rust object.
9007     * Nearly everywhere, inner must be non-null, however in places where
9008     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9009     */
9010    LDKnativePayeePubKey *inner;
9011    /**
9012     * Indicates that this is the only struct which contains the same pointer.
9013     * Rust functions which take ownership of an object provided via an argument require
9014     * this to be true and invalidate the object pointed to by inner.
9015     */
9016    bool is_owned;
9017 } LDKPayeePubKey;
9018
9019 /**
9020  * The contents of CResult_PayeePubKeyErrorZ
9021  */
9022 typedef union LDKCResult_PayeePubKeyErrorZPtr {
9023    /**
9024     * A pointer to the contents in the success state.
9025     * Reading from this pointer when `result_ok` is not set is undefined.
9026     */
9027    struct LDKPayeePubKey *result;
9028    /**
9029     * A pointer to the contents in the error state.
9030     * Reading from this pointer when `result_ok` is set is undefined.
9031     */
9032    enum LDKSecp256k1Error *err;
9033 } LDKCResult_PayeePubKeyErrorZPtr;
9034
9035 /**
9036  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
9037  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
9038  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9039  */
9040 typedef struct LDKCResult_PayeePubKeyErrorZ {
9041    /**
9042     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
9043     * `err` or `result` depending on the state of `result_ok`.
9044     */
9045    union LDKCResult_PayeePubKeyErrorZPtr contents;
9046    /**
9047     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
9048     */
9049    bool result_ok;
9050 } LDKCResult_PayeePubKeyErrorZ;
9051
9052
9053
9054 /**
9055  * Private routing information
9056  *
9057  * # Invariants
9058  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
9059  *
9060  */
9061 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
9062    /**
9063     * A pointer to the opaque Rust object.
9064     * Nearly everywhere, inner must be non-null, however in places where
9065     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9066     */
9067    LDKnativePrivateRoute *inner;
9068    /**
9069     * Indicates that this is the only struct which contains the same pointer.
9070     * Rust functions which take ownership of an object provided via an argument require
9071     * this to be true and invalidate the object pointed to by inner.
9072     */
9073    bool is_owned;
9074 } LDKPrivateRoute;
9075
9076 /**
9077  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
9078  * This corresponds to std::vector in C++
9079  */
9080 typedef struct LDKCVec_PrivateRouteZ {
9081    /**
9082     * The elements in the array.
9083     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9084     */
9085    struct LDKPrivateRoute *data;
9086    /**
9087     * The number of elements pointed to by `data`.
9088     */
9089    uintptr_t datalen;
9090 } LDKCVec_PrivateRouteZ;
9091
9092
9093
9094 /**
9095  * A timestamp that refers to a date after 1 January 1970.
9096  *
9097  * # Invariants
9098  *
9099  * The Unix timestamp representing the stored time has to be positive and no greater than
9100  * [`MAX_TIMESTAMP`].
9101  */
9102 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
9103    /**
9104     * A pointer to the opaque Rust object.
9105     * Nearly everywhere, inner must be non-null, however in places where
9106     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9107     */
9108    LDKnativePositiveTimestamp *inner;
9109    /**
9110     * Indicates that this is the only struct which contains the same pointer.
9111     * Rust functions which take ownership of an object provided via an argument require
9112     * this to be true and invalidate the object pointed to by inner.
9113     */
9114    bool is_owned;
9115 } LDKPositiveTimestamp;
9116
9117 /**
9118  * The contents of CResult_PositiveTimestampCreationErrorZ
9119  */
9120 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
9121    /**
9122     * A pointer to the contents in the success state.
9123     * Reading from this pointer when `result_ok` is not set is undefined.
9124     */
9125    struct LDKPositiveTimestamp *result;
9126    /**
9127     * A pointer to the contents in the error state.
9128     * Reading from this pointer when `result_ok` is set is undefined.
9129     */
9130    enum LDKCreationError *err;
9131 } LDKCResult_PositiveTimestampCreationErrorZPtr;
9132
9133 /**
9134  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
9135  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
9136  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9137  */
9138 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
9139    /**
9140     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
9141     * `err` or `result` depending on the state of `result_ok`.
9142     */
9143    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
9144    /**
9145     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
9146     */
9147    bool result_ok;
9148 } LDKCResult_PositiveTimestampCreationErrorZ;
9149
9150 /**
9151  * The contents of CResult_NoneSemanticErrorZ
9152  */
9153 typedef union LDKCResult_NoneSemanticErrorZPtr {
9154    /**
9155     * Note that this value is always NULL, as there are no contents in the OK variant
9156     */
9157    void *result;
9158    /**
9159     * A pointer to the contents in the error state.
9160     * Reading from this pointer when `result_ok` is set is undefined.
9161     */
9162    enum LDKSemanticError *err;
9163 } LDKCResult_NoneSemanticErrorZPtr;
9164
9165 /**
9166  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
9167  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
9168  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9169  */
9170 typedef struct LDKCResult_NoneSemanticErrorZ {
9171    /**
9172     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
9173     * `err` or `result` depending on the state of `result_ok`.
9174     */
9175    union LDKCResult_NoneSemanticErrorZPtr contents;
9176    /**
9177     * Whether this CResult_NoneSemanticErrorZ represents a success state.
9178     */
9179    bool result_ok;
9180 } LDKCResult_NoneSemanticErrorZ;
9181
9182 /**
9183  * The contents of CResult_InvoiceSemanticErrorZ
9184  */
9185 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
9186    /**
9187     * A pointer to the contents in the success state.
9188     * Reading from this pointer when `result_ok` is not set is undefined.
9189     */
9190    struct LDKInvoice *result;
9191    /**
9192     * A pointer to the contents in the error state.
9193     * Reading from this pointer when `result_ok` is set is undefined.
9194     */
9195    enum LDKSemanticError *err;
9196 } LDKCResult_InvoiceSemanticErrorZPtr;
9197
9198 /**
9199  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
9200  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
9201  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9202  */
9203 typedef struct LDKCResult_InvoiceSemanticErrorZ {
9204    /**
9205     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
9206     * `err` or `result` depending on the state of `result_ok`.
9207     */
9208    union LDKCResult_InvoiceSemanticErrorZPtr contents;
9209    /**
9210     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
9211     */
9212    bool result_ok;
9213 } LDKCResult_InvoiceSemanticErrorZ;
9214
9215
9216
9217 /**
9218  * Description string
9219  *
9220  * # Invariants
9221  * The description can be at most 639 __bytes__ long
9222  */
9223 typedef struct MUST_USE_STRUCT LDKDescription {
9224    /**
9225     * A pointer to the opaque Rust object.
9226     * Nearly everywhere, inner must be non-null, however in places where
9227     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9228     */
9229    LDKnativeDescription *inner;
9230    /**
9231     * Indicates that this is the only struct which contains the same pointer.
9232     * Rust functions which take ownership of an object provided via an argument require
9233     * this to be true and invalidate the object pointed to by inner.
9234     */
9235    bool is_owned;
9236 } LDKDescription;
9237
9238 /**
9239  * The contents of CResult_DescriptionCreationErrorZ
9240  */
9241 typedef union LDKCResult_DescriptionCreationErrorZPtr {
9242    /**
9243     * A pointer to the contents in the success state.
9244     * Reading from this pointer when `result_ok` is not set is undefined.
9245     */
9246    struct LDKDescription *result;
9247    /**
9248     * A pointer to the contents in the error state.
9249     * Reading from this pointer when `result_ok` is set is undefined.
9250     */
9251    enum LDKCreationError *err;
9252 } LDKCResult_DescriptionCreationErrorZPtr;
9253
9254 /**
9255  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
9256  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
9257  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9258  */
9259 typedef struct LDKCResult_DescriptionCreationErrorZ {
9260    /**
9261     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
9262     * `err` or `result` depending on the state of `result_ok`.
9263     */
9264    union LDKCResult_DescriptionCreationErrorZPtr contents;
9265    /**
9266     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
9267     */
9268    bool result_ok;
9269 } LDKCResult_DescriptionCreationErrorZ;
9270
9271 /**
9272  * The contents of CResult_PrivateRouteCreationErrorZ
9273  */
9274 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
9275    /**
9276     * A pointer to the contents in the success state.
9277     * Reading from this pointer when `result_ok` is not set is undefined.
9278     */
9279    struct LDKPrivateRoute *result;
9280    /**
9281     * A pointer to the contents in the error state.
9282     * Reading from this pointer when `result_ok` is set is undefined.
9283     */
9284    enum LDKCreationError *err;
9285 } LDKCResult_PrivateRouteCreationErrorZPtr;
9286
9287 /**
9288  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
9289  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
9290  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9291  */
9292 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
9293    /**
9294     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
9295     * `err` or `result` depending on the state of `result_ok`.
9296     */
9297    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
9298    /**
9299     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
9300     */
9301    bool result_ok;
9302 } LDKCResult_PrivateRouteCreationErrorZ;
9303
9304 /**
9305  * The contents of CResult_StringErrorZ
9306  */
9307 typedef union LDKCResult_StringErrorZPtr {
9308    /**
9309     * A pointer to the contents in the success state.
9310     * Reading from this pointer when `result_ok` is not set is undefined.
9311     */
9312    struct LDKStr *result;
9313    /**
9314     * A pointer to the contents in the error state.
9315     * Reading from this pointer when `result_ok` is set is undefined.
9316     */
9317    enum LDKSecp256k1Error *err;
9318 } LDKCResult_StringErrorZPtr;
9319
9320 /**
9321  * A CResult_StringErrorZ represents the result of a fallible operation,
9322  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
9323  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9324  */
9325 typedef struct LDKCResult_StringErrorZ {
9326    /**
9327     * The contents of this CResult_StringErrorZ, accessible via either
9328     * `err` or `result` depending on the state of `result_ok`.
9329     */
9330    union LDKCResult_StringErrorZPtr contents;
9331    /**
9332     * Whether this CResult_StringErrorZ represents a success state.
9333     */
9334    bool result_ok;
9335 } LDKCResult_StringErrorZ;
9336
9337 /**
9338  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
9339  */
9340 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
9341    /**
9342     * A pointer to the contents in the success state.
9343     * Reading from this pointer when `result_ok` is not set is undefined.
9344     */
9345    struct LDKChannelMonitorUpdate *result;
9346    /**
9347     * A pointer to the contents in the error state.
9348     * Reading from this pointer when `result_ok` is set is undefined.
9349     */
9350    struct LDKDecodeError *err;
9351 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
9352
9353 /**
9354  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
9355  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9356  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9357  */
9358 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
9359    /**
9360     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
9361     * `err` or `result` depending on the state of `result_ok`.
9362     */
9363    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
9364    /**
9365     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
9366     */
9367    bool result_ok;
9368 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
9369
9370 /**
9371  * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
9372  */
9373 typedef enum LDKCOption_MonitorEventZ_Tag {
9374    /**
9375     * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
9376     */
9377    LDKCOption_MonitorEventZ_Some,
9378    /**
9379     * When we're in this state, this COption_MonitorEventZ contains nothing
9380     */
9381    LDKCOption_MonitorEventZ_None,
9382    /**
9383     * Must be last for serialization purposes
9384     */
9385    LDKCOption_MonitorEventZ_Sentinel,
9386 } LDKCOption_MonitorEventZ_Tag;
9387
9388 typedef struct LDKCOption_MonitorEventZ {
9389    LDKCOption_MonitorEventZ_Tag tag;
9390    union {
9391       struct {
9392          struct LDKMonitorEvent some;
9393       };
9394    };
9395 } LDKCOption_MonitorEventZ;
9396
9397 /**
9398  * The contents of CResult_COption_MonitorEventZDecodeErrorZ
9399  */
9400 typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr {
9401    /**
9402     * A pointer to the contents in the success state.
9403     * Reading from this pointer when `result_ok` is not set is undefined.
9404     */
9405    struct LDKCOption_MonitorEventZ *result;
9406    /**
9407     * A pointer to the contents in the error state.
9408     * Reading from this pointer when `result_ok` is set is undefined.
9409     */
9410    struct LDKDecodeError *err;
9411 } LDKCResult_COption_MonitorEventZDecodeErrorZPtr;
9412
9413 /**
9414  * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
9415  * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9416  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9417  */
9418 typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ {
9419    /**
9420     * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
9421     * `err` or `result` depending on the state of `result_ok`.
9422     */
9423    union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents;
9424    /**
9425     * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
9426     */
9427    bool result_ok;
9428 } LDKCResult_COption_MonitorEventZDecodeErrorZ;
9429
9430 /**
9431  * The contents of CResult_HTLCUpdateDecodeErrorZ
9432  */
9433 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
9434    /**
9435     * A pointer to the contents in the success state.
9436     * Reading from this pointer when `result_ok` is not set is undefined.
9437     */
9438    struct LDKHTLCUpdate *result;
9439    /**
9440     * A pointer to the contents in the error state.
9441     * Reading from this pointer when `result_ok` is set is undefined.
9442     */
9443    struct LDKDecodeError *err;
9444 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
9445
9446 /**
9447  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
9448  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9449  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9450  */
9451 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
9452    /**
9453     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
9454     * `err` or `result` depending on the state of `result_ok`.
9455     */
9456    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
9457    /**
9458     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
9459     */
9460    bool result_ok;
9461 } LDKCResult_HTLCUpdateDecodeErrorZ;
9462
9463 /**
9464  * A tuple of 2 elements. See the individual fields for the types contained.
9465  */
9466 typedef struct LDKC2Tuple_OutPointScriptZ {
9467    /**
9468     * The element at position 0
9469     */
9470    struct LDKOutPoint a;
9471    /**
9472     * The element at position 1
9473     */
9474    struct LDKCVec_u8Z b;
9475 } LDKC2Tuple_OutPointScriptZ;
9476
9477 /**
9478  * A tuple of 2 elements. See the individual fields for the types contained.
9479  */
9480 typedef struct LDKC2Tuple_u32ScriptZ {
9481    /**
9482     * The element at position 0
9483     */
9484    uint32_t a;
9485    /**
9486     * The element at position 1
9487     */
9488    struct LDKCVec_u8Z b;
9489 } LDKC2Tuple_u32ScriptZ;
9490
9491 /**
9492  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
9493  * This corresponds to std::vector in C++
9494  */
9495 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
9496    /**
9497     * The elements in the array.
9498     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9499     */
9500    struct LDKC2Tuple_u32ScriptZ *data;
9501    /**
9502     * The number of elements pointed to by `data`.
9503     */
9504    uintptr_t datalen;
9505 } LDKCVec_C2Tuple_u32ScriptZZ;
9506
9507 /**
9508  * A tuple of 2 elements. See the individual fields for the types contained.
9509  */
9510 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9511    /**
9512     * The element at position 0
9513     */
9514    struct LDKThirtyTwoBytes a;
9515    /**
9516     * The element at position 1
9517     */
9518    struct LDKCVec_C2Tuple_u32ScriptZZ b;
9519 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
9520
9521 /**
9522  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
9523  * This corresponds to std::vector in C++
9524  */
9525 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9526    /**
9527     * The elements in the array.
9528     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9529     */
9530    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
9531    /**
9532     * The number of elements pointed to by `data`.
9533     */
9534    uintptr_t datalen;
9535 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
9536
9537 /**
9538  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
9539  * This corresponds to std::vector in C++
9540  */
9541 typedef struct LDKCVec_EventZ {
9542    /**
9543     * The elements in the array.
9544     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9545     */
9546    struct LDKEvent *data;
9547    /**
9548     * The number of elements pointed to by `data`.
9549     */
9550    uintptr_t datalen;
9551 } LDKCVec_EventZ;
9552
9553 /**
9554  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
9555  * This corresponds to std::vector in C++
9556  */
9557 typedef struct LDKCVec_TransactionZ {
9558    /**
9559     * The elements in the array.
9560     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9561     */
9562    struct LDKTransaction *data;
9563    /**
9564     * The number of elements pointed to by `data`.
9565     */
9566    uintptr_t datalen;
9567 } LDKCVec_TransactionZ;
9568
9569 /**
9570  * A tuple of 2 elements. See the individual fields for the types contained.
9571  */
9572 typedef struct LDKC2Tuple_u32TxOutZ {
9573    /**
9574     * The element at position 0
9575     */
9576    uint32_t a;
9577    /**
9578     * The element at position 1
9579     */
9580    struct LDKTxOut b;
9581 } LDKC2Tuple_u32TxOutZ;
9582
9583 /**
9584  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
9585  * This corresponds to std::vector in C++
9586  */
9587 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
9588    /**
9589     * The elements in the array.
9590     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9591     */
9592    struct LDKC2Tuple_u32TxOutZ *data;
9593    /**
9594     * The number of elements pointed to by `data`.
9595     */
9596    uintptr_t datalen;
9597 } LDKCVec_C2Tuple_u32TxOutZZ;
9598
9599 /**
9600  * A tuple of 2 elements. See the individual fields for the types contained.
9601  */
9602 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9603    /**
9604     * The element at position 0
9605     */
9606    struct LDKThirtyTwoBytes a;
9607    /**
9608     * The element at position 1
9609     */
9610    struct LDKCVec_C2Tuple_u32TxOutZZ b;
9611 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
9612
9613 /**
9614  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
9615  * This corresponds to std::vector in C++
9616  */
9617 typedef struct LDKCVec_TransactionOutputsZ {
9618    /**
9619     * The elements in the array.
9620     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9621     */
9622    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
9623    /**
9624     * The number of elements pointed to by `data`.
9625     */
9626    uintptr_t datalen;
9627 } LDKCVec_TransactionOutputsZ;
9628
9629 /**
9630  * Details about the balance(s) available for spending once the channel appears on chain.
9631  *
9632  * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
9633  * be provided.
9634  */
9635 typedef enum LDKBalance_Tag {
9636    /**
9637     * The channel is not yet closed (or the commitment or closing transaction has not yet
9638     * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
9639     * force-closed now.
9640     */
9641    LDKBalance_ClaimableOnChannelClose,
9642    /**
9643     * The channel has been closed, and the given balance is ours but awaiting confirmations until
9644     * we consider it spendable.
9645     */
9646    LDKBalance_ClaimableAwaitingConfirmations,
9647    /**
9648     * The channel has been closed, and the given balance should be ours but awaiting spending
9649     * transaction confirmation. If the spending transaction does not confirm in time, it is
9650     * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
9651     *
9652     * Once the spending transaction confirms, before it has reached enough confirmations to be
9653     * considered safe from chain reorganizations, the balance will instead be provided via
9654     * [`Balance::ClaimableAwaitingConfirmations`].
9655     */
9656    LDKBalance_ContentiousClaimable,
9657    /**
9658     * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
9659     * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
9660     * likely to be claimed by our counterparty before we do.
9661     */
9662    LDKBalance_MaybeTimeoutClaimableHTLC,
9663    /**
9664     * HTLCs which we received from our counterparty which are claimable with a preimage which we
9665     * do not currently have. This will only be claimable if we receive the preimage from the node
9666     * to which we forwarded this HTLC before the timeout.
9667     */
9668    LDKBalance_MaybePreimageClaimableHTLC,
9669    /**
9670     * The channel has been closed, and our counterparty broadcasted a revoked commitment
9671     * transaction.
9672     *
9673     * Thus, we're able to claim all outputs in the commitment transaction, one of which has the
9674     * following amount.
9675     */
9676    LDKBalance_CounterpartyRevokedOutputClaimable,
9677    /**
9678     * Must be last for serialization purposes
9679     */
9680    LDKBalance_Sentinel,
9681 } LDKBalance_Tag;
9682
9683 typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
9684    /**
9685     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
9686     * required to do so.
9687     */
9688    uint64_t claimable_amount_satoshis;
9689 } LDKBalance_LDKClaimableOnChannelClose_Body;
9690
9691 typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
9692    /**
9693     * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
9694     * were spent in broadcasting the transaction.
9695     */
9696    uint64_t claimable_amount_satoshis;
9697    /**
9698     * The height at which an [`Event::SpendableOutputs`] event will be generated for this
9699     * amount.
9700     */
9701    uint32_t confirmation_height;
9702 } LDKBalance_LDKClaimableAwaitingConfirmations_Body;
9703
9704 typedef struct LDKBalance_LDKContentiousClaimable_Body {
9705    /**
9706     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
9707     * required to do so.
9708     */
9709    uint64_t claimable_amount_satoshis;
9710    /**
9711     * The height at which the counterparty may be able to claim the balance if we have not
9712     * done so.
9713     */
9714    uint32_t timeout_height;
9715 } LDKBalance_LDKContentiousClaimable_Body;
9716
9717 typedef struct LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body {
9718    /**
9719     * The amount potentially available to claim, in satoshis, excluding the on-chain fees
9720     * which will be required to do so.
9721     */
9722    uint64_t claimable_amount_satoshis;
9723    /**
9724     * The height at which we will be able to claim the balance if our counterparty has not
9725     * done so.
9726     */
9727    uint32_t claimable_height;
9728 } LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body;
9729
9730 typedef struct LDKBalance_LDKMaybePreimageClaimableHTLC_Body {
9731    /**
9732     * The amount potentially available to claim, in satoshis, excluding the on-chain fees
9733     * which will be required to do so.
9734     */
9735    uint64_t claimable_amount_satoshis;
9736    /**
9737     * The height at which our counterparty will be able to claim the balance if we have not
9738     * yet received the preimage and claimed it ourselves.
9739     */
9740    uint32_t expiry_height;
9741 } LDKBalance_LDKMaybePreimageClaimableHTLC_Body;
9742
9743 typedef struct LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body {
9744    /**
9745     * The amount, in satoshis, of the output which we can claim.
9746     *
9747     * Note that for outputs from HTLC balances this may be excluding some on-chain fees that
9748     * were already spent.
9749     */
9750    uint64_t claimable_amount_satoshis;
9751 } LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body;
9752
9753 typedef struct MUST_USE_STRUCT LDKBalance {
9754    LDKBalance_Tag tag;
9755    union {
9756       LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
9757       LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
9758       LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
9759       LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body maybe_timeout_claimable_htlc;
9760       LDKBalance_LDKMaybePreimageClaimableHTLC_Body maybe_preimage_claimable_htlc;
9761       LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body counterparty_revoked_output_claimable;
9762    };
9763 } LDKBalance;
9764
9765 /**
9766  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
9767  * This corresponds to std::vector in C++
9768  */
9769 typedef struct LDKCVec_BalanceZ {
9770    /**
9771     * The elements in the array.
9772     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9773     */
9774    struct LDKBalance *data;
9775    /**
9776     * The number of elements pointed to by `data`.
9777     */
9778    uintptr_t datalen;
9779 } LDKCVec_BalanceZ;
9780
9781 /**
9782  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
9783  */
9784 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9785    /**
9786     * A pointer to the contents in the success state.
9787     * Reading from this pointer when `result_ok` is not set is undefined.
9788     */
9789    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
9790    /**
9791     * A pointer to the contents in the error state.
9792     * Reading from this pointer when `result_ok` is set is undefined.
9793     */
9794    struct LDKDecodeError *err;
9795 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
9796
9797 /**
9798  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
9799  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9800  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9801  */
9802 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9803    /**
9804     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
9805     * `err` or `result` depending on the state of `result_ok`.
9806     */
9807    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
9808    /**
9809     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
9810     */
9811    bool result_ok;
9812 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
9813
9814 /**
9815  * A tuple of 2 elements. See the individual fields for the types contained.
9816  */
9817 typedef struct LDKC2Tuple_PublicKeyTypeZ {
9818    /**
9819     * The element at position 0
9820     */
9821    struct LDKPublicKey a;
9822    /**
9823     * The element at position 1
9824     */
9825    struct LDKType b;
9826 } LDKC2Tuple_PublicKeyTypeZ;
9827
9828 /**
9829  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
9830  * This corresponds to std::vector in C++
9831  */
9832 typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
9833    /**
9834     * The elements in the array.
9835     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9836     */
9837    struct LDKC2Tuple_PublicKeyTypeZ *data;
9838    /**
9839     * The number of elements pointed to by `data`.
9840     */
9841    uintptr_t datalen;
9842 } LDKCVec_C2Tuple_PublicKeyTypeZZ;
9843
9844 /**
9845  * The contents of a custom onion message.
9846  */
9847 typedef struct LDKCustomOnionMessageContents {
9848    /**
9849     * An opaque pointer which is passed to your function implementations as an argument.
9850     * This has no meaning in the LDK, and can be NULL or any other value.
9851     */
9852    void *this_arg;
9853    /**
9854     * Returns the TLV type identifying the message contents. MUST be >= 64.
9855     */
9856    uint64_t (*tlv_type)(const void *this_arg);
9857    /**
9858     * Serialize the object into a byte array
9859     */
9860    struct LDKCVec_u8Z (*write)(const void *this_arg);
9861    /**
9862     * Frees any resources associated with this object given its this_arg pointer.
9863     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9864     */
9865    void (*free)(void *this_arg);
9866 } LDKCustomOnionMessageContents;
9867
9868 /**
9869  * An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
9870  */
9871 typedef enum LDKCOption_CustomOnionMessageContentsZ_Tag {
9872    /**
9873     * When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
9874     */
9875    LDKCOption_CustomOnionMessageContentsZ_Some,
9876    /**
9877     * When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
9878     */
9879    LDKCOption_CustomOnionMessageContentsZ_None,
9880    /**
9881     * Must be last for serialization purposes
9882     */
9883    LDKCOption_CustomOnionMessageContentsZ_Sentinel,
9884 } LDKCOption_CustomOnionMessageContentsZ_Tag;
9885
9886 typedef struct LDKCOption_CustomOnionMessageContentsZ {
9887    LDKCOption_CustomOnionMessageContentsZ_Tag tag;
9888    union {
9889       struct {
9890          struct LDKCustomOnionMessageContents some;
9891       };
9892    };
9893 } LDKCOption_CustomOnionMessageContentsZ;
9894
9895 /**
9896  * The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
9897  */
9898 typedef union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
9899    /**
9900     * A pointer to the contents in the success state.
9901     * Reading from this pointer when `result_ok` is not set is undefined.
9902     */
9903    struct LDKCOption_CustomOnionMessageContentsZ *result;
9904    /**
9905     * A pointer to the contents in the error state.
9906     * Reading from this pointer when `result_ok` is set is undefined.
9907     */
9908    struct LDKDecodeError *err;
9909 } LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr;
9910
9911 /**
9912  * A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
9913  * containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9914  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9915  */
9916 typedef struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
9917    /**
9918     * The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
9919     * `err` or `result` depending on the state of `result_ok`.
9920     */
9921    union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr contents;
9922    /**
9923     * Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
9924     */
9925    bool result_ok;
9926 } LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ;
9927
9928 /**
9929  * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
9930  */
9931 typedef enum LDKCOption_NetAddressZ_Tag {
9932    /**
9933     * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
9934     */
9935    LDKCOption_NetAddressZ_Some,
9936    /**
9937     * When we're in this state, this COption_NetAddressZ contains nothing
9938     */
9939    LDKCOption_NetAddressZ_None,
9940    /**
9941     * Must be last for serialization purposes
9942     */
9943    LDKCOption_NetAddressZ_Sentinel,
9944 } LDKCOption_NetAddressZ_Tag;
9945
9946 typedef struct LDKCOption_NetAddressZ {
9947    LDKCOption_NetAddressZ_Tag tag;
9948    union {
9949       struct {
9950          struct LDKNetAddress some;
9951       };
9952    };
9953 } LDKCOption_NetAddressZ;
9954
9955
9956
9957 /**
9958  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
9959  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
9960  * descriptor.
9961  */
9962 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
9963    /**
9964     * A pointer to the opaque Rust object.
9965     * Nearly everywhere, inner must be non-null, however in places where
9966     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9967     */
9968    LDKnativePeerHandleError *inner;
9969    /**
9970     * Indicates that this is the only struct which contains the same pointer.
9971     * Rust functions which take ownership of an object provided via an argument require
9972     * this to be true and invalidate the object pointed to by inner.
9973     */
9974    bool is_owned;
9975 } LDKPeerHandleError;
9976
9977 /**
9978  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
9979  */
9980 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
9981    /**
9982     * A pointer to the contents in the success state.
9983     * Reading from this pointer when `result_ok` is not set is undefined.
9984     */
9985    struct LDKCVec_u8Z *result;
9986    /**
9987     * A pointer to the contents in the error state.
9988     * Reading from this pointer when `result_ok` is set is undefined.
9989     */
9990    struct LDKPeerHandleError *err;
9991 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
9992
9993 /**
9994  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
9995  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9996  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9997  */
9998 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
9999    /**
10000     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
10001     * `err` or `result` depending on the state of `result_ok`.
10002     */
10003    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
10004    /**
10005     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
10006     */
10007    bool result_ok;
10008 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
10009
10010 /**
10011  * The contents of CResult_NonePeerHandleErrorZ
10012  */
10013 typedef union LDKCResult_NonePeerHandleErrorZPtr {
10014    /**
10015     * Note that this value is always NULL, as there are no contents in the OK variant
10016     */
10017    void *result;
10018    /**
10019     * A pointer to the contents in the error state.
10020     * Reading from this pointer when `result_ok` is set is undefined.
10021     */
10022    struct LDKPeerHandleError *err;
10023 } LDKCResult_NonePeerHandleErrorZPtr;
10024
10025 /**
10026  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
10027  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10028  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10029  */
10030 typedef struct LDKCResult_NonePeerHandleErrorZ {
10031    /**
10032     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
10033     * `err` or `result` depending on the state of `result_ok`.
10034     */
10035    union LDKCResult_NonePeerHandleErrorZPtr contents;
10036    /**
10037     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
10038     */
10039    bool result_ok;
10040 } LDKCResult_NonePeerHandleErrorZ;
10041
10042 /**
10043  * The contents of CResult_boolPeerHandleErrorZ
10044  */
10045 typedef union LDKCResult_boolPeerHandleErrorZPtr {
10046    /**
10047     * A pointer to the contents in the success state.
10048     * Reading from this pointer when `result_ok` is not set is undefined.
10049     */
10050    bool *result;
10051    /**
10052     * A pointer to the contents in the error state.
10053     * Reading from this pointer when `result_ok` is set is undefined.
10054     */
10055    struct LDKPeerHandleError *err;
10056 } LDKCResult_boolPeerHandleErrorZPtr;
10057
10058 /**
10059  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
10060  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10061  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10062  */
10063 typedef struct LDKCResult_boolPeerHandleErrorZ {
10064    /**
10065     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
10066     * `err` or `result` depending on the state of `result_ok`.
10067     */
10068    union LDKCResult_boolPeerHandleErrorZPtr contents;
10069    /**
10070     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
10071     */
10072    bool result_ok;
10073 } LDKCResult_boolPeerHandleErrorZ;
10074
10075 /**
10076  * Errors that may occur when [sending an onion message].
10077  *
10078  * [sending an onion message]: OnionMessenger::send_custom_onion_message
10079  */
10080 typedef enum LDKSendError_Tag {
10081    /**
10082     * Errored computing onion message packet keys.
10083     */
10084    LDKSendError_Secp256k1,
10085    /**
10086     * Because implementations such as Eclair will drop onion messages where the message packet
10087     * exceeds 32834 bytes, we refuse to send messages where the packet exceeds this size.
10088     */
10089    LDKSendError_TooBigPacket,
10090    /**
10091     * The provided [`Destination`] was an invalid [`BlindedRoute`], due to having fewer than two
10092     * blinded hops.
10093     */
10094    LDKSendError_TooFewBlindedHops,
10095    /**
10096     * Our next-hop peer was offline or does not support onion message forwarding.
10097     */
10098    LDKSendError_InvalidFirstHop,
10099    /**
10100     * Onion message contents must have a TLV type >= 64.
10101     */
10102    LDKSendError_InvalidMessage,
10103    /**
10104     * Our next-hop peer's buffer was full or our total outbound buffer was full.
10105     */
10106    LDKSendError_BufferFull,
10107    /**
10108     * Must be last for serialization purposes
10109     */
10110    LDKSendError_Sentinel,
10111 } LDKSendError_Tag;
10112
10113 typedef struct MUST_USE_STRUCT LDKSendError {
10114    LDKSendError_Tag tag;
10115    union {
10116       struct {
10117          enum LDKSecp256k1Error secp256k1;
10118       };
10119    };
10120 } LDKSendError;
10121
10122 /**
10123  * The contents of CResult_NoneSendErrorZ
10124  */
10125 typedef union LDKCResult_NoneSendErrorZPtr {
10126    /**
10127     * Note that this value is always NULL, as there are no contents in the OK variant
10128     */
10129    void *result;
10130    /**
10131     * A pointer to the contents in the error state.
10132     * Reading from this pointer when `result_ok` is set is undefined.
10133     */
10134    struct LDKSendError *err;
10135 } LDKCResult_NoneSendErrorZPtr;
10136
10137 /**
10138  * A CResult_NoneSendErrorZ represents the result of a fallible operation,
10139  * containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
10140  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10141  */
10142 typedef struct LDKCResult_NoneSendErrorZ {
10143    /**
10144     * The contents of this CResult_NoneSendErrorZ, accessible via either
10145     * `err` or `result` depending on the state of `result_ok`.
10146     */
10147    union LDKCResult_NoneSendErrorZPtr contents;
10148    /**
10149     * Whether this CResult_NoneSendErrorZ represents a success state.
10150     */
10151    bool result_ok;
10152 } LDKCResult_NoneSendErrorZ;
10153
10154 /**
10155  * All-encompassing standard error type that processing can return
10156  */
10157 typedef enum LDKGraphSyncError_Tag {
10158    /**
10159     * Error trying to read the update data, typically due to an erroneous data length indication
10160     * that is greater than the actual amount of data provided
10161     */
10162    LDKGraphSyncError_DecodeError,
10163    /**
10164     * Error applying the patch to the network graph, usually the result of updates that are too
10165     * old or missing prerequisite data to the application of updates out of order
10166     */
10167    LDKGraphSyncError_LightningError,
10168    /**
10169     * Must be last for serialization purposes
10170     */
10171    LDKGraphSyncError_Sentinel,
10172 } LDKGraphSyncError_Tag;
10173
10174 typedef struct MUST_USE_STRUCT LDKGraphSyncError {
10175    LDKGraphSyncError_Tag tag;
10176    union {
10177       struct {
10178          struct LDKDecodeError decode_error;
10179       };
10180       struct {
10181          struct LDKLightningError lightning_error;
10182       };
10183    };
10184 } LDKGraphSyncError;
10185
10186 /**
10187  * The contents of CResult_u32GraphSyncErrorZ
10188  */
10189 typedef union LDKCResult_u32GraphSyncErrorZPtr {
10190    /**
10191     * A pointer to the contents in the success state.
10192     * Reading from this pointer when `result_ok` is not set is undefined.
10193     */
10194    uint32_t *result;
10195    /**
10196     * A pointer to the contents in the error state.
10197     * Reading from this pointer when `result_ok` is set is undefined.
10198     */
10199    struct LDKGraphSyncError *err;
10200 } LDKCResult_u32GraphSyncErrorZPtr;
10201
10202 /**
10203  * A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
10204  * containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
10205  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10206  */
10207 typedef struct LDKCResult_u32GraphSyncErrorZ {
10208    /**
10209     * The contents of this CResult_u32GraphSyncErrorZ, accessible via either
10210     * `err` or `result` depending on the state of `result_ok`.
10211     */
10212    union LDKCResult_u32GraphSyncErrorZPtr contents;
10213    /**
10214     * Whether this CResult_u32GraphSyncErrorZ represents a success state.
10215     */
10216    bool result_ok;
10217 } LDKCResult_u32GraphSyncErrorZ;
10218
10219 /**
10220  * The contents of CResult_NetAddressDecodeErrorZ
10221  */
10222 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
10223    /**
10224     * A pointer to the contents in the success state.
10225     * Reading from this pointer when `result_ok` is not set is undefined.
10226     */
10227    struct LDKNetAddress *result;
10228    /**
10229     * A pointer to the contents in the error state.
10230     * Reading from this pointer when `result_ok` is set is undefined.
10231     */
10232    struct LDKDecodeError *err;
10233 } LDKCResult_NetAddressDecodeErrorZPtr;
10234
10235 /**
10236  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
10237  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
10238  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10239  */
10240 typedef struct LDKCResult_NetAddressDecodeErrorZ {
10241    /**
10242     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
10243     * `err` or `result` depending on the state of `result_ok`.
10244     */
10245    union LDKCResult_NetAddressDecodeErrorZPtr contents;
10246    /**
10247     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
10248     */
10249    bool result_ok;
10250 } LDKCResult_NetAddressDecodeErrorZ;
10251
10252
10253
10254 /**
10255  * An update_add_htlc message to be sent or received from a peer
10256  */
10257 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
10258    /**
10259     * A pointer to the opaque Rust object.
10260     * Nearly everywhere, inner must be non-null, however in places where
10261     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10262     */
10263    LDKnativeUpdateAddHTLC *inner;
10264    /**
10265     * Indicates that this is the only struct which contains the same pointer.
10266     * Rust functions which take ownership of an object provided via an argument require
10267     * this to be true and invalidate the object pointed to by inner.
10268     */
10269    bool is_owned;
10270 } LDKUpdateAddHTLC;
10271
10272 /**
10273  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
10274  * This corresponds to std::vector in C++
10275  */
10276 typedef struct LDKCVec_UpdateAddHTLCZ {
10277    /**
10278     * The elements in the array.
10279     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10280     */
10281    struct LDKUpdateAddHTLC *data;
10282    /**
10283     * The number of elements pointed to by `data`.
10284     */
10285    uintptr_t datalen;
10286 } LDKCVec_UpdateAddHTLCZ;
10287
10288
10289
10290 /**
10291  * An update_fulfill_htlc message to be sent or received from a peer
10292  */
10293 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
10294    /**
10295     * A pointer to the opaque Rust object.
10296     * Nearly everywhere, inner must be non-null, however in places where
10297     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10298     */
10299    LDKnativeUpdateFulfillHTLC *inner;
10300    /**
10301     * Indicates that this is the only struct which contains the same pointer.
10302     * Rust functions which take ownership of an object provided via an argument require
10303     * this to be true and invalidate the object pointed to by inner.
10304     */
10305    bool is_owned;
10306 } LDKUpdateFulfillHTLC;
10307
10308 /**
10309  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
10310  * This corresponds to std::vector in C++
10311  */
10312 typedef struct LDKCVec_UpdateFulfillHTLCZ {
10313    /**
10314     * The elements in the array.
10315     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10316     */
10317    struct LDKUpdateFulfillHTLC *data;
10318    /**
10319     * The number of elements pointed to by `data`.
10320     */
10321    uintptr_t datalen;
10322 } LDKCVec_UpdateFulfillHTLCZ;
10323
10324
10325
10326 /**
10327  * An update_fail_htlc message to be sent or received from a peer
10328  */
10329 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
10330    /**
10331     * A pointer to the opaque Rust object.
10332     * Nearly everywhere, inner must be non-null, however in places where
10333     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10334     */
10335    LDKnativeUpdateFailHTLC *inner;
10336    /**
10337     * Indicates that this is the only struct which contains the same pointer.
10338     * Rust functions which take ownership of an object provided via an argument require
10339     * this to be true and invalidate the object pointed to by inner.
10340     */
10341    bool is_owned;
10342 } LDKUpdateFailHTLC;
10343
10344 /**
10345  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
10346  * This corresponds to std::vector in C++
10347  */
10348 typedef struct LDKCVec_UpdateFailHTLCZ {
10349    /**
10350     * The elements in the array.
10351     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10352     */
10353    struct LDKUpdateFailHTLC *data;
10354    /**
10355     * The number of elements pointed to by `data`.
10356     */
10357    uintptr_t datalen;
10358 } LDKCVec_UpdateFailHTLCZ;
10359
10360
10361
10362 /**
10363  * An update_fail_malformed_htlc message to be sent or received from a peer
10364  */
10365 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
10366    /**
10367     * A pointer to the opaque Rust object.
10368     * Nearly everywhere, inner must be non-null, however in places where
10369     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10370     */
10371    LDKnativeUpdateFailMalformedHTLC *inner;
10372    /**
10373     * Indicates that this is the only struct which contains the same pointer.
10374     * Rust functions which take ownership of an object provided via an argument require
10375     * this to be true and invalidate the object pointed to by inner.
10376     */
10377    bool is_owned;
10378 } LDKUpdateFailMalformedHTLC;
10379
10380 /**
10381  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
10382  * This corresponds to std::vector in C++
10383  */
10384 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
10385    /**
10386     * The elements in the array.
10387     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10388     */
10389    struct LDKUpdateFailMalformedHTLC *data;
10390    /**
10391     * The number of elements pointed to by `data`.
10392     */
10393    uintptr_t datalen;
10394 } LDKCVec_UpdateFailMalformedHTLCZ;
10395
10396 /**
10397  * The contents of CResult_AcceptChannelDecodeErrorZ
10398  */
10399 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
10400    /**
10401     * A pointer to the contents in the success state.
10402     * Reading from this pointer when `result_ok` is not set is undefined.
10403     */
10404    struct LDKAcceptChannel *result;
10405    /**
10406     * A pointer to the contents in the error state.
10407     * Reading from this pointer when `result_ok` is set is undefined.
10408     */
10409    struct LDKDecodeError *err;
10410 } LDKCResult_AcceptChannelDecodeErrorZPtr;
10411
10412 /**
10413  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
10414  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
10415  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10416  */
10417 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
10418    /**
10419     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
10420     * `err` or `result` depending on the state of `result_ok`.
10421     */
10422    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
10423    /**
10424     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
10425     */
10426    bool result_ok;
10427 } LDKCResult_AcceptChannelDecodeErrorZ;
10428
10429 /**
10430  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
10431  */
10432 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
10433    /**
10434     * A pointer to the contents in the success state.
10435     * Reading from this pointer when `result_ok` is not set is undefined.
10436     */
10437    struct LDKAnnouncementSignatures *result;
10438    /**
10439     * A pointer to the contents in the error state.
10440     * Reading from this pointer when `result_ok` is set is undefined.
10441     */
10442    struct LDKDecodeError *err;
10443 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
10444
10445 /**
10446  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
10447  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
10448  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10449  */
10450 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
10451    /**
10452     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
10453     * `err` or `result` depending on the state of `result_ok`.
10454     */
10455    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
10456    /**
10457     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
10458     */
10459    bool result_ok;
10460 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
10461
10462 /**
10463  * The contents of CResult_ChannelReestablishDecodeErrorZ
10464  */
10465 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
10466    /**
10467     * A pointer to the contents in the success state.
10468     * Reading from this pointer when `result_ok` is not set is undefined.
10469     */
10470    struct LDKChannelReestablish *result;
10471    /**
10472     * A pointer to the contents in the error state.
10473     * Reading from this pointer when `result_ok` is set is undefined.
10474     */
10475    struct LDKDecodeError *err;
10476 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
10477
10478 /**
10479  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
10480  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
10481  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10482  */
10483 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
10484    /**
10485     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
10486     * `err` or `result` depending on the state of `result_ok`.
10487     */
10488    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
10489    /**
10490     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
10491     */
10492    bool result_ok;
10493 } LDKCResult_ChannelReestablishDecodeErrorZ;
10494
10495 /**
10496  * The contents of CResult_ClosingSignedDecodeErrorZ
10497  */
10498 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
10499    /**
10500     * A pointer to the contents in the success state.
10501     * Reading from this pointer when `result_ok` is not set is undefined.
10502     */
10503    struct LDKClosingSigned *result;
10504    /**
10505     * A pointer to the contents in the error state.
10506     * Reading from this pointer when `result_ok` is set is undefined.
10507     */
10508    struct LDKDecodeError *err;
10509 } LDKCResult_ClosingSignedDecodeErrorZPtr;
10510
10511 /**
10512  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
10513  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
10514  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10515  */
10516 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
10517    /**
10518     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
10519     * `err` or `result` depending on the state of `result_ok`.
10520     */
10521    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
10522    /**
10523     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
10524     */
10525    bool result_ok;
10526 } LDKCResult_ClosingSignedDecodeErrorZ;
10527
10528
10529
10530 /**
10531  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
10532  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
10533  * to use.
10534  */
10535 typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
10536    /**
10537     * A pointer to the opaque Rust object.
10538     * Nearly everywhere, inner must be non-null, however in places where
10539     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10540     */
10541    LDKnativeClosingSignedFeeRange *inner;
10542    /**
10543     * Indicates that this is the only struct which contains the same pointer.
10544     * Rust functions which take ownership of an object provided via an argument require
10545     * this to be true and invalidate the object pointed to by inner.
10546     */
10547    bool is_owned;
10548 } LDKClosingSignedFeeRange;
10549
10550 /**
10551  * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
10552  */
10553 typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
10554    /**
10555     * A pointer to the contents in the success state.
10556     * Reading from this pointer when `result_ok` is not set is undefined.
10557     */
10558    struct LDKClosingSignedFeeRange *result;
10559    /**
10560     * A pointer to the contents in the error state.
10561     * Reading from this pointer when `result_ok` is set is undefined.
10562     */
10563    struct LDKDecodeError *err;
10564 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr;
10565
10566 /**
10567  * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
10568  * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10569  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10570  */
10571 typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ {
10572    /**
10573     * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
10574     * `err` or `result` depending on the state of `result_ok`.
10575     */
10576    union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
10577    /**
10578     * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
10579     */
10580    bool result_ok;
10581 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
10582
10583
10584
10585 /**
10586  * A commitment_signed message to be sent or received from a peer
10587  */
10588 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
10589    /**
10590     * A pointer to the opaque Rust object.
10591     * Nearly everywhere, inner must be non-null, however in places where
10592     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10593     */
10594    LDKnativeCommitmentSigned *inner;
10595    /**
10596     * Indicates that this is the only struct which contains the same pointer.
10597     * Rust functions which take ownership of an object provided via an argument require
10598     * this to be true and invalidate the object pointed to by inner.
10599     */
10600    bool is_owned;
10601 } LDKCommitmentSigned;
10602
10603 /**
10604  * The contents of CResult_CommitmentSignedDecodeErrorZ
10605  */
10606 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
10607    /**
10608     * A pointer to the contents in the success state.
10609     * Reading from this pointer when `result_ok` is not set is undefined.
10610     */
10611    struct LDKCommitmentSigned *result;
10612    /**
10613     * A pointer to the contents in the error state.
10614     * Reading from this pointer when `result_ok` is set is undefined.
10615     */
10616    struct LDKDecodeError *err;
10617 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
10618
10619 /**
10620  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
10621  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
10622  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10623  */
10624 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
10625    /**
10626     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
10627     * `err` or `result` depending on the state of `result_ok`.
10628     */
10629    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
10630    /**
10631     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
10632     */
10633    bool result_ok;
10634 } LDKCResult_CommitmentSignedDecodeErrorZ;
10635
10636 /**
10637  * The contents of CResult_FundingCreatedDecodeErrorZ
10638  */
10639 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
10640    /**
10641     * A pointer to the contents in the success state.
10642     * Reading from this pointer when `result_ok` is not set is undefined.
10643     */
10644    struct LDKFundingCreated *result;
10645    /**
10646     * A pointer to the contents in the error state.
10647     * Reading from this pointer when `result_ok` is set is undefined.
10648     */
10649    struct LDKDecodeError *err;
10650 } LDKCResult_FundingCreatedDecodeErrorZPtr;
10651
10652 /**
10653  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
10654  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
10655  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10656  */
10657 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
10658    /**
10659     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
10660     * `err` or `result` depending on the state of `result_ok`.
10661     */
10662    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
10663    /**
10664     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
10665     */
10666    bool result_ok;
10667 } LDKCResult_FundingCreatedDecodeErrorZ;
10668
10669 /**
10670  * The contents of CResult_FundingSignedDecodeErrorZ
10671  */
10672 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
10673    /**
10674     * A pointer to the contents in the success state.
10675     * Reading from this pointer when `result_ok` is not set is undefined.
10676     */
10677    struct LDKFundingSigned *result;
10678    /**
10679     * A pointer to the contents in the error state.
10680     * Reading from this pointer when `result_ok` is set is undefined.
10681     */
10682    struct LDKDecodeError *err;
10683 } LDKCResult_FundingSignedDecodeErrorZPtr;
10684
10685 /**
10686  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
10687  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
10688  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10689  */
10690 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
10691    /**
10692     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
10693     * `err` or `result` depending on the state of `result_ok`.
10694     */
10695    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
10696    /**
10697     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
10698     */
10699    bool result_ok;
10700 } LDKCResult_FundingSignedDecodeErrorZ;
10701
10702 /**
10703  * The contents of CResult_ChannelReadyDecodeErrorZ
10704  */
10705 typedef union LDKCResult_ChannelReadyDecodeErrorZPtr {
10706    /**
10707     * A pointer to the contents in the success state.
10708     * Reading from this pointer when `result_ok` is not set is undefined.
10709     */
10710    struct LDKChannelReady *result;
10711    /**
10712     * A pointer to the contents in the error state.
10713     * Reading from this pointer when `result_ok` is set is undefined.
10714     */
10715    struct LDKDecodeError *err;
10716 } LDKCResult_ChannelReadyDecodeErrorZPtr;
10717
10718 /**
10719  * A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
10720  * containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
10721  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10722  */
10723 typedef struct LDKCResult_ChannelReadyDecodeErrorZ {
10724    /**
10725     * The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
10726     * `err` or `result` depending on the state of `result_ok`.
10727     */
10728    union LDKCResult_ChannelReadyDecodeErrorZPtr contents;
10729    /**
10730     * Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
10731     */
10732    bool result_ok;
10733 } LDKCResult_ChannelReadyDecodeErrorZ;
10734
10735
10736
10737 /**
10738  * An init message to be sent or received from a peer
10739  */
10740 typedef struct MUST_USE_STRUCT LDKInit {
10741    /**
10742     * A pointer to the opaque Rust object.
10743     * Nearly everywhere, inner must be non-null, however in places where
10744     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10745     */
10746    LDKnativeInit *inner;
10747    /**
10748     * Indicates that this is the only struct which contains the same pointer.
10749     * Rust functions which take ownership of an object provided via an argument require
10750     * this to be true and invalidate the object pointed to by inner.
10751     */
10752    bool is_owned;
10753 } LDKInit;
10754
10755 /**
10756  * The contents of CResult_InitDecodeErrorZ
10757  */
10758 typedef union LDKCResult_InitDecodeErrorZPtr {
10759    /**
10760     * A pointer to the contents in the success state.
10761     * Reading from this pointer when `result_ok` is not set is undefined.
10762     */
10763    struct LDKInit *result;
10764    /**
10765     * A pointer to the contents in the error state.
10766     * Reading from this pointer when `result_ok` is set is undefined.
10767     */
10768    struct LDKDecodeError *err;
10769 } LDKCResult_InitDecodeErrorZPtr;
10770
10771 /**
10772  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
10773  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
10774  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10775  */
10776 typedef struct LDKCResult_InitDecodeErrorZ {
10777    /**
10778     * The contents of this CResult_InitDecodeErrorZ, accessible via either
10779     * `err` or `result` depending on the state of `result_ok`.
10780     */
10781    union LDKCResult_InitDecodeErrorZPtr contents;
10782    /**
10783     * Whether this CResult_InitDecodeErrorZ represents a success state.
10784     */
10785    bool result_ok;
10786 } LDKCResult_InitDecodeErrorZ;
10787
10788 /**
10789  * The contents of CResult_OpenChannelDecodeErrorZ
10790  */
10791 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
10792    /**
10793     * A pointer to the contents in the success state.
10794     * Reading from this pointer when `result_ok` is not set is undefined.
10795     */
10796    struct LDKOpenChannel *result;
10797    /**
10798     * A pointer to the contents in the error state.
10799     * Reading from this pointer when `result_ok` is set is undefined.
10800     */
10801    struct LDKDecodeError *err;
10802 } LDKCResult_OpenChannelDecodeErrorZPtr;
10803
10804 /**
10805  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
10806  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
10807  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10808  */
10809 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
10810    /**
10811     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
10812     * `err` or `result` depending on the state of `result_ok`.
10813     */
10814    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
10815    /**
10816     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
10817     */
10818    bool result_ok;
10819 } LDKCResult_OpenChannelDecodeErrorZ;
10820
10821 /**
10822  * The contents of CResult_RevokeAndACKDecodeErrorZ
10823  */
10824 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
10825    /**
10826     * A pointer to the contents in the success state.
10827     * Reading from this pointer when `result_ok` is not set is undefined.
10828     */
10829    struct LDKRevokeAndACK *result;
10830    /**
10831     * A pointer to the contents in the error state.
10832     * Reading from this pointer when `result_ok` is set is undefined.
10833     */
10834    struct LDKDecodeError *err;
10835 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
10836
10837 /**
10838  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
10839  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
10840  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10841  */
10842 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
10843    /**
10844     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
10845     * `err` or `result` depending on the state of `result_ok`.
10846     */
10847    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
10848    /**
10849     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
10850     */
10851    bool result_ok;
10852 } LDKCResult_RevokeAndACKDecodeErrorZ;
10853
10854 /**
10855  * The contents of CResult_ShutdownDecodeErrorZ
10856  */
10857 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
10858    /**
10859     * A pointer to the contents in the success state.
10860     * Reading from this pointer when `result_ok` is not set is undefined.
10861     */
10862    struct LDKShutdown *result;
10863    /**
10864     * A pointer to the contents in the error state.
10865     * Reading from this pointer when `result_ok` is set is undefined.
10866     */
10867    struct LDKDecodeError *err;
10868 } LDKCResult_ShutdownDecodeErrorZPtr;
10869
10870 /**
10871  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
10872  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
10873  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10874  */
10875 typedef struct LDKCResult_ShutdownDecodeErrorZ {
10876    /**
10877     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
10878     * `err` or `result` depending on the state of `result_ok`.
10879     */
10880    union LDKCResult_ShutdownDecodeErrorZPtr contents;
10881    /**
10882     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
10883     */
10884    bool result_ok;
10885 } LDKCResult_ShutdownDecodeErrorZ;
10886
10887 /**
10888  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
10889  */
10890 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
10891    /**
10892     * A pointer to the contents in the success state.
10893     * Reading from this pointer when `result_ok` is not set is undefined.
10894     */
10895    struct LDKUpdateFailHTLC *result;
10896    /**
10897     * A pointer to the contents in the error state.
10898     * Reading from this pointer when `result_ok` is set is undefined.
10899     */
10900    struct LDKDecodeError *err;
10901 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
10902
10903 /**
10904  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
10905  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10906  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10907  */
10908 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
10909    /**
10910     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
10911     * `err` or `result` depending on the state of `result_ok`.
10912     */
10913    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
10914    /**
10915     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
10916     */
10917    bool result_ok;
10918 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
10919
10920 /**
10921  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
10922  */
10923 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10924    /**
10925     * A pointer to the contents in the success state.
10926     * Reading from this pointer when `result_ok` is not set is undefined.
10927     */
10928    struct LDKUpdateFailMalformedHTLC *result;
10929    /**
10930     * A pointer to the contents in the error state.
10931     * Reading from this pointer when `result_ok` is set is undefined.
10932     */
10933    struct LDKDecodeError *err;
10934 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
10935
10936 /**
10937  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
10938  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10939  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10940  */
10941 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
10942    /**
10943     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
10944     * `err` or `result` depending on the state of `result_ok`.
10945     */
10946    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
10947    /**
10948     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
10949     */
10950    bool result_ok;
10951 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
10952
10953
10954
10955 /**
10956  * An update_fee message to be sent or received from a peer
10957  */
10958 typedef struct MUST_USE_STRUCT LDKUpdateFee {
10959    /**
10960     * A pointer to the opaque Rust object.
10961     * Nearly everywhere, inner must be non-null, however in places where
10962     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10963     */
10964    LDKnativeUpdateFee *inner;
10965    /**
10966     * Indicates that this is the only struct which contains the same pointer.
10967     * Rust functions which take ownership of an object provided via an argument require
10968     * this to be true and invalidate the object pointed to by inner.
10969     */
10970    bool is_owned;
10971 } LDKUpdateFee;
10972
10973 /**
10974  * The contents of CResult_UpdateFeeDecodeErrorZ
10975  */
10976 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
10977    /**
10978     * A pointer to the contents in the success state.
10979     * Reading from this pointer when `result_ok` is not set is undefined.
10980     */
10981    struct LDKUpdateFee *result;
10982    /**
10983     * A pointer to the contents in the error state.
10984     * Reading from this pointer when `result_ok` is set is undefined.
10985     */
10986    struct LDKDecodeError *err;
10987 } LDKCResult_UpdateFeeDecodeErrorZPtr;
10988
10989 /**
10990  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
10991  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
10992  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10993  */
10994 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
10995    /**
10996     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
10997     * `err` or `result` depending on the state of `result_ok`.
10998     */
10999    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
11000    /**
11001     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
11002     */
11003    bool result_ok;
11004 } LDKCResult_UpdateFeeDecodeErrorZ;
11005
11006 /**
11007  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
11008  */
11009 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
11010    /**
11011     * A pointer to the contents in the success state.
11012     * Reading from this pointer when `result_ok` is not set is undefined.
11013     */
11014    struct LDKUpdateFulfillHTLC *result;
11015    /**
11016     * A pointer to the contents in the error state.
11017     * Reading from this pointer when `result_ok` is set is undefined.
11018     */
11019    struct LDKDecodeError *err;
11020 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
11021
11022 /**
11023  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
11024  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
11025  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11026  */
11027 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
11028    /**
11029     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
11030     * `err` or `result` depending on the state of `result_ok`.
11031     */
11032    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
11033    /**
11034     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
11035     */
11036    bool result_ok;
11037 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
11038
11039 /**
11040  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
11041  */
11042 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
11043    /**
11044     * A pointer to the contents in the success state.
11045     * Reading from this pointer when `result_ok` is not set is undefined.
11046     */
11047    struct LDKUpdateAddHTLC *result;
11048    /**
11049     * A pointer to the contents in the error state.
11050     * Reading from this pointer when `result_ok` is set is undefined.
11051     */
11052    struct LDKDecodeError *err;
11053 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
11054
11055 /**
11056  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
11057  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
11058  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11059  */
11060 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
11061    /**
11062     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
11063     * `err` or `result` depending on the state of `result_ok`.
11064     */
11065    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
11066    /**
11067     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
11068     */
11069    bool result_ok;
11070 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
11071
11072
11073
11074 /**
11075  * An onion message to be sent or received from a peer
11076  */
11077 typedef struct MUST_USE_STRUCT LDKOnionMessage {
11078    /**
11079     * A pointer to the opaque Rust object.
11080     * Nearly everywhere, inner must be non-null, however in places where
11081     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11082     */
11083    LDKnativeOnionMessage *inner;
11084    /**
11085     * Indicates that this is the only struct which contains the same pointer.
11086     * Rust functions which take ownership of an object provided via an argument require
11087     * this to be true and invalidate the object pointed to by inner.
11088     */
11089    bool is_owned;
11090 } LDKOnionMessage;
11091
11092 /**
11093  * The contents of CResult_OnionMessageDecodeErrorZ
11094  */
11095 typedef union LDKCResult_OnionMessageDecodeErrorZPtr {
11096    /**
11097     * A pointer to the contents in the success state.
11098     * Reading from this pointer when `result_ok` is not set is undefined.
11099     */
11100    struct LDKOnionMessage *result;
11101    /**
11102     * A pointer to the contents in the error state.
11103     * Reading from this pointer when `result_ok` is set is undefined.
11104     */
11105    struct LDKDecodeError *err;
11106 } LDKCResult_OnionMessageDecodeErrorZPtr;
11107
11108 /**
11109  * A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
11110  * containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
11111  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11112  */
11113 typedef struct LDKCResult_OnionMessageDecodeErrorZ {
11114    /**
11115     * The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
11116     * `err` or `result` depending on the state of `result_ok`.
11117     */
11118    union LDKCResult_OnionMessageDecodeErrorZPtr contents;
11119    /**
11120     * Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
11121     */
11122    bool result_ok;
11123 } LDKCResult_OnionMessageDecodeErrorZ;
11124
11125
11126
11127 /**
11128  * A ping message to be sent or received from a peer
11129  */
11130 typedef struct MUST_USE_STRUCT LDKPing {
11131    /**
11132     * A pointer to the opaque Rust object.
11133     * Nearly everywhere, inner must be non-null, however in places where
11134     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11135     */
11136    LDKnativePing *inner;
11137    /**
11138     * Indicates that this is the only struct which contains the same pointer.
11139     * Rust functions which take ownership of an object provided via an argument require
11140     * this to be true and invalidate the object pointed to by inner.
11141     */
11142    bool is_owned;
11143 } LDKPing;
11144
11145 /**
11146  * The contents of CResult_PingDecodeErrorZ
11147  */
11148 typedef union LDKCResult_PingDecodeErrorZPtr {
11149    /**
11150     * A pointer to the contents in the success state.
11151     * Reading from this pointer when `result_ok` is not set is undefined.
11152     */
11153    struct LDKPing *result;
11154    /**
11155     * A pointer to the contents in the error state.
11156     * Reading from this pointer when `result_ok` is set is undefined.
11157     */
11158    struct LDKDecodeError *err;
11159 } LDKCResult_PingDecodeErrorZPtr;
11160
11161 /**
11162  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
11163  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
11164  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11165  */
11166 typedef struct LDKCResult_PingDecodeErrorZ {
11167    /**
11168     * The contents of this CResult_PingDecodeErrorZ, accessible via either
11169     * `err` or `result` depending on the state of `result_ok`.
11170     */
11171    union LDKCResult_PingDecodeErrorZPtr contents;
11172    /**
11173     * Whether this CResult_PingDecodeErrorZ represents a success state.
11174     */
11175    bool result_ok;
11176 } LDKCResult_PingDecodeErrorZ;
11177
11178
11179
11180 /**
11181  * A pong message to be sent or received from a peer
11182  */
11183 typedef struct MUST_USE_STRUCT LDKPong {
11184    /**
11185     * A pointer to the opaque Rust object.
11186     * Nearly everywhere, inner must be non-null, however in places where
11187     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11188     */
11189    LDKnativePong *inner;
11190    /**
11191     * Indicates that this is the only struct which contains the same pointer.
11192     * Rust functions which take ownership of an object provided via an argument require
11193     * this to be true and invalidate the object pointed to by inner.
11194     */
11195    bool is_owned;
11196 } LDKPong;
11197
11198 /**
11199  * The contents of CResult_PongDecodeErrorZ
11200  */
11201 typedef union LDKCResult_PongDecodeErrorZPtr {
11202    /**
11203     * A pointer to the contents in the success state.
11204     * Reading from this pointer when `result_ok` is not set is undefined.
11205     */
11206    struct LDKPong *result;
11207    /**
11208     * A pointer to the contents in the error state.
11209     * Reading from this pointer when `result_ok` is set is undefined.
11210     */
11211    struct LDKDecodeError *err;
11212 } LDKCResult_PongDecodeErrorZPtr;
11213
11214 /**
11215  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
11216  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
11217  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11218  */
11219 typedef struct LDKCResult_PongDecodeErrorZ {
11220    /**
11221     * The contents of this CResult_PongDecodeErrorZ, accessible via either
11222     * `err` or `result` depending on the state of `result_ok`.
11223     */
11224    union LDKCResult_PongDecodeErrorZPtr contents;
11225    /**
11226     * Whether this CResult_PongDecodeErrorZ represents a success state.
11227     */
11228    bool result_ok;
11229 } LDKCResult_PongDecodeErrorZ;
11230
11231 /**
11232  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
11233  */
11234 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11235    /**
11236     * A pointer to the contents in the success state.
11237     * Reading from this pointer when `result_ok` is not set is undefined.
11238     */
11239    struct LDKUnsignedChannelAnnouncement *result;
11240    /**
11241     * A pointer to the contents in the error state.
11242     * Reading from this pointer when `result_ok` is set is undefined.
11243     */
11244    struct LDKDecodeError *err;
11245 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
11246
11247 /**
11248  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
11249  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11250  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11251  */
11252 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
11253    /**
11254     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
11255     * `err` or `result` depending on the state of `result_ok`.
11256     */
11257    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
11258    /**
11259     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
11260     */
11261    bool result_ok;
11262 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
11263
11264 /**
11265  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
11266  */
11267 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
11268    /**
11269     * A pointer to the contents in the success state.
11270     * Reading from this pointer when `result_ok` is not set is undefined.
11271     */
11272    struct LDKChannelAnnouncement *result;
11273    /**
11274     * A pointer to the contents in the error state.
11275     * Reading from this pointer when `result_ok` is set is undefined.
11276     */
11277    struct LDKDecodeError *err;
11278 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
11279
11280 /**
11281  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
11282  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11283  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11284  */
11285 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
11286    /**
11287     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
11288     * `err` or `result` depending on the state of `result_ok`.
11289     */
11290    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
11291    /**
11292     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
11293     */
11294    bool result_ok;
11295 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
11296
11297
11298
11299 /**
11300  * The unsigned part of a channel_update
11301  */
11302 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
11303    /**
11304     * A pointer to the opaque Rust object.
11305     * Nearly everywhere, inner must be non-null, however in places where
11306     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11307     */
11308    LDKnativeUnsignedChannelUpdate *inner;
11309    /**
11310     * Indicates that this is the only struct which contains the same pointer.
11311     * Rust functions which take ownership of an object provided via an argument require
11312     * this to be true and invalidate the object pointed to by inner.
11313     */
11314    bool is_owned;
11315 } LDKUnsignedChannelUpdate;
11316
11317 /**
11318  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
11319  */
11320 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
11321    /**
11322     * A pointer to the contents in the success state.
11323     * Reading from this pointer when `result_ok` is not set is undefined.
11324     */
11325    struct LDKUnsignedChannelUpdate *result;
11326    /**
11327     * A pointer to the contents in the error state.
11328     * Reading from this pointer when `result_ok` is set is undefined.
11329     */
11330    struct LDKDecodeError *err;
11331 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
11332
11333 /**
11334  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
11335  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11336  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11337  */
11338 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
11339    /**
11340     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
11341     * `err` or `result` depending on the state of `result_ok`.
11342     */
11343    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
11344    /**
11345     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
11346     */
11347    bool result_ok;
11348 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
11349
11350 /**
11351  * The contents of CResult_ChannelUpdateDecodeErrorZ
11352  */
11353 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
11354    /**
11355     * A pointer to the contents in the success state.
11356     * Reading from this pointer when `result_ok` is not set is undefined.
11357     */
11358    struct LDKChannelUpdate *result;
11359    /**
11360     * A pointer to the contents in the error state.
11361     * Reading from this pointer when `result_ok` is set is undefined.
11362     */
11363    struct LDKDecodeError *err;
11364 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
11365
11366 /**
11367  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
11368  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11369  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11370  */
11371 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
11372    /**
11373     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
11374     * `err` or `result` depending on the state of `result_ok`.
11375     */
11376    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
11377    /**
11378     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
11379     */
11380    bool result_ok;
11381 } LDKCResult_ChannelUpdateDecodeErrorZ;
11382
11383 /**
11384  * The contents of CResult_ErrorMessageDecodeErrorZ
11385  */
11386 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
11387    /**
11388     * A pointer to the contents in the success state.
11389     * Reading from this pointer when `result_ok` is not set is undefined.
11390     */
11391    struct LDKErrorMessage *result;
11392    /**
11393     * A pointer to the contents in the error state.
11394     * Reading from this pointer when `result_ok` is set is undefined.
11395     */
11396    struct LDKDecodeError *err;
11397 } LDKCResult_ErrorMessageDecodeErrorZPtr;
11398
11399 /**
11400  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
11401  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
11402  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11403  */
11404 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
11405    /**
11406     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
11407     * `err` or `result` depending on the state of `result_ok`.
11408     */
11409    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
11410    /**
11411     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
11412     */
11413    bool result_ok;
11414 } LDKCResult_ErrorMessageDecodeErrorZ;
11415
11416 /**
11417  * The contents of CResult_WarningMessageDecodeErrorZ
11418  */
11419 typedef union LDKCResult_WarningMessageDecodeErrorZPtr {
11420    /**
11421     * A pointer to the contents in the success state.
11422     * Reading from this pointer when `result_ok` is not set is undefined.
11423     */
11424    struct LDKWarningMessage *result;
11425    /**
11426     * A pointer to the contents in the error state.
11427     * Reading from this pointer when `result_ok` is set is undefined.
11428     */
11429    struct LDKDecodeError *err;
11430 } LDKCResult_WarningMessageDecodeErrorZPtr;
11431
11432 /**
11433  * A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
11434  * containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
11435  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11436  */
11437 typedef struct LDKCResult_WarningMessageDecodeErrorZ {
11438    /**
11439     * The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
11440     * `err` or `result` depending on the state of `result_ok`.
11441     */
11442    union LDKCResult_WarningMessageDecodeErrorZPtr contents;
11443    /**
11444     * Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
11445     */
11446    bool result_ok;
11447 } LDKCResult_WarningMessageDecodeErrorZ;
11448
11449
11450
11451 /**
11452  * The unsigned part of a node_announcement
11453  */
11454 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
11455    /**
11456     * A pointer to the opaque Rust object.
11457     * Nearly everywhere, inner must be non-null, however in places where
11458     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11459     */
11460    LDKnativeUnsignedNodeAnnouncement *inner;
11461    /**
11462     * Indicates that this is the only struct which contains the same pointer.
11463     * Rust functions which take ownership of an object provided via an argument require
11464     * this to be true and invalidate the object pointed to by inner.
11465     */
11466    bool is_owned;
11467 } LDKUnsignedNodeAnnouncement;
11468
11469 /**
11470  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
11471  */
11472 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11473    /**
11474     * A pointer to the contents in the success state.
11475     * Reading from this pointer when `result_ok` is not set is undefined.
11476     */
11477    struct LDKUnsignedNodeAnnouncement *result;
11478    /**
11479     * A pointer to the contents in the error state.
11480     * Reading from this pointer when `result_ok` is set is undefined.
11481     */
11482    struct LDKDecodeError *err;
11483 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
11484
11485 /**
11486  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
11487  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11488  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11489  */
11490 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
11491    /**
11492     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
11493     * `err` or `result` depending on the state of `result_ok`.
11494     */
11495    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
11496    /**
11497     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
11498     */
11499    bool result_ok;
11500 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
11501
11502
11503
11504 /**
11505  * A node_announcement message to be sent or received from a peer
11506  */
11507 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
11508    /**
11509     * A pointer to the opaque Rust object.
11510     * Nearly everywhere, inner must be non-null, however in places where
11511     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11512     */
11513    LDKnativeNodeAnnouncement *inner;
11514    /**
11515     * Indicates that this is the only struct which contains the same pointer.
11516     * Rust functions which take ownership of an object provided via an argument require
11517     * this to be true and invalidate the object pointed to by inner.
11518     */
11519    bool is_owned;
11520 } LDKNodeAnnouncement;
11521
11522 /**
11523  * The contents of CResult_NodeAnnouncementDecodeErrorZ
11524  */
11525 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
11526    /**
11527     * A pointer to the contents in the success state.
11528     * Reading from this pointer when `result_ok` is not set is undefined.
11529     */
11530    struct LDKNodeAnnouncement *result;
11531    /**
11532     * A pointer to the contents in the error state.
11533     * Reading from this pointer when `result_ok` is set is undefined.
11534     */
11535    struct LDKDecodeError *err;
11536 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
11537
11538 /**
11539  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
11540  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11541  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11542  */
11543 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
11544    /**
11545     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
11546     * `err` or `result` depending on the state of `result_ok`.
11547     */
11548    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
11549    /**
11550     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
11551     */
11552    bool result_ok;
11553 } LDKCResult_NodeAnnouncementDecodeErrorZ;
11554
11555 /**
11556  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
11557  */
11558 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
11559    /**
11560     * A pointer to the contents in the success state.
11561     * Reading from this pointer when `result_ok` is not set is undefined.
11562     */
11563    struct LDKQueryShortChannelIds *result;
11564    /**
11565     * A pointer to the contents in the error state.
11566     * Reading from this pointer when `result_ok` is set is undefined.
11567     */
11568    struct LDKDecodeError *err;
11569 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
11570
11571 /**
11572  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
11573  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
11574  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11575  */
11576 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
11577    /**
11578     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
11579     * `err` or `result` depending on the state of `result_ok`.
11580     */
11581    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
11582    /**
11583     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
11584     */
11585    bool result_ok;
11586 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
11587
11588
11589
11590 /**
11591  * A reply_short_channel_ids_end message is sent as a reply to a
11592  * query_short_channel_ids message. The query recipient makes a best
11593  * effort to respond based on their local network view which may not be
11594  * a perfect view of the network.
11595  */
11596 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
11597    /**
11598     * A pointer to the opaque Rust object.
11599     * Nearly everywhere, inner must be non-null, however in places where
11600     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11601     */
11602    LDKnativeReplyShortChannelIdsEnd *inner;
11603    /**
11604     * Indicates that this is the only struct which contains the same pointer.
11605     * Rust functions which take ownership of an object provided via an argument require
11606     * this to be true and invalidate the object pointed to by inner.
11607     */
11608    bool is_owned;
11609 } LDKReplyShortChannelIdsEnd;
11610
11611 /**
11612  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
11613  */
11614 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
11615    /**
11616     * A pointer to the contents in the success state.
11617     * Reading from this pointer when `result_ok` is not set is undefined.
11618     */
11619    struct LDKReplyShortChannelIdsEnd *result;
11620    /**
11621     * A pointer to the contents in the error state.
11622     * Reading from this pointer when `result_ok` is set is undefined.
11623     */
11624    struct LDKDecodeError *err;
11625 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
11626
11627 /**
11628  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
11629  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
11630  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11631  */
11632 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
11633    /**
11634     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
11635     * `err` or `result` depending on the state of `result_ok`.
11636     */
11637    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
11638    /**
11639     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
11640     */
11641    bool result_ok;
11642 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
11643
11644 /**
11645  * The contents of CResult_QueryChannelRangeDecodeErrorZ
11646  */
11647 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
11648    /**
11649     * A pointer to the contents in the success state.
11650     * Reading from this pointer when `result_ok` is not set is undefined.
11651     */
11652    struct LDKQueryChannelRange *result;
11653    /**
11654     * A pointer to the contents in the error state.
11655     * Reading from this pointer when `result_ok` is set is undefined.
11656     */
11657    struct LDKDecodeError *err;
11658 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
11659
11660 /**
11661  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
11662  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11663  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11664  */
11665 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
11666    /**
11667     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
11668     * `err` or `result` depending on the state of `result_ok`.
11669     */
11670    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
11671    /**
11672     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
11673     */
11674    bool result_ok;
11675 } LDKCResult_QueryChannelRangeDecodeErrorZ;
11676
11677 /**
11678  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
11679  */
11680 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
11681    /**
11682     * A pointer to the contents in the success state.
11683     * Reading from this pointer when `result_ok` is not set is undefined.
11684     */
11685    struct LDKReplyChannelRange *result;
11686    /**
11687     * A pointer to the contents in the error state.
11688     * Reading from this pointer when `result_ok` is set is undefined.
11689     */
11690    struct LDKDecodeError *err;
11691 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
11692
11693 /**
11694  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
11695  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11696  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11697  */
11698 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
11699    /**
11700     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
11701     * `err` or `result` depending on the state of `result_ok`.
11702     */
11703    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
11704    /**
11705     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
11706     */
11707    bool result_ok;
11708 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
11709
11710 /**
11711  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
11712  */
11713 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
11714    /**
11715     * A pointer to the contents in the success state.
11716     * Reading from this pointer when `result_ok` is not set is undefined.
11717     */
11718    struct LDKGossipTimestampFilter *result;
11719    /**
11720     * A pointer to the contents in the error state.
11721     * Reading from this pointer when `result_ok` is set is undefined.
11722     */
11723    struct LDKDecodeError *err;
11724 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
11725
11726 /**
11727  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
11728  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
11729  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11730  */
11731 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
11732    /**
11733     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
11734     * `err` or `result` depending on the state of `result_ok`.
11735     */
11736    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
11737    /**
11738     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
11739     */
11740    bool result_ok;
11741 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
11742
11743 /**
11744  * A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
11745  * This corresponds to std::vector in C++
11746  */
11747 typedef struct LDKCVec_PhantomRouteHintsZ {
11748    /**
11749     * The elements in the array.
11750     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11751     */
11752    struct LDKPhantomRouteHints *data;
11753    /**
11754     * The number of elements pointed to by `data`.
11755     */
11756    uintptr_t datalen;
11757 } LDKCVec_PhantomRouteHintsZ;
11758
11759 /**
11760  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
11761  * may occur.
11762  */
11763 typedef enum LDKSignOrCreationError_Tag {
11764    /**
11765     * An error occurred during signing
11766     */
11767    LDKSignOrCreationError_SignError,
11768    /**
11769     * An error occurred while building the transaction
11770     */
11771    LDKSignOrCreationError_CreationError,
11772    /**
11773     * Must be last for serialization purposes
11774     */
11775    LDKSignOrCreationError_Sentinel,
11776 } LDKSignOrCreationError_Tag;
11777
11778 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
11779    LDKSignOrCreationError_Tag tag;
11780    union {
11781       struct {
11782          enum LDKCreationError creation_error;
11783       };
11784    };
11785 } LDKSignOrCreationError;
11786
11787 /**
11788  * The contents of CResult_InvoiceSignOrCreationErrorZ
11789  */
11790 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
11791    /**
11792     * A pointer to the contents in the success state.
11793     * Reading from this pointer when `result_ok` is not set is undefined.
11794     */
11795    struct LDKInvoice *result;
11796    /**
11797     * A pointer to the contents in the error state.
11798     * Reading from this pointer when `result_ok` is set is undefined.
11799     */
11800    struct LDKSignOrCreationError *err;
11801 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
11802
11803 /**
11804  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
11805  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
11806  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11807  */
11808 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
11809    /**
11810     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
11811     * `err` or `result` depending on the state of `result_ok`.
11812     */
11813    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
11814    /**
11815     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
11816     */
11817    bool result_ok;
11818 } LDKCResult_InvoiceSignOrCreationErrorZ;
11819
11820
11821
11822 /**
11823  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
11824  *
11825  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
11826  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
11827  * [`Confirm::transactions_confirmed`].
11828  *
11829  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
11830  * may have been spent there. See [`Filter::register_output`] for details.
11831  *
11832  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
11833  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
11834  */
11835 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
11836    /**
11837     * A pointer to the opaque Rust object.
11838     * Nearly everywhere, inner must be non-null, however in places where
11839     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11840     */
11841    LDKnativeWatchedOutput *inner;
11842    /**
11843     * Indicates that this is the only struct which contains the same pointer.
11844     * Rust functions which take ownership of an object provided via an argument require
11845     * this to be true and invalidate the object pointed to by inner.
11846     */
11847    bool is_owned;
11848 } LDKWatchedOutput;
11849
11850 /**
11851  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
11852  * channels.
11853  *
11854  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
11855  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
11856  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
11857  * receiving full blocks from a chain source, any further filtering is unnecessary.
11858  *
11859  * After an output has been registered, subsequent block retrievals from the chain source must not
11860  * exclude any transactions matching the new criteria nor any in-block descendants of such
11861  * transactions.
11862  *
11863  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
11864  * should not block on I/O. Implementations should instead queue the newly monitored data to be
11865  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
11866  * invocation that has called the `Filter` must return [`InProgress`].
11867  *
11868  * [`InProgress`]: ChannelMonitorUpdateStatus::InProgress
11869  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
11870  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
11871  */
11872 typedef struct LDKFilter {
11873    /**
11874     * An opaque pointer which is passed to your function implementations as an argument.
11875     * This has no meaning in the LDK, and can be NULL or any other value.
11876     */
11877    void *this_arg;
11878    /**
11879     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
11880     * a spending condition.
11881     */
11882    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
11883    /**
11884     * Registers interest in spends of a transaction output.
11885     *
11886     * Note that this method might be called during processing of a new block. You therefore need
11887     * to ensure that also dependent output spents within an already connected block are correctly
11888     * handled, e.g., by re-scanning the block in question whenever new outputs have been
11889     * registered mid-processing.
11890     */
11891    void (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
11892    /**
11893     * Frees any resources associated with this object given its this_arg pointer.
11894     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11895     */
11896    void (*free)(void *this_arg);
11897 } LDKFilter;
11898
11899 /**
11900  * An enum which can either contain a crate::lightning::chain::Filter or not
11901  */
11902 typedef enum LDKCOption_FilterZ_Tag {
11903    /**
11904     * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
11905     */
11906    LDKCOption_FilterZ_Some,
11907    /**
11908     * When we're in this state, this COption_FilterZ contains nothing
11909     */
11910    LDKCOption_FilterZ_None,
11911    /**
11912     * Must be last for serialization purposes
11913     */
11914    LDKCOption_FilterZ_Sentinel,
11915 } LDKCOption_FilterZ_Tag;
11916
11917 typedef struct LDKCOption_FilterZ {
11918    LDKCOption_FilterZ_Tag tag;
11919    union {
11920       struct {
11921          struct LDKFilter some;
11922       };
11923    };
11924 } LDKCOption_FilterZ;
11925
11926
11927
11928 /**
11929  * A read-only reference to a current ChannelMonitor.
11930  *
11931  * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is
11932  * released.
11933  */
11934 typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor {
11935    /**
11936     * A pointer to the opaque Rust object.
11937     * Nearly everywhere, inner must be non-null, however in places where
11938     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11939     */
11940    LDKnativeLockedChannelMonitor *inner;
11941    /**
11942     * Indicates that this is the only struct which contains the same pointer.
11943     * Rust functions which take ownership of an object provided via an argument require
11944     * this to be true and invalidate the object pointed to by inner.
11945     */
11946    bool is_owned;
11947 } LDKLockedChannelMonitor;
11948
11949 /**
11950  * The contents of CResult_LockedChannelMonitorNoneZ
11951  */
11952 typedef union LDKCResult_LockedChannelMonitorNoneZPtr {
11953    /**
11954     * A pointer to the contents in the success state.
11955     * Reading from this pointer when `result_ok` is not set is undefined.
11956     */
11957    struct LDKLockedChannelMonitor *result;
11958    /**
11959     * Note that this value is always NULL, as there are no contents in the Err variant
11960     */
11961    void *err;
11962 } LDKCResult_LockedChannelMonitorNoneZPtr;
11963
11964 /**
11965  * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
11966  * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
11967  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11968  */
11969 typedef struct LDKCResult_LockedChannelMonitorNoneZ {
11970    /**
11971     * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
11972     * `err` or `result` depending on the state of `result_ok`.
11973     */
11974    union LDKCResult_LockedChannelMonitorNoneZPtr contents;
11975    /**
11976     * Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
11977     */
11978    bool result_ok;
11979 } LDKCResult_LockedChannelMonitorNoneZ;
11980
11981 /**
11982  * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
11983  * This corresponds to std::vector in C++
11984  */
11985 typedef struct LDKCVec_OutPointZ {
11986    /**
11987     * The elements in the array.
11988     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11989     */
11990    struct LDKOutPoint *data;
11991    /**
11992     * The number of elements pointed to by `data`.
11993     */
11994    uintptr_t datalen;
11995 } LDKCVec_OutPointZ;
11996
11997 /**
11998  * A trait indicating an object may generate message send events
11999  */
12000 typedef struct LDKMessageSendEventsProvider {
12001    /**
12002     * An opaque pointer which is passed to your function implementations as an argument.
12003     * This has no meaning in the LDK, and can be NULL or any other value.
12004     */
12005    void *this_arg;
12006    /**
12007     * Gets the list of pending events which were generated by previous actions, clearing the list
12008     * in the process.
12009     */
12010    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
12011    /**
12012     * Frees any resources associated with this object given its this_arg pointer.
12013     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12014     */
12015    void (*free)(void *this_arg);
12016 } LDKMessageSendEventsProvider;
12017
12018 /**
12019  * A trait indicating an object may generate onion messages to send
12020  */
12021 typedef struct LDKOnionMessageProvider {
12022    /**
12023     * An opaque pointer which is passed to your function implementations as an argument.
12024     * This has no meaning in the LDK, and can be NULL or any other value.
12025     */
12026    void *this_arg;
12027    /**
12028     * Gets the next pending onion message for the peer with the given node id.
12029     *
12030     * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
12031     */
12032    struct LDKOnionMessage (*next_onion_message_for_peer)(const void *this_arg, struct LDKPublicKey peer_node_id);
12033    /**
12034     * Frees any resources associated with this object given its this_arg pointer.
12035     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12036     */
12037    void (*free)(void *this_arg);
12038 } LDKOnionMessageProvider;
12039
12040 /**
12041  * A trait implemented for objects handling events from [`EventsProvider`].
12042  */
12043 typedef struct LDKEventHandler {
12044    /**
12045     * An opaque pointer which is passed to your function implementations as an argument.
12046     * This has no meaning in the LDK, and can be NULL or any other value.
12047     */
12048    void *this_arg;
12049    /**
12050     * Handles the given [`Event`].
12051     *
12052     * See [`EventsProvider`] for details that must be considered when implementing this method.
12053     */
12054    void (*handle_event)(const void *this_arg, const struct LDKEvent *NONNULL_PTR event);
12055    /**
12056     * Frees any resources associated with this object given its this_arg pointer.
12057     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12058     */
12059    void (*free)(void *this_arg);
12060 } LDKEventHandler;
12061
12062 /**
12063  * A trait indicating an object may generate events.
12064  *
12065  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
12066  *
12067  * # Requirements
12068  *
12069  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
12070  * event since the last invocation.
12071  *
12072  * In order to ensure no [`Event`]s are lost, implementors of this trait will persist [`Event`]s
12073  * and replay any unhandled events on startup. An [`Event`] is considered handled when
12074  * [`process_pending_events`] returns, thus handlers MUST fully handle [`Event`]s and persist any
12075  * relevant changes to disk *before* returning.
12076  *
12077  * Further, because an application may crash between an [`Event`] being handled and the
12078  * implementor of this trait being re-serialized, [`Event`] handling must be idempotent - in
12079  * effect, [`Event`]s may be replayed.
12080  *
12081  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
12082  * consult the provider's documentation on the implication of processing events and how a handler
12083  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
12084  * [`ChainMonitor::process_pending_events`]).
12085  *
12086  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
12087  * own type(s).
12088  *
12089  * [`process_pending_events`]: Self::process_pending_events
12090  * [`handle_event`]: EventHandler::handle_event
12091  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
12092  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
12093  */
12094 typedef struct LDKEventsProvider {
12095    /**
12096     * An opaque pointer which is passed to your function implementations as an argument.
12097     * This has no meaning in the LDK, and can be NULL or any other value.
12098     */
12099    void *this_arg;
12100    /**
12101     * Processes any events generated since the last call using the given event handler.
12102     *
12103     * See the trait-level documentation for requirements.
12104     */
12105    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
12106    /**
12107     * Frees any resources associated with this object given its this_arg pointer.
12108     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12109     */
12110    void (*free)(void *this_arg);
12111 } LDKEventsProvider;
12112
12113
12114
12115 /**
12116  * Lightning TLV uses a custom variable-length integer called BigSize. It is similar to Bitcoin's
12117  * variable-length integers except that it is serialized in big-endian instead of little-endian.
12118  *
12119  * Like Bitcoin's variable-length integer, it exhibits ambiguity in that certain values can be
12120  * encoded in several different ways, which we must check for at deserialization-time. Thus, if
12121  * you're looking for an example of a variable-length integer to use for your own project, move
12122  * along, this is a rather poor design.
12123  */
12124 typedef struct MUST_USE_STRUCT LDKBigSize {
12125    /**
12126     * A pointer to the opaque Rust object.
12127     * Nearly everywhere, inner must be non-null, however in places where
12128     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12129     */
12130    LDKnativeBigSize *inner;
12131    /**
12132     * Indicates that this is the only struct which contains the same pointer.
12133     * Rust functions which take ownership of an object provided via an argument require
12134     * this to be true and invalidate the object pointed to by inner.
12135     */
12136    bool is_owned;
12137 } LDKBigSize;
12138
12139 /**
12140  * Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk.
12141  */
12142 typedef struct LDKPersister {
12143    /**
12144     * An opaque pointer which is passed to your function implementations as an argument.
12145     * This has no meaning in the LDK, and can be NULL or any other value.
12146     */
12147    void *this_arg;
12148    /**
12149     * Persist the given ['ChannelManager'] to disk, returning an error if persistence failed.
12150     */
12151    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
12152    /**
12153     * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed.
12154     */
12155    struct LDKCResult_NoneErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
12156    /**
12157     * Persist the given [`WriteableScore`] to disk, returning an error if persistence failed.
12158     */
12159    struct LDKCResult_NoneErrorZ (*persist_scorer)(const void *this_arg, const struct LDKWriteableScore *NONNULL_PTR scorer);
12160    /**
12161     * Frees any resources associated with this object given its this_arg pointer.
12162     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12163     */
12164    void (*free)(void *this_arg);
12165 } LDKPersister;
12166
12167 /**
12168  * A callback which is called when a [`Future`] completes.
12169  *
12170  * Note that this MUST NOT call back into LDK directly, it must instead schedule actions to be
12171  * taken later. Rust users should use the [`std::future::Future`] implementation for [`Future`]
12172  * instead.
12173  *
12174  * Note that the [`std::future::Future`] implementation may only work for runtimes which schedule
12175  * futures when they receive a wake, rather than immediately executing them.
12176  */
12177 typedef struct LDKFutureCallback {
12178    /**
12179     * An opaque pointer which is passed to your function implementations as an argument.
12180     * This has no meaning in the LDK, and can be NULL or any other value.
12181     */
12182    void *this_arg;
12183    /**
12184     * The method which is called.
12185     */
12186    void (*call)(const void *this_arg);
12187    /**
12188     * Frees any resources associated with this object given its this_arg pointer.
12189     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12190     */
12191    void (*free)(void *this_arg);
12192 } LDKFutureCallback;
12193
12194
12195
12196 /**
12197  * A simple future which can complete once, and calls some callback(s) when it does so.
12198  */
12199 typedef struct MUST_USE_STRUCT LDKFuture {
12200    /**
12201     * A pointer to the opaque Rust object.
12202     * Nearly everywhere, inner must be non-null, however in places where
12203     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12204     */
12205    LDKnativeFuture *inner;
12206    /**
12207     * Indicates that this is the only struct which contains the same pointer.
12208     * Rust functions which take ownership of an object provided via an argument require
12209     * this to be true and invalidate the object pointed to by inner.
12210     */
12211    bool is_owned;
12212 } LDKFuture;
12213
12214
12215
12216 /**
12217  * Configuration we set when applicable.
12218  *
12219  * Default::default() provides sane defaults.
12220  */
12221 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
12222    /**
12223     * A pointer to the opaque Rust object.
12224     * Nearly everywhere, inner must be non-null, however in places where
12225     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12226     */
12227    LDKnativeChannelHandshakeConfig *inner;
12228    /**
12229     * Indicates that this is the only struct which contains the same pointer.
12230     * Rust functions which take ownership of an object provided via an argument require
12231     * this to be true and invalidate the object pointed to by inner.
12232     */
12233    bool is_owned;
12234 } LDKChannelHandshakeConfig;
12235
12236
12237
12238 /**
12239  * Optional channel limits which are applied during channel creation.
12240  *
12241  * These limits are only applied to our counterparty's limits, not our own.
12242  *
12243  * Use 0/<type>::max_value() as appropriate to skip checking.
12244  *
12245  * Provides sane defaults for most configurations.
12246  *
12247  * Most additional limits are disabled except those with which specify a default in individual
12248  * field documentation. Note that this may result in barely-usable channels, but since they
12249  * are applied mostly only to incoming channels that's not much of a problem.
12250  */
12251 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
12252    /**
12253     * A pointer to the opaque Rust object.
12254     * Nearly everywhere, inner must be non-null, however in places where
12255     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12256     */
12257    LDKnativeChannelHandshakeLimits *inner;
12258    /**
12259     * Indicates that this is the only struct which contains the same pointer.
12260     * Rust functions which take ownership of an object provided via an argument require
12261     * this to be true and invalidate the object pointed to by inner.
12262     */
12263    bool is_owned;
12264 } LDKChannelHandshakeLimits;
12265
12266
12267
12268 /**
12269  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
12270  *
12271  * Default::default() provides sane defaults for most configurations
12272  * (but currently with 0 relay fees!)
12273  */
12274 typedef struct MUST_USE_STRUCT LDKUserConfig {
12275    /**
12276     * A pointer to the opaque Rust object.
12277     * Nearly everywhere, inner must be non-null, however in places where
12278     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12279     */
12280    LDKnativeUserConfig *inner;
12281    /**
12282     * Indicates that this is the only struct which contains the same pointer.
12283     * Rust functions which take ownership of an object provided via an argument require
12284     * this to be true and invalidate the object pointed to by inner.
12285     */
12286    bool is_owned;
12287 } LDKUserConfig;
12288
12289
12290
12291 /**
12292  * The best known block as identified by its hash and height.
12293  */
12294 typedef struct MUST_USE_STRUCT LDKBestBlock {
12295    /**
12296     * A pointer to the opaque Rust object.
12297     * Nearly everywhere, inner must be non-null, however in places where
12298     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12299     */
12300    LDKnativeBestBlock *inner;
12301    /**
12302     * Indicates that this is the only struct which contains the same pointer.
12303     * Rust functions which take ownership of an object provided via an argument require
12304     * this to be true and invalidate the object pointed to by inner.
12305     */
12306    bool is_owned;
12307 } LDKBestBlock;
12308
12309 /**
12310  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
12311  * chain.
12312  *
12313  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
12314  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
12315  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
12316  * when needed.
12317  *
12318  * By using [`Listen::filtered_block_connected`] this interface supports clients fetching the
12319  * entire header chain and only blocks with matching transaction data using BIP 157 filters or
12320  * other similar filtering.
12321  */
12322 typedef struct LDKListen {
12323    /**
12324     * An opaque pointer which is passed to your function implementations as an argument.
12325     * This has no meaning in the LDK, and can be NULL or any other value.
12326     */
12327    void *this_arg;
12328    /**
12329     * Notifies the listener that a block was added at the given height, with the transaction data
12330     * possibly filtered.
12331     */
12332    void (*filtered_block_connected)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
12333    /**
12334     * Notifies the listener that a block was added at the given height.
12335     */
12336    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
12337    /**
12338     * Notifies the listener that a block was removed at the given height.
12339     */
12340    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
12341    /**
12342     * Frees any resources associated with this object given its this_arg pointer.
12343     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12344     */
12345    void (*free)(void *this_arg);
12346 } LDKListen;
12347
12348 /**
12349  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
12350  * unconfirmed during a chain reorganization.
12351  *
12352  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
12353  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
12354  * related to registered transactions and outputs. Upon notification, it would pass along the
12355  * matching transactions using this interface.
12356  *
12357  * # Use
12358  *
12359  * The intended use is as follows:
12360  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
12361  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
12362  *   that has been reorganized out of the chain.
12363  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
12364  *
12365  * # Order
12366  *
12367  * Clients must call these methods in chain order. Specifically:
12368  * - Transactions confirmed in a block must be given before transactions confirmed in a later
12369  *   block.
12370  * - Dependent transactions within the same block must be given in topological order, possibly in
12371  *   separate calls.
12372  * - Unconfirmed transactions must be given after the original confirmations and before any
12373  *   reconfirmation.
12374  *
12375  * See individual method documentation for further details.
12376  *
12377  * [`transactions_confirmed`]: Self::transactions_confirmed
12378  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
12379  * [`best_block_updated`]: Self::best_block_updated
12380  * [`get_relevant_txids`]: Self::get_relevant_txids
12381  */
12382 typedef struct LDKConfirm {
12383    /**
12384     * An opaque pointer which is passed to your function implementations as an argument.
12385     * This has no meaning in the LDK, and can be NULL or any other value.
12386     */
12387    void *this_arg;
12388    /**
12389     * Processes transactions confirmed in a block with a given header and height.
12390     *
12391     * Should be called for any transactions registered by [`Filter::register_tx`] or any
12392     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
12393     * appearing in the same block do not need to be included in the same call; instead, multiple
12394     * calls with additional transactions may be made so long as they are made in [chain order].
12395     *
12396     * May be called before or after [`best_block_updated`] for the corresponding block. However,
12397     * in the event of a chain reorganization, it must not be called with a `header` that is no
12398     * longer in the chain as of the last call to [`best_block_updated`].
12399     *
12400     * [chain order]: Confirm#order
12401     * [`best_block_updated`]: Self::best_block_updated
12402     */
12403    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
12404    /**
12405     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
12406     *
12407     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
12408     * reorganized out of the best chain. Once called, the given transaction will not be returned
12409     * by [`get_relevant_txids`], unless it has been reconfirmed via [`transactions_confirmed`].
12410     *
12411     * [`get_relevant_txids`]: Self::get_relevant_txids
12412     * [`transactions_confirmed`]: Self::transactions_confirmed
12413     */
12414    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
12415    /**
12416     * Processes an update to the best header connected at the given height.
12417     *
12418     * Should be called when a new header is available but may be skipped for intermediary blocks
12419     * if they become available at the same time.
12420     */
12421    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
12422    /**
12423     * Returns transactions that should be monitored for reorganization out of the chain.
12424     *
12425     * Will include any transactions passed to [`transactions_confirmed`] that have insufficient
12426     * confirmations to be safe from a chain reorganization. Will not include any transactions
12427     * passed to [`transaction_unconfirmed`], unless later reconfirmed.
12428     *
12429     * May be called to determine the subset of transactions that must still be monitored for
12430     * reorganization. Will be idempotent between calls but may change as a result of calls to the
12431     * other interface methods. Thus, this is useful to determine which transactions may need to be
12432     * given to [`transaction_unconfirmed`].
12433     *
12434     * [`transactions_confirmed`]: Self::transactions_confirmed
12435     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
12436     */
12437    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
12438    /**
12439     * Frees any resources associated with this object given its this_arg pointer.
12440     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12441     */
12442    void (*free)(void *this_arg);
12443 } LDKConfirm;
12444
12445
12446
12447 /**
12448  * An opaque identifier describing a specific [`Persist`] method call.
12449  */
12450 typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
12451    /**
12452     * A pointer to the opaque Rust object.
12453     * Nearly everywhere, inner must be non-null, however in places where
12454     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12455     */
12456    LDKnativeMonitorUpdateId *inner;
12457    /**
12458     * Indicates that this is the only struct which contains the same pointer.
12459     * Rust functions which take ownership of an object provided via an argument require
12460     * this to be true and invalidate the object pointed to by inner.
12461     */
12462    bool is_owned;
12463 } LDKMonitorUpdateId;
12464
12465 /**
12466  * `Persist` defines behavior for persisting channel monitors: this could mean
12467  * writing once to disk, and/or uploading to one or more backup services.
12468  *
12469  * Each method can return three possible values:
12470  *  * If persistence (including any relevant `fsync()` calls) happens immediately, the
12471  *    implementation should return [`ChannelMonitorUpdateStatus::Completed`], indicating normal
12472  *    channel operation should continue.
12473  *  * If persistence happens asynchronously, implementations should first ensure the
12474  *    [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return
12475  *    [`ChannelMonitorUpdateStatus::InProgress`] while the update continues in the background.
12476  *    Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be called with
12477  *    the corresponding [`MonitorUpdateId`].
12478  *
12479  *    Note that unlike the direct [`chain::Watch`] interface,
12480  *    [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
12481  *
12482  *  * If persistence fails for some reason, implementations should return
12483  *    [`ChannelMonitorUpdateStatus::PermanentFailure`], in which case the channel will likely be
12484  *    closed without broadcasting the latest state. See
12485  *    [`ChannelMonitorUpdateStatus::PermanentFailure`] for more details.
12486  */
12487 typedef struct LDKPersist {
12488    /**
12489     * An opaque pointer which is passed to your function implementations as an argument.
12490     * This has no meaning in the LDK, and can be NULL or any other value.
12491     */
12492    void *this_arg;
12493    /**
12494     * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
12495     * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
12496     *
12497     * The data can be stored any way you want, but the identifier provided by LDK is the
12498     * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
12499     * and the stored channel data). Note that you **must** persist every new monitor to disk.
12500     *
12501     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
12502     * if you return [`ChannelMonitorUpdateStatus::InProgress`].
12503     *
12504     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
12505     * and [`ChannelMonitorUpdateStatus`] for requirements when returning errors.
12506     *
12507     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
12508     * [`Writeable::write`]: crate::util::ser::Writeable::write
12509     */
12510    enum LDKChannelMonitorUpdateStatus (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
12511    /**
12512     * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
12513     * update.
12514     *
12515     * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
12516     * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
12517     * details.
12518     *
12519     * During blockchain synchronization operations, this may be called with no
12520     * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
12521     * Note that after the full [`ChannelMonitor`] is persisted any previous
12522     * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
12523     * applied to the persisted [`ChannelMonitor`] as they were already applied.
12524     *
12525     * If an implementer chooses to persist the updates only, they need to make
12526     * sure that all the updates are applied to the `ChannelMonitors` *before*
12527     * the set of channel monitors is given to the `ChannelManager`
12528     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
12529     * applying a monitor update to a monitor. If full `ChannelMonitors` are
12530     * persisted, then there is no need to persist individual updates.
12531     *
12532     * Note that there could be a performance tradeoff between persisting complete
12533     * channel monitors on every update vs. persisting only updates and applying
12534     * them in batches. The size of each monitor grows `O(number of state updates)`
12535     * whereas updates are small and `O(1)`.
12536     *
12537     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
12538     * if you return [`ChannelMonitorUpdateStatus::InProgress`].
12539     *
12540     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
12541     * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
12542     * [`ChannelMonitorUpdateStatus`] for requirements when returning errors.
12543     *
12544     * [`Writeable::write`]: crate::util::ser::Writeable::write
12545     *
12546     * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
12547     */
12548    enum LDKChannelMonitorUpdateStatus (*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);
12549    /**
12550     * Frees any resources associated with this object given its this_arg pointer.
12551     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12552     */
12553    void (*free)(void *this_arg);
12554 } LDKPersist;
12555
12556
12557
12558 /**
12559  * An implementation of [`chain::Watch`] for monitoring channels.
12560  *
12561  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
12562  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
12563  * or used independently to monitor channels remotely. See the [module-level documentation] for
12564  * details.
12565  *
12566  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
12567  * [module-level documentation]: crate::chain::chainmonitor
12568  */
12569 typedef struct MUST_USE_STRUCT LDKChainMonitor {
12570    /**
12571     * A pointer to the opaque Rust object.
12572     * Nearly everywhere, inner must be non-null, however in places where
12573     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12574     */
12575    LDKnativeChainMonitor *inner;
12576    /**
12577     * Indicates that this is the only struct which contains the same pointer.
12578     * Rust functions which take ownership of an object provided via an argument require
12579     * this to be true and invalidate the object pointed to by inner.
12580     */
12581    bool is_owned;
12582 } LDKChainMonitor;
12583
12584
12585
12586 /**
12587  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
12588  * and derives keys from that.
12589  *
12590  * Your node_id is seed/0'
12591  * ChannelMonitor closes may use seed/1'
12592  * Cooperative closes may use seed/2'
12593  * The two close keys may be needed to claim on-chain funds!
12594  *
12595  * This struct cannot be used for nodes that wish to support receiving phantom payments;
12596  * [`PhantomKeysManager`] must be used instead.
12597  *
12598  * Note that switching between this struct and [`PhantomKeysManager`] will invalidate any
12599  * previously issued invoices and attempts to pay previous invoices will fail.
12600  */
12601 typedef struct MUST_USE_STRUCT LDKKeysManager {
12602    /**
12603     * A pointer to the opaque Rust object.
12604     * Nearly everywhere, inner must be non-null, however in places where
12605     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12606     */
12607    LDKnativeKeysManager *inner;
12608    /**
12609     * Indicates that this is the only struct which contains the same pointer.
12610     * Rust functions which take ownership of an object provided via an argument require
12611     * this to be true and invalidate the object pointed to by inner.
12612     */
12613    bool is_owned;
12614 } LDKKeysManager;
12615
12616
12617
12618 /**
12619  * Similar to [`KeysManager`], but allows the node using this struct to receive phantom node
12620  * payments.
12621  *
12622  * A phantom node payment is a payment made to a phantom invoice, which is an invoice that can be
12623  * paid to one of multiple nodes. This works because we encode the invoice route hints such that
12624  * LDK will recognize an incoming payment as destined for a phantom node, and collect the payment
12625  * itself without ever needing to forward to this fake node.
12626  *
12627  * Phantom node payments are useful for load balancing between multiple LDK nodes. They also
12628  * provide some fault tolerance, because payers will automatically retry paying other provided
12629  * nodes in the case that one node goes down.
12630  *
12631  * Note that multi-path payments are not supported in phantom invoices for security reasons.
12632  * Switching between this struct and [`KeysManager`] will invalidate any previously issued
12633  * invoices and attempts to pay previous invoices will fail.
12634  */
12635 typedef struct MUST_USE_STRUCT LDKPhantomKeysManager {
12636    /**
12637     * A pointer to the opaque Rust object.
12638     * Nearly everywhere, inner must be non-null, however in places where
12639     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12640     */
12641    LDKnativePhantomKeysManager *inner;
12642    /**
12643     * Indicates that this is the only struct which contains the same pointer.
12644     * Rust functions which take ownership of an object provided via an argument require
12645     * this to be true and invalidate the object pointed to by inner.
12646     */
12647    bool is_owned;
12648 } LDKPhantomKeysManager;
12649
12650
12651
12652 /**
12653  * Chain-related parameters used to construct a new `ChannelManager`.
12654  *
12655  * Typically, the block-specific parameters are derived from the best block hash for the network,
12656  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
12657  * are not needed when deserializing a previously constructed `ChannelManager`.
12658  */
12659 typedef struct MUST_USE_STRUCT LDKChainParameters {
12660    /**
12661     * A pointer to the opaque Rust object.
12662     * Nearly everywhere, inner must be non-null, however in places where
12663     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12664     */
12665    LDKnativeChainParameters *inner;
12666    /**
12667     * Indicates that this is the only struct which contains the same pointer.
12668     * Rust functions which take ownership of an object provided via an argument require
12669     * this to be true and invalidate the object pointed to by inner.
12670     */
12671    bool is_owned;
12672 } LDKChainParameters;
12673
12674 /**
12675  * A trait to describe an object which can receive channel messages.
12676  *
12677  * Messages MAY be called in parallel when they originate from different their_node_ids, however
12678  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
12679  */
12680 typedef struct LDKChannelMessageHandler {
12681    /**
12682     * An opaque pointer which is passed to your function implementations as an argument.
12683     * This has no meaning in the LDK, and can be NULL or any other value.
12684     */
12685    void *this_arg;
12686    /**
12687     * Handle an incoming open_channel message from the given peer.
12688     */
12689    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
12690    /**
12691     * Handle an incoming accept_channel message from the given peer.
12692     */
12693    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
12694    /**
12695     * Handle an incoming funding_created message from the given peer.
12696     */
12697    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
12698    /**
12699     * Handle an incoming funding_signed message from the given peer.
12700     */
12701    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
12702    /**
12703     * Handle an incoming channel_ready message from the given peer.
12704     */
12705    void (*handle_channel_ready)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReady *NONNULL_PTR msg);
12706    /**
12707     * Handle an incoming shutdown message from the given peer.
12708     */
12709    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);
12710    /**
12711     * Handle an incoming closing_signed message from the given peer.
12712     */
12713    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
12714    /**
12715     * Handle an incoming update_add_htlc message from the given peer.
12716     */
12717    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
12718    /**
12719     * Handle an incoming update_fulfill_htlc message from the given peer.
12720     */
12721    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
12722    /**
12723     * Handle an incoming update_fail_htlc message from the given peer.
12724     */
12725    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
12726    /**
12727     * Handle an incoming update_fail_malformed_htlc message from the given peer.
12728     */
12729    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
12730    /**
12731     * Handle an incoming commitment_signed message from the given peer.
12732     */
12733    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
12734    /**
12735     * Handle an incoming revoke_and_ack message from the given peer.
12736     */
12737    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
12738    /**
12739     * Handle an incoming update_fee message from the given peer.
12740     */
12741    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
12742    /**
12743     * Handle an incoming announcement_signatures message from the given peer.
12744     */
12745    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
12746    /**
12747     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
12748     * is believed to be possible in the future (eg they're sending us messages we don't
12749     * understand or indicate they require unknown feature bits), no_connection_possible is set
12750     * and any outstanding channels should be failed.
12751     *
12752     * Note that in some rare cases this may be called without a corresponding
12753     * [`Self::peer_connected`].
12754     */
12755    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
12756    /**
12757     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
12758     *
12759     * May return an `Err(())` if the features the peer supports are not sufficient to communicate
12760     * with us. Implementors should be somewhat conservative about doing so, however, as other
12761     * message handlers may still wish to communicate with this peer.
12762     */
12763    struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
12764    /**
12765     * Handle an incoming channel_reestablish message from the given peer.
12766     */
12767    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
12768    /**
12769     * Handle an incoming channel update from the given peer.
12770     */
12771    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
12772    /**
12773     * Handle an incoming error message from the given peer.
12774     */
12775    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
12776    /**
12777     * Gets the node feature flags which this handler itself supports. All available handlers are
12778     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
12779     * which are broadcasted in our [`NodeAnnouncement`] message.
12780     */
12781    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
12782    /**
12783     * Gets the init feature flags which should be sent to the given peer. All available handlers
12784     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
12785     * which are sent in our [`Init`] message.
12786     *
12787     * Note that this method is called before [`Self::peer_connected`].
12788     */
12789    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
12790    /**
12791     * Implementation of MessageSendEventsProvider for this object.
12792     */
12793    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
12794    /**
12795     * Frees any resources associated with this object given its this_arg pointer.
12796     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12797     */
12798    void (*free)(void *this_arg);
12799 } LDKChannelMessageHandler;
12800
12801
12802
12803 /**
12804  * Arguments for the creation of a ChannelManager that are not deserialized.
12805  *
12806  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
12807  * is:
12808  * 1) Deserialize all stored [`ChannelMonitor`]s.
12809  * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
12810  *    `<(BlockHash, ChannelManager)>::read(reader, args)`
12811  *    This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
12812  *    [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
12813  * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
12814  *    same way you would handle a [`chain::Filter`] call using
12815  *    [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
12816  * 4) Reconnect blocks on your [`ChannelMonitor`]s.
12817  * 5) Disconnect/connect blocks on the [`ChannelManager`].
12818  * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
12819  *    Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
12820  *    will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
12821  *    the next step.
12822  * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
12823  *    [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
12824  *
12825  * Note that the ordering of #4-7 is not of importance, however all four must occur before you
12826  * call any other methods on the newly-deserialized [`ChannelManager`].
12827  *
12828  * Note that because some channels may be closed during deserialization, it is critical that you
12829  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
12830  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
12831  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
12832  * not force-close the same channels but consider them live), you may end up revoking a state for
12833  * which you've already broadcasted the transaction.
12834  *
12835  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
12836  */
12837 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
12838    /**
12839     * A pointer to the opaque Rust object.
12840     * Nearly everywhere, inner must be non-null, however in places where
12841     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12842     */
12843    LDKnativeChannelManagerReadArgs *inner;
12844    /**
12845     * Indicates that this is the only struct which contains the same pointer.
12846     * Rust functions which take ownership of an object provided via an argument require
12847     * this to be true and invalidate the object pointed to by inner.
12848     */
12849    bool is_owned;
12850 } LDKChannelManagerReadArgs;
12851
12852
12853
12854 /**
12855  * A set of keys that were HKDF-expanded from an initial call to
12856  * [`KeysInterface::get_inbound_payment_key_material`].
12857  *
12858  * [`KeysInterface::get_inbound_payment_key_material`]: crate::chain::keysinterface::KeysInterface::get_inbound_payment_key_material
12859  */
12860 typedef struct MUST_USE_STRUCT LDKExpandedKey {
12861    /**
12862     * A pointer to the opaque Rust object.
12863     * Nearly everywhere, inner must be non-null, however in places where
12864     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12865     */
12866    LDKnativeExpandedKey *inner;
12867    /**
12868     * Indicates that this is the only struct which contains the same pointer.
12869     * Rust functions which take ownership of an object provided via an argument require
12870     * this to be true and invalidate the object pointed to by inner.
12871     */
12872    bool is_owned;
12873 } LDKExpandedKey;
12874
12875
12876
12877 /**
12878  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
12879  * This is used to convince the recipient that the channel is at a certain commitment
12880  * number even if they lost that data due to a local failure.  Of course, the peer may lie
12881  * and even later commitments may have been revoked.
12882  */
12883 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
12884    /**
12885     * A pointer to the opaque Rust object.
12886     * Nearly everywhere, inner must be non-null, however in places where
12887     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12888     */
12889    LDKnativeDataLossProtect *inner;
12890    /**
12891     * Indicates that this is the only struct which contains the same pointer.
12892     * Rust functions which take ownership of an object provided via an argument require
12893     * this to be true and invalidate the object pointed to by inner.
12894     */
12895    bool is_owned;
12896 } LDKDataLossProtect;
12897
12898 /**
12899  * A 3-byte byte array.
12900  */
12901 typedef struct LDKThreeBytes {
12902    /**
12903     * The three bytes
12904     */
12905    uint8_t data[3];
12906 } LDKThreeBytes;
12907
12908 /**
12909  * A trait to describe an object which can receive routing messages.
12910  *
12911  * # Implementor DoS Warnings
12912  *
12913  * For `gossip_queries` messages there are potential DoS vectors when handling
12914  * inbound queries. Implementors using an on-disk network graph should be aware of
12915  * repeated disk I/O for queries accessing different parts of the network graph.
12916  */
12917 typedef struct LDKRoutingMessageHandler {
12918    /**
12919     * An opaque pointer which is passed to your function implementations as an argument.
12920     * This has no meaning in the LDK, and can be NULL or any other value.
12921     */
12922    void *this_arg;
12923    /**
12924     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
12925     * false or returning an Err otherwise.
12926     */
12927    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
12928    /**
12929     * Handle a channel_announcement message, returning true if it should be forwarded on, false
12930     * or returning an Err otherwise.
12931     */
12932    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
12933    /**
12934     * Handle an incoming channel_update message, returning true if it should be forwarded on,
12935     * false or returning an Err otherwise.
12936     */
12937    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
12938    /**
12939     * Gets channel announcements and updates required to dump our routing table to a remote node,
12940     * starting at the short_channel_id indicated by starting_point and including announcements
12941     * for a single channel.
12942     */
12943    struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcement)(const void *this_arg, uint64_t starting_point);
12944    /**
12945     * Gets a node announcement required to dump our routing table to a remote node, starting at
12946     * the node *after* the provided pubkey and including up to one announcement immediately
12947     * higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
12948     * If None is provided for starting_point, we start at the first node.
12949     *
12950     * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
12951     * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
12952     */
12953    struct LDKNodeAnnouncement (*get_next_node_announcement)(const void *this_arg, struct LDKPublicKey starting_point);
12954    /**
12955     * Called when a connection is established with a peer. This can be used to
12956     * perform routing table synchronization using a strategy defined by the
12957     * implementor.
12958     *
12959     * May return an `Err(())` if the features the peer supports are not sufficient to communicate
12960     * with us. Implementors should be somewhat conservative about doing so, however, as other
12961     * message handlers may still wish to communicate with this peer.
12962     */
12963    struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
12964    /**
12965     * Handles the reply of a query we initiated to learn about channels
12966     * for a given range of blocks. We can expect to receive one or more
12967     * replies to a single query.
12968     */
12969    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
12970    /**
12971     * Handles the reply of a query we initiated asking for routing gossip
12972     * messages for a list of channels. We should receive this message when
12973     * a node has completed its best effort to send us the pertaining routing
12974     * gossip messages.
12975     */
12976    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
12977    /**
12978     * Handles when a peer asks us to send a list of short_channel_ids
12979     * for the requested range of blocks.
12980     */
12981    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
12982    /**
12983     * Handles when a peer asks us to send routing gossip messages for a
12984     * list of short_channel_ids.
12985     */
12986    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
12987    /**
12988     * Gets the node feature flags which this handler itself supports. All available handlers are
12989     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
12990     * which are broadcasted in our [`NodeAnnouncement`] message.
12991     */
12992    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
12993    /**
12994     * Gets the init feature flags which should be sent to the given peer. All available handlers
12995     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
12996     * which are sent in our [`Init`] message.
12997     *
12998     * Note that this method is called before [`Self::peer_connected`].
12999     */
13000    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
13001    /**
13002     * Implementation of MessageSendEventsProvider for this object.
13003     */
13004    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
13005    /**
13006     * Frees any resources associated with this object given its this_arg pointer.
13007     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13008     */
13009    void (*free)(void *this_arg);
13010 } LDKRoutingMessageHandler;
13011
13012 /**
13013  * A trait to describe an object that can receive onion messages.
13014  */
13015 typedef struct LDKOnionMessageHandler {
13016    /**
13017     * An opaque pointer which is passed to your function implementations as an argument.
13018     * This has no meaning in the LDK, and can be NULL or any other value.
13019     */
13020    void *this_arg;
13021    /**
13022     * Handle an incoming onion_message message from the given peer.
13023     */
13024    void (*handle_onion_message)(const void *this_arg, struct LDKPublicKey peer_node_id, const struct LDKOnionMessage *NONNULL_PTR msg);
13025    /**
13026     * Called when a connection is established with a peer. Can be used to track which peers
13027     * advertise onion message support and are online.
13028     *
13029     * May return an `Err(())` if the features the peer supports are not sufficient to communicate
13030     * with us. Implementors should be somewhat conservative about doing so, however, as other
13031     * message handlers may still wish to communicate with this peer.
13032     */
13033    struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
13034    /**
13035     * Indicates a connection to the peer failed/an existing connection was lost. Allows handlers to
13036     * drop and refuse to forward onion messages to this peer.
13037     *
13038     * Note that in some rare cases this may be called without a corresponding
13039     * [`Self::peer_connected`].
13040     */
13041    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
13042    /**
13043     * Gets the node feature flags which this handler itself supports. All available handlers are
13044     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
13045     * which are broadcasted in our [`NodeAnnouncement`] message.
13046     */
13047    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
13048    /**
13049     * Gets the init feature flags which should be sent to the given peer. All available handlers
13050     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
13051     * which are sent in our [`Init`] message.
13052     *
13053     * Note that this method is called before [`Self::peer_connected`].
13054     */
13055    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
13056    /**
13057     * Implementation of OnionMessageProvider for this object.
13058     */
13059    struct LDKOnionMessageProvider OnionMessageProvider;
13060    /**
13061     * Frees any resources associated with this object given its this_arg pointer.
13062     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13063     */
13064    void (*free)(void *this_arg);
13065 } LDKOnionMessageHandler;
13066
13067 /**
13068  * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
13069  * decoders.
13070  */
13071 typedef struct LDKCustomMessageReader {
13072    /**
13073     * An opaque pointer which is passed to your function implementations as an argument.
13074     * This has no meaning in the LDK, and can be NULL or any other value.
13075     */
13076    void *this_arg;
13077    /**
13078     * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
13079     * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
13080     * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
13081     * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
13082     */
13083    struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer);
13084    /**
13085     * Frees any resources associated with this object given its this_arg pointer.
13086     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13087     */
13088    void (*free)(void *this_arg);
13089 } LDKCustomMessageReader;
13090
13091 /**
13092  * Handler for BOLT1-compliant messages.
13093  */
13094 typedef struct LDKCustomMessageHandler {
13095    /**
13096     * An opaque pointer which is passed to your function implementations as an argument.
13097     * This has no meaning in the LDK, and can be NULL or any other value.
13098     */
13099    void *this_arg;
13100    /**
13101     * Called with the message type that was received and the buffer to be read.
13102     * Can return a `MessageHandlingError` if the message could not be handled.
13103     */
13104    struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id);
13105    /**
13106     * Gets the list of pending messages which were generated by the custom message
13107     * handler, clearing the list in the process. The first tuple element must
13108     * correspond to the intended recipients node ids. If no connection to one of the
13109     * specified node does not exist, the message is simply not sent to it.
13110     */
13111    struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg);
13112    /**
13113     * Implementation of CustomMessageReader for this object.
13114     */
13115    struct LDKCustomMessageReader CustomMessageReader;
13116    /**
13117     * Frees any resources associated with this object given its this_arg pointer.
13118     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13119     */
13120    void (*free)(void *this_arg);
13121 } LDKCustomMessageHandler;
13122
13123
13124
13125 /**
13126  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
13127  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
13128  */
13129 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
13130    /**
13131     * A pointer to the opaque Rust object.
13132     * Nearly everywhere, inner must be non-null, however in places where
13133     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13134     */
13135    LDKnativeIgnoringMessageHandler *inner;
13136    /**
13137     * Indicates that this is the only struct which contains the same pointer.
13138     * Rust functions which take ownership of an object provided via an argument require
13139     * this to be true and invalidate the object pointed to by inner.
13140     */
13141    bool is_owned;
13142 } LDKIgnoringMessageHandler;
13143
13144 /**
13145  * Handler for custom onion messages. If you are using [`SimpleArcOnionMessenger`],
13146  * [`SimpleRefOnionMessenger`], or prefer to ignore inbound custom onion messages,
13147  * [`IgnoringMessageHandler`] must be provided to [`OnionMessenger::new`]. Otherwise, a custom
13148  * implementation of this trait must be provided, with [`CustomMessage`] specifying the supported
13149  * message types.
13150  *
13151  * See [`OnionMessenger`] for example usage.
13152  *
13153  * [`IgnoringMessageHandler`]: crate::ln::peer_handler::IgnoringMessageHandler
13154  * [`CustomMessage`]: Self::CustomMessage
13155  */
13156 typedef struct LDKCustomOnionMessageHandler {
13157    /**
13158     * An opaque pointer which is passed to your function implementations as an argument.
13159     * This has no meaning in the LDK, and can be NULL or any other value.
13160     */
13161    void *this_arg;
13162    /**
13163     * Called with the custom message that was received.
13164     */
13165    void (*handle_custom_message)(const void *this_arg, struct LDKCustomOnionMessageContents msg);
13166    /**
13167     * Read a custom message of type `message_type` from `buffer`, returning `Ok(None)` if the
13168     * message type is unknown.
13169     */
13170    struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ (*read_custom_message)(const void *this_arg, uint64_t message_type, struct LDKu8slice buffer);
13171    /**
13172     * Frees any resources associated with this object given its this_arg pointer.
13173     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13174     */
13175    void (*free)(void *this_arg);
13176 } LDKCustomOnionMessageHandler;
13177
13178
13179
13180 /**
13181  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
13182  * You can provide one of these as the route_handler in a MessageHandler.
13183  */
13184 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
13185    /**
13186     * A pointer to the opaque Rust object.
13187     * Nearly everywhere, inner must be non-null, however in places where
13188     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13189     */
13190    LDKnativeErroringMessageHandler *inner;
13191    /**
13192     * Indicates that this is the only struct which contains the same pointer.
13193     * Rust functions which take ownership of an object provided via an argument require
13194     * this to be true and invalidate the object pointed to by inner.
13195     */
13196    bool is_owned;
13197 } LDKErroringMessageHandler;
13198
13199
13200
13201 /**
13202  * Provides references to trait impls which handle different types of messages.
13203  */
13204 typedef struct MUST_USE_STRUCT LDKMessageHandler {
13205    /**
13206     * A pointer to the opaque Rust object.
13207     * Nearly everywhere, inner must be non-null, however in places where
13208     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13209     */
13210    LDKnativeMessageHandler *inner;
13211    /**
13212     * Indicates that this is the only struct which contains the same pointer.
13213     * Rust functions which take ownership of an object provided via an argument require
13214     * this to be true and invalidate the object pointed to by inner.
13215     */
13216    bool is_owned;
13217 } LDKMessageHandler;
13218
13219 /**
13220  * Provides an object which can be used to send data to and which uniquely identifies a connection
13221  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
13222  * implement Hash to meet the PeerManager API.
13223  *
13224  * For efficiency, Clone should be relatively cheap for this type.
13225  *
13226  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
13227  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
13228  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
13229  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
13230  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
13231  * to simply use another value which is guaranteed to be globally unique instead.
13232  */
13233 typedef struct LDKSocketDescriptor {
13234    /**
13235     * An opaque pointer which is passed to your function implementations as an argument.
13236     * This has no meaning in the LDK, and can be NULL or any other value.
13237     */
13238    void *this_arg;
13239    /**
13240     * Attempts to send some data from the given slice to the peer.
13241     *
13242     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
13243     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
13244     * called and further write attempts may occur until that time.
13245     *
13246     * If the returned size is smaller than `data.len()`, a
13247     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
13248     * written. Additionally, until a `send_data` event completes fully, no further
13249     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
13250     * prevent denial-of-service issues, you should not read or buffer any data from the socket
13251     * until then.
13252     *
13253     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
13254     * (indicating that read events should be paused to prevent DoS in the send buffer),
13255     * `resume_read` may be set indicating that read events on this descriptor should resume. A
13256     * `resume_read` of false carries no meaning, and should not cause any action.
13257     */
13258    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
13259    /**
13260     * Disconnect the socket pointed to by this SocketDescriptor.
13261     *
13262     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
13263     * call (doing so is a noop).
13264     */
13265    void (*disconnect_socket)(void *this_arg);
13266    /**
13267     * Checks if two objects are equal given this object's this_arg pointer and another object.
13268     */
13269    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
13270    /**
13271     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
13272     * This is used, for example, for inclusion of this object in a hash map.
13273     */
13274    uint64_t (*hash)(const void *this_arg);
13275    /**
13276     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
13277     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
13278     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
13279     */
13280    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
13281    /**
13282     * Frees any resources associated with this object given its this_arg pointer.
13283     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13284     */
13285    void (*free)(void *this_arg);
13286 } LDKSocketDescriptor;
13287
13288
13289
13290 /**
13291  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
13292  * socket events into messages which it passes on to its [`MessageHandler`].
13293  *
13294  * Locks are taken internally, so you must never assume that reentrancy from a
13295  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
13296  *
13297  * Calls to [`read_event`] will decode relevant messages and pass them to the
13298  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
13299  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
13300  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
13301  * calls only after previous ones have returned.
13302  *
13303  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
13304  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
13305  * essentially you should default to using a SimpleRefPeerManager, and use a
13306  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
13307  * you're using lightning-net-tokio.
13308  *
13309  * [`read_event`]: PeerManager::read_event
13310  */
13311 typedef struct MUST_USE_STRUCT LDKPeerManager {
13312    /**
13313     * A pointer to the opaque Rust object.
13314     * Nearly everywhere, inner must be non-null, however in places where
13315     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13316     */
13317    LDKnativePeerManager *inner;
13318    /**
13319     * Indicates that this is the only struct which contains the same pointer.
13320     * Rust functions which take ownership of an object provided via an argument require
13321     * this to be true and invalidate the object pointed to by inner.
13322     */
13323    bool is_owned;
13324 } LDKPeerManager;
13325
13326
13327
13328 /**
13329  * Static channel fields used to build transactions given per-commitment fields, organized by
13330  * broadcaster/countersignatory.
13331  *
13332  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
13333  * as_holder_broadcastable and as_counterparty_broadcastable functions.
13334  */
13335 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
13336    /**
13337     * A pointer to the opaque Rust object.
13338     * Nearly everywhere, inner must be non-null, however in places where
13339     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13340     */
13341    LDKnativeDirectedChannelTransactionParameters *inner;
13342    /**
13343     * Indicates that this is the only struct which contains the same pointer.
13344     * Rust functions which take ownership of an object provided via an argument require
13345     * this to be true and invalidate the object pointed to by inner.
13346     */
13347    bool is_owned;
13348 } LDKDirectedChannelTransactionParameters;
13349
13350 /**
13351  * Integer in the range `0..=16`
13352  */
13353 typedef struct LDKWitnessVersion {
13354    uint8_t _0;
13355 } LDKWitnessVersion;
13356
13357
13358
13359 /**
13360  * A read-only view of [`NetworkGraph`].
13361  */
13362 typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
13363    /**
13364     * A pointer to the opaque Rust object.
13365     * Nearly everywhere, inner must be non-null, however in places where
13366     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13367     */
13368    LDKnativeReadOnlyNetworkGraph *inner;
13369    /**
13370     * Indicates that this is the only struct which contains the same pointer.
13371     * Rust functions which take ownership of an object provided via an argument require
13372     * this to be true and invalidate the object pointed to by inner.
13373     */
13374    bool is_owned;
13375 } LDKReadOnlyNetworkGraph;
13376
13377
13378
13379 /**
13380  * Receives and validates network updates from peers,
13381  * stores authentic and relevant data as a network graph.
13382  * This network graph is then used for routing payments.
13383  * Provides interface to help with initial routing sync by
13384  * serving historical announcements.
13385  *
13386  * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
13387  * [`NetworkGraph`].
13388  */
13389 typedef struct MUST_USE_STRUCT LDKP2PGossipSync {
13390    /**
13391     * A pointer to the opaque Rust object.
13392     * Nearly everywhere, inner must be non-null, however in places where
13393     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13394     */
13395    LDKnativeP2PGossipSync *inner;
13396    /**
13397     * Indicates that this is the only struct which contains the same pointer.
13398     * Rust functions which take ownership of an object provided via an argument require
13399     * this to be true and invalidate the object pointed to by inner.
13400     */
13401    bool is_owned;
13402 } LDKP2PGossipSync;
13403
13404
13405
13406 /**
13407  * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a
13408  * source node to a target node.
13409  */
13410 typedef struct MUST_USE_STRUCT LDKDirectedChannelInfo {
13411    /**
13412     * A pointer to the opaque Rust object.
13413     * Nearly everywhere, inner must be non-null, however in places where
13414     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13415     */
13416    LDKnativeDirectedChannelInfo *inner;
13417    /**
13418     * Indicates that this is the only struct which contains the same pointer.
13419     * Rust functions which take ownership of an object provided via an argument require
13420     * this to be true and invalidate the object pointed to by inner.
13421     */
13422    bool is_owned;
13423 } LDKDirectedChannelInfo;
13424
13425 /**
13426  * The effective capacity of a channel for routing purposes.
13427  *
13428  * While this may be smaller than the actual channel capacity, amounts greater than
13429  * [`Self::as_msat`] should not be routed through the channel.
13430  */
13431 typedef enum LDKEffectiveCapacity_Tag {
13432    /**
13433     * The available liquidity in the channel known from being a channel counterparty, and thus a
13434     * direct hop.
13435     */
13436    LDKEffectiveCapacity_ExactLiquidity,
13437    /**
13438     * The maximum HTLC amount in one direction as advertised on the gossip network.
13439     */
13440    LDKEffectiveCapacity_MaximumHTLC,
13441    /**
13442     * The total capacity of the channel as determined by the funding transaction.
13443     */
13444    LDKEffectiveCapacity_Total,
13445    /**
13446     * A capacity sufficient to route any payment, typically used for private channels provided by
13447     * an invoice.
13448     */
13449    LDKEffectiveCapacity_Infinite,
13450    /**
13451     * A capacity that is unknown possibly because either the chain state is unavailable to know
13452     * the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network.
13453     */
13454    LDKEffectiveCapacity_Unknown,
13455    /**
13456     * Must be last for serialization purposes
13457     */
13458    LDKEffectiveCapacity_Sentinel,
13459 } LDKEffectiveCapacity_Tag;
13460
13461 typedef struct LDKEffectiveCapacity_LDKExactLiquidity_Body {
13462    /**
13463     * Either the inbound or outbound liquidity depending on the direction, denominated in
13464     * millisatoshi.
13465     */
13466    uint64_t liquidity_msat;
13467 } LDKEffectiveCapacity_LDKExactLiquidity_Body;
13468
13469 typedef struct LDKEffectiveCapacity_LDKMaximumHTLC_Body {
13470    /**
13471     * The maximum HTLC amount denominated in millisatoshi.
13472     */
13473    uint64_t amount_msat;
13474 } LDKEffectiveCapacity_LDKMaximumHTLC_Body;
13475
13476 typedef struct LDKEffectiveCapacity_LDKTotal_Body {
13477    /**
13478     * The funding amount denominated in millisatoshi.
13479     */
13480    uint64_t capacity_msat;
13481    /**
13482     * The maximum HTLC amount denominated in millisatoshi.
13483     */
13484    struct LDKCOption_u64Z htlc_maximum_msat;
13485 } LDKEffectiveCapacity_LDKTotal_Body;
13486
13487 typedef struct MUST_USE_STRUCT LDKEffectiveCapacity {
13488    LDKEffectiveCapacity_Tag tag;
13489    union {
13490       LDKEffectiveCapacity_LDKExactLiquidity_Body exact_liquidity;
13491       LDKEffectiveCapacity_LDKMaximumHTLC_Body maximum_htlc;
13492       LDKEffectiveCapacity_LDKTotal_Body total;
13493    };
13494 } LDKEffectiveCapacity;
13495
13496
13497
13498 /**
13499  * A concrete implementation of [`LockableScore`] which supports multi-threading.
13500  */
13501 typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore {
13502    /**
13503     * A pointer to the opaque Rust object.
13504     * Nearly everywhere, inner must be non-null, however in places where
13505     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13506     */
13507    LDKnativeMultiThreadedLockableScore *inner;
13508    /**
13509     * Indicates that this is the only struct which contains the same pointer.
13510     * Rust functions which take ownership of an object provided via an argument require
13511     * this to be true and invalidate the object pointed to by inner.
13512     */
13513    bool is_owned;
13514 } LDKMultiThreadedLockableScore;
13515
13516
13517
13518 /**
13519  * A locked `MultiThreadedLockableScore`.
13520  */
13521 typedef struct MUST_USE_STRUCT LDKMultiThreadedScoreLock {
13522    /**
13523     * A pointer to the opaque Rust object.
13524     * Nearly everywhere, inner must be non-null, however in places where
13525     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13526     */
13527    LDKnativeMultiThreadedScoreLock *inner;
13528    /**
13529     * Indicates that this is the only struct which contains the same pointer.
13530     * Rust functions which take ownership of an object provided via an argument require
13531     * this to be true and invalidate the object pointed to by inner.
13532     */
13533    bool is_owned;
13534 } LDKMultiThreadedScoreLock;
13535
13536
13537
13538 /**
13539  * Parameters for configuring [`ProbabilisticScorer`].
13540  *
13541  * Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel
13542  * penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel).
13543  *
13544  * The penalty applied to any channel by the [`ProbabilisticScorer`] is the sum of each of the
13545  * parameters here.
13546  */
13547 typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters {
13548    /**
13549     * A pointer to the opaque Rust object.
13550     * Nearly everywhere, inner must be non-null, however in places where
13551     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13552     */
13553    LDKnativeProbabilisticScoringParameters *inner;
13554    /**
13555     * Indicates that this is the only struct which contains the same pointer.
13556     * Rust functions which take ownership of an object provided via an argument require
13557     * this to be true and invalidate the object pointed to by inner.
13558     */
13559    bool is_owned;
13560 } LDKProbabilisticScoringParameters;
13561
13562
13563
13564 /**
13565  * A sender, receiver and forwarder of onion messages. In upcoming releases, this object will be
13566  * used to retrieve invoices and fulfill invoice requests from [offers]. Currently, only sending
13567  * and receiving custom onion messages is supported.
13568  *
13569  * # Example
13570  *
13571  * ```
13572  * # extern crate bitcoin;
13573  * # use bitcoin::hashes::_export::_core::time::Duration;
13574  * # use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};
13575  * # use lightning::chain::keysinterface::{InMemorySigner, KeysManager, KeysInterface};
13576  * # use lightning::ln::msgs::DecodeError;
13577  * # use lightning::ln::peer_handler::IgnoringMessageHandler;
13578  * # use lightning::onion_message::messenger::{Destination, OnionMessenger};
13579  * # use lightning::onion_message::packet::CustomOnionMessageContents;
13580  * # use lightning::onion_message::blinded_route::BlindedRoute;
13581  * # use lightning::util::logger::{Logger, Record};
13582  * # use lightning::util::ser::{Writeable, Writer};
13583  * # use lightning::io;
13584  * # use std::sync::Arc;
13585  * # struct FakeLogger {};
13586  * # impl Logger for FakeLogger {
13587  * #     fn log(&self, record: &Record) { unimplemented!() }
13588  * # }
13589  * # let seed = [42u8; 32];
13590  * # let time = Duration::from_secs(123456);
13591  * # let keys_manager = KeysManager::new(&seed, time.as_secs(), time.subsec_nanos());
13592  * # let logger = Arc::new(FakeLogger {});
13593  * # let node_secret = SecretKey::from_slice(&hex::decode(\"0101010101010101010101010101010101010101010101010101010101010101\").unwrap()[..]).unwrap();
13594  * # let secp_ctx = Secp256k1::new();
13595  * # let hop_node_id1 = PublicKey::from_secret_key(&secp_ctx, &node_secret);
13596  * # let (hop_node_id2, hop_node_id3, hop_node_id4) = (hop_node_id1, hop_node_id1, hop_node_id1);
13597  * # let destination_node_id = hop_node_id1;
13598  * # let your_custom_message_handler = IgnoringMessageHandler {};
13599  * // Create the onion messenger. This must use the same `keys_manager` as is passed to your
13600  * // ChannelManager.
13601  * let onion_messenger = OnionMessenger::new(&keys_manager, logger, your_custom_message_handler);
13602  *
13603  * # struct YourCustomMessage {}
13604  * impl Writeable for YourCustomMessage {
13605  * \tfn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
13606  * \t\t# Ok(())
13607  * \t\t// Write your custom onion message to `w`
13608  * \t}
13609  * }
13610  * impl CustomOnionMessageContents for YourCustomMessage {
13611  * \tfn tlv_type(&self) -> u64 {
13612  * \t\t# let your_custom_message_type = 42;
13613  * \t\tyour_custom_message_type
13614  * \t}
13615  * }
13616  * // Send a custom onion message to a node id.
13617  * let intermediate_hops = [hop_node_id1, hop_node_id2];
13618  * let reply_path = None;
13619  * # let your_custom_message = YourCustomMessage {};
13620  * onion_messenger.send_custom_onion_message(&intermediate_hops, Destination::Node(destination_node_id), your_custom_message, reply_path);
13621  *
13622  * // Create a blinded route to yourself, for someone to send an onion message to.
13623  * # let your_node_id = hop_node_id1;
13624  * let hops = [hop_node_id3, hop_node_id4, your_node_id];
13625  * let blinded_route = BlindedRoute::new(&hops, &keys_manager, &secp_ctx).unwrap();
13626  *
13627  * // Send a custom onion message to a blinded route.
13628  * # let intermediate_hops = [hop_node_id1, hop_node_id2];
13629  * let reply_path = None;
13630  * # let your_custom_message = YourCustomMessage {};
13631  * onion_messenger.send_custom_onion_message(&intermediate_hops, Destination::BlindedRoute(blinded_route), your_custom_message, reply_path);
13632  * ```
13633  *
13634  * [offers]: <https://github.com/lightning/bolts/pull/798>
13635  * [`OnionMessenger`]: crate::onion_message::OnionMessenger
13636  */
13637 typedef struct MUST_USE_STRUCT LDKOnionMessenger {
13638    /**
13639     * A pointer to the opaque Rust object.
13640     * Nearly everywhere, inner must be non-null, however in places where
13641     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13642     */
13643    LDKnativeOnionMessenger *inner;
13644    /**
13645     * Indicates that this is the only struct which contains the same pointer.
13646     * Rust functions which take ownership of an object provided via an argument require
13647     * this to be true and invalidate the object pointed to by inner.
13648     */
13649    bool is_owned;
13650 } LDKOnionMessenger;
13651
13652 /**
13653  * The destination of an onion message.
13654  */
13655 typedef enum LDKDestination_Tag {
13656    /**
13657     * We're sending this onion message to a node.
13658     */
13659    LDKDestination_Node,
13660    /**
13661     * We're sending this onion message to a blinded route.
13662     */
13663    LDKDestination_BlindedRoute,
13664    /**
13665     * Must be last for serialization purposes
13666     */
13667    LDKDestination_Sentinel,
13668 } LDKDestination_Tag;
13669
13670 typedef struct MUST_USE_STRUCT LDKDestination {
13671    LDKDestination_Tag tag;
13672    union {
13673       struct {
13674          struct LDKPublicKey node;
13675       };
13676       struct {
13677          struct LDKBlindedRoute blinded_route;
13678       };
13679    };
13680 } LDKDestination;
13681
13682
13683
13684 /**
13685  * FilesystemPersister persists channel data on disk, where each channel's
13686  * data is stored in a file named after its funding outpoint.
13687  *
13688  * Warning: this module does the best it can with calls to persist data, but it
13689  * can only guarantee that the data is passed to the drive. It is up to the
13690  * drive manufacturers to do the actual persistence properly, which they often
13691  * don't (especially on consumer-grade hardware). Therefore, it is up to the
13692  * user to validate their entire storage stack, to ensure the writes are
13693  * persistent.
13694  * Corollary: especially when dealing with larger amounts of money, it is best
13695  * practice to have multiple channel data backups and not rely only on one
13696  * FilesystemPersister.
13697  */
13698 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
13699    /**
13700     * A pointer to the opaque Rust object.
13701     * Nearly everywhere, inner must be non-null, however in places where
13702     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13703     */
13704    LDKnativeFilesystemPersister *inner;
13705    /**
13706     * Indicates that this is the only struct which contains the same pointer.
13707     * Rust functions which take ownership of an object provided via an argument require
13708     * this to be true and invalidate the object pointed to by inner.
13709     */
13710    bool is_owned;
13711 } LDKFilesystemPersister;
13712
13713
13714
13715 /**
13716  * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
13717  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
13718  * responsibilities are:
13719  * * Processing [`Event`]s with a user-provided [`EventHandler`].
13720  * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
13721  *   writing it to disk/backups by invoking the callback given to it at startup.
13722  *   [`ChannelManager`] persistence should be done in the background.
13723  * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
13724  *   at the appropriate intervals.
13725  * * Calling [`NetworkGraph::remove_stale_channels_and_tracking`] (if a [`GossipSync`] with a
13726  *   [`NetworkGraph`] is provided to [`BackgroundProcessor::start`]).
13727  *
13728  * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
13729  * upon as doing so may result in high latency.
13730  *
13731  * # Note
13732  *
13733  * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
13734  * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
13735  * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
13736  * unilateral chain closure fees are at risk.
13737  *
13738  * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
13739  * [`Event`]: lightning::util::events::Event
13740  *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
13741  */
13742 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
13743    /**
13744     * A pointer to the opaque Rust object.
13745     * Nearly everywhere, inner must be non-null, however in places where
13746     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13747     */
13748    LDKnativeBackgroundProcessor *inner;
13749    /**
13750     * Indicates that this is the only struct which contains the same pointer.
13751     * Rust functions which take ownership of an object provided via an argument require
13752     * this to be true and invalidate the object pointed to by inner.
13753     */
13754    bool is_owned;
13755 } LDKBackgroundProcessor;
13756
13757
13758
13759 /**
13760  * The main Rapid Gossip Sync object.
13761  *
13762  * See [crate-level documentation] for usage.
13763  *
13764  * [crate-level documentation]: crate
13765  */
13766 typedef struct MUST_USE_STRUCT LDKRapidGossipSync {
13767    /**
13768     * A pointer to the opaque Rust object.
13769     * Nearly everywhere, inner must be non-null, however in places where
13770     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13771     */
13772    LDKnativeRapidGossipSync *inner;
13773    /**
13774     * Indicates that this is the only struct which contains the same pointer.
13775     * Rust functions which take ownership of an object provided via an argument require
13776     * this to be true and invalidate the object pointed to by inner.
13777     */
13778    bool is_owned;
13779 } LDKRapidGossipSync;
13780
13781 /**
13782  * Either [`P2PGossipSync`] or [`RapidGossipSync`].
13783  */
13784 typedef enum LDKGossipSync_Tag {
13785    /**
13786     * Gossip sync via the lightning peer-to-peer network as defined by BOLT 7.
13787     */
13788    LDKGossipSync_P2P,
13789    /**
13790     * Rapid gossip sync from a trusted server.
13791     */
13792    LDKGossipSync_Rapid,
13793    /**
13794     * No gossip sync.
13795     */
13796    LDKGossipSync_None,
13797    /**
13798     * Must be last for serialization purposes
13799     */
13800    LDKGossipSync_Sentinel,
13801 } LDKGossipSync_Tag;
13802
13803 typedef struct MUST_USE_STRUCT LDKGossipSync {
13804    LDKGossipSync_Tag tag;
13805    union {
13806       struct {
13807          /**
13808           * Note that this field is expected to be a reference.
13809           */
13810          struct LDKP2PGossipSync p2p;
13811       };
13812       struct {
13813          /**
13814           * Note that this field is expected to be a reference.
13815           */
13816          struct LDKRapidGossipSync rapid;
13817       };
13818    };
13819 } LDKGossipSync;
13820
13821
13822
13823 /**
13824  * Data of the `RawInvoice` that is encoded in the data part
13825  */
13826 typedef struct MUST_USE_STRUCT LDKRawDataPart {
13827    /**
13828     * A pointer to the opaque Rust object.
13829     * Nearly everywhere, inner must be non-null, however in places where
13830     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13831     */
13832    LDKnativeRawDataPart *inner;
13833    /**
13834     * Indicates that this is the only struct which contains the same pointer.
13835     * Rust functions which take ownership of an object provided via an argument require
13836     * this to be true and invalidate the object pointed to by inner.
13837     */
13838    bool is_owned;
13839 } LDKRawDataPart;
13840
13841
13842
13843 /**
13844  * SHA-256 hash
13845  */
13846 typedef struct MUST_USE_STRUCT LDKSha256 {
13847    /**
13848     * A pointer to the opaque Rust object.
13849     * Nearly everywhere, inner must be non-null, however in places where
13850     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13851     */
13852    LDKnativeSha256 *inner;
13853    /**
13854     * Indicates that this is the only struct which contains the same pointer.
13855     * Rust functions which take ownership of an object provided via an argument require
13856     * this to be true and invalidate the object pointed to by inner.
13857     */
13858    bool is_owned;
13859 } LDKSha256;
13860
13861
13862
13863 /**
13864  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
13865  * expires
13866  */
13867 typedef struct MUST_USE_STRUCT LDKExpiryTime {
13868    /**
13869     * A pointer to the opaque Rust object.
13870     * Nearly everywhere, inner must be non-null, however in places where
13871     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13872     */
13873    LDKnativeExpiryTime *inner;
13874    /**
13875     * Indicates that this is the only struct which contains the same pointer.
13876     * Rust functions which take ownership of an object provided via an argument require
13877     * this to be true and invalidate the object pointed to by inner.
13878     */
13879    bool is_owned;
13880 } LDKExpiryTime;
13881
13882
13883
13884 /**
13885  * `min_final_cltv_expiry` to use for the last HTLC in the route
13886  */
13887 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
13888    /**
13889     * A pointer to the opaque Rust object.
13890     * Nearly everywhere, inner must be non-null, however in places where
13891     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13892     */
13893    LDKnativeMinFinalCltvExpiry *inner;
13894    /**
13895     * Indicates that this is the only struct which contains the same pointer.
13896     * Rust functions which take ownership of an object provided via an argument require
13897     * this to be true and invalidate the object pointed to by inner.
13898     */
13899    bool is_owned;
13900 } LDKMinFinalCltvExpiry;
13901
13902 /**
13903  * A 20-byte byte array.
13904  */
13905 typedef struct LDKTwentyBytes {
13906    /**
13907     * The twenty bytes
13908     */
13909    uint8_t data[20];
13910 } LDKTwentyBytes;
13911
13912 /**
13913  * Fallback address in case no LN payment is possible
13914  */
13915 typedef enum LDKFallback_Tag {
13916    LDKFallback_SegWitProgram,
13917    LDKFallback_PubKeyHash,
13918    LDKFallback_ScriptHash,
13919    /**
13920     * Must be last for serialization purposes
13921     */
13922    LDKFallback_Sentinel,
13923 } LDKFallback_Tag;
13924
13925 typedef struct LDKFallback_LDKSegWitProgram_Body {
13926    struct LDKu5 version;
13927    struct LDKCVec_u8Z program;
13928 } LDKFallback_LDKSegWitProgram_Body;
13929
13930 typedef struct MUST_USE_STRUCT LDKFallback {
13931    LDKFallback_Tag tag;
13932    union {
13933       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
13934       struct {
13935          struct LDKTwentyBytes pub_key_hash;
13936       };
13937       struct {
13938          struct LDKTwentyBytes script_hash;
13939       };
13940    };
13941 } LDKFallback;
13942
13943 /**
13944  * A trait defining behavior of an [`Invoice`] payer.
13945  */
13946 typedef struct LDKPayer {
13947    /**
13948     * An opaque pointer which is passed to your function implementations as an argument.
13949     * This has no meaning in the LDK, and can be NULL or any other value.
13950     */
13951    void *this_arg;
13952    /**
13953     * Returns the payer's node id.
13954     */
13955    struct LDKPublicKey (*node_id)(const void *this_arg);
13956    /**
13957     * Returns the payer's channels.
13958     */
13959    struct LDKCVec_ChannelDetailsZ (*first_hops)(const void *this_arg);
13960    /**
13961     * Sends a payment over the Lightning Network using the given [`Route`].
13962     *
13963     * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
13964     */
13965    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
13966    /**
13967     * Sends a spontaneous payment over the Lightning Network using the given [`Route`].
13968     */
13969    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_spontaneous_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage);
13970    /**
13971     * Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
13972     */
13973    struct LDKCResult_NonePaymentSendFailureZ (*retry_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
13974    /**
13975     * Signals that no further retries for the given payment will occur.
13976     */
13977    void (*abandon_payment)(const void *this_arg, struct LDKThirtyTwoBytes payment_id);
13978    /**
13979     * Frees any resources associated with this object given its this_arg pointer.
13980     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13981     */
13982    void (*free)(void *this_arg);
13983 } LDKPayer;
13984
13985 /**
13986  * A trait defining behavior for routing an [`Invoice`] payment.
13987  */
13988 typedef struct LDKRouter {
13989    /**
13990     * An opaque pointer which is passed to your function implementations as an argument.
13991     * This has no meaning in the LDK, and can be NULL or any other value.
13992     */
13993    void *this_arg;
13994    /**
13995     * Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
13996     *
13997     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
13998     */
13999    struct LDKCResult_RouteLightningErrorZ (*find_route)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, const uint8_t (*payment_hash)[32], struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs);
14000    /**
14001     * Lets the router know that payment through a specific path has failed.
14002     */
14003    void (*notify_payment_path_failed)(const void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
14004    /**
14005     * Lets the router know that payment through a specific path was successful.
14006     */
14007    void (*notify_payment_path_successful)(const void *this_arg, struct LDKCVec_RouteHopZ path);
14008    /**
14009     * Lets the router know that a payment probe was successful.
14010     */
14011    void (*notify_payment_probe_successful)(const void *this_arg, struct LDKCVec_RouteHopZ path);
14012    /**
14013     * Lets the router know that a payment probe failed.
14014     */
14015    void (*notify_payment_probe_failed)(const void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
14016    /**
14017     * Frees any resources associated with this object given its this_arg pointer.
14018     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
14019     */
14020    void (*free)(void *this_arg);
14021 } LDKRouter;
14022
14023
14024
14025 /**
14026  * A utility for paying [`Invoice`]s and sending spontaneous payments.
14027  *
14028  * See [module-level documentation] for details.
14029  *
14030  * [module-level documentation]: crate::payment
14031  */
14032 typedef struct MUST_USE_STRUCT LDKInvoicePayer {
14033    /**
14034     * A pointer to the opaque Rust object.
14035     * Nearly everywhere, inner must be non-null, however in places where
14036     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14037     */
14038    LDKnativeInvoicePayer *inner;
14039    /**
14040     * Indicates that this is the only struct which contains the same pointer.
14041     * Rust functions which take ownership of an object provided via an argument require
14042     * this to be true and invalidate the object pointed to by inner.
14043     */
14044    bool is_owned;
14045 } LDKInvoicePayer;
14046
14047 /**
14048  * Strategies available to retry payment path failures for an [`Invoice`].
14049  *
14050  */
14051 typedef enum LDKRetry_Tag {
14052    /**
14053     * Max number of attempts to retry payment.
14054     *
14055     * Note that this is the number of *path* failures, not full payment retries. For multi-path
14056     * payments, if this is less than the total number of paths, we will never even retry all of the
14057     * payment's paths.
14058     */
14059    LDKRetry_Attempts,
14060    /**
14061     * Time elapsed before abandoning retries for a payment.
14062     */
14063    LDKRetry_Timeout,
14064    /**
14065     * Must be last for serialization purposes
14066     */
14067    LDKRetry_Sentinel,
14068 } LDKRetry_Tag;
14069
14070 typedef struct MUST_USE_STRUCT LDKRetry {
14071    LDKRetry_Tag tag;
14072    union {
14073       struct {
14074          uintptr_t attempts;
14075       };
14076       struct {
14077          uint64_t timeout;
14078       };
14079    };
14080 } LDKRetry;
14081
14082
14083
14084 /**
14085  * A [`Router`] implemented using [`find_route`].
14086  */
14087 typedef struct MUST_USE_STRUCT LDKDefaultRouter {
14088    /**
14089     * A pointer to the opaque Rust object.
14090     * Nearly everywhere, inner must be non-null, however in places where
14091     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14092     */
14093    LDKnativeDefaultRouter *inner;
14094    /**
14095     * Indicates that this is the only struct which contains the same pointer.
14096     * Rust functions which take ownership of an object provided via an argument require
14097     * this to be true and invalidate the object pointed to by inner.
14098     */
14099    bool is_owned;
14100 } LDKDefaultRouter;
14101
14102 extern const uintptr_t MAX_BUF_SIZE;
14103
14104 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
14105
14106 extern const uint32_t FEERATE_FLOOR_SATS_PER_KW;
14107
14108 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
14109
14110 extern const uint32_t ANTI_REORG_DELAY;
14111
14112 extern const uint16_t BREAKDOWN_TIMEOUT;
14113
14114 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
14115
14116 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
14117
14118 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
14119
14120 extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT;
14121
14122 extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA;
14123
14124 extern const uint8_t DEFAULT_MAX_PATH_COUNT;
14125
14126 extern const uint64_t MAX_TIMESTAMP;
14127
14128 extern const uint64_t DEFAULT_EXPIRY_TIME;
14129
14130 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY;
14131
14132 extern const uint8_t TAG_PAYMENT_HASH;
14133
14134 extern const uint8_t TAG_DESCRIPTION;
14135
14136 extern const uint8_t TAG_PAYEE_PUB_KEY;
14137
14138 extern const uint8_t TAG_DESCRIPTION_HASH;
14139
14140 extern const uint8_t TAG_EXPIRY_TIME;
14141
14142 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
14143
14144 extern const uint8_t TAG_FALLBACK;
14145
14146 extern const uint8_t TAG_PRIVATE_ROUTE;
14147
14148 extern const uint8_t TAG_PAYMENT_SECRET;
14149
14150 extern const uint8_t TAG_FEATURES;
14151
14152 struct LDKStr _ldk_get_compiled_version(void);
14153
14154 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
14155
14156 /**
14157  * Convenience function for constructing a new BigEndianScalar
14158  */
14159 struct LDKBigEndianScalar BigEndianScalar_new(struct LDKThirtyTwoBytes big_endian_bytes);
14160
14161 /**
14162  * Creates a new Bech32Error which has the same data as `orig`
14163  */
14164 struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig);
14165
14166 /**
14167  * Releases any memory held by the given `Bech32Error` (which is currently none)
14168  */
14169 void Bech32Error_free(struct LDKBech32Error o);
14170
14171 /**
14172  * Frees the data buffer, if data_is_owned is set and datalen > 0.
14173  */
14174 void Transaction_free(struct LDKTransaction _res);
14175
14176 /**
14177  * Convenience function for constructing a new TxOut
14178  */
14179 struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
14180
14181 /**
14182  * Frees the data pointed to by script_pubkey.
14183  */
14184 void TxOut_free(struct LDKTxOut _res);
14185
14186 /**
14187  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
14188  */
14189 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
14190
14191 /**
14192  * Frees the data buffer, if chars_is_owned is set and len > 0.
14193  */
14194 void Str_free(struct LDKStr _res);
14195
14196 #if defined(LDK_DEBUG_BUILD)
14197 /**
14198  * This function exists for memory safety testing purposes. It should never be used in production
14199  * code
14200  */
14201 const void *__unmangle_inner_ptr(const void *ptr);
14202 #endif
14203
14204 /**
14205  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14206  */
14207 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
14208
14209 /**
14210  * Creates a new CResult_BlindedRouteNoneZ in the success state.
14211  */
14212 struct LDKCResult_BlindedRouteNoneZ CResult_BlindedRouteNoneZ_ok(struct LDKBlindedRoute o);
14213
14214 /**
14215  * Creates a new CResult_BlindedRouteNoneZ in the error state.
14216  */
14217 struct LDKCResult_BlindedRouteNoneZ CResult_BlindedRouteNoneZ_err(void);
14218
14219 /**
14220  * Checks if the given object is currently in the success state
14221  */
14222 bool CResult_BlindedRouteNoneZ_is_ok(const struct LDKCResult_BlindedRouteNoneZ *NONNULL_PTR o);
14223
14224 /**
14225  * Frees any resources used by the CResult_BlindedRouteNoneZ.
14226  */
14227 void CResult_BlindedRouteNoneZ_free(struct LDKCResult_BlindedRouteNoneZ _res);
14228
14229 /**
14230  * Creates a new CResult_BlindedRouteDecodeErrorZ in the success state.
14231  */
14232 struct LDKCResult_BlindedRouteDecodeErrorZ CResult_BlindedRouteDecodeErrorZ_ok(struct LDKBlindedRoute o);
14233
14234 /**
14235  * Creates a new CResult_BlindedRouteDecodeErrorZ in the error state.
14236  */
14237 struct LDKCResult_BlindedRouteDecodeErrorZ CResult_BlindedRouteDecodeErrorZ_err(struct LDKDecodeError e);
14238
14239 /**
14240  * Checks if the given object is currently in the success state
14241  */
14242 bool CResult_BlindedRouteDecodeErrorZ_is_ok(const struct LDKCResult_BlindedRouteDecodeErrorZ *NONNULL_PTR o);
14243
14244 /**
14245  * Frees any resources used by the CResult_BlindedRouteDecodeErrorZ.
14246  */
14247 void CResult_BlindedRouteDecodeErrorZ_free(struct LDKCResult_BlindedRouteDecodeErrorZ _res);
14248
14249 /**
14250  * Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
14251  */
14252 struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_ok(struct LDKBlindedHop o);
14253
14254 /**
14255  * Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
14256  */
14257 struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_err(struct LDKDecodeError e);
14258
14259 /**
14260  * Checks if the given object is currently in the success state
14261  */
14262 bool CResult_BlindedHopDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR o);
14263
14264 /**
14265  * Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
14266  */
14267 void CResult_BlindedHopDecodeErrorZ_free(struct LDKCResult_BlindedHopDecodeErrorZ _res);
14268
14269 /**
14270  * Creates a new CResult_NoneNoneZ in the success state.
14271  */
14272 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
14273
14274 /**
14275  * Creates a new CResult_NoneNoneZ in the error state.
14276  */
14277 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
14278
14279 /**
14280  * Checks if the given object is currently in the success state
14281  */
14282 bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o);
14283
14284 /**
14285  * Frees any resources used by the CResult_NoneNoneZ.
14286  */
14287 void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
14288
14289 /**
14290  * Creates a new CResult_NoneNoneZ which has the same data as `orig`
14291  * but with all dynamically-allocated buffers duplicated in new buffers.
14292  */
14293 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
14294
14295 /**
14296  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
14297  */
14298 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o);
14299
14300 /**
14301  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
14302  */
14303 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e);
14304
14305 /**
14306  * Checks if the given object is currently in the success state
14307  */
14308 bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o);
14309
14310 /**
14311  * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
14312  */
14313 void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res);
14314
14315 /**
14316  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
14317  * but with all dynamically-allocated buffers duplicated in new buffers.
14318  */
14319 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig);
14320
14321 /**
14322  * Creates a new CResult_SecretKeyErrorZ in the success state.
14323  */
14324 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
14325
14326 /**
14327  * Creates a new CResult_SecretKeyErrorZ in the error state.
14328  */
14329 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
14330
14331 /**
14332  * Checks if the given object is currently in the success state
14333  */
14334 bool CResult_SecretKeyErrorZ_is_ok(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR o);
14335
14336 /**
14337  * Frees any resources used by the CResult_SecretKeyErrorZ.
14338  */
14339 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
14340
14341 /**
14342  * Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
14343  * but with all dynamically-allocated buffers duplicated in new buffers.
14344  */
14345 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_clone(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR orig);
14346
14347 /**
14348  * Creates a new CResult_PublicKeyErrorZ in the success state.
14349  */
14350 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
14351
14352 /**
14353  * Creates a new CResult_PublicKeyErrorZ in the error state.
14354  */
14355 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
14356
14357 /**
14358  * Checks if the given object is currently in the success state
14359  */
14360 bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o);
14361
14362 /**
14363  * Frees any resources used by the CResult_PublicKeyErrorZ.
14364  */
14365 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
14366
14367 /**
14368  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
14369  * but with all dynamically-allocated buffers duplicated in new buffers.
14370  */
14371 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
14372
14373 /**
14374  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
14375  */
14376 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
14377
14378 /**
14379  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
14380  */
14381 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
14382
14383 /**
14384  * Checks if the given object is currently in the success state
14385  */
14386 bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o);
14387
14388 /**
14389  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
14390  */
14391 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
14392
14393 /**
14394  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
14395  * but with all dynamically-allocated buffers duplicated in new buffers.
14396  */
14397 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
14398
14399 /**
14400  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
14401  */
14402 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
14403
14404 /**
14405  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
14406  */
14407 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
14408
14409 /**
14410  * Checks if the given object is currently in the success state
14411  */
14412 bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o);
14413
14414 /**
14415  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
14416  */
14417 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
14418
14419 /**
14420  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
14421  * but with all dynamically-allocated buffers duplicated in new buffers.
14422  */
14423 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
14424
14425 /**
14426  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
14427  */
14428 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
14429
14430 /**
14431  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
14432  */
14433 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
14434
14435 /**
14436  * Checks if the given object is currently in the success state
14437  */
14438 bool CResult_TxCreationKeysErrorZ_is_ok(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR o);
14439
14440 /**
14441  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
14442  */
14443 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
14444
14445 /**
14446  * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
14447  * but with all dynamically-allocated buffers duplicated in new buffers.
14448  */
14449 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig);
14450
14451 /**
14452  * Constructs a new COption_u32Z containing a u32
14453  */
14454 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
14455
14456 /**
14457  * Constructs a new COption_u32Z containing nothing
14458  */
14459 struct LDKCOption_u32Z COption_u32Z_none(void);
14460
14461 /**
14462  * Frees any resources associated with the u32, if we are in the Some state
14463  */
14464 void COption_u32Z_free(struct LDKCOption_u32Z _res);
14465
14466 /**
14467  * Creates a new COption_u32Z which has the same data as `orig`
14468  * but with all dynamically-allocated buffers duplicated in new buffers.
14469  */
14470 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
14471
14472 /**
14473  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
14474  */
14475 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
14476
14477 /**
14478  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
14479  */
14480 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
14481
14482 /**
14483  * Checks if the given object is currently in the success state
14484  */
14485 bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o);
14486
14487 /**
14488  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
14489  */
14490 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
14491
14492 /**
14493  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
14494  * but with all dynamically-allocated buffers duplicated in new buffers.
14495  */
14496 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
14497
14498 /**
14499  * Constructs a new COption_NoneZ containing a
14500  */
14501 enum LDKCOption_NoneZ COption_NoneZ_some(void);
14502
14503 /**
14504  * Constructs a new COption_NoneZ containing nothing
14505  */
14506 enum LDKCOption_NoneZ COption_NoneZ_none(void);
14507
14508 /**
14509  * Frees any resources associated with the , if we are in the Some state
14510  */
14511 void COption_NoneZ_free(enum LDKCOption_NoneZ _res);
14512
14513 /**
14514  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
14515  */
14516 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
14517
14518 /**
14519  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
14520  */
14521 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
14522
14523 /**
14524  * Checks if the given object is currently in the success state
14525  */
14526 bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
14527
14528 /**
14529  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
14530  */
14531 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
14532
14533 /**
14534  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
14535  * but with all dynamically-allocated buffers duplicated in new buffers.
14536  */
14537 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
14538
14539 /**
14540  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
14541  */
14542 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
14543
14544 /**
14545  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
14546  */
14547 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
14548
14549 /**
14550  * Checks if the given object is currently in the success state
14551  */
14552 bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
14553
14554 /**
14555  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
14556  */
14557 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
14558
14559 /**
14560  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
14561  * but with all dynamically-allocated buffers duplicated in new buffers.
14562  */
14563 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
14564
14565 /**
14566  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14567  */
14568 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
14569
14570 /**
14571  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
14572  */
14573 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
14574
14575 /**
14576  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
14577  */
14578 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
14579
14580 /**
14581  * Checks if the given object is currently in the success state
14582  */
14583 bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
14584
14585 /**
14586  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
14587  */
14588 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
14589
14590 /**
14591  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
14592  * but with all dynamically-allocated buffers duplicated in new buffers.
14593  */
14594 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
14595
14596 /**
14597  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
14598  */
14599 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
14600
14601 /**
14602  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
14603  */
14604 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
14605
14606 /**
14607  * Checks if the given object is currently in the success state
14608  */
14609 bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
14610
14611 /**
14612  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
14613  */
14614 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
14615
14616 /**
14617  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
14618  * but with all dynamically-allocated buffers duplicated in new buffers.
14619  */
14620 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
14621
14622 /**
14623  * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
14624  */
14625 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
14626
14627 /**
14628  * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
14629  */
14630 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
14631
14632 /**
14633  * Checks if the given object is currently in the success state
14634  */
14635 bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o);
14636
14637 /**
14638  * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
14639  */
14640 void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
14641
14642 /**
14643  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
14644  */
14645 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
14646
14647 /**
14648  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
14649  */
14650 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
14651
14652 /**
14653  * Checks if the given object is currently in the success state
14654  */
14655 bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
14656
14657 /**
14658  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
14659  */
14660 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
14661
14662 /**
14663  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
14664  * but with all dynamically-allocated buffers duplicated in new buffers.
14665  */
14666 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
14667
14668 /**
14669  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
14670  */
14671 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
14672
14673 /**
14674  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
14675  */
14676 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
14677
14678 /**
14679  * Checks if the given object is currently in the success state
14680  */
14681 bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o);
14682
14683 /**
14684  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
14685  */
14686 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
14687
14688 /**
14689  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
14690  */
14691 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
14692
14693 /**
14694  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
14695  */
14696 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
14697
14698 /**
14699  * Checks if the given object is currently in the success state
14700  */
14701 bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o);
14702
14703 /**
14704  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
14705  */
14706 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
14707
14708 /**
14709  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
14710  * but with all dynamically-allocated buffers duplicated in new buffers.
14711  */
14712 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
14713
14714 /**
14715  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
14716  */
14717 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
14718
14719 /**
14720  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
14721  */
14722 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
14723
14724 /**
14725  * Checks if the given object is currently in the success state
14726  */
14727 bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o);
14728
14729 /**
14730  * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
14731  */
14732 void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
14733
14734 /**
14735  * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
14736  * but with all dynamically-allocated buffers duplicated in new buffers.
14737  */
14738 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
14739
14740 /**
14741  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
14742  */
14743 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
14744
14745 /**
14746  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
14747  */
14748 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
14749
14750 /**
14751  * Checks if the given object is currently in the success state
14752  */
14753 bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o);
14754
14755 /**
14756  * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
14757  */
14758 void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
14759
14760 /**
14761  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
14762  * but with all dynamically-allocated buffers duplicated in new buffers.
14763  */
14764 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig);
14765
14766 /**
14767  * Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
14768  */
14769 struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_some(struct LDKWriteableScore o);
14770
14771 /**
14772  * Constructs a new COption_WriteableScoreZ containing nothing
14773  */
14774 struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_none(void);
14775
14776 /**
14777  * Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
14778  */
14779 void COption_WriteableScoreZ_free(struct LDKCOption_WriteableScoreZ _res);
14780
14781 /**
14782  * Creates a new CResult_NoneErrorZ in the success state.
14783  */
14784 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
14785
14786 /**
14787  * Creates a new CResult_NoneErrorZ in the error state.
14788  */
14789 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
14790
14791 /**
14792  * Checks if the given object is currently in the success state
14793  */
14794 bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o);
14795
14796 /**
14797  * Frees any resources used by the CResult_NoneErrorZ.
14798  */
14799 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
14800
14801 /**
14802  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
14803  * but with all dynamically-allocated buffers duplicated in new buffers.
14804  */
14805 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
14806
14807 /**
14808  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
14809  */
14810 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
14811
14812 /**
14813  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
14814  */
14815 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
14816
14817 /**
14818  * Checks if the given object is currently in the success state
14819  */
14820 bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o);
14821
14822 /**
14823  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
14824  */
14825 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
14826
14827 /**
14828  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
14829  * but with all dynamically-allocated buffers duplicated in new buffers.
14830  */
14831 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
14832
14833 /**
14834  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14835  */
14836 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
14837
14838 /**
14839  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14840  */
14841 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
14842
14843 /**
14844  * Creates a new CResult_RouteDecodeErrorZ in the success state.
14845  */
14846 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
14847
14848 /**
14849  * Creates a new CResult_RouteDecodeErrorZ in the error state.
14850  */
14851 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
14852
14853 /**
14854  * Checks if the given object is currently in the success state
14855  */
14856 bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o);
14857
14858 /**
14859  * Frees any resources used by the CResult_RouteDecodeErrorZ.
14860  */
14861 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
14862
14863 /**
14864  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
14865  * but with all dynamically-allocated buffers duplicated in new buffers.
14866  */
14867 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
14868
14869 /**
14870  * Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
14871  */
14872 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o);
14873
14874 /**
14875  * Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
14876  */
14877 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e);
14878
14879 /**
14880  * Checks if the given object is currently in the success state
14881  */
14882 bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o);
14883
14884 /**
14885  * Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
14886  */
14887 void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res);
14888
14889 /**
14890  * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
14891  * but with all dynamically-allocated buffers duplicated in new buffers.
14892  */
14893 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig);
14894
14895 /**
14896  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14897  */
14898 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
14899
14900 /**
14901  * Constructs a new COption_u64Z containing a u64
14902  */
14903 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
14904
14905 /**
14906  * Constructs a new COption_u64Z containing nothing
14907  */
14908 struct LDKCOption_u64Z COption_u64Z_none(void);
14909
14910 /**
14911  * Frees any resources associated with the u64, if we are in the Some state
14912  */
14913 void COption_u64Z_free(struct LDKCOption_u64Z _res);
14914
14915 /**
14916  * Creates a new COption_u64Z which has the same data as `orig`
14917  * but with all dynamically-allocated buffers duplicated in new buffers.
14918  */
14919 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
14920
14921 /**
14922  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14923  */
14924 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
14925
14926 /**
14927  * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
14928  */
14929 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o);
14930
14931 /**
14932  * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
14933  */
14934 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e);
14935
14936 /**
14937  * Checks if the given object is currently in the success state
14938  */
14939 bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o);
14940
14941 /**
14942  * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
14943  */
14944 void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res);
14945
14946 /**
14947  * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
14948  * but with all dynamically-allocated buffers duplicated in new buffers.
14949  */
14950 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig);
14951
14952 /**
14953  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14954  */
14955 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
14956
14957 /**
14958  * Creates a new CResult_RouteHintDecodeErrorZ in the success state.
14959  */
14960 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o);
14961
14962 /**
14963  * Creates a new CResult_RouteHintDecodeErrorZ in the error state.
14964  */
14965 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e);
14966
14967 /**
14968  * Checks if the given object is currently in the success state
14969  */
14970 bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o);
14971
14972 /**
14973  * Frees any resources used by the CResult_RouteHintDecodeErrorZ.
14974  */
14975 void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res);
14976
14977 /**
14978  * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
14979  * but with all dynamically-allocated buffers duplicated in new buffers.
14980  */
14981 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig);
14982
14983 /**
14984  * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
14985  */
14986 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o);
14987
14988 /**
14989  * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
14990  */
14991 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e);
14992
14993 /**
14994  * Checks if the given object is currently in the success state
14995  */
14996 bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o);
14997
14998 /**
14999  * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
15000  */
15001 void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res);
15002
15003 /**
15004  * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
15005  * but with all dynamically-allocated buffers duplicated in new buffers.
15006  */
15007 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
15008
15009 /**
15010  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15011  */
15012 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
15013
15014 /**
15015  * Creates a new CResult_RouteLightningErrorZ in the success state.
15016  */
15017 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
15018
15019 /**
15020  * Creates a new CResult_RouteLightningErrorZ in the error state.
15021  */
15022 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
15023
15024 /**
15025  * Checks if the given object is currently in the success state
15026  */
15027 bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o);
15028
15029 /**
15030  * Frees any resources used by the CResult_RouteLightningErrorZ.
15031  */
15032 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
15033
15034 /**
15035  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
15036  * but with all dynamically-allocated buffers duplicated in new buffers.
15037  */
15038 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
15039
15040 /**
15041  * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
15042  */
15043 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o);
15044
15045 /**
15046  * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
15047  */
15048 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_err(struct LDKDecodeError e);
15049
15050 /**
15051  * Checks if the given object is currently in the success state
15052  */
15053 bool CResult_PaymentPurposeDecodeErrorZ_is_ok(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR o);
15054
15055 /**
15056  * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
15057  */
15058 void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res);
15059
15060 /**
15061  * Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
15062  * but with all dynamically-allocated buffers duplicated in new buffers.
15063  */
15064 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig);
15065
15066 /**
15067  * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
15068  */
15069 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o);
15070
15071 /**
15072  * Constructs a new COption_ClosureReasonZ containing nothing
15073  */
15074 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void);
15075
15076 /**
15077  * Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
15078  */
15079 void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res);
15080
15081 /**
15082  * Creates a new COption_ClosureReasonZ which has the same data as `orig`
15083  * but with all dynamically-allocated buffers duplicated in new buffers.
15084  */
15085 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig);
15086
15087 /**
15088  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
15089  */
15090 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o);
15091
15092 /**
15093  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
15094  */
15095 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e);
15096
15097 /**
15098  * Checks if the given object is currently in the success state
15099  */
15100 bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o);
15101
15102 /**
15103  * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
15104  */
15105 void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res);
15106
15107 /**
15108  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
15109  * but with all dynamically-allocated buffers duplicated in new buffers.
15110  */
15111 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig);
15112
15113 /**
15114  * Constructs a new COption_HTLCDestinationZ containing a crate::lightning::util::events::HTLCDestination
15115  */
15116 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_some(struct LDKHTLCDestination o);
15117
15118 /**
15119  * Constructs a new COption_HTLCDestinationZ containing nothing
15120  */
15121 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_none(void);
15122
15123 /**
15124  * Frees any resources associated with the crate::lightning::util::events::HTLCDestination, if we are in the Some state
15125  */
15126 void COption_HTLCDestinationZ_free(struct LDKCOption_HTLCDestinationZ _res);
15127
15128 /**
15129  * Creates a new COption_HTLCDestinationZ which has the same data as `orig`
15130  * but with all dynamically-allocated buffers duplicated in new buffers.
15131  */
15132 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_clone(const struct LDKCOption_HTLCDestinationZ *NONNULL_PTR orig);
15133
15134 /**
15135  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
15136  */
15137 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_ok(struct LDKCOption_HTLCDestinationZ o);
15138
15139 /**
15140  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
15141  */
15142 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_err(struct LDKDecodeError e);
15143
15144 /**
15145  * Checks if the given object is currently in the success state
15146  */
15147 bool CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR o);
15148
15149 /**
15150  * Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
15151  */
15152 void CResult_COption_HTLCDestinationZDecodeErrorZ_free(struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res);
15153
15154 /**
15155  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
15156  * but with all dynamically-allocated buffers duplicated in new buffers.
15157  */
15158 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_clone(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR orig);
15159
15160 /**
15161  * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
15162  */
15163 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
15164
15165 /**
15166  * Constructs a new COption_NetworkUpdateZ containing nothing
15167  */
15168 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
15169
15170 /**
15171  * Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
15172  */
15173 void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
15174
15175 /**
15176  * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
15177  * but with all dynamically-allocated buffers duplicated in new buffers.
15178  */
15179 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
15180
15181 /**
15182  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15183  */
15184 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
15185
15186 /**
15187  * Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
15188  */
15189 struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o);
15190
15191 /**
15192  * Constructs a new COption_EventZ containing nothing
15193  */
15194 struct LDKCOption_EventZ COption_EventZ_none(void);
15195
15196 /**
15197  * Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
15198  */
15199 void COption_EventZ_free(struct LDKCOption_EventZ _res);
15200
15201 /**
15202  * Creates a new COption_EventZ which has the same data as `orig`
15203  * but with all dynamically-allocated buffers duplicated in new buffers.
15204  */
15205 struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig);
15206
15207 /**
15208  * Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
15209  */
15210 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o);
15211
15212 /**
15213  * Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
15214  */
15215 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e);
15216
15217 /**
15218  * Checks if the given object is currently in the success state
15219  */
15220 bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o);
15221
15222 /**
15223  * Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
15224  */
15225 void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res);
15226
15227 /**
15228  * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
15229  * but with all dynamically-allocated buffers duplicated in new buffers.
15230  */
15231 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig);
15232
15233 /**
15234  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15235  */
15236 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
15237
15238 /**
15239  * Creates a new CResult_TxOutAccessErrorZ in the success state.
15240  */
15241 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
15242
15243 /**
15244  * Creates a new CResult_TxOutAccessErrorZ in the error state.
15245  */
15246 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
15247
15248 /**
15249  * Checks if the given object is currently in the success state
15250  */
15251 bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o);
15252
15253 /**
15254  * Frees any resources used by the CResult_TxOutAccessErrorZ.
15255  */
15256 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
15257
15258 /**
15259  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
15260  * but with all dynamically-allocated buffers duplicated in new buffers.
15261  */
15262 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
15263
15264 /**
15265  * Creates a new tuple which has the same data as `orig`
15266  * but with all dynamically-allocated buffers duplicated in new buffers.
15267  */
15268 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
15269
15270 /**
15271  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
15272  */
15273 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
15274
15275 /**
15276  * Frees any resources used by the C2Tuple_usizeTransactionZ.
15277  */
15278 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
15279
15280 /**
15281  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15282  */
15283 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
15284
15285 /**
15286  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15287  */
15288 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
15289
15290 /**
15291  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15292  */
15293 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
15294
15295 /**
15296  * Creates a new tuple which has the same data as `orig`
15297  * but with all dynamically-allocated buffers duplicated in new buffers.
15298  */
15299 struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(const struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR orig);
15300
15301 /**
15302  * Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
15303  */
15304 struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorEventZ b, struct LDKPublicKey c);
15305
15306 /**
15307  * Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
15308  */
15309 void C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res);
15310
15311 /**
15312  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15313  */
15314 void CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res);
15315
15316 /**
15317  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
15318  */
15319 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o);
15320
15321 /**
15322  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
15323  */
15324 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e);
15325
15326 /**
15327  * Checks if the given object is currently in the success state
15328  */
15329 bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o);
15330
15331 /**
15332  * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
15333  */
15334 void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res);
15335
15336 /**
15337  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
15338  * but with all dynamically-allocated buffers duplicated in new buffers.
15339  */
15340 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig);
15341
15342 /**
15343  * Creates a new tuple which has the same data as `orig`
15344  * but with all dynamically-allocated buffers duplicated in new buffers.
15345  */
15346 struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const struct LDKC2Tuple_u64u64Z *NONNULL_PTR orig);
15347
15348 /**
15349  * Creates a new C2Tuple_u64u64Z from the contained elements.
15350  */
15351 struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
15352
15353 /**
15354  * Frees any resources used by the C2Tuple_u64u64Z.
15355  */
15356 void C2Tuple_u64u64Z_free(struct LDKC2Tuple_u64u64Z _res);
15357
15358 /**
15359  * Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
15360  */
15361 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_some(struct LDKC2Tuple_u64u64Z o);
15362
15363 /**
15364  * Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
15365  */
15366 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_none(void);
15367
15368 /**
15369  * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
15370  */
15371 void COption_C2Tuple_u64u64ZZ_free(struct LDKCOption_C2Tuple_u64u64ZZ _res);
15372
15373 /**
15374  * Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
15375  * but with all dynamically-allocated buffers duplicated in new buffers.
15376  */
15377 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_clone(const struct LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR orig);
15378
15379 /**
15380  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15381  */
15382 void CVec_NodeIdZ_free(struct LDKCVec_NodeIdZ _res);
15383
15384 /**
15385  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
15386  */
15387 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o);
15388
15389 /**
15390  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
15391  */
15392 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e);
15393
15394 /**
15395  * Checks if the given object is currently in the success state
15396  */
15397 bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o);
15398
15399 /**
15400  * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
15401  */
15402 void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res);
15403
15404 /**
15405  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
15406  */
15407 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
15408
15409 /**
15410  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
15411  */
15412 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
15413
15414 /**
15415  * Checks if the given object is currently in the success state
15416  */
15417 bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o);
15418
15419 /**
15420  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
15421  */
15422 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
15423
15424 /**
15425  * Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
15426  * but with all dynamically-allocated buffers duplicated in new buffers.
15427  */
15428 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_clone(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR orig);
15429
15430 /**
15431  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
15432  */
15433 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
15434
15435 /**
15436  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
15437  */
15438 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
15439
15440 /**
15441  * Checks if the given object is currently in the success state
15442  */
15443 bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o);
15444
15445 /**
15446  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
15447  */
15448 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
15449
15450 /**
15451  * Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
15452  * but with all dynamically-allocated buffers duplicated in new buffers.
15453  */
15454 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR orig);
15455
15456 /**
15457  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
15458  */
15459 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
15460
15461 /**
15462  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
15463  */
15464 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
15465
15466 /**
15467  * Checks if the given object is currently in the success state
15468  */
15469 bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o);
15470
15471 /**
15472  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
15473  */
15474 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
15475
15476 /**
15477  * Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
15478  * but with all dynamically-allocated buffers duplicated in new buffers.
15479  */
15480 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_clone(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR orig);
15481
15482 /**
15483  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
15484  */
15485 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
15486
15487 /**
15488  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
15489  */
15490 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
15491
15492 /**
15493  * Checks if the given object is currently in the success state
15494  */
15495 bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o);
15496
15497 /**
15498  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
15499  */
15500 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
15501
15502 /**
15503  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
15504  * but with all dynamically-allocated buffers duplicated in new buffers.
15505  */
15506 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig);
15507
15508 /**
15509  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
15510  */
15511 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o);
15512
15513 /**
15514  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
15515  */
15516 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
15517
15518 /**
15519  * Checks if the given object is currently in the success state
15520  */
15521 bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o);
15522
15523 /**
15524  * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
15525  */
15526 void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res);
15527
15528 /**
15529  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
15530  * but with all dynamically-allocated buffers duplicated in new buffers.
15531  */
15532 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig);
15533
15534 /**
15535  * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
15536  */
15537 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
15538
15539 /**
15540  * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
15541  */
15542 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
15543
15544 /**
15545  * Checks if the given object is currently in the success state
15546  */
15547 bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o);
15548
15549 /**
15550  * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
15551  */
15552 void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
15553
15554 /**
15555  * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
15556  * but with all dynamically-allocated buffers duplicated in new buffers.
15557  */
15558 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
15559
15560 /**
15561  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
15562  */
15563 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o);
15564
15565 /**
15566  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
15567  */
15568 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e);
15569
15570 /**
15571  * Checks if the given object is currently in the success state
15572  */
15573 bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o);
15574
15575 /**
15576  * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
15577  */
15578 void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res);
15579
15580 /**
15581  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
15582  * but with all dynamically-allocated buffers duplicated in new buffers.
15583  */
15584 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig);
15585
15586 /**
15587  * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
15588  */
15589 struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o);
15590
15591 /**
15592  * Constructs a new COption_AccessZ containing nothing
15593  */
15594 struct LDKCOption_AccessZ COption_AccessZ_none(void);
15595
15596 /**
15597  * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
15598  */
15599 void COption_AccessZ_free(struct LDKCOption_AccessZ _res);
15600
15601 /**
15602  * Creates a new CResult_boolLightningErrorZ in the success state.
15603  */
15604 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
15605
15606 /**
15607  * Creates a new CResult_boolLightningErrorZ in the error state.
15608  */
15609 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
15610
15611 /**
15612  * Checks if the given object is currently in the success state
15613  */
15614 bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o);
15615
15616 /**
15617  * Frees any resources used by the CResult_boolLightningErrorZ.
15618  */
15619 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
15620
15621 /**
15622  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
15623  * but with all dynamically-allocated buffers duplicated in new buffers.
15624  */
15625 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
15626
15627 /**
15628  * Creates a new tuple which has the same data as `orig`
15629  * but with all dynamically-allocated buffers duplicated in new buffers.
15630  */
15631 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
15632
15633 /**
15634  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
15635  */
15636 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
15637
15638 /**
15639  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
15640  */
15641 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
15642
15643 /**
15644  * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
15645  */
15646 struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o);
15647
15648 /**
15649  * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
15650  */
15651 struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none(void);
15652
15653 /**
15654  * Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
15655  */
15656 void COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
15657
15658 /**
15659  * Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
15660  * but with all dynamically-allocated buffers duplicated in new buffers.
15661  */
15662 struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR orig);
15663
15664 /**
15665  * Creates a new CResult_NoneLightningErrorZ in the success state.
15666  */
15667 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
15668
15669 /**
15670  * Creates a new CResult_NoneLightningErrorZ in the error state.
15671  */
15672 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
15673
15674 /**
15675  * Checks if the given object is currently in the success state
15676  */
15677 bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o);
15678
15679 /**
15680  * Frees any resources used by the CResult_NoneLightningErrorZ.
15681  */
15682 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
15683
15684 /**
15685  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
15686  * but with all dynamically-allocated buffers duplicated in new buffers.
15687  */
15688 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
15689
15690 /**
15691  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
15692  */
15693 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o);
15694
15695 /**
15696  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
15697  */
15698 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e);
15699
15700 /**
15701  * Checks if the given object is currently in the success state
15702  */
15703 bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o);
15704
15705 /**
15706  * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
15707  */
15708 void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res);
15709
15710 /**
15711  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
15712  * but with all dynamically-allocated buffers duplicated in new buffers.
15713  */
15714 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig);
15715
15716 /**
15717  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
15718  */
15719 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
15720
15721 /**
15722  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
15723  */
15724 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
15725
15726 /**
15727  * Checks if the given object is currently in the success state
15728  */
15729 bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o);
15730
15731 /**
15732  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
15733  */
15734 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
15735
15736 /**
15737  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
15738  * but with all dynamically-allocated buffers duplicated in new buffers.
15739  */
15740 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
15741
15742 /**
15743  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
15744  */
15745 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
15746
15747 /**
15748  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
15749  */
15750 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
15751
15752 /**
15753  * Checks if the given object is currently in the success state
15754  */
15755 bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o);
15756
15757 /**
15758  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
15759  */
15760 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
15761
15762 /**
15763  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
15764  * but with all dynamically-allocated buffers duplicated in new buffers.
15765  */
15766 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
15767
15768 /**
15769  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15770  */
15771 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
15772
15773 /**
15774  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
15775  */
15776 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
15777
15778 /**
15779  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
15780  */
15781 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
15782
15783 /**
15784  * Checks if the given object is currently in the success state
15785  */
15786 bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o);
15787
15788 /**
15789  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
15790  */
15791 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
15792
15793 /**
15794  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
15795  * but with all dynamically-allocated buffers duplicated in new buffers.
15796  */
15797 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
15798
15799 /**
15800  * Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
15801  */
15802 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_ok(struct LDKNodeAlias o);
15803
15804 /**
15805  * Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
15806  */
15807 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_err(struct LDKDecodeError e);
15808
15809 /**
15810  * Checks if the given object is currently in the success state
15811  */
15812 bool CResult_NodeAliasDecodeErrorZ_is_ok(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR o);
15813
15814 /**
15815  * Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
15816  */
15817 void CResult_NodeAliasDecodeErrorZ_free(struct LDKCResult_NodeAliasDecodeErrorZ _res);
15818
15819 /**
15820  * Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
15821  * but with all dynamically-allocated buffers duplicated in new buffers.
15822  */
15823 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_clone(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR orig);
15824
15825 /**
15826  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
15827  */
15828 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
15829
15830 /**
15831  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
15832  */
15833 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
15834
15835 /**
15836  * Checks if the given object is currently in the success state
15837  */
15838 bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o);
15839
15840 /**
15841  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
15842  */
15843 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
15844
15845 /**
15846  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
15847  * but with all dynamically-allocated buffers duplicated in new buffers.
15848  */
15849 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
15850
15851 /**
15852  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
15853  */
15854 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
15855
15856 /**
15857  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
15858  */
15859 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
15860
15861 /**
15862  * Checks if the given object is currently in the success state
15863  */
15864 bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o);
15865
15866 /**
15867  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
15868  */
15869 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
15870
15871 /**
15872  * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
15873  */
15874 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o);
15875
15876 /**
15877  * Constructs a new COption_CVec_NetAddressZZ containing nothing
15878  */
15879 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void);
15880
15881 /**
15882  * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
15883  */
15884 void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
15885
15886 /**
15887  * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
15888  * but with all dynamically-allocated buffers duplicated in new buffers.
15889  */
15890 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
15891
15892 /**
15893  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
15894  */
15895 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
15896
15897 /**
15898  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
15899  */
15900 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
15901
15902 /**
15903  * Checks if the given object is currently in the success state
15904  */
15905 bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
15906
15907 /**
15908  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
15909  */
15910 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
15911
15912 /**
15913  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
15914  * but with all dynamically-allocated buffers duplicated in new buffers.
15915  */
15916 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
15917
15918 /**
15919  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
15920  */
15921 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
15922
15923 /**
15924  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
15925  */
15926 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
15927
15928 /**
15929  * Checks if the given object is currently in the success state
15930  */
15931 bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
15932
15933 /**
15934  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
15935  */
15936 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
15937
15938 /**
15939  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
15940  * but with all dynamically-allocated buffers duplicated in new buffers.
15941  */
15942 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
15943
15944 /**
15945  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
15946  */
15947 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
15948
15949 /**
15950  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
15951  */
15952 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
15953
15954 /**
15955  * Checks if the given object is currently in the success state
15956  */
15957 bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
15958
15959 /**
15960  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
15961  */
15962 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
15963
15964 /**
15965  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
15966  * but with all dynamically-allocated buffers duplicated in new buffers.
15967  */
15968 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
15969
15970 /**
15971  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15972  */
15973 void CVec_PaymentPreimageZ_free(struct LDKCVec_PaymentPreimageZ _res);
15974
15975 /**
15976  * Creates a new tuple which has the same data as `orig`
15977  * but with all dynamically-allocated buffers duplicated in new buffers.
15978  */
15979 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
15980
15981 /**
15982  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
15983  */
15984 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
15985
15986 /**
15987  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
15988  */
15989 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
15990
15991 /**
15992  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
15993  */
15994 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
15995
15996 /**
15997  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
15998  */
15999 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
16000
16001 /**
16002  * Checks if the given object is currently in the success state
16003  */
16004 bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o);
16005
16006 /**
16007  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
16008  */
16009 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
16010
16011 /**
16012  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
16013  * but with all dynamically-allocated buffers duplicated in new buffers.
16014  */
16015 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
16016
16017 /**
16018  * Creates a new CResult_SignatureNoneZ in the success state.
16019  */
16020 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
16021
16022 /**
16023  * Creates a new CResult_SignatureNoneZ in the error state.
16024  */
16025 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
16026
16027 /**
16028  * Checks if the given object is currently in the success state
16029  */
16030 bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o);
16031
16032 /**
16033  * Frees any resources used by the CResult_SignatureNoneZ.
16034  */
16035 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
16036
16037 /**
16038  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
16039  * but with all dynamically-allocated buffers duplicated in new buffers.
16040  */
16041 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
16042
16043 /**
16044  * Creates a new tuple which has the same data as `orig`
16045  * but with all dynamically-allocated buffers duplicated in new buffers.
16046  */
16047 struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_clone(const struct LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR orig);
16048
16049 /**
16050  * Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
16051  */
16052 struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_new(struct LDKSignature a, struct LDKSignature b);
16053
16054 /**
16055  * Frees any resources used by the C2Tuple_SignatureSignatureZ.
16056  */
16057 void C2Tuple_SignatureSignatureZ_free(struct LDKC2Tuple_SignatureSignatureZ _res);
16058
16059 /**
16060  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
16061  */
16062 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_ok(struct LDKC2Tuple_SignatureSignatureZ o);
16063
16064 /**
16065  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
16066  */
16067 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_err(void);
16068
16069 /**
16070  * Checks if the given object is currently in the success state
16071  */
16072 bool CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR o);
16073
16074 /**
16075  * Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
16076  */
16077 void CResult_C2Tuple_SignatureSignatureZNoneZ_free(struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res);
16078
16079 /**
16080  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
16081  * but with all dynamically-allocated buffers duplicated in new buffers.
16082  */
16083 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR orig);
16084
16085 /**
16086  * Creates a new CResult_SecretKeyNoneZ in the success state.
16087  */
16088 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_ok(struct LDKSecretKey o);
16089
16090 /**
16091  * Creates a new CResult_SecretKeyNoneZ in the error state.
16092  */
16093 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_err(void);
16094
16095 /**
16096  * Checks if the given object is currently in the success state
16097  */
16098 bool CResult_SecretKeyNoneZ_is_ok(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR o);
16099
16100 /**
16101  * Frees any resources used by the CResult_SecretKeyNoneZ.
16102  */
16103 void CResult_SecretKeyNoneZ_free(struct LDKCResult_SecretKeyNoneZ _res);
16104
16105 /**
16106  * Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
16107  * but with all dynamically-allocated buffers duplicated in new buffers.
16108  */
16109 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_clone(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR orig);
16110
16111 /**
16112  * Creates a new CResult_PublicKeyNoneZ in the success state.
16113  */
16114 struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_ok(struct LDKPublicKey o);
16115
16116 /**
16117  * Creates a new CResult_PublicKeyNoneZ in the error state.
16118  */
16119 struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_err(void);
16120
16121 /**
16122  * Checks if the given object is currently in the success state
16123  */
16124 bool CResult_PublicKeyNoneZ_is_ok(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR o);
16125
16126 /**
16127  * Frees any resources used by the CResult_PublicKeyNoneZ.
16128  */
16129 void CResult_PublicKeyNoneZ_free(struct LDKCResult_PublicKeyNoneZ _res);
16130
16131 /**
16132  * Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
16133  * but with all dynamically-allocated buffers duplicated in new buffers.
16134  */
16135 struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_clone(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR orig);
16136
16137 /**
16138  * Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar
16139  */
16140 struct LDKCOption_ScalarZ COption_ScalarZ_some(struct LDKBigEndianScalar o);
16141
16142 /**
16143  * Constructs a new COption_ScalarZ containing nothing
16144  */
16145 struct LDKCOption_ScalarZ COption_ScalarZ_none(void);
16146
16147 /**
16148  * Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
16149  */
16150 void COption_ScalarZ_free(struct LDKCOption_ScalarZ _res);
16151
16152 /**
16153  * Creates a new CResult_SharedSecretNoneZ in the success state.
16154  */
16155 struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
16156
16157 /**
16158  * Creates a new CResult_SharedSecretNoneZ in the error state.
16159  */
16160 struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_err(void);
16161
16162 /**
16163  * Checks if the given object is currently in the success state
16164  */
16165 bool CResult_SharedSecretNoneZ_is_ok(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR o);
16166
16167 /**
16168  * Frees any resources used by the CResult_SharedSecretNoneZ.
16169  */
16170 void CResult_SharedSecretNoneZ_free(struct LDKCResult_SharedSecretNoneZ _res);
16171
16172 /**
16173  * Creates a new CResult_SharedSecretNoneZ which has the same data as `orig`
16174  * but with all dynamically-allocated buffers duplicated in new buffers.
16175  */
16176 struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_clone(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR orig);
16177
16178 /**
16179  * Creates a new CResult_SignDecodeErrorZ in the success state.
16180  */
16181 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
16182
16183 /**
16184  * Creates a new CResult_SignDecodeErrorZ in the error state.
16185  */
16186 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
16187
16188 /**
16189  * Checks if the given object is currently in the success state
16190  */
16191 bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o);
16192
16193 /**
16194  * Frees any resources used by the CResult_SignDecodeErrorZ.
16195  */
16196 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
16197
16198 /**
16199  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
16200  * but with all dynamically-allocated buffers duplicated in new buffers.
16201  */
16202 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
16203
16204 /**
16205  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16206  */
16207 void CVec_u5Z_free(struct LDKCVec_u5Z _res);
16208
16209 /**
16210  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
16211  */
16212 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
16213
16214 /**
16215  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
16216  */
16217 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
16218
16219 /**
16220  * Checks if the given object is currently in the success state
16221  */
16222 bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o);
16223
16224 /**
16225  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
16226  */
16227 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
16228
16229 /**
16230  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
16231  * but with all dynamically-allocated buffers duplicated in new buffers.
16232  */
16233 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
16234
16235 /**
16236  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16237  */
16238 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
16239
16240 /**
16241  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16242  */
16243 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
16244
16245 /**
16246  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
16247  */
16248 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
16249
16250 /**
16251  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
16252  */
16253 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
16254
16255 /**
16256  * Checks if the given object is currently in the success state
16257  */
16258 bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o);
16259
16260 /**
16261  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
16262  */
16263 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
16264
16265 /**
16266  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
16267  * but with all dynamically-allocated buffers duplicated in new buffers.
16268  */
16269 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
16270
16271 /**
16272  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
16273  */
16274 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
16275
16276 /**
16277  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
16278  */
16279 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
16280
16281 /**
16282  * Checks if the given object is currently in the success state
16283  */
16284 bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o);
16285
16286 /**
16287  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
16288  */
16289 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
16290
16291 /**
16292  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
16293  * but with all dynamically-allocated buffers duplicated in new buffers.
16294  */
16295 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
16296
16297 /**
16298  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16299  */
16300 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
16301
16302 /**
16303  * Creates a new CResult_TransactionNoneZ in the success state.
16304  */
16305 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
16306
16307 /**
16308  * Creates a new CResult_TransactionNoneZ in the error state.
16309  */
16310 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
16311
16312 /**
16313  * Checks if the given object is currently in the success state
16314  */
16315 bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o);
16316
16317 /**
16318  * Frees any resources used by the CResult_TransactionNoneZ.
16319  */
16320 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
16321
16322 /**
16323  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
16324  * but with all dynamically-allocated buffers duplicated in new buffers.
16325  */
16326 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
16327
16328 /**
16329  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
16330  */
16331 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
16332
16333 /**
16334  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
16335  */
16336 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
16337
16338 /**
16339  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16340  */
16341 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
16342
16343 /**
16344  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
16345  */
16346 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
16347
16348 /**
16349  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
16350  */
16351 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
16352
16353 /**
16354  * Checks if the given object is currently in the success state
16355  */
16356 bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o);
16357
16358 /**
16359  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
16360  */
16361 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
16362
16363 /**
16364  * Constructs a new COption_u16Z containing a u16
16365  */
16366 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
16367
16368 /**
16369  * Constructs a new COption_u16Z containing nothing
16370  */
16371 struct LDKCOption_u16Z COption_u16Z_none(void);
16372
16373 /**
16374  * Frees any resources associated with the u16, if we are in the Some state
16375  */
16376 void COption_u16Z_free(struct LDKCOption_u16Z _res);
16377
16378 /**
16379  * Creates a new COption_u16Z which has the same data as `orig`
16380  * but with all dynamically-allocated buffers duplicated in new buffers.
16381  */
16382 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
16383
16384 /**
16385  * Creates a new CResult_NoneAPIErrorZ in the success state.
16386  */
16387 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
16388
16389 /**
16390  * Creates a new CResult_NoneAPIErrorZ in the error state.
16391  */
16392 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
16393
16394 /**
16395  * Checks if the given object is currently in the success state
16396  */
16397 bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o);
16398
16399 /**
16400  * Frees any resources used by the CResult_NoneAPIErrorZ.
16401  */
16402 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
16403
16404 /**
16405  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
16406  * but with all dynamically-allocated buffers duplicated in new buffers.
16407  */
16408 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
16409
16410 /**
16411  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16412  */
16413 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
16414
16415 /**
16416  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16417  */
16418 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
16419
16420 /**
16421  * Creates a new CResult__u832APIErrorZ in the success state.
16422  */
16423 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o);
16424
16425 /**
16426  * Creates a new CResult__u832APIErrorZ in the error state.
16427  */
16428 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
16429
16430 /**
16431  * Checks if the given object is currently in the success state
16432  */
16433 bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o);
16434
16435 /**
16436  * Frees any resources used by the CResult__u832APIErrorZ.
16437  */
16438 void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res);
16439
16440 /**
16441  * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
16442  * but with all dynamically-allocated buffers duplicated in new buffers.
16443  */
16444 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig);
16445
16446 /**
16447  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
16448  */
16449 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
16450
16451 /**
16452  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
16453  */
16454 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
16455
16456 /**
16457  * Checks if the given object is currently in the success state
16458  */
16459 bool CResult_PaymentIdPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR o);
16460
16461 /**
16462  * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
16463  */
16464 void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res);
16465
16466 /**
16467  * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
16468  * but with all dynamically-allocated buffers duplicated in new buffers.
16469  */
16470 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig);
16471
16472 /**
16473  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
16474  */
16475 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
16476
16477 /**
16478  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
16479  */
16480 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
16481
16482 /**
16483  * Checks if the given object is currently in the success state
16484  */
16485 bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o);
16486
16487 /**
16488  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
16489  */
16490 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
16491
16492 /**
16493  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
16494  * but with all dynamically-allocated buffers duplicated in new buffers.
16495  */
16496 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
16497
16498 /**
16499  * Creates a new tuple which has the same data as `orig`
16500  * but with all dynamically-allocated buffers duplicated in new buffers.
16501  */
16502 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig);
16503
16504 /**
16505  * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
16506  */
16507 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
16508
16509 /**
16510  * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
16511  */
16512 void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res);
16513
16514 /**
16515  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
16516  */
16517 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o);
16518
16519 /**
16520  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
16521  */
16522 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
16523
16524 /**
16525  * Checks if the given object is currently in the success state
16526  */
16527 bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o);
16528
16529 /**
16530  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
16531  */
16532 void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res);
16533
16534 /**
16535  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
16536  * but with all dynamically-allocated buffers duplicated in new buffers.
16537  */
16538 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig);
16539
16540 /**
16541  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16542  */
16543 void CVec_ThirtyTwoBytesZ_free(struct LDKCVec_ThirtyTwoBytesZ _res);
16544
16545 /**
16546  * Creates a new tuple which has the same data as `orig`
16547  * but with all dynamically-allocated buffers duplicated in new buffers.
16548  */
16549 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
16550
16551 /**
16552  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
16553  */
16554 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
16555
16556 /**
16557  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
16558  */
16559 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
16560
16561 /**
16562  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
16563  */
16564 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
16565
16566 /**
16567  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
16568  */
16569 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void);
16570
16571 /**
16572  * Checks if the given object is currently in the success state
16573  */
16574 bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o);
16575
16576 /**
16577  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
16578  */
16579 void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res);
16580
16581 /**
16582  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
16583  * but with all dynamically-allocated buffers duplicated in new buffers.
16584  */
16585 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig);
16586
16587 /**
16588  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
16589  */
16590 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
16591
16592 /**
16593  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
16594  */
16595 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e);
16596
16597 /**
16598  * Checks if the given object is currently in the success state
16599  */
16600 bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o);
16601
16602 /**
16603  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
16604  */
16605 void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res);
16606
16607 /**
16608  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
16609  * but with all dynamically-allocated buffers duplicated in new buffers.
16610  */
16611 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig);
16612
16613 /**
16614  * Creates a new CResult_PaymentSecretNoneZ in the success state.
16615  */
16616 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
16617
16618 /**
16619  * Creates a new CResult_PaymentSecretNoneZ in the error state.
16620  */
16621 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void);
16622
16623 /**
16624  * Checks if the given object is currently in the success state
16625  */
16626 bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o);
16627
16628 /**
16629  * Frees any resources used by the CResult_PaymentSecretNoneZ.
16630  */
16631 void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res);
16632
16633 /**
16634  * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
16635  * but with all dynamically-allocated buffers duplicated in new buffers.
16636  */
16637 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig);
16638
16639 /**
16640  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
16641  */
16642 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
16643
16644 /**
16645  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
16646  */
16647 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
16648
16649 /**
16650  * Checks if the given object is currently in the success state
16651  */
16652 bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o);
16653
16654 /**
16655  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
16656  */
16657 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
16658
16659 /**
16660  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
16661  * but with all dynamically-allocated buffers duplicated in new buffers.
16662  */
16663 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
16664
16665 /**
16666  * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
16667  */
16668 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
16669
16670 /**
16671  * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
16672  */
16673 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e);
16674
16675 /**
16676  * Checks if the given object is currently in the success state
16677  */
16678 bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o);
16679
16680 /**
16681  * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
16682  */
16683 void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res);
16684
16685 /**
16686  * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
16687  * but with all dynamically-allocated buffers duplicated in new buffers.
16688  */
16689 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig);
16690
16691 /**
16692  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
16693  */
16694 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o);
16695
16696 /**
16697  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
16698  */
16699 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e);
16700
16701 /**
16702  * Checks if the given object is currently in the success state
16703  */
16704 bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o);
16705
16706 /**
16707  * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
16708  */
16709 void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res);
16710
16711 /**
16712  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
16713  * but with all dynamically-allocated buffers duplicated in new buffers.
16714  */
16715 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig);
16716
16717 /**
16718  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
16719  */
16720 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o);
16721
16722 /**
16723  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
16724  */
16725 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e);
16726
16727 /**
16728  * Checks if the given object is currently in the success state
16729  */
16730 bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o);
16731
16732 /**
16733  * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
16734  */
16735 void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res);
16736
16737 /**
16738  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
16739  * but with all dynamically-allocated buffers duplicated in new buffers.
16740  */
16741 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig);
16742
16743 /**
16744  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
16745  */
16746 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o);
16747
16748 /**
16749  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
16750  */
16751 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e);
16752
16753 /**
16754  * Checks if the given object is currently in the success state
16755  */
16756 bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o);
16757
16758 /**
16759  * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
16760  */
16761 void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res);
16762
16763 /**
16764  * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
16765  * but with all dynamically-allocated buffers duplicated in new buffers.
16766  */
16767 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig);
16768
16769 /**
16770  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
16771  */
16772 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o);
16773
16774 /**
16775  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
16776  */
16777 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e);
16778
16779 /**
16780  * Checks if the given object is currently in the success state
16781  */
16782 bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o);
16783
16784 /**
16785  * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
16786  */
16787 void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res);
16788
16789 /**
16790  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
16791  * but with all dynamically-allocated buffers duplicated in new buffers.
16792  */
16793 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig);
16794
16795 /**
16796  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16797  */
16798 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
16799
16800 /**
16801  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
16802  */
16803 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
16804
16805 /**
16806  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
16807  */
16808 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
16809
16810 /**
16811  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
16812  */
16813 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
16814
16815 /**
16816  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
16817  */
16818 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
16819
16820 /**
16821  * Checks if the given object is currently in the success state
16822  */
16823 bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o);
16824
16825 /**
16826  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
16827  */
16828 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
16829
16830 /**
16831  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
16832  */
16833 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
16834
16835 /**
16836  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
16837  */
16838 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
16839
16840 /**
16841  * Checks if the given object is currently in the success state
16842  */
16843 bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o);
16844
16845 /**
16846  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
16847  */
16848 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
16849
16850 /**
16851  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
16852  * but with all dynamically-allocated buffers duplicated in new buffers.
16853  */
16854 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
16855
16856 /**
16857  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
16858  */
16859 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
16860
16861 /**
16862  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
16863  */
16864 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
16865
16866 /**
16867  * Checks if the given object is currently in the success state
16868  */
16869 bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o);
16870
16871 /**
16872  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
16873  */
16874 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
16875
16876 /**
16877  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
16878  * but with all dynamically-allocated buffers duplicated in new buffers.
16879  */
16880 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
16881
16882 /**
16883  * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
16884  */
16885 struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
16886
16887 /**
16888  * Constructs a new COption_TypeZ containing nothing
16889  */
16890 struct LDKCOption_TypeZ COption_TypeZ_none(void);
16891
16892 /**
16893  * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
16894  */
16895 void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
16896
16897 /**
16898  * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
16899  */
16900 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
16901
16902 /**
16903  * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
16904  */
16905 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
16906
16907 /**
16908  * Checks if the given object is currently in the success state
16909  */
16910 bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o);
16911
16912 /**
16913  * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
16914  */
16915 void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
16916
16917 /**
16918  * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
16919  */
16920 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
16921
16922 /**
16923  * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
16924  */
16925 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
16926
16927 /**
16928  * Checks if the given object is currently in the success state
16929  */
16930 bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o);
16931
16932 /**
16933  * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
16934  */
16935 void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
16936
16937 /**
16938  * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
16939  * but with all dynamically-allocated buffers duplicated in new buffers.
16940  */
16941 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
16942
16943 /**
16944  * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
16945  */
16946 struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_ok(struct LDKInFlightHtlcs o);
16947
16948 /**
16949  * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
16950  */
16951 struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_err(struct LDKDecodeError e);
16952
16953 /**
16954  * Checks if the given object is currently in the success state
16955  */
16956 bool CResult_InFlightHtlcsDecodeErrorZ_is_ok(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR o);
16957
16958 /**
16959  * Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
16960  */
16961 void CResult_InFlightHtlcsDecodeErrorZ_free(struct LDKCResult_InFlightHtlcsDecodeErrorZ _res);
16962
16963 /**
16964  * Creates a new CResult_SiPrefixParseErrorZ in the success state.
16965  */
16966 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o);
16967
16968 /**
16969  * Creates a new CResult_SiPrefixParseErrorZ in the error state.
16970  */
16971 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e);
16972
16973 /**
16974  * Checks if the given object is currently in the success state
16975  */
16976 bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o);
16977
16978 /**
16979  * Frees any resources used by the CResult_SiPrefixParseErrorZ.
16980  */
16981 void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res);
16982
16983 /**
16984  * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
16985  * but with all dynamically-allocated buffers duplicated in new buffers.
16986  */
16987 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_clone(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR orig);
16988
16989 /**
16990  * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
16991  */
16992 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o);
16993
16994 /**
16995  * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
16996  */
16997 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e);
16998
16999 /**
17000  * Checks if the given object is currently in the success state
17001  */
17002 bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o);
17003
17004 /**
17005  * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
17006  */
17007 void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res);
17008
17009 /**
17010  * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
17011  * but with all dynamically-allocated buffers duplicated in new buffers.
17012  */
17013 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig);
17014
17015 /**
17016  * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
17017  */
17018 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o);
17019
17020 /**
17021  * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
17022  */
17023 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e);
17024
17025 /**
17026  * Checks if the given object is currently in the success state
17027  */
17028 bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o);
17029
17030 /**
17031  * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
17032  */
17033 void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res);
17034
17035 /**
17036  * Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
17037  * but with all dynamically-allocated buffers duplicated in new buffers.
17038  */
17039 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig);
17040
17041 /**
17042  * Creates a new tuple which has the same data as `orig`
17043  * but with all dynamically-allocated buffers duplicated in new buffers.
17044  */
17045 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
17046
17047 /**
17048  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
17049  */
17050 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
17051
17052 /**
17053  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
17054  */
17055 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
17056
17057 /**
17058  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
17059  */
17060 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
17061
17062 /**
17063  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
17064  */
17065 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
17066
17067 /**
17068  * Checks if the given object is currently in the success state
17069  */
17070 bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o);
17071
17072 /**
17073  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
17074  */
17075 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
17076
17077 /**
17078  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
17079  * but with all dynamically-allocated buffers duplicated in new buffers.
17080  */
17081 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
17082
17083 /**
17084  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17085  */
17086 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
17087
17088 /**
17089  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
17090  */
17091 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
17092
17093 /**
17094  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
17095  */
17096 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
17097
17098 /**
17099  * Checks if the given object is currently in the success state
17100  */
17101 bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o);
17102
17103 /**
17104  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
17105  */
17106 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
17107
17108 /**
17109  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
17110  * but with all dynamically-allocated buffers duplicated in new buffers.
17111  */
17112 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
17113
17114 /**
17115  * Creates a new CResult_NoneSemanticErrorZ in the success state.
17116  */
17117 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
17118
17119 /**
17120  * Creates a new CResult_NoneSemanticErrorZ in the error state.
17121  */
17122 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
17123
17124 /**
17125  * Checks if the given object is currently in the success state
17126  */
17127 bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o);
17128
17129 /**
17130  * Frees any resources used by the CResult_NoneSemanticErrorZ.
17131  */
17132 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
17133
17134 /**
17135  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
17136  * but with all dynamically-allocated buffers duplicated in new buffers.
17137  */
17138 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
17139
17140 /**
17141  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
17142  */
17143 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
17144
17145 /**
17146  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
17147  */
17148 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
17149
17150 /**
17151  * Checks if the given object is currently in the success state
17152  */
17153 bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o);
17154
17155 /**
17156  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
17157  */
17158 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
17159
17160 /**
17161  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
17162  * but with all dynamically-allocated buffers duplicated in new buffers.
17163  */
17164 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
17165
17166 /**
17167  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
17168  */
17169 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
17170
17171 /**
17172  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
17173  */
17174 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
17175
17176 /**
17177  * Checks if the given object is currently in the success state
17178  */
17179 bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o);
17180
17181 /**
17182  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
17183  */
17184 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
17185
17186 /**
17187  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
17188  * but with all dynamically-allocated buffers duplicated in new buffers.
17189  */
17190 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
17191
17192 /**
17193  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
17194  */
17195 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
17196
17197 /**
17198  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
17199  */
17200 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
17201
17202 /**
17203  * Checks if the given object is currently in the success state
17204  */
17205 bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o);
17206
17207 /**
17208  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
17209  */
17210 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
17211
17212 /**
17213  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
17214  * but with all dynamically-allocated buffers duplicated in new buffers.
17215  */
17216 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
17217
17218 /**
17219  * Creates a new CResult_StringErrorZ in the success state.
17220  */
17221 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
17222
17223 /**
17224  * Creates a new CResult_StringErrorZ in the error state.
17225  */
17226 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
17227
17228 /**
17229  * Checks if the given object is currently in the success state
17230  */
17231 bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o);
17232
17233 /**
17234  * Frees any resources used by the CResult_StringErrorZ.
17235  */
17236 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
17237
17238 /**
17239  * Creates a new CResult_StringErrorZ which has the same data as `orig`
17240  * but with all dynamically-allocated buffers duplicated in new buffers.
17241  */
17242 struct LDKCResult_StringErrorZ CResult_StringErrorZ_clone(const struct LDKCResult_StringErrorZ *NONNULL_PTR orig);
17243
17244 /**
17245  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
17246  */
17247 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
17248
17249 /**
17250  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
17251  */
17252 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
17253
17254 /**
17255  * Checks if the given object is currently in the success state
17256  */
17257 bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o);
17258
17259 /**
17260  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
17261  */
17262 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
17263
17264 /**
17265  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
17266  * but with all dynamically-allocated buffers duplicated in new buffers.
17267  */
17268 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
17269
17270 /**
17271  * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
17272  */
17273 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o);
17274
17275 /**
17276  * Constructs a new COption_MonitorEventZ containing nothing
17277  */
17278 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void);
17279
17280 /**
17281  * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
17282  */
17283 void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res);
17284
17285 /**
17286  * Creates a new COption_MonitorEventZ which has the same data as `orig`
17287  * but with all dynamically-allocated buffers duplicated in new buffers.
17288  */
17289 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig);
17290
17291 /**
17292  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
17293  */
17294 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o);
17295
17296 /**
17297  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
17298  */
17299 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e);
17300
17301 /**
17302  * Checks if the given object is currently in the success state
17303  */
17304 bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o);
17305
17306 /**
17307  * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
17308  */
17309 void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res);
17310
17311 /**
17312  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
17313  * but with all dynamically-allocated buffers duplicated in new buffers.
17314  */
17315 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig);
17316
17317 /**
17318  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
17319  */
17320 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
17321
17322 /**
17323  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
17324  */
17325 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
17326
17327 /**
17328  * Checks if the given object is currently in the success state
17329  */
17330 bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o);
17331
17332 /**
17333  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
17334  */
17335 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
17336
17337 /**
17338  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
17339  * but with all dynamically-allocated buffers duplicated in new buffers.
17340  */
17341 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
17342
17343 /**
17344  * Creates a new tuple which has the same data as `orig`
17345  * but with all dynamically-allocated buffers duplicated in new buffers.
17346  */
17347 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
17348
17349 /**
17350  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
17351  */
17352 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
17353
17354 /**
17355  * Frees any resources used by the C2Tuple_OutPointScriptZ.
17356  */
17357 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
17358
17359 /**
17360  * Creates a new tuple which has the same data as `orig`
17361  * but with all dynamically-allocated buffers duplicated in new buffers.
17362  */
17363 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
17364
17365 /**
17366  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
17367  */
17368 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
17369
17370 /**
17371  * Frees any resources used by the C2Tuple_u32ScriptZ.
17372  */
17373 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
17374
17375 /**
17376  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17377  */
17378 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
17379
17380 /**
17381  * Creates a new tuple which has the same data as `orig`
17382  * but with all dynamically-allocated buffers duplicated in new buffers.
17383  */
17384 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
17385
17386 /**
17387  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
17388  */
17389 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
17390
17391 /**
17392  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
17393  */
17394 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
17395
17396 /**
17397  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17398  */
17399 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
17400
17401 /**
17402  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17403  */
17404 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
17405
17406 /**
17407  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17408  */
17409 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
17410
17411 /**
17412  * Creates a new tuple which has the same data as `orig`
17413  * but with all dynamically-allocated buffers duplicated in new buffers.
17414  */
17415 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
17416
17417 /**
17418  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
17419  */
17420 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
17421
17422 /**
17423  * Frees any resources used by the C2Tuple_u32TxOutZ.
17424  */
17425 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
17426
17427 /**
17428  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17429  */
17430 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
17431
17432 /**
17433  * Creates a new tuple which has the same data as `orig`
17434  * but with all dynamically-allocated buffers duplicated in new buffers.
17435  */
17436 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
17437
17438 /**
17439  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
17440  */
17441 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
17442
17443 /**
17444  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
17445  */
17446 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
17447
17448 /**
17449  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17450  */
17451 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
17452
17453 /**
17454  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17455  */
17456 void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
17457
17458 /**
17459  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
17460  */
17461 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
17462
17463 /**
17464  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
17465  */
17466 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
17467
17468 /**
17469  * Checks if the given object is currently in the success state
17470  */
17471 bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o);
17472
17473 /**
17474  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
17475  */
17476 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
17477
17478 /**
17479  * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
17480  */
17481 struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
17482
17483 /**
17484  * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
17485  */
17486 void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
17487
17488 /**
17489  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17490  */
17491 void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
17492
17493 /**
17494  * Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
17495  */
17496 struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_some(struct LDKCustomOnionMessageContents o);
17497
17498 /**
17499  * Constructs a new COption_CustomOnionMessageContentsZ containing nothing
17500  */
17501 struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_none(void);
17502
17503 /**
17504  * Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
17505  */
17506 void COption_CustomOnionMessageContentsZ_free(struct LDKCOption_CustomOnionMessageContentsZ _res);
17507
17508 /**
17509  * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
17510  */
17511 struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_CustomOnionMessageContentsZ o);
17512
17513 /**
17514  * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
17515  */
17516 struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(struct LDKDecodeError e);
17517
17518 /**
17519  * Checks if the given object is currently in the success state
17520  */
17521 bool CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR o);
17522
17523 /**
17524  * Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
17525  */
17526 void CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res);
17527
17528 /**
17529  * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
17530  */
17531 struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o);
17532
17533 /**
17534  * Constructs a new COption_NetAddressZ containing nothing
17535  */
17536 struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void);
17537
17538 /**
17539  * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
17540  */
17541 void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res);
17542
17543 /**
17544  * Creates a new COption_NetAddressZ which has the same data as `orig`
17545  * but with all dynamically-allocated buffers duplicated in new buffers.
17546  */
17547 struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig);
17548
17549 /**
17550  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
17551  */
17552 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
17553
17554 /**
17555  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
17556  */
17557 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
17558
17559 /**
17560  * Checks if the given object is currently in the success state
17561  */
17562 bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o);
17563
17564 /**
17565  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
17566  */
17567 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
17568
17569 /**
17570  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
17571  * but with all dynamically-allocated buffers duplicated in new buffers.
17572  */
17573 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
17574
17575 /**
17576  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
17577  */
17578 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
17579
17580 /**
17581  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
17582  */
17583 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
17584
17585 /**
17586  * Checks if the given object is currently in the success state
17587  */
17588 bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o);
17589
17590 /**
17591  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
17592  */
17593 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
17594
17595 /**
17596  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
17597  * but with all dynamically-allocated buffers duplicated in new buffers.
17598  */
17599 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
17600
17601 /**
17602  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
17603  */
17604 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
17605
17606 /**
17607  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
17608  */
17609 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
17610
17611 /**
17612  * Checks if the given object is currently in the success state
17613  */
17614 bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o);
17615
17616 /**
17617  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
17618  */
17619 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
17620
17621 /**
17622  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
17623  * but with all dynamically-allocated buffers duplicated in new buffers.
17624  */
17625 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
17626
17627 /**
17628  * Creates a new CResult_NoneSendErrorZ in the success state.
17629  */
17630 struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_ok(void);
17631
17632 /**
17633  * Creates a new CResult_NoneSendErrorZ in the error state.
17634  */
17635 struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_err(struct LDKSendError e);
17636
17637 /**
17638  * Checks if the given object is currently in the success state
17639  */
17640 bool CResult_NoneSendErrorZ_is_ok(const struct LDKCResult_NoneSendErrorZ *NONNULL_PTR o);
17641
17642 /**
17643  * Frees any resources used by the CResult_NoneSendErrorZ.
17644  */
17645 void CResult_NoneSendErrorZ_free(struct LDKCResult_NoneSendErrorZ _res);
17646
17647 /**
17648  * Creates a new CResult_u32GraphSyncErrorZ in the success state.
17649  */
17650 struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_ok(uint32_t o);
17651
17652 /**
17653  * Creates a new CResult_u32GraphSyncErrorZ in the error state.
17654  */
17655 struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_err(struct LDKGraphSyncError e);
17656
17657 /**
17658  * Checks if the given object is currently in the success state
17659  */
17660 bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR o);
17661
17662 /**
17663  * Frees any resources used by the CResult_u32GraphSyncErrorZ.
17664  */
17665 void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res);
17666
17667 /**
17668  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
17669  */
17670 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
17671
17672 /**
17673  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
17674  */
17675 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
17676
17677 /**
17678  * Checks if the given object is currently in the success state
17679  */
17680 bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o);
17681
17682 /**
17683  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
17684  */
17685 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
17686
17687 /**
17688  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
17689  * but with all dynamically-allocated buffers duplicated in new buffers.
17690  */
17691 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
17692
17693 /**
17694  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17695  */
17696 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
17697
17698 /**
17699  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17700  */
17701 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
17702
17703 /**
17704  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17705  */
17706 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
17707
17708 /**
17709  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17710  */
17711 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
17712
17713 /**
17714  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
17715  */
17716 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
17717
17718 /**
17719  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
17720  */
17721 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
17722
17723 /**
17724  * Checks if the given object is currently in the success state
17725  */
17726 bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o);
17727
17728 /**
17729  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
17730  */
17731 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
17732
17733 /**
17734  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
17735  * but with all dynamically-allocated buffers duplicated in new buffers.
17736  */
17737 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
17738
17739 /**
17740  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
17741  */
17742 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
17743
17744 /**
17745  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
17746  */
17747 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
17748
17749 /**
17750  * Checks if the given object is currently in the success state
17751  */
17752 bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o);
17753
17754 /**
17755  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
17756  */
17757 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
17758
17759 /**
17760  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
17761  * but with all dynamically-allocated buffers duplicated in new buffers.
17762  */
17763 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
17764
17765 /**
17766  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
17767  */
17768 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
17769
17770 /**
17771  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
17772  */
17773 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
17774
17775 /**
17776  * Checks if the given object is currently in the success state
17777  */
17778 bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o);
17779
17780 /**
17781  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
17782  */
17783 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
17784
17785 /**
17786  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
17787  * but with all dynamically-allocated buffers duplicated in new buffers.
17788  */
17789 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
17790
17791 /**
17792  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
17793  */
17794 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
17795
17796 /**
17797  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
17798  */
17799 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
17800
17801 /**
17802  * Checks if the given object is currently in the success state
17803  */
17804 bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o);
17805
17806 /**
17807  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
17808  */
17809 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
17810
17811 /**
17812  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
17813  * but with all dynamically-allocated buffers duplicated in new buffers.
17814  */
17815 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
17816
17817 /**
17818  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
17819  */
17820 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
17821
17822 /**
17823  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
17824  */
17825 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
17826
17827 /**
17828  * Checks if the given object is currently in the success state
17829  */
17830 bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o);
17831
17832 /**
17833  * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
17834  */
17835 void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
17836
17837 /**
17838  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
17839  * but with all dynamically-allocated buffers duplicated in new buffers.
17840  */
17841 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
17842
17843 /**
17844  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
17845  */
17846 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
17847
17848 /**
17849  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
17850  */
17851 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
17852
17853 /**
17854  * Checks if the given object is currently in the success state
17855  */
17856 bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o);
17857
17858 /**
17859  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
17860  */
17861 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
17862
17863 /**
17864  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
17865  * but with all dynamically-allocated buffers duplicated in new buffers.
17866  */
17867 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
17868
17869 /**
17870  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
17871  */
17872 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
17873
17874 /**
17875  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
17876  */
17877 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
17878
17879 /**
17880  * Checks if the given object is currently in the success state
17881  */
17882 bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o);
17883
17884 /**
17885  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
17886  */
17887 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
17888
17889 /**
17890  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
17891  * but with all dynamically-allocated buffers duplicated in new buffers.
17892  */
17893 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
17894
17895 /**
17896  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
17897  */
17898 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
17899
17900 /**
17901  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
17902  */
17903 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
17904
17905 /**
17906  * Checks if the given object is currently in the success state
17907  */
17908 bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o);
17909
17910 /**
17911  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
17912  */
17913 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
17914
17915 /**
17916  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
17917  * but with all dynamically-allocated buffers duplicated in new buffers.
17918  */
17919 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
17920
17921 /**
17922  * Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
17923  */
17924 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_ok(struct LDKChannelReady o);
17925
17926 /**
17927  * Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
17928  */
17929 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_err(struct LDKDecodeError e);
17930
17931 /**
17932  * Checks if the given object is currently in the success state
17933  */
17934 bool CResult_ChannelReadyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR o);
17935
17936 /**
17937  * Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
17938  */
17939 void CResult_ChannelReadyDecodeErrorZ_free(struct LDKCResult_ChannelReadyDecodeErrorZ _res);
17940
17941 /**
17942  * Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
17943  * but with all dynamically-allocated buffers duplicated in new buffers.
17944  */
17945 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_clone(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR orig);
17946
17947 /**
17948  * Creates a new CResult_InitDecodeErrorZ in the success state.
17949  */
17950 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
17951
17952 /**
17953  * Creates a new CResult_InitDecodeErrorZ in the error state.
17954  */
17955 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
17956
17957 /**
17958  * Checks if the given object is currently in the success state
17959  */
17960 bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o);
17961
17962 /**
17963  * Frees any resources used by the CResult_InitDecodeErrorZ.
17964  */
17965 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
17966
17967 /**
17968  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
17969  * but with all dynamically-allocated buffers duplicated in new buffers.
17970  */
17971 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
17972
17973 /**
17974  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
17975  */
17976 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
17977
17978 /**
17979  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
17980  */
17981 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
17982
17983 /**
17984  * Checks if the given object is currently in the success state
17985  */
17986 bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o);
17987
17988 /**
17989  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
17990  */
17991 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
17992
17993 /**
17994  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
17995  * but with all dynamically-allocated buffers duplicated in new buffers.
17996  */
17997 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
17998
17999 /**
18000  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
18001  */
18002 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
18003
18004 /**
18005  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
18006  */
18007 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
18008
18009 /**
18010  * Checks if the given object is currently in the success state
18011  */
18012 bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o);
18013
18014 /**
18015  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
18016  */
18017 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
18018
18019 /**
18020  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
18021  * but with all dynamically-allocated buffers duplicated in new buffers.
18022  */
18023 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
18024
18025 /**
18026  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
18027  */
18028 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
18029
18030 /**
18031  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
18032  */
18033 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
18034
18035 /**
18036  * Checks if the given object is currently in the success state
18037  */
18038 bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o);
18039
18040 /**
18041  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
18042  */
18043 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
18044
18045 /**
18046  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
18047  * but with all dynamically-allocated buffers duplicated in new buffers.
18048  */
18049 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
18050
18051 /**
18052  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
18053  */
18054 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
18055
18056 /**
18057  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
18058  */
18059 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
18060
18061 /**
18062  * Checks if the given object is currently in the success state
18063  */
18064 bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o);
18065
18066 /**
18067  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
18068  */
18069 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
18070
18071 /**
18072  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
18073  * but with all dynamically-allocated buffers duplicated in new buffers.
18074  */
18075 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
18076
18077 /**
18078  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
18079  */
18080 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
18081
18082 /**
18083  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
18084  */
18085 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
18086
18087 /**
18088  * Checks if the given object is currently in the success state
18089  */
18090 bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o);
18091
18092 /**
18093  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
18094  */
18095 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
18096
18097 /**
18098  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
18099  * but with all dynamically-allocated buffers duplicated in new buffers.
18100  */
18101 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
18102
18103 /**
18104  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
18105  */
18106 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
18107
18108 /**
18109  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
18110  */
18111 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
18112
18113 /**
18114  * Checks if the given object is currently in the success state
18115  */
18116 bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o);
18117
18118 /**
18119  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
18120  */
18121 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
18122
18123 /**
18124  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
18125  * but with all dynamically-allocated buffers duplicated in new buffers.
18126  */
18127 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
18128
18129 /**
18130  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
18131  */
18132 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
18133
18134 /**
18135  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
18136  */
18137 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
18138
18139 /**
18140  * Checks if the given object is currently in the success state
18141  */
18142 bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o);
18143
18144 /**
18145  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
18146  */
18147 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
18148
18149 /**
18150  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
18151  * but with all dynamically-allocated buffers duplicated in new buffers.
18152  */
18153 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
18154
18155 /**
18156  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
18157  */
18158 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
18159
18160 /**
18161  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
18162  */
18163 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
18164
18165 /**
18166  * Checks if the given object is currently in the success state
18167  */
18168 bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o);
18169
18170 /**
18171  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
18172  */
18173 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
18174
18175 /**
18176  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
18177  * but with all dynamically-allocated buffers duplicated in new buffers.
18178  */
18179 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
18180
18181 /**
18182  * Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
18183  */
18184 struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_ok(struct LDKOnionMessage o);
18185
18186 /**
18187  * Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
18188  */
18189 struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_err(struct LDKDecodeError e);
18190
18191 /**
18192  * Checks if the given object is currently in the success state
18193  */
18194 bool CResult_OnionMessageDecodeErrorZ_is_ok(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR o);
18195
18196 /**
18197  * Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
18198  */
18199 void CResult_OnionMessageDecodeErrorZ_free(struct LDKCResult_OnionMessageDecodeErrorZ _res);
18200
18201 /**
18202  * Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
18203  * but with all dynamically-allocated buffers duplicated in new buffers.
18204  */
18205 struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_clone(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR orig);
18206
18207 /**
18208  * Creates a new CResult_PingDecodeErrorZ in the success state.
18209  */
18210 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
18211
18212 /**
18213  * Creates a new CResult_PingDecodeErrorZ in the error state.
18214  */
18215 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
18216
18217 /**
18218  * Checks if the given object is currently in the success state
18219  */
18220 bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o);
18221
18222 /**
18223  * Frees any resources used by the CResult_PingDecodeErrorZ.
18224  */
18225 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
18226
18227 /**
18228  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
18229  * but with all dynamically-allocated buffers duplicated in new buffers.
18230  */
18231 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
18232
18233 /**
18234  * Creates a new CResult_PongDecodeErrorZ in the success state.
18235  */
18236 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
18237
18238 /**
18239  * Creates a new CResult_PongDecodeErrorZ in the error state.
18240  */
18241 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
18242
18243 /**
18244  * Checks if the given object is currently in the success state
18245  */
18246 bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o);
18247
18248 /**
18249  * Frees any resources used by the CResult_PongDecodeErrorZ.
18250  */
18251 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
18252
18253 /**
18254  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
18255  * but with all dynamically-allocated buffers duplicated in new buffers.
18256  */
18257 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
18258
18259 /**
18260  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
18261  */
18262 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
18263
18264 /**
18265  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
18266  */
18267 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
18268
18269 /**
18270  * Checks if the given object is currently in the success state
18271  */
18272 bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
18273
18274 /**
18275  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
18276  */
18277 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
18278
18279 /**
18280  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
18281  * but with all dynamically-allocated buffers duplicated in new buffers.
18282  */
18283 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
18284
18285 /**
18286  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
18287  */
18288 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
18289
18290 /**
18291  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
18292  */
18293 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
18294
18295 /**
18296  * Checks if the given object is currently in the success state
18297  */
18298 bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
18299
18300 /**
18301  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
18302  */
18303 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
18304
18305 /**
18306  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
18307  * but with all dynamically-allocated buffers duplicated in new buffers.
18308  */
18309 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
18310
18311 /**
18312  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
18313  */
18314 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
18315
18316 /**
18317  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
18318  */
18319 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
18320
18321 /**
18322  * Checks if the given object is currently in the success state
18323  */
18324 bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o);
18325
18326 /**
18327  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
18328  */
18329 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
18330
18331 /**
18332  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
18333  * but with all dynamically-allocated buffers duplicated in new buffers.
18334  */
18335 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
18336
18337 /**
18338  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
18339  */
18340 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
18341
18342 /**
18343  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
18344  */
18345 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
18346
18347 /**
18348  * Checks if the given object is currently in the success state
18349  */
18350 bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o);
18351
18352 /**
18353  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
18354  */
18355 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
18356
18357 /**
18358  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
18359  * but with all dynamically-allocated buffers duplicated in new buffers.
18360  */
18361 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
18362
18363 /**
18364  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
18365  */
18366 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
18367
18368 /**
18369  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
18370  */
18371 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
18372
18373 /**
18374  * Checks if the given object is currently in the success state
18375  */
18376 bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o);
18377
18378 /**
18379  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
18380  */
18381 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
18382
18383 /**
18384  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
18385  * but with all dynamically-allocated buffers duplicated in new buffers.
18386  */
18387 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
18388
18389 /**
18390  * Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
18391  */
18392 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o);
18393
18394 /**
18395  * Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
18396  */
18397 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e);
18398
18399 /**
18400  * Checks if the given object is currently in the success state
18401  */
18402 bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o);
18403
18404 /**
18405  * Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
18406  */
18407 void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res);
18408
18409 /**
18410  * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
18411  * but with all dynamically-allocated buffers duplicated in new buffers.
18412  */
18413 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig);
18414
18415 /**
18416  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
18417  */
18418 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
18419
18420 /**
18421  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
18422  */
18423 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
18424
18425 /**
18426  * Checks if the given object is currently in the success state
18427  */
18428 bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
18429
18430 /**
18431  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
18432  */
18433 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
18434
18435 /**
18436  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
18437  * but with all dynamically-allocated buffers duplicated in new buffers.
18438  */
18439 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
18440
18441 /**
18442  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
18443  */
18444 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
18445
18446 /**
18447  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
18448  */
18449 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
18450
18451 /**
18452  * Checks if the given object is currently in the success state
18453  */
18454 bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
18455
18456 /**
18457  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
18458  */
18459 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
18460
18461 /**
18462  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
18463  * but with all dynamically-allocated buffers duplicated in new buffers.
18464  */
18465 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
18466
18467 /**
18468  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
18469  */
18470 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
18471
18472 /**
18473  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
18474  */
18475 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
18476
18477 /**
18478  * Checks if the given object is currently in the success state
18479  */
18480 bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o);
18481
18482 /**
18483  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
18484  */
18485 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
18486
18487 /**
18488  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
18489  * but with all dynamically-allocated buffers duplicated in new buffers.
18490  */
18491 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
18492
18493 /**
18494  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
18495  */
18496 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
18497
18498 /**
18499  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
18500  */
18501 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
18502
18503 /**
18504  * Checks if the given object is currently in the success state
18505  */
18506 bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o);
18507
18508 /**
18509  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
18510  */
18511 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
18512
18513 /**
18514  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
18515  * but with all dynamically-allocated buffers duplicated in new buffers.
18516  */
18517 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
18518
18519 /**
18520  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
18521  */
18522 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
18523
18524 /**
18525  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
18526  */
18527 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
18528
18529 /**
18530  * Checks if the given object is currently in the success state
18531  */
18532 bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o);
18533
18534 /**
18535  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
18536  */
18537 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
18538
18539 /**
18540  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
18541  * but with all dynamically-allocated buffers duplicated in new buffers.
18542  */
18543 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
18544
18545 /**
18546  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
18547  */
18548 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
18549
18550 /**
18551  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
18552  */
18553 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
18554
18555 /**
18556  * Checks if the given object is currently in the success state
18557  */
18558 bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o);
18559
18560 /**
18561  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
18562  */
18563 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
18564
18565 /**
18566  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
18567  * but with all dynamically-allocated buffers duplicated in new buffers.
18568  */
18569 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
18570
18571 /**
18572  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
18573  */
18574 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
18575
18576 /**
18577  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
18578  */
18579 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
18580
18581 /**
18582  * Checks if the given object is currently in the success state
18583  */
18584 bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o);
18585
18586 /**
18587  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
18588  */
18589 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
18590
18591 /**
18592  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
18593  * but with all dynamically-allocated buffers duplicated in new buffers.
18594  */
18595 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
18596
18597 /**
18598  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18599  */
18600 void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res);
18601
18602 /**
18603  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
18604  */
18605 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
18606
18607 /**
18608  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
18609  */
18610 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
18611
18612 /**
18613  * Checks if the given object is currently in the success state
18614  */
18615 bool CResult_InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR o);
18616
18617 /**
18618  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
18619  */
18620 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
18621
18622 /**
18623  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
18624  * but with all dynamically-allocated buffers duplicated in new buffers.
18625  */
18626 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
18627
18628 /**
18629  * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
18630  */
18631 struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
18632
18633 /**
18634  * Constructs a new COption_FilterZ containing nothing
18635  */
18636 struct LDKCOption_FilterZ COption_FilterZ_none(void);
18637
18638 /**
18639  * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
18640  */
18641 void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
18642
18643 /**
18644  * Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
18645  */
18646 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o);
18647
18648 /**
18649  * Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
18650  */
18651 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
18652
18653 /**
18654  * Checks if the given object is currently in the success state
18655  */
18656 bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o);
18657
18658 /**
18659  * Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
18660  */
18661 void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res);
18662
18663 /**
18664  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18665  */
18666 void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res);
18667
18668 /**
18669  * Frees any resources used by the PaymentPurpose
18670  */
18671 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
18672
18673 /**
18674  * Creates a copy of the PaymentPurpose
18675  */
18676 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
18677
18678 /**
18679  * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
18680  */
18681 struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret);
18682
18683 /**
18684  * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
18685  */
18686 struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
18687
18688 /**
18689  * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read
18690  */
18691 struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_PTR obj);
18692
18693 /**
18694  * Read a PaymentPurpose from a byte array, created by PaymentPurpose_write
18695  */
18696 struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser);
18697
18698 /**
18699  * Frees any resources used by the ClosureReason
18700  */
18701 void ClosureReason_free(struct LDKClosureReason this_ptr);
18702
18703 /**
18704  * Creates a copy of the ClosureReason
18705  */
18706 struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
18707
18708 /**
18709  * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
18710  */
18711 struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg);
18712
18713 /**
18714  * Utility method to constructs a new HolderForceClosed-variant ClosureReason
18715  */
18716 struct LDKClosureReason ClosureReason_holder_force_closed(void);
18717
18718 /**
18719  * Utility method to constructs a new CooperativeClosure-variant ClosureReason
18720  */
18721 struct LDKClosureReason ClosureReason_cooperative_closure(void);
18722
18723 /**
18724  * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
18725  */
18726 struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
18727
18728 /**
18729  * Utility method to constructs a new FundingTimedOut-variant ClosureReason
18730  */
18731 struct LDKClosureReason ClosureReason_funding_timed_out(void);
18732
18733 /**
18734  * Utility method to constructs a new ProcessingError-variant ClosureReason
18735  */
18736 struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
18737
18738 /**
18739  * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
18740  */
18741 struct LDKClosureReason ClosureReason_disconnected_peer(void);
18742
18743 /**
18744  * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
18745  */
18746 struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
18747
18748 /**
18749  * Checks if two ClosureReasons contain equal inner contents.
18750  * This ignores pointers and is_owned flags and looks at the values in fields.
18751  */
18752 bool ClosureReason_eq(const struct LDKClosureReason *NONNULL_PTR a, const struct LDKClosureReason *NONNULL_PTR b);
18753
18754 /**
18755  * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
18756  */
18757 struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
18758
18759 /**
18760  * Read a ClosureReason from a byte array, created by ClosureReason_write
18761  */
18762 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser);
18763
18764 /**
18765  * Frees any resources used by the HTLCDestination
18766  */
18767 void HTLCDestination_free(struct LDKHTLCDestination this_ptr);
18768
18769 /**
18770  * Creates a copy of the HTLCDestination
18771  */
18772 struct LDKHTLCDestination HTLCDestination_clone(const struct LDKHTLCDestination *NONNULL_PTR orig);
18773
18774 /**
18775  * Utility method to constructs a new NextHopChannel-variant HTLCDestination
18776  */
18777 struct LDKHTLCDestination HTLCDestination_next_hop_channel(struct LDKPublicKey node_id, struct LDKThirtyTwoBytes channel_id);
18778
18779 /**
18780  * Utility method to constructs a new UnknownNextHop-variant HTLCDestination
18781  */
18782 struct LDKHTLCDestination HTLCDestination_unknown_next_hop(uint64_t requested_forward_scid);
18783
18784 /**
18785  * Utility method to constructs a new FailedPayment-variant HTLCDestination
18786  */
18787 struct LDKHTLCDestination HTLCDestination_failed_payment(struct LDKThirtyTwoBytes payment_hash);
18788
18789 /**
18790  * Checks if two HTLCDestinations contain equal inner contents.
18791  * This ignores pointers and is_owned flags and looks at the values in fields.
18792  */
18793 bool HTLCDestination_eq(const struct LDKHTLCDestination *NONNULL_PTR a, const struct LDKHTLCDestination *NONNULL_PTR b);
18794
18795 /**
18796  * Serialize the HTLCDestination object into a byte array which can be read by HTLCDestination_read
18797  */
18798 struct LDKCVec_u8Z HTLCDestination_write(const struct LDKHTLCDestination *NONNULL_PTR obj);
18799
18800 /**
18801  * Read a HTLCDestination from a byte array, created by HTLCDestination_write
18802  */
18803 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ HTLCDestination_read(struct LDKu8slice ser);
18804
18805 /**
18806  * Frees any resources used by the Event
18807  */
18808 void Event_free(struct LDKEvent this_ptr);
18809
18810 /**
18811  * Creates a copy of the Event
18812  */
18813 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
18814
18815 /**
18816  * Utility method to constructs a new FundingGenerationReady-variant Event
18817  */
18818 struct LDKEvent Event_funding_generation_ready(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, uint64_t user_channel_id);
18819
18820 /**
18821  * Utility method to constructs a new PaymentReceived-variant Event
18822  */
18823 struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose);
18824
18825 /**
18826  * Utility method to constructs a new PaymentClaimed-variant Event
18827  */
18828 struct LDKEvent Event_payment_claimed(struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose);
18829
18830 /**
18831  * Utility method to constructs a new PaymentSent-variant Event
18832  */
18833 struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
18834
18835 /**
18836  * Utility method to constructs a new PaymentFailed-variant Event
18837  */
18838 struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash);
18839
18840 /**
18841  * Utility method to constructs a new PaymentPathSuccessful-variant Event
18842  */
18843 struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
18844
18845 /**
18846  * Utility method to constructs a new PaymentPathFailed-variant Event
18847  */
18848 struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool payment_failed_permanently, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id, struct LDKRouteParameters retry);
18849
18850 /**
18851  * Utility method to constructs a new ProbeSuccessful-variant Event
18852  */
18853 struct LDKEvent Event_probe_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
18854
18855 /**
18856  * Utility method to constructs a new ProbeFailed-variant Event
18857  */
18858 struct LDKEvent Event_probe_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id);
18859
18860 /**
18861  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
18862  */
18863 struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
18864
18865 /**
18866  * Utility method to constructs a new SpendableOutputs-variant Event
18867  */
18868 struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
18869
18870 /**
18871  * Utility method to constructs a new PaymentForwarded-variant Event
18872  */
18873 struct LDKEvent Event_payment_forwarded(struct LDKThirtyTwoBytes prev_channel_id, struct LDKThirtyTwoBytes next_channel_id, struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx);
18874
18875 /**
18876  * Utility method to constructs a new ChannelClosed-variant Event
18877  */
18878 struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64_t user_channel_id, struct LDKClosureReason reason);
18879
18880 /**
18881  * Utility method to constructs a new DiscardFunding-variant Event
18882  */
18883 struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
18884
18885 /**
18886  * Utility method to constructs a new OpenChannelRequest-variant Event
18887  */
18888 struct LDKEvent Event_open_channel_request(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t funding_satoshis, uint64_t push_msat, struct LDKChannelTypeFeatures channel_type);
18889
18890 /**
18891  * Utility method to constructs a new HTLCHandlingFailed-variant Event
18892  */
18893 struct LDKEvent Event_htlchandling_failed(struct LDKThirtyTwoBytes prev_channel_id, struct LDKHTLCDestination failed_next_destination);
18894
18895 /**
18896  * Serialize the Event object into a byte array which can be read by Event_read
18897  */
18898 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
18899
18900 /**
18901  * Read a Event from a byte array, created by Event_write
18902  */
18903 struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser);
18904
18905 /**
18906  * Frees any resources used by the MessageSendEvent
18907  */
18908 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
18909
18910 /**
18911  * Creates a copy of the MessageSendEvent
18912  */
18913 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
18914
18915 /**
18916  * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
18917  */
18918 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
18919
18920 /**
18921  * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
18922  */
18923 struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
18924
18925 /**
18926  * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
18927  */
18928 struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
18929
18930 /**
18931  * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
18932  */
18933 struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
18934
18935 /**
18936  * Utility method to constructs a new SendChannelReady-variant MessageSendEvent
18937  */
18938 struct LDKMessageSendEvent MessageSendEvent_send_channel_ready(struct LDKPublicKey node_id, struct LDKChannelReady msg);
18939
18940 /**
18941  * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
18942  */
18943 struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
18944
18945 /**
18946  * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
18947  */
18948 struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
18949
18950 /**
18951  * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
18952  */
18953 struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
18954
18955 /**
18956  * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
18957  */
18958 struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
18959
18960 /**
18961  * Utility method to constructs a new SendShutdown-variant MessageSendEvent
18962  */
18963 struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
18964
18965 /**
18966  * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
18967  */
18968 struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
18969
18970 /**
18971  * Utility method to constructs a new SendChannelAnnouncement-variant MessageSendEvent
18972  */
18973 struct LDKMessageSendEvent MessageSendEvent_send_channel_announcement(struct LDKPublicKey node_id, struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
18974
18975 /**
18976  * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
18977  */
18978 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
18979
18980 /**
18981  * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
18982  */
18983 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
18984
18985 /**
18986  * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
18987  */
18988 struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
18989
18990 /**
18991  * Utility method to constructs a new HandleError-variant MessageSendEvent
18992  */
18993 struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
18994
18995 /**
18996  * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
18997  */
18998 struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
18999
19000 /**
19001  * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
19002  */
19003 struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
19004
19005 /**
19006  * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
19007  */
19008 struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
19009
19010 /**
19011  * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent
19012  */
19013 struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg);
19014
19015 /**
19016  * Calls the free function if one is set
19017  */
19018 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
19019
19020 /**
19021  * Calls the free function if one is set
19022  */
19023 void OnionMessageProvider_free(struct LDKOnionMessageProvider this_ptr);
19024
19025 /**
19026  * Calls the free function if one is set
19027  */
19028 void EventsProvider_free(struct LDKEventsProvider this_ptr);
19029
19030 /**
19031  * Calls the free function if one is set
19032  */
19033 void EventHandler_free(struct LDKEventHandler this_ptr);
19034
19035 /**
19036  * Frees any resources used by the APIError
19037  */
19038 void APIError_free(struct LDKAPIError this_ptr);
19039
19040 /**
19041  * Creates a copy of the APIError
19042  */
19043 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
19044
19045 /**
19046  * Utility method to constructs a new APIMisuseError-variant APIError
19047  */
19048 struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
19049
19050 /**
19051  * Utility method to constructs a new FeeRateTooHigh-variant APIError
19052  */
19053 struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
19054
19055 /**
19056  * Utility method to constructs a new RouteError-variant APIError
19057  */
19058 struct LDKAPIError APIError_route_error(struct LDKStr err);
19059
19060 /**
19061  * Utility method to constructs a new ChannelUnavailable-variant APIError
19062  */
19063 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
19064
19065 /**
19066  * Utility method to constructs a new MonitorUpdateInProgress-variant APIError
19067  */
19068 struct LDKAPIError APIError_monitor_update_in_progress(void);
19069
19070 /**
19071  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
19072  */
19073 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
19074
19075 /**
19076  * Checks if two APIErrors contain equal inner contents.
19077  * This ignores pointers and is_owned flags and looks at the values in fields.
19078  */
19079 bool APIError_eq(const struct LDKAPIError *NONNULL_PTR a, const struct LDKAPIError *NONNULL_PTR b);
19080
19081 /**
19082  * Frees any resources used by the BigSize, if is_owned is set and inner is non-NULL.
19083  */
19084 void BigSize_free(struct LDKBigSize this_obj);
19085
19086 uint64_t BigSize_get_a(const struct LDKBigSize *NONNULL_PTR this_ptr);
19087
19088 void BigSize_set_a(struct LDKBigSize *NONNULL_PTR this_ptr, uint64_t val);
19089
19090 /**
19091  * Constructs a new BigSize given each field
19092  */
19093 MUST_USE_RES struct LDKBigSize BigSize_new(uint64_t a_arg);
19094
19095 /**
19096  * Frees any resources used by the Hostname, if is_owned is set and inner is non-NULL.
19097  */
19098 void Hostname_free(struct LDKHostname this_obj);
19099
19100 /**
19101  * Creates a copy of the Hostname
19102  */
19103 struct LDKHostname Hostname_clone(const struct LDKHostname *NONNULL_PTR orig);
19104
19105 /**
19106  * Checks if two Hostnames contain equal inner contents.
19107  * This ignores pointers and is_owned flags and looks at the values in fields.
19108  * Two objects with NULL inner values will be considered "equal" here.
19109  */
19110 bool Hostname_eq(const struct LDKHostname *NONNULL_PTR a, const struct LDKHostname *NONNULL_PTR b);
19111
19112 /**
19113  * Returns the length of the hostname.
19114  */
19115 MUST_USE_RES uint8_t Hostname_len(const struct LDKHostname *NONNULL_PTR this_arg);
19116
19117 /**
19118  * Creates a digital signature of a message given a SecretKey, like the node's secret.
19119  * 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.
19120  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
19121  */
19122 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
19123
19124 /**
19125  * Recovers the PublicKey of the signer of the message given the message and the signature.
19126  */
19127 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
19128
19129 /**
19130  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
19131  * and the PublicKey.
19132  */
19133 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
19134
19135 /**
19136  * Construct the invoice's HRP and signatureless data into a preimage to be hashed.
19137  */
19138 struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z data_without_signature);
19139
19140 /**
19141  * Calls the free function if one is set
19142  */
19143 void Persister_free(struct LDKPersister this_ptr);
19144
19145 /**
19146  * Calls the free function if one is set
19147  */
19148 void FutureCallback_free(struct LDKFutureCallback this_ptr);
19149
19150 /**
19151  * Frees any resources used by the Future, if is_owned is set and inner is non-NULL.
19152  */
19153 void Future_free(struct LDKFuture this_obj);
19154
19155 /**
19156  * Registers a callback to be called upon completion of this future. If the future has already
19157  * completed, the callback will be called immediately.
19158  */
19159 void Future_register_callback_fn(const struct LDKFuture *NONNULL_PTR this_arg, struct LDKFutureCallback callback);
19160
19161 /**
19162  * Creates a copy of the Level
19163  */
19164 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
19165
19166 /**
19167  * Utility method to constructs a new Gossip-variant Level
19168  */
19169 enum LDKLevel Level_gossip(void);
19170
19171 /**
19172  * Utility method to constructs a new Trace-variant Level
19173  */
19174 enum LDKLevel Level_trace(void);
19175
19176 /**
19177  * Utility method to constructs a new Debug-variant Level
19178  */
19179 enum LDKLevel Level_debug(void);
19180
19181 /**
19182  * Utility method to constructs a new Info-variant Level
19183  */
19184 enum LDKLevel Level_info(void);
19185
19186 /**
19187  * Utility method to constructs a new Warn-variant Level
19188  */
19189 enum LDKLevel Level_warn(void);
19190
19191 /**
19192  * Utility method to constructs a new Error-variant Level
19193  */
19194 enum LDKLevel Level_error(void);
19195
19196 /**
19197  * Checks if two Levels contain equal inner contents.
19198  * This ignores pointers and is_owned flags and looks at the values in fields.
19199  */
19200 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
19201
19202 /**
19203  * Checks if two Levels contain equal inner contents.
19204  */
19205 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
19206
19207 /**
19208  * Returns the most verbose logging level.
19209  */
19210 MUST_USE_RES enum LDKLevel Level_max(void);
19211
19212 /**
19213  * Frees any resources used by the Record, if is_owned is set and inner is non-NULL.
19214  */
19215 void Record_free(struct LDKRecord this_obj);
19216
19217 /**
19218  * The verbosity level of the message.
19219  */
19220 enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr);
19221
19222 /**
19223  * The verbosity level of the message.
19224  */
19225 void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val);
19226
19227 /**
19228  * The message body.
19229  */
19230 struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr);
19231
19232 /**
19233  * The message body.
19234  */
19235 void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
19236
19237 /**
19238  * The module path of the message.
19239  */
19240 struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr);
19241
19242 /**
19243  * The module path of the message.
19244  */
19245 void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
19246
19247 /**
19248  * The source file containing the message.
19249  */
19250 struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr);
19251
19252 /**
19253  * The source file containing the message.
19254  */
19255 void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
19256
19257 /**
19258  * The line containing the message.
19259  */
19260 uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr);
19261
19262 /**
19263  * The line containing the message.
19264  */
19265 void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val);
19266
19267 /**
19268  * Creates a copy of the Record
19269  */
19270 struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig);
19271
19272 /**
19273  * Calls the free function if one is set
19274  */
19275 void Logger_free(struct LDKLogger this_ptr);
19276
19277 /**
19278  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
19279  */
19280 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
19281
19282 /**
19283  * Confirmations we will wait for before considering the channel locked in.
19284  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
19285  * equivalent limit applied to outbound channels).
19286  *
19287  * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
19288  * transaction before operation. If you wish to accept channels with zero confirmations, see
19289  * [`UserConfig::manually_accept_inbound_channels`] and
19290  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
19291  *
19292  * Default value: 6.
19293  *
19294  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
19295  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
19296  */
19297 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
19298
19299 /**
19300  * Confirmations we will wait for before considering the channel locked in.
19301  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
19302  * equivalent limit applied to outbound channels).
19303  *
19304  * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
19305  * transaction before operation. If you wish to accept channels with zero confirmations, see
19306  * [`UserConfig::manually_accept_inbound_channels`] and
19307  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
19308  *
19309  * Default value: 6.
19310  *
19311  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
19312  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
19313  */
19314 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
19315
19316 /**
19317  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
19318  * the number of blocks we have to punish our counterparty if they broadcast a revoked
19319  * transaction).
19320  *
19321  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
19322  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
19323  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
19324  * possibly with time in between to RBF the spending transaction).
19325  *
19326  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
19327  * case of an honest unilateral channel close, which implicitly decrease the economic value of
19328  * our channel.
19329  *
19330  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
19331  * can tweak config to ask for more security, not less.
19332  */
19333 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
19334
19335 /**
19336  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
19337  * the number of blocks we have to punish our counterparty if they broadcast a revoked
19338  * transaction).
19339  *
19340  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
19341  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
19342  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
19343  * possibly with time in between to RBF the spending transaction).
19344  *
19345  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
19346  * case of an honest unilateral channel close, which implicitly decrease the economic value of
19347  * our channel.
19348  *
19349  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
19350  * can tweak config to ask for more security, not less.
19351  */
19352 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
19353
19354 /**
19355  * Set to the smallest value HTLC we will accept to process.
19356  *
19357  * This value is sent to our counterparty on channel-open and we close the channel any time
19358  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
19359  *
19360  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
19361  * by the protocol.
19362  */
19363 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
19364
19365 /**
19366  * Set to the smallest value HTLC we will accept to process.
19367  *
19368  * This value is sent to our counterparty on channel-open and we close the channel any time
19369  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
19370  *
19371  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
19372  * by the protocol.
19373  */
19374 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
19375
19376 /**
19377  * Sets the percentage of the channel value we will cap the total value of outstanding inbound
19378  * HTLCs to.
19379  *
19380  * This can be set to a value between 1-100, where the value corresponds to the percent of the
19381  * channel value in whole percentages.
19382  *
19383  * Note that:
19384  * * If configured to another value than the default value 10, any new channels created with
19385  * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
19386  * `ChannelManager`.
19387  *
19388  * * This caps the total value for inbound HTLCs in-flight only, and there's currently
19389  * no way to configure the cap for the total value of outbound HTLCs in-flight.
19390  *
19391  * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
19392  * are different from the non-HTLC-encumbered funds. This makes this an important knob to
19393  * restrict exposure to loss due to being offline for too long.
19394  * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
19395  * for more information.
19396  *
19397  * Default value: 10.
19398  * Minimum value: 1, any values less than 1 will be treated as 1 instead.
19399  * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
19400  */
19401 uint8_t ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
19402
19403 /**
19404  * Sets the percentage of the channel value we will cap the total value of outstanding inbound
19405  * HTLCs to.
19406  *
19407  * This can be set to a value between 1-100, where the value corresponds to the percent of the
19408  * channel value in whole percentages.
19409  *
19410  * Note that:
19411  * * If configured to another value than the default value 10, any new channels created with
19412  * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
19413  * `ChannelManager`.
19414  *
19415  * * This caps the total value for inbound HTLCs in-flight only, and there's currently
19416  * no way to configure the cap for the total value of outbound HTLCs in-flight.
19417  *
19418  * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
19419  * are different from the non-HTLC-encumbered funds. This makes this an important knob to
19420  * restrict exposure to loss due to being offline for too long.
19421  * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
19422  * for more information.
19423  *
19424  * Default value: 10.
19425  * Minimum value: 1, any values less than 1 will be treated as 1 instead.
19426  * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
19427  */
19428 void ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint8_t val);
19429
19430 /**
19431  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
19432  * BOLTs) option for outbound private channels. This provides better privacy by not including
19433  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
19434  * relay HTLCs to us using the channel's SCID alias.
19435  *
19436  * If this option is set, channels may be created that will not be readable by LDK versions
19437  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
19438  * [`DecodeError::InvalidValue`].
19439  *
19440  * Note that setting this to true does *not* prevent us from opening channels with
19441  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
19442  * private channel without that option.
19443  *
19444  * Ignored if the channel is negotiated to be announced, see
19445  * [`ChannelHandshakeConfig::announced_channel`] and
19446  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
19447  *
19448  * Default value: false. This value is likely to change to true in the future.
19449  *
19450  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
19451  * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
19452  */
19453 bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
19454
19455 /**
19456  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
19457  * BOLTs) option for outbound private channels. This provides better privacy by not including
19458  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
19459  * relay HTLCs to us using the channel's SCID alias.
19460  *
19461  * If this option is set, channels may be created that will not be readable by LDK versions
19462  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
19463  * [`DecodeError::InvalidValue`].
19464  *
19465  * Note that setting this to true does *not* prevent us from opening channels with
19466  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
19467  * private channel without that option.
19468  *
19469  * Ignored if the channel is negotiated to be announced, see
19470  * [`ChannelHandshakeConfig::announced_channel`] and
19471  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
19472  *
19473  * Default value: false. This value is likely to change to true in the future.
19474  *
19475  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
19476  * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
19477  */
19478 void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
19479
19480 /**
19481  * Set to announce the channel publicly and notify all nodes that they can route via this
19482  * channel.
19483  *
19484  * This should only be set to true for nodes which expect to be online reliably.
19485  *
19486  * As the node which funds a channel picks this value this will only apply for new outbound
19487  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
19488  *
19489  * Default value: false.
19490  */
19491 bool ChannelHandshakeConfig_get_announced_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
19492
19493 /**
19494  * Set to announce the channel publicly and notify all nodes that they can route via this
19495  * channel.
19496  *
19497  * This should only be set to true for nodes which expect to be online reliably.
19498  *
19499  * As the node which funds a channel picks this value this will only apply for new outbound
19500  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
19501  *
19502  * Default value: false.
19503  */
19504 void ChannelHandshakeConfig_set_announced_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
19505
19506 /**
19507  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
19508  * supports it, they will then enforce the mutual-close output to us matches what we provided
19509  * at intialization, preventing us from closing to an alternate pubkey.
19510  *
19511  * This is set to true by default to provide a slight increase in security, though ultimately
19512  * any attacker who is able to take control of a channel can just as easily send the funds via
19513  * lightning payments, so we never require that our counterparties support this option.
19514  *
19515  * The upfront key committed is provided from [`KeysInterface::get_shutdown_scriptpubkey`].
19516  *
19517  * Default value: true.
19518  *
19519  * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
19520  */
19521 bool ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
19522
19523 /**
19524  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
19525  * supports it, they will then enforce the mutual-close output to us matches what we provided
19526  * at intialization, preventing us from closing to an alternate pubkey.
19527  *
19528  * This is set to true by default to provide a slight increase in security, though ultimately
19529  * any attacker who is able to take control of a channel can just as easily send the funds via
19530  * lightning payments, so we never require that our counterparties support this option.
19531  *
19532  * The upfront key committed is provided from [`KeysInterface::get_shutdown_scriptpubkey`].
19533  *
19534  * Default value: true.
19535  *
19536  * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
19537  */
19538 void ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
19539
19540 /**
19541  * The Proportion of the channel value to configure as counterparty's channel reserve,
19542  * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels.
19543  *
19544  * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain
19545  * on their side, at all times.
19546  * This ensures that if our counterparty broadcasts a revoked state, we can punish them by
19547  * claiming at least this value on chain.
19548  *
19549  * Channel reserve values greater than 30% could be considered highly unreasonable, since that
19550  * amount can never be used for payments.
19551  * Also, if our selected channel reserve for counterparty and counterparty's selected
19552  * channel reserve for us sum up to equal or greater than channel value, channel negotiations
19553  * will fail.
19554  *
19555  * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve
19556  * other than the default value.
19557  *
19558  * Default value: 1% of channel value, i.e., configured as 10,000 millionths.
19559  * Minimum value: If the calculated proportional value is less than 1000 sats, it will be treated
19560  *                as 1000 sats instead, which is a safe implementation-specific lower bound.
19561  * Maximum value: 1,000,000, any values larger than 1 Million will be treated as 1 Million (or 100%)
19562  *                instead, although channel negotiations will fail in that case.
19563  */
19564 uint32_t ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
19565
19566 /**
19567  * The Proportion of the channel value to configure as counterparty's channel reserve,
19568  * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels.
19569  *
19570  * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain
19571  * on their side, at all times.
19572  * This ensures that if our counterparty broadcasts a revoked state, we can punish them by
19573  * claiming at least this value on chain.
19574  *
19575  * Channel reserve values greater than 30% could be considered highly unreasonable, since that
19576  * amount can never be used for payments.
19577  * Also, if our selected channel reserve for counterparty and counterparty's selected
19578  * channel reserve for us sum up to equal or greater than channel value, channel negotiations
19579  * will fail.
19580  *
19581  * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve
19582  * other than the default value.
19583  *
19584  * Default value: 1% of channel value, i.e., configured as 10,000 millionths.
19585  * Minimum value: If the calculated proportional value is less than 1000 sats, it will be treated
19586  *                as 1000 sats instead, which is a safe implementation-specific lower bound.
19587  * Maximum value: 1,000,000, any values larger than 1 Million will be treated as 1 Million (or 100%)
19588  *                instead, although channel negotiations will fail in that case.
19589  */
19590 void ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
19591
19592 /**
19593  * Constructs a new ChannelHandshakeConfig given each field
19594  */
19595 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, uint8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, bool negotiate_scid_privacy_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg, uint32_t their_channel_reserve_proportional_millionths_arg);
19596
19597 /**
19598  * Creates a copy of the ChannelHandshakeConfig
19599  */
19600 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
19601
19602 /**
19603  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
19604  */
19605 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
19606
19607 /**
19608  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
19609  */
19610 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
19611
19612 /**
19613  * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
19614  * only applies to inbound channels.
19615  *
19616  * Default value: 0.
19617  */
19618 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
19619
19620 /**
19621  * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
19622  * only applies to inbound channels.
19623  *
19624  * Default value: 0.
19625  */
19626 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
19627
19628 /**
19629  * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
19630  * only applies to inbound channels.
19631  *
19632  * Default value: 2^24 - 1.
19633  */
19634 uint64_t ChannelHandshakeLimits_get_max_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
19635
19636 /**
19637  * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
19638  * only applies to inbound channels.
19639  *
19640  * Default value: 2^24 - 1.
19641  */
19642 void ChannelHandshakeLimits_set_max_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
19643
19644 /**
19645  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
19646  * you to limit the maximum minimum-size they can require.
19647  *
19648  * Default value: u64::max_value.
19649  */
19650 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
19651
19652 /**
19653  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
19654  * you to limit the maximum minimum-size they can require.
19655  *
19656  * Default value: u64::max_value.
19657  */
19658 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
19659
19660 /**
19661  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
19662  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
19663  *
19664  * Default value: 0.
19665  */
19666 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
19667
19668 /**
19669  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
19670  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
19671  *
19672  * Default value: 0.
19673  */
19674 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
19675
19676 /**
19677  * The remote node will require we keep a certain amount in direct payment to ourselves at all
19678  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
19679  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
19680  *
19681  * Default value: u64::max_value.
19682  */
19683 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
19684
19685 /**
19686  * The remote node will require we keep a certain amount in direct payment to ourselves at all
19687  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
19688  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
19689  *
19690  * Default value: u64::max_value.
19691  */
19692 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
19693
19694 /**
19695  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
19696  * time. This allows you to set a minimum such value.
19697  *
19698  * Default value: 0.
19699  */
19700 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
19701
19702 /**
19703  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
19704  * time. This allows you to set a minimum such value.
19705  *
19706  * Default value: 0.
19707  */
19708 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
19709
19710 /**
19711  * Before a channel is usable the funding transaction will need to be confirmed by at least a
19712  * certain number of blocks, specified by the node which is not the funder (as the funder can
19713  * assume they aren't going to double-spend themselves).
19714  * This config allows you to set a limit on the maximum amount of time to wait.
19715  *
19716  * Default value: 144, or roughly one day and only applies to outbound channels.
19717  */
19718 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
19719
19720 /**
19721  * Before a channel is usable the funding transaction will need to be confirmed by at least a
19722  * certain number of blocks, specified by the node which is not the funder (as the funder can
19723  * assume they aren't going to double-spend themselves).
19724  * This config allows you to set a limit on the maximum amount of time to wait.
19725  *
19726  * Default value: 144, or roughly one day and only applies to outbound channels.
19727  */
19728 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
19729
19730 /**
19731  * Whether we implicitly trust funding transactions generated by us for our own outbound
19732  * channels to not be double-spent.
19733  *
19734  * If this is set, we assume that our own funding transactions are *never* double-spent, and
19735  * thus we can trust them without any confirmations. This is generally a reasonable
19736  * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
19737  * control of the signing keys).
19738  *
19739  * You may wish to un-set this if you allow the user to (or do in an automated fashion)
19740  * double-spend the funding transaction to RBF with an alternative channel open.
19741  *
19742  * This only applies if our counterparty set their confirmations-required value to 0, and we
19743  * always trust our own funding transaction at 1 confirmation irrespective of this value.
19744  * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
19745  * `true` (0) and `false` (1).
19746  *
19747  * Default value: true
19748  */
19749 bool ChannelHandshakeLimits_get_trust_own_funding_0conf(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
19750
19751 /**
19752  * Whether we implicitly trust funding transactions generated by us for our own outbound
19753  * channels to not be double-spent.
19754  *
19755  * If this is set, we assume that our own funding transactions are *never* double-spent, and
19756  * thus we can trust them without any confirmations. This is generally a reasonable
19757  * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
19758  * control of the signing keys).
19759  *
19760  * You may wish to un-set this if you allow the user to (or do in an automated fashion)
19761  * double-spend the funding transaction to RBF with an alternative channel open.
19762  *
19763  * This only applies if our counterparty set their confirmations-required value to 0, and we
19764  * always trust our own funding transaction at 1 confirmation irrespective of this value.
19765  * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
19766  * `true` (0) and `false` (1).
19767  *
19768  * Default value: true
19769  */
19770 void ChannelHandshakeLimits_set_trust_own_funding_0conf(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
19771
19772 /**
19773  * Set to force an incoming channel to match our announced channel preference in
19774  * [`ChannelHandshakeConfig::announced_channel`].
19775  *
19776  * For a node which is not online reliably, this should be set to true and
19777  * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public)
19778  * channels will ever be opened.
19779  *
19780  * Default value: true.
19781  */
19782 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
19783
19784 /**
19785  * Set to force an incoming channel to match our announced channel preference in
19786  * [`ChannelHandshakeConfig::announced_channel`].
19787  *
19788  * For a node which is not online reliably, this should be set to true and
19789  * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public)
19790  * channels will ever be opened.
19791  *
19792  * Default value: true.
19793  */
19794 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
19795
19796 /**
19797  * Set to the amount of time we're willing to wait to claim money back to us.
19798  *
19799  * Not checking this value would be a security issue, as our peer would be able to set it to
19800  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
19801  *
19802  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
19803  * reduce the loss of having useless locked funds (if your peer accepts)
19804  */
19805 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
19806
19807 /**
19808  * Set to the amount of time we're willing to wait to claim money back to us.
19809  *
19810  * Not checking this value would be a security issue, as our peer would be able to set it to
19811  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
19812  *
19813  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
19814  * reduce the loss of having useless locked funds (if your peer accepts)
19815  */
19816 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
19817
19818 /**
19819  * Constructs a new ChannelHandshakeLimits given each field
19820  */
19821 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_funding_satoshis_arg, uint64_t max_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 trust_own_funding_0conf_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg);
19822
19823 /**
19824  * Creates a copy of the ChannelHandshakeLimits
19825  */
19826 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
19827
19828 /**
19829  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
19830  */
19831 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
19832
19833 /**
19834  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
19835  */
19836 void ChannelConfig_free(struct LDKChannelConfig this_obj);
19837
19838 /**
19839  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
19840  * over the channel.
19841  * This may be allowed to change at runtime in a later update, however doing so must result in
19842  * update messages sent to notify all nodes of our updated relay fee.
19843  *
19844  * Default value: 0.
19845  */
19846 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
19847
19848 /**
19849  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
19850  * over the channel.
19851  * This may be allowed to change at runtime in a later update, however doing so must result in
19852  * update messages sent to notify all nodes of our updated relay fee.
19853  *
19854  * Default value: 0.
19855  */
19856 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
19857
19858 /**
19859  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
19860  * excess of [`forwarding_fee_proportional_millionths`].
19861  * This may be allowed to change at runtime in a later update, however doing so must result in
19862  * update messages sent to notify all nodes of our updated relay fee.
19863  *
19864  * The default value of a single satoshi roughly matches the market rate on many routing nodes
19865  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
19866  * this node.
19867  *
19868  * Default value: 1000.
19869  *
19870  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
19871  */
19872 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
19873
19874 /**
19875  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
19876  * excess of [`forwarding_fee_proportional_millionths`].
19877  * This may be allowed to change at runtime in a later update, however doing so must result in
19878  * update messages sent to notify all nodes of our updated relay fee.
19879  *
19880  * The default value of a single satoshi roughly matches the market rate on many routing nodes
19881  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
19882  * this node.
19883  *
19884  * Default value: 1000.
19885  *
19886  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
19887  */
19888 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
19889
19890 /**
19891  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
19892  * the channel this config applies to.
19893  *
19894  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
19895  * HTLC balance when a channel appears on-chain whereas
19896  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
19897  * (non-HTLC-encumbered) balance.
19898  *
19899  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
19900  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
19901  * commitment transaction at least once per this many blocks (minus some margin to allow us
19902  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
19903  * the spending transaction).
19904  *
19905  * Default value: 72 (12 hours at an average of 6 blocks/hour).
19906  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
19907  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
19908  *
19909  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
19910  */
19911 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
19912
19913 /**
19914  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
19915  * the channel this config applies to.
19916  *
19917  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
19918  * HTLC balance when a channel appears on-chain whereas
19919  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
19920  * (non-HTLC-encumbered) balance.
19921  *
19922  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
19923  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
19924  * commitment transaction at least once per this many blocks (minus some margin to allow us
19925  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
19926  * the spending transaction).
19927  *
19928  * Default value: 72 (12 hours at an average of 6 blocks/hour).
19929  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
19930  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
19931  *
19932  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
19933  */
19934 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
19935
19936 /**
19937  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
19938  * small to claim on-chain.
19939  *
19940  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
19941  * not be claimable on-chain, instead being turned into additional miner fees if either
19942  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
19943  * to such payments may be sustantial if there are many dust HTLCs present when the
19944  * channel is force-closed.
19945  *
19946  * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a
19947  * channel negotiated throughout the channel open process, along with the fees required to have
19948  * a broadcastable HTLC spending transaction. When a channel supports anchor outputs
19949  * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into
19950  * account the HTLC transaction fee as it is zero.
19951  *
19952  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
19953  * exposure across all three types per-channel. Setting this too low may prevent the
19954  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
19955  * important to prevent stealing of dust HTLCs by miners.
19956  *
19957  * Default value: 5_000_000 msat.
19958  */
19959 uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
19960
19961 /**
19962  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
19963  * small to claim on-chain.
19964  *
19965  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
19966  * not be claimable on-chain, instead being turned into additional miner fees if either
19967  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
19968  * to such payments may be sustantial if there are many dust HTLCs present when the
19969  * channel is force-closed.
19970  *
19971  * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a
19972  * channel negotiated throughout the channel open process, along with the fees required to have
19973  * a broadcastable HTLC spending transaction. When a channel supports anchor outputs
19974  * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into
19975  * account the HTLC transaction fee as it is zero.
19976  *
19977  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
19978  * exposure across all three types per-channel. Setting this too low may prevent the
19979  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
19980  * important to prevent stealing of dust HTLCs by miners.
19981  *
19982  * Default value: 5_000_000 msat.
19983  */
19984 void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
19985
19986 /**
19987  * The additional fee we're willing to pay to avoid waiting for the counterparty's
19988  * `to_self_delay` to reclaim funds.
19989  *
19990  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
19991  * closing transaction which both sides find acceptable, ultimately paid by the channel
19992  * funder/initiator.
19993  *
19994  * When we are the funder, because we have to pay the channel closing fee, we bound the
19995  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
19996  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
19997  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
19998  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
19999  * funds.
20000  *
20001  * When we are not the funder, we require the closing transaction fee pay at least our
20002  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
20003  * Thus, this value is ignored when we are not the funder.
20004  *
20005  * Default value: 1000 satoshis.
20006  *
20007  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
20008  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
20009  */
20010 uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
20011
20012 /**
20013  * The additional fee we're willing to pay to avoid waiting for the counterparty's
20014  * `to_self_delay` to reclaim funds.
20015  *
20016  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
20017  * closing transaction which both sides find acceptable, ultimately paid by the channel
20018  * funder/initiator.
20019  *
20020  * When we are the funder, because we have to pay the channel closing fee, we bound the
20021  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
20022  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
20023  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
20024  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
20025  * funds.
20026  *
20027  * When we are not the funder, we require the closing transaction fee pay at least our
20028  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
20029  * Thus, this value is ignored when we are not the funder.
20030  *
20031  * Default value: 1000 satoshis.
20032  *
20033  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
20034  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
20035  */
20036 void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
20037
20038 /**
20039  * Constructs a new ChannelConfig given each field
20040  */
20041 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, uint64_t max_dust_htlc_exposure_msat_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg);
20042
20043 /**
20044  * Creates a copy of the ChannelConfig
20045  */
20046 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
20047
20048 /**
20049  * Checks if two ChannelConfigs contain equal inner contents.
20050  * This ignores pointers and is_owned flags and looks at the values in fields.
20051  * Two objects with NULL inner values will be considered "equal" here.
20052  */
20053 bool ChannelConfig_eq(const struct LDKChannelConfig *NONNULL_PTR a, const struct LDKChannelConfig *NONNULL_PTR b);
20054
20055 /**
20056  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
20057  */
20058 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
20059
20060 /**
20061  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
20062  */
20063 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
20064
20065 /**
20066  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
20067  */
20068 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
20069
20070 /**
20071  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
20072  */
20073 void UserConfig_free(struct LDKUserConfig this_obj);
20074
20075 /**
20076  * Channel handshake config that we propose to our counterparty.
20077  */
20078 struct LDKChannelHandshakeConfig UserConfig_get_channel_handshake_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
20079
20080 /**
20081  * Channel handshake config that we propose to our counterparty.
20082  */
20083 void UserConfig_set_channel_handshake_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
20084
20085 /**
20086  * Limits applied to our counterparty's proposed channel handshake config settings.
20087  */
20088 struct LDKChannelHandshakeLimits UserConfig_get_channel_handshake_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
20089
20090 /**
20091  * Limits applied to our counterparty's proposed channel handshake config settings.
20092  */
20093 void UserConfig_set_channel_handshake_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
20094
20095 /**
20096  * Channel config which affects behavior during channel lifetime.
20097  */
20098 struct LDKChannelConfig UserConfig_get_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
20099
20100 /**
20101  * Channel config which affects behavior during channel lifetime.
20102  */
20103 void UserConfig_set_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
20104
20105 /**
20106  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
20107  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
20108  * node which is not online reliably.
20109  *
20110  * For nodes which are not online reliably, you should set all channels to *not* be announced
20111  * (using [`ChannelHandshakeConfig::announced_channel`] and
20112  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
20113  * ensure you are not exposed to any forwarding risk.
20114  *
20115  * Note that because you cannot change a channel's announced state after creation, there is no
20116  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
20117  * from a publicly-announced forwarding node to a private non-forwarding node you must close
20118  * all your channels and open new ones. For privacy, you should also change your node_id
20119  * (swapping all private and public key material for new ones) at that time.
20120  *
20121  * Default value: false.
20122  */
20123 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
20124
20125 /**
20126  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
20127  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
20128  * node which is not online reliably.
20129  *
20130  * For nodes which are not online reliably, you should set all channels to *not* be announced
20131  * (using [`ChannelHandshakeConfig::announced_channel`] and
20132  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
20133  * ensure you are not exposed to any forwarding risk.
20134  *
20135  * Note that because you cannot change a channel's announced state after creation, there is no
20136  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
20137  * from a publicly-announced forwarding node to a private non-forwarding node you must close
20138  * all your channels and open new ones. For privacy, you should also change your node_id
20139  * (swapping all private and public key material for new ones) at that time.
20140  *
20141  * Default value: false.
20142  */
20143 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
20144
20145 /**
20146  * If this is set to false, we do not accept inbound requests to open a new channel.
20147  * Default value: true.
20148  */
20149 bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
20150
20151 /**
20152  * If this is set to false, we do not accept inbound requests to open a new channel.
20153  * Default value: true.
20154  */
20155 void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
20156
20157 /**
20158  * If this is set to true, the user needs to manually accept inbound requests to open a new
20159  * channel.
20160  *
20161  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
20162  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
20163  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
20164  * user explicitly chooses to accept the request.
20165  *
20166  * Default value: false.
20167  *
20168  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
20169  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
20170  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
20171  */
20172 bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
20173
20174 /**
20175  * If this is set to true, the user needs to manually accept inbound requests to open a new
20176  * channel.
20177  *
20178  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
20179  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
20180  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
20181  * user explicitly chooses to accept the request.
20182  *
20183  * Default value: false.
20184  *
20185  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
20186  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
20187  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
20188  */
20189 void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
20190
20191 /**
20192  * Constructs a new UserConfig given each field
20193  */
20194 MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig channel_handshake_config_arg, struct LDKChannelHandshakeLimits channel_handshake_limits_arg, struct LDKChannelConfig channel_config_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg, bool manually_accept_inbound_channels_arg);
20195
20196 /**
20197  * Creates a copy of the UserConfig
20198  */
20199 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
20200
20201 /**
20202  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
20203  */
20204 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
20205
20206 /**
20207  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
20208  */
20209 void BestBlock_free(struct LDKBestBlock this_obj);
20210
20211 /**
20212  * Creates a copy of the BestBlock
20213  */
20214 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
20215
20216 /**
20217  * Checks if two BestBlocks contain equal inner contents.
20218  * This ignores pointers and is_owned flags and looks at the values in fields.
20219  * Two objects with NULL inner values will be considered "equal" here.
20220  */
20221 bool BestBlock_eq(const struct LDKBestBlock *NONNULL_PTR a, const struct LDKBestBlock *NONNULL_PTR b);
20222
20223 /**
20224  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
20225  * network.
20226  */
20227 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
20228
20229 /**
20230  * Returns a `BestBlock` as identified by the given block hash and height.
20231  */
20232 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
20233
20234 /**
20235  * Returns the best block hash.
20236  */
20237 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
20238
20239 /**
20240  * Returns the best block height.
20241  */
20242 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
20243
20244 /**
20245  * Creates a copy of the AccessError
20246  */
20247 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
20248
20249 /**
20250  * Utility method to constructs a new UnknownChain-variant AccessError
20251  */
20252 enum LDKAccessError AccessError_unknown_chain(void);
20253
20254 /**
20255  * Utility method to constructs a new UnknownTx-variant AccessError
20256  */
20257 enum LDKAccessError AccessError_unknown_tx(void);
20258
20259 /**
20260  * Calls the free function if one is set
20261  */
20262 void Access_free(struct LDKAccess this_ptr);
20263
20264 /**
20265  * Calls the free function if one is set
20266  */
20267 void Listen_free(struct LDKListen this_ptr);
20268
20269 /**
20270  * Calls the free function if one is set
20271  */
20272 void Confirm_free(struct LDKConfirm this_ptr);
20273
20274 /**
20275  * Creates a copy of the ChannelMonitorUpdateStatus
20276  */
20277 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_clone(const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR orig);
20278
20279 /**
20280  * Utility method to constructs a new Completed-variant ChannelMonitorUpdateStatus
20281  */
20282 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_completed(void);
20283
20284 /**
20285  * Utility method to constructs a new InProgress-variant ChannelMonitorUpdateStatus
20286  */
20287 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_in_progress(void);
20288
20289 /**
20290  * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateStatus
20291  */
20292 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_permanent_failure(void);
20293
20294 /**
20295  * Checks if two ChannelMonitorUpdateStatuss contain equal inner contents.
20296  * This ignores pointers and is_owned flags and looks at the values in fields.
20297  */
20298 bool ChannelMonitorUpdateStatus_eq(const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR a, const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR b);
20299
20300 /**
20301  * Calls the free function if one is set
20302  */
20303 void Watch_free(struct LDKWatch this_ptr);
20304
20305 /**
20306  * Calls the free function if one is set
20307  */
20308 void Filter_free(struct LDKFilter this_ptr);
20309
20310 /**
20311  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
20312  */
20313 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
20314
20315 /**
20316  * First block where the transaction output may have been spent.
20317  *
20318  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20319  */
20320 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
20321
20322 /**
20323  * First block where the transaction output may have been spent.
20324  *
20325  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20326  */
20327 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20328
20329 /**
20330  * Outpoint identifying the transaction output.
20331  */
20332 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
20333
20334 /**
20335  * Outpoint identifying the transaction output.
20336  */
20337 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
20338
20339 /**
20340  * Spending condition of the transaction output.
20341  */
20342 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
20343
20344 /**
20345  * Spending condition of the transaction output.
20346  */
20347 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
20348
20349 /**
20350  * Constructs a new WatchedOutput given each field
20351  */
20352 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
20353
20354 /**
20355  * Creates a copy of the WatchedOutput
20356  */
20357 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
20358
20359 /**
20360  * Checks if two WatchedOutputs contain equal inner contents.
20361  * This ignores pointers and is_owned flags and looks at the values in fields.
20362  * Two objects with NULL inner values will be considered "equal" here.
20363  */
20364 bool WatchedOutput_eq(const struct LDKWatchedOutput *NONNULL_PTR a, const struct LDKWatchedOutput *NONNULL_PTR b);
20365
20366 /**
20367  * Checks if two WatchedOutputs contain equal inner contents.
20368  */
20369 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
20370
20371 /**
20372  * Calls the free function if one is set
20373  */
20374 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
20375
20376 /**
20377  * Creates a copy of the ConfirmationTarget
20378  */
20379 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
20380
20381 /**
20382  * Utility method to constructs a new Background-variant ConfirmationTarget
20383  */
20384 enum LDKConfirmationTarget ConfirmationTarget_background(void);
20385
20386 /**
20387  * Utility method to constructs a new Normal-variant ConfirmationTarget
20388  */
20389 enum LDKConfirmationTarget ConfirmationTarget_normal(void);
20390
20391 /**
20392  * Utility method to constructs a new HighPriority-variant ConfirmationTarget
20393  */
20394 enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
20395
20396 /**
20397  * Checks if two ConfirmationTargets contain equal inner contents.
20398  * This ignores pointers and is_owned flags and looks at the values in fields.
20399  */
20400 bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
20401
20402 /**
20403  * Calls the free function if one is set
20404  */
20405 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
20406
20407 /**
20408  * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
20409  */
20410 void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj);
20411
20412 /**
20413  * Creates a copy of the MonitorUpdateId
20414  */
20415 struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
20416
20417 /**
20418  * Checks if two MonitorUpdateIds contain equal inner contents.
20419  */
20420 uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
20421
20422 /**
20423  * Checks if two MonitorUpdateIds contain equal inner contents.
20424  * This ignores pointers and is_owned flags and looks at the values in fields.
20425  * Two objects with NULL inner values will be considered "equal" here.
20426  */
20427 bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b);
20428
20429 /**
20430  * Calls the free function if one is set
20431  */
20432 void Persist_free(struct LDKPersist this_ptr);
20433
20434 /**
20435  * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL.
20436  */
20437 void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj);
20438
20439 /**
20440  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
20441  */
20442 void ChainMonitor_free(struct LDKChainMonitor this_obj);
20443
20444 /**
20445  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
20446  *
20447  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
20448  * will call back to it indicating transactions and outputs of interest. This allows clients to
20449  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
20450  * always need to fetch full blocks absent another means for determining which blocks contain
20451  * transactions relevant to the watched channels.
20452  */
20453 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
20454
20455 /**
20456  * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
20457  * claims which are awaiting confirmation.
20458  *
20459  * Includes the balances from each [`ChannelMonitor`] *except* those included in
20460  * `ignored_channels`, allowing you to filter out balances from channels which are still open
20461  * (and whose balance should likely be pulled from the [`ChannelDetails`]).
20462  *
20463  * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
20464  * inclusion in the return value.
20465  */
20466 MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
20467
20468 /**
20469  * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no
20470  * such [`ChannelMonitor`] is currently being monitored for.
20471  *
20472  * Note that the result holds a mutex over our monitor set, and should not be held
20473  * indefinitely.
20474  */
20475 MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo);
20476
20477 /**
20478  * Lists the funding outpoint of each [`ChannelMonitor`] being monitored.
20479  *
20480  * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always
20481  * monitoring for on-chain state resolutions.
20482  */
20483 MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
20484
20485 /**
20486  * Indicates the persistence of a [`ChannelMonitor`] has completed after
20487  * [`ChannelMonitorUpdateStatus::InProgress`] was returned from an update operation.
20488  *
20489  * Thus, the anticipated use is, at a high level:
20490  *  1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
20491  *     update to disk and begins updating any remote (e.g. watchtower/backup) copies,
20492  *     returning [`ChannelMonitorUpdateStatus::InProgress`],
20493  *  2) once all remote copies are updated, you call this function with the
20494  *     `completed_update_id` that completed, and once all pending updates have completed the
20495  *     channel will be re-enabled.
20496  *
20497  * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
20498  * registered [`ChannelMonitor`]s.
20499  */
20500 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);
20501
20502 /**
20503  * Constructs a new Listen which calls the relevant methods on this_arg.
20504  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
20505  */
20506 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
20507
20508 /**
20509  * Constructs a new Confirm which calls the relevant methods on this_arg.
20510  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
20511  */
20512 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
20513
20514 /**
20515  * Constructs a new Watch which calls the relevant methods on this_arg.
20516  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
20517  */
20518 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
20519
20520 /**
20521  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
20522  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
20523  */
20524 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
20525
20526 /**
20527  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
20528  */
20529 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
20530
20531 /**
20532  * The sequence number of this update. Updates *must* be replayed in-order according to this
20533  * sequence number (and updates may panic if they are not). The update_id values are strictly
20534  * increasing and increase by one for each new update, with one exception specified below.
20535  *
20536  * This sequence number is also used to track up to which points updates which returned
20537  * [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given
20538  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
20539  *
20540  * The only instance where update_id values are not strictly increasing is the case where we
20541  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
20542  * its docs for more details.
20543  *
20544  * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
20545  */
20546 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
20547
20548 /**
20549  * The sequence number of this update. Updates *must* be replayed in-order according to this
20550  * sequence number (and updates may panic if they are not). The update_id values are strictly
20551  * increasing and increase by one for each new update, with one exception specified below.
20552  *
20553  * This sequence number is also used to track up to which points updates which returned
20554  * [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given
20555  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
20556  *
20557  * The only instance where update_id values are not strictly increasing is the case where we
20558  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
20559  * its docs for more details.
20560  *
20561  * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
20562  */
20563 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
20564
20565 /**
20566  * Creates a copy of the ChannelMonitorUpdate
20567  */
20568 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
20569
20570 /**
20571  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
20572  */
20573 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
20574
20575 /**
20576  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
20577  */
20578 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
20579
20580 /**
20581  * Frees any resources used by the MonitorEvent
20582  */
20583 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
20584
20585 /**
20586  * Creates a copy of the MonitorEvent
20587  */
20588 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
20589
20590 /**
20591  * Utility method to constructs a new HTLCEvent-variant MonitorEvent
20592  */
20593 struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
20594
20595 /**
20596  * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
20597  */
20598 struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
20599
20600 /**
20601  * Utility method to constructs a new Completed-variant MonitorEvent
20602  */
20603 struct LDKMonitorEvent MonitorEvent_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id);
20604
20605 /**
20606  * Utility method to constructs a new UpdateFailed-variant MonitorEvent
20607  */
20608 struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a);
20609
20610 /**
20611  * Checks if two MonitorEvents contain equal inner contents.
20612  * This ignores pointers and is_owned flags and looks at the values in fields.
20613  */
20614 bool MonitorEvent_eq(const struct LDKMonitorEvent *NONNULL_PTR a, const struct LDKMonitorEvent *NONNULL_PTR b);
20615
20616 /**
20617  * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
20618  */
20619 struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj);
20620
20621 /**
20622  * Read a MonitorEvent from a byte array, created by MonitorEvent_write
20623  */
20624 struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser);
20625
20626 /**
20627  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
20628  */
20629 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
20630
20631 /**
20632  * Creates a copy of the HTLCUpdate
20633  */
20634 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
20635
20636 /**
20637  * Checks if two HTLCUpdates contain equal inner contents.
20638  * This ignores pointers and is_owned flags and looks at the values in fields.
20639  * Two objects with NULL inner values will be considered "equal" here.
20640  */
20641 bool HTLCUpdate_eq(const struct LDKHTLCUpdate *NONNULL_PTR a, const struct LDKHTLCUpdate *NONNULL_PTR b);
20642
20643 /**
20644  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
20645  */
20646 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
20647
20648 /**
20649  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
20650  */
20651 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
20652
20653 /**
20654  * Frees any resources used by the Balance
20655  */
20656 void Balance_free(struct LDKBalance this_ptr);
20657
20658 /**
20659  * Creates a copy of the Balance
20660  */
20661 struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
20662
20663 /**
20664  * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
20665  */
20666 struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
20667
20668 /**
20669  * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
20670  */
20671 struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
20672
20673 /**
20674  * Utility method to constructs a new ContentiousClaimable-variant Balance
20675  */
20676 struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height);
20677
20678 /**
20679  * Utility method to constructs a new MaybeTimeoutClaimableHTLC-variant Balance
20680  */
20681 struct LDKBalance Balance_maybe_timeout_claimable_htlc(uint64_t claimable_amount_satoshis, uint32_t claimable_height);
20682
20683 /**
20684  * Utility method to constructs a new MaybePreimageClaimableHTLC-variant Balance
20685  */
20686 struct LDKBalance Balance_maybe_preimage_claimable_htlc(uint64_t claimable_amount_satoshis, uint32_t expiry_height);
20687
20688 /**
20689  * Utility method to constructs a new CounterpartyRevokedOutputClaimable-variant Balance
20690  */
20691 struct LDKBalance Balance_counterparty_revoked_output_claimable(uint64_t claimable_amount_satoshis);
20692
20693 /**
20694  * Checks if two Balances contain equal inner contents.
20695  * This ignores pointers and is_owned flags and looks at the values in fields.
20696  */
20697 bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
20698
20699 /**
20700  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
20701  */
20702 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
20703
20704 /**
20705  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
20706  */
20707 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
20708
20709 /**
20710  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
20711  * itself.
20712  *
20713  * panics if the given update is not the next update by update_id.
20714  */
20715 MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger);
20716
20717 /**
20718  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
20719  * ChannelMonitor.
20720  */
20721 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
20722
20723 /**
20724  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
20725  */
20726 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
20727
20728 /**
20729  * Gets a list of txids, with their output scripts (in the order they appear in the
20730  * transaction), which we must learn about spends of via block_connected().
20731  */
20732 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
20733
20734 /**
20735  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
20736  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
20737  * have been registered.
20738  */
20739 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
20740
20741 /**
20742  * Get the list of HTLCs who's status has been updated on chain. This should be called by
20743  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
20744  */
20745 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
20746
20747 /**
20748  * Gets the list of pending events which were generated by previous actions, clearing the list
20749  * in the process.
20750  *
20751  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
20752  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
20753  * no internal locking in ChannelMonitors.
20754  */
20755 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
20756
20757 /**
20758  * Gets the `node_id` of the counterparty for this channel.
20759  *
20760  * Will be `None` for channels constructed on LDK versions prior to 0.0.110 and always `Some`
20761  * otherwise.
20762  *
20763  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20764  */
20765 MUST_USE_RES struct LDKPublicKey ChannelMonitor_get_counterparty_node_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
20766
20767 /**
20768  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
20769  * the Channel was out-of-date.
20770  *
20771  * You may also use this to broadcast the latest local commitment transaction, either because
20772  * a monitor update failed with [`ChannelMonitorUpdateStatus::PermanentFailure`] or because we've
20773  * fallen behind (i.e. we've received proof that our counterparty side knows a revocation
20774  * secret we gave them that they shouldn't know).
20775  *
20776  * Broadcasting these transactions in the second case is UNSAFE, as they allow counterparty
20777  * side to punish you. Nevertheless you may want to broadcast them if counterparty doesn't
20778  * close channel with their commitment transaction after a substantial amount of time. Best
20779  * may be to contact the other node operator out-of-band to coordinate other options available
20780  * to you. In any-case, the choice is up to you.
20781  *
20782  * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure
20783  */
20784 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);
20785
20786 /**
20787  * Processes transactions in a newly connected block, which may result in any of the following:
20788  * - update the monitor's state against resolved HTLCs
20789  * - punish the counterparty in the case of seeing a revoked commitment transaction
20790  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
20791  * - detect settled outputs for later spending
20792  * - schedule and bump any in-flight claims
20793  *
20794  * Returns any new outputs to watch from `txdata`; after called, these are also included in
20795  * [`get_outputs_to_watch`].
20796  *
20797  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
20798  */
20799 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);
20800
20801 /**
20802  * Determines if the disconnected block contained any transactions of interest and updates
20803  * appropriately.
20804  */
20805 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);
20806
20807 /**
20808  * Processes transactions confirmed in a block with the given header and height, returning new
20809  * outputs to watch. See [`block_connected`] for details.
20810  *
20811  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
20812  * blocks. See [`chain::Confirm`] for calling expectations.
20813  *
20814  * [`block_connected`]: Self::block_connected
20815  */
20816 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);
20817
20818 /**
20819  * Processes a transaction that was reorganized out of the chain.
20820  *
20821  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
20822  * than blocks. See [`chain::Confirm`] for calling expectations.
20823  *
20824  * [`block_disconnected`]: Self::block_disconnected
20825  */
20826 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);
20827
20828 /**
20829  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
20830  * [`block_connected`] for details.
20831  *
20832  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
20833  * blocks. See [`chain::Confirm`] for calling expectations.
20834  *
20835  * [`block_connected`]: Self::block_connected
20836  */
20837 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);
20838
20839 /**
20840  * Returns the set of txids that should be monitored for re-organization out of the chain.
20841  */
20842 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
20843
20844 /**
20845  * Gets the latest best block which was connected either via the [`chain::Listen`] or
20846  * [`chain::Confirm`] interfaces.
20847  */
20848 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
20849
20850 /**
20851  * Gets the balances in this channel which are either claimable by us if we were to
20852  * force-close the channel now or which are claimable on-chain (possibly awaiting
20853  * confirmation).
20854  *
20855  * Any balances in the channel which are available on-chain (excluding on-chain fees) are
20856  * included here until an [`Event::SpendableOutputs`] event has been generated for the
20857  * balance, or until our counterparty has claimed the balance and accrued several
20858  * confirmations on the claim transaction.
20859  *
20860  * Note that for `ChannelMonitors` which track a channel which went on-chain with versions of
20861  * LDK prior to 0.0.111, balances may not be fully captured if our counterparty broadcasted
20862  * a revoked state.
20863  *
20864  * See [`Balance`] for additional details on the types of claimable balances which
20865  * may be returned here and their meanings.
20866  */
20867 MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
20868
20869 /**
20870  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
20871  */
20872 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
20873
20874 /**
20875  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
20876  */
20877 void OutPoint_free(struct LDKOutPoint this_obj);
20878
20879 /**
20880  * The referenced transaction's txid.
20881  */
20882 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
20883
20884 /**
20885  * The referenced transaction's txid.
20886  */
20887 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20888
20889 /**
20890  * The index of the referenced output in its transaction's vout.
20891  */
20892 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
20893
20894 /**
20895  * The index of the referenced output in its transaction's vout.
20896  */
20897 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
20898
20899 /**
20900  * Constructs a new OutPoint given each field
20901  */
20902 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
20903
20904 /**
20905  * Creates a copy of the OutPoint
20906  */
20907 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
20908
20909 /**
20910  * Checks if two OutPoints contain equal inner contents.
20911  * This ignores pointers and is_owned flags and looks at the values in fields.
20912  * Two objects with NULL inner values will be considered "equal" here.
20913  */
20914 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
20915
20916 /**
20917  * Checks if two OutPoints contain equal inner contents.
20918  */
20919 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
20920
20921 /**
20922  * Convert an `OutPoint` to a lightning channel id.
20923  */
20924 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
20925
20926 /**
20927  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
20928  */
20929 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
20930
20931 /**
20932  * Read a OutPoint from a byte array, created by OutPoint_write
20933  */
20934 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
20935
20936 /**
20937  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
20938  */
20939 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
20940
20941 /**
20942  * The outpoint which is spendable
20943  */
20944 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
20945
20946 /**
20947  * The outpoint which is spendable
20948  */
20949 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
20950
20951 /**
20952  * Per commitment point to derive delayed_payment_key by key holder
20953  */
20954 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
20955
20956 /**
20957  * Per commitment point to derive delayed_payment_key by key holder
20958  */
20959 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20960
20961 /**
20962  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
20963  * the witness_script.
20964  */
20965 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
20966
20967 /**
20968  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
20969  * the witness_script.
20970  */
20971 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
20972
20973 /**
20974  * The output which is referenced by the given outpoint
20975  *
20976  * Returns a copy of the field.
20977  */
20978 struct LDKTxOut DelayedPaymentOutputDescriptor_get_output(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
20979
20980 /**
20981  * The output which is referenced by the given outpoint
20982  */
20983 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
20984
20985 /**
20986  * The revocation point specific to the commitment transaction which was broadcast. Used to
20987  * derive the witnessScript for this output.
20988  */
20989 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
20990
20991 /**
20992  * The revocation point specific to the commitment transaction which was broadcast. Used to
20993  * derive the witnessScript for this output.
20994  */
20995 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20996
20997 /**
20998  * Arbitrary identification information returned by a call to
20999  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
21000  * the channel to spend the output.
21001  */
21002 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
21003
21004 /**
21005  * Arbitrary identification information returned by a call to
21006  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
21007  * the channel to spend the output.
21008  */
21009 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21010
21011 /**
21012  * The value of the channel which this output originated from, possibly indirectly.
21013  */
21014 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
21015
21016 /**
21017  * The value of the channel which this output originated from, possibly indirectly.
21018  */
21019 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
21020
21021 /**
21022  * Constructs a new DelayedPaymentOutputDescriptor given each field
21023  */
21024 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);
21025
21026 /**
21027  * Creates a copy of the DelayedPaymentOutputDescriptor
21028  */
21029 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
21030
21031 /**
21032  * Checks if two DelayedPaymentOutputDescriptors contain equal inner contents.
21033  * This ignores pointers and is_owned flags and looks at the values in fields.
21034  * Two objects with NULL inner values will be considered "equal" here.
21035  */
21036 bool DelayedPaymentOutputDescriptor_eq(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR b);
21037
21038 /**
21039  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
21040  */
21041 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
21042
21043 /**
21044  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
21045  */
21046 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
21047
21048 /**
21049  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
21050  */
21051 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
21052
21053 /**
21054  * The outpoint which is spendable
21055  */
21056 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
21057
21058 /**
21059  * The outpoint which is spendable
21060  */
21061 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
21062
21063 /**
21064  * The output which is referenced by the given outpoint
21065  *
21066  * Returns a copy of the field.
21067  */
21068 struct LDKTxOut StaticPaymentOutputDescriptor_get_output(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
21069
21070 /**
21071  * The output which is referenced by the given outpoint
21072  */
21073 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
21074
21075 /**
21076  * Arbitrary identification information returned by a call to
21077  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
21078  * the channel to spend the output.
21079  */
21080 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
21081
21082 /**
21083  * Arbitrary identification information returned by a call to
21084  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
21085  * the channel to spend the output.
21086  */
21087 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21088
21089 /**
21090  * The value of the channel which this transactions spends.
21091  */
21092 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
21093
21094 /**
21095  * The value of the channel which this transactions spends.
21096  */
21097 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
21098
21099 /**
21100  * Constructs a new StaticPaymentOutputDescriptor given each field
21101  */
21102 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);
21103
21104 /**
21105  * Creates a copy of the StaticPaymentOutputDescriptor
21106  */
21107 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
21108
21109 /**
21110  * Checks if two StaticPaymentOutputDescriptors contain equal inner contents.
21111  * This ignores pointers and is_owned flags and looks at the values in fields.
21112  * Two objects with NULL inner values will be considered "equal" here.
21113  */
21114 bool StaticPaymentOutputDescriptor_eq(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR b);
21115
21116 /**
21117  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
21118  */
21119 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
21120
21121 /**
21122  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
21123  */
21124 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
21125
21126 /**
21127  * Frees any resources used by the SpendableOutputDescriptor
21128  */
21129 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
21130
21131 /**
21132  * Creates a copy of the SpendableOutputDescriptor
21133  */
21134 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
21135
21136 /**
21137  * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
21138  */
21139 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output);
21140
21141 /**
21142  * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
21143  */
21144 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a);
21145
21146 /**
21147  * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
21148  */
21149 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
21150
21151 /**
21152  * Checks if two SpendableOutputDescriptors contain equal inner contents.
21153  * This ignores pointers and is_owned flags and looks at the values in fields.
21154  */
21155 bool SpendableOutputDescriptor_eq(const struct LDKSpendableOutputDescriptor *NONNULL_PTR a, const struct LDKSpendableOutputDescriptor *NONNULL_PTR b);
21156
21157 /**
21158  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
21159  */
21160 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
21161
21162 /**
21163  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
21164  */
21165 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
21166
21167 /**
21168  * Calls the free function if one is set
21169  */
21170 void BaseSign_free(struct LDKBaseSign this_ptr);
21171
21172 /**
21173  * Creates a copy of a Sign
21174  */
21175 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
21176
21177 /**
21178  * Calls the free function if one is set
21179  */
21180 void Sign_free(struct LDKSign this_ptr);
21181
21182 /**
21183  * Creates a copy of the Recipient
21184  */
21185 enum LDKRecipient Recipient_clone(const enum LDKRecipient *NONNULL_PTR orig);
21186
21187 /**
21188  * Utility method to constructs a new Node-variant Recipient
21189  */
21190 enum LDKRecipient Recipient_node(void);
21191
21192 /**
21193  * Utility method to constructs a new PhantomNode-variant Recipient
21194  */
21195 enum LDKRecipient Recipient_phantom_node(void);
21196
21197 /**
21198  * Calls the free function if one is set
21199  */
21200 void KeysInterface_free(struct LDKKeysInterface this_ptr);
21201
21202 /**
21203  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
21204  */
21205 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
21206
21207 /**
21208  * Private key of anchor tx
21209  */
21210 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
21211
21212 /**
21213  * Private key of anchor tx
21214  */
21215 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
21216
21217 /**
21218  * Holder secret key for blinded revocation pubkey
21219  */
21220 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
21221
21222 /**
21223  * Holder secret key for blinded revocation pubkey
21224  */
21225 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
21226
21227 /**
21228  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
21229  */
21230 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
21231
21232 /**
21233  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
21234  */
21235 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
21236
21237 /**
21238  * Holder secret key used in HTLC tx
21239  */
21240 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
21241
21242 /**
21243  * Holder secret key used in HTLC tx
21244  */
21245 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
21246
21247 /**
21248  * Holder htlc secret key used in commitment tx htlc outputs
21249  */
21250 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
21251
21252 /**
21253  * Holder htlc secret key used in commitment tx htlc outputs
21254  */
21255 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
21256
21257 /**
21258  * Commitment seed
21259  */
21260 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
21261
21262 /**
21263  * Commitment seed
21264  */
21265 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21266
21267 /**
21268  * Creates a copy of the InMemorySigner
21269  */
21270 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
21271
21272 /**
21273  * Create a new InMemorySigner
21274  */
21275 MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(struct LDKSecretKey node_secret, 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);
21276
21277 /**
21278  * Counterparty pubkeys.
21279  * Will panic if ready_channel wasn't called.
21280  */
21281 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
21282
21283 /**
21284  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
21285  * transactions, ie the amount of time that we have to wait to recover our funds if we
21286  * broadcast a transaction.
21287  * Will panic if ready_channel wasn't called.
21288  */
21289 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
21290
21291 /**
21292  * The contest_delay value specified by us and applied on transactions broadcastable
21293  * by our counterparty, ie the amount of time that they have to wait to recover their funds
21294  * if they broadcast a transaction.
21295  * Will panic if ready_channel wasn't called.
21296  */
21297 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
21298
21299 /**
21300  * Whether the holder is the initiator
21301  * Will panic if ready_channel wasn't called.
21302  */
21303 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
21304
21305 /**
21306  * Funding outpoint
21307  * Will panic if ready_channel wasn't called.
21308  */
21309 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
21310
21311 /**
21312  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
21313  * building transactions.
21314  *
21315  * Will panic if ready_channel wasn't called.
21316  */
21317 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
21318
21319 /**
21320  * Whether anchors should be used.
21321  * Will panic if ready_channel wasn't called.
21322  */
21323 MUST_USE_RES bool InMemorySigner_opt_anchors(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
21324
21325 /**
21326  * Sign the single input of spend_tx at index `input_idx` which spends the output
21327  * described by descriptor, returning the witness stack for the input.
21328  *
21329  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
21330  * is not spending the outpoint described by `descriptor.outpoint`,
21331  * or if an output descriptor script_pubkey does not match the one we can spend.
21332  */
21333 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);
21334
21335 /**
21336  * Sign the single input of spend_tx at index `input_idx` which spends the output
21337  * described by descriptor, returning the witness stack for the input.
21338  *
21339  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
21340  * is not spending the outpoint described by `descriptor.outpoint`, does not have a
21341  * sequence set to `descriptor.to_self_delay`, or if an output descriptor
21342  * script_pubkey does not match the one we can spend.
21343  */
21344 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);
21345
21346 /**
21347  * Constructs a new BaseSign which calls the relevant methods on this_arg.
21348  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
21349  */
21350 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
21351
21352 /**
21353  * Constructs a new Sign which calls the relevant methods on this_arg.
21354  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
21355  */
21356 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
21357
21358 /**
21359  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
21360  */
21361 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
21362
21363 /**
21364  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
21365  */
21366 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKSecretKey arg);
21367
21368 /**
21369  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
21370  */
21371 void KeysManager_free(struct LDKKeysManager this_obj);
21372
21373 /**
21374  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
21375  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
21376  * starting_time isn't strictly required to actually be a time, but it must absolutely,
21377  * without a doubt, be unique to this instance. ie if you start multiple times with the same
21378  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
21379  * simply use the current time (with very high precision).
21380  *
21381  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
21382  * obviously, starting_time should be unique every time you reload the library - it is only
21383  * used to generate new ephemeral key data (which will be stored by the individual channel if
21384  * necessary).
21385  *
21386  * Note that the seed is required to recover certain on-chain funds independent of
21387  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
21388  * channel, and some on-chain during-closing funds.
21389  *
21390  * Note that until the 0.1 release there is no guarantee of backward compatibility between
21391  * versions. Once the library is more fully supported, the docs will be updated to include a
21392  * detailed description of the guarantee.
21393  */
21394 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
21395
21396 /**
21397  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
21398  *
21399  * Key derivation parameters are accessible through a per-channel secrets
21400  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
21401  * onchain output detection for which a corresponding delayed_payment_key must be derived.
21402  */
21403 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]);
21404
21405 /**
21406  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
21407  * output to the given change destination (if sufficient change value remains). The
21408  * transaction will have a feerate, at least, of the given value.
21409  *
21410  * Returns `Err(())` if the output value is greater than the input value minus required fee,
21411  * if a descriptor was duplicated, or if an output descriptor `script_pubkey`
21412  * does not match the one we can spend.
21413  *
21414  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
21415  *
21416  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
21417  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
21418  */
21419 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);
21420
21421 /**
21422  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
21423  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
21424  */
21425 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
21426
21427 /**
21428  * Frees any resources used by the PhantomKeysManager, if is_owned is set and inner is non-NULL.
21429  */
21430 void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj);
21431
21432 /**
21433  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
21434  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
21435  */
21436 struct LDKKeysInterface PhantomKeysManager_as_KeysInterface(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
21437
21438 /**
21439  * Constructs a `PhantomKeysManager` given a 32-byte seed and an additional `cross_node_seed`
21440  * that is shared across all nodes that intend to participate in [phantom node payments] together.
21441  *
21442  * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and
21443  * `starting_time_nanos`.
21444  *
21445  * `cross_node_seed` must be the same across all phantom payment-receiving nodes and also the
21446  * same across restarts, or else inbound payments may fail.
21447  *
21448  * [phantom node payments]: PhantomKeysManager
21449  */
21450 MUST_USE_RES struct LDKPhantomKeysManager PhantomKeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos, const uint8_t (*cross_node_seed)[32]);
21451
21452 /**
21453  * See [`KeysManager::spend_spendable_outputs`] for documentation on this method.
21454  */
21455 MUST_USE_RES struct LDKCResult_TransactionNoneZ PhantomKeysManager_spend_spendable_outputs(const struct LDKPhantomKeysManager *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);
21456
21457 /**
21458  * See [`KeysManager::derive_channel_keys`] for documentation on this method.
21459  */
21460 MUST_USE_RES struct LDKInMemorySigner PhantomKeysManager_derive_channel_keys(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]);
21461
21462 /**
21463  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
21464  */
21465 void ChannelManager_free(struct LDKChannelManager this_obj);
21466
21467 /**
21468  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
21469  */
21470 void ChainParameters_free(struct LDKChainParameters this_obj);
21471
21472 /**
21473  * The network for determining the `chain_hash` in Lightning messages.
21474  */
21475 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
21476
21477 /**
21478  * The network for determining the `chain_hash` in Lightning messages.
21479  */
21480 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
21481
21482 /**
21483  * The hash and height of the latest block successfully connected.
21484  *
21485  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
21486  */
21487 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
21488
21489 /**
21490  * The hash and height of the latest block successfully connected.
21491  *
21492  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
21493  */
21494 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
21495
21496 /**
21497  * Constructs a new ChainParameters given each field
21498  */
21499 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
21500
21501 /**
21502  * Creates a copy of the ChainParameters
21503  */
21504 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
21505
21506 /**
21507  * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL.
21508  */
21509 void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
21510
21511 /**
21512  * Base routing fee in millisatoshis.
21513  */
21514 uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
21515
21516 /**
21517  * Base routing fee in millisatoshis.
21518  */
21519 void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
21520
21521 /**
21522  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
21523  */
21524 uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
21525
21526 /**
21527  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
21528  */
21529 void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
21530
21531 /**
21532  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
21533  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
21534  * `cltv_expiry_delta` for more details.
21535  */
21536 uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
21537
21538 /**
21539  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
21540  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
21541  * `cltv_expiry_delta` for more details.
21542  */
21543 void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
21544
21545 /**
21546  * Constructs a new CounterpartyForwardingInfo given each field
21547  */
21548 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);
21549
21550 /**
21551  * Creates a copy of the CounterpartyForwardingInfo
21552  */
21553 struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
21554
21555 /**
21556  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
21557  */
21558 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
21559
21560 /**
21561  * The node_id of our counterparty
21562  */
21563 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
21564
21565 /**
21566  * The node_id of our counterparty
21567  */
21568 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21569
21570 /**
21571  * The Features the channel counterparty provided upon last connection.
21572  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
21573  * many routing-relevant features are present in the init context.
21574  */
21575 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
21576
21577 /**
21578  * The Features the channel counterparty provided upon last connection.
21579  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
21580  * many routing-relevant features are present in the init context.
21581  */
21582 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
21583
21584 /**
21585  * The value, in satoshis, that must always be held in the channel for our counterparty. This
21586  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
21587  * claiming at least this value on chain.
21588  *
21589  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
21590  *
21591  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
21592  */
21593 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
21594
21595 /**
21596  * The value, in satoshis, that must always be held in the channel for our counterparty. This
21597  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
21598  * claiming at least this value on chain.
21599  *
21600  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
21601  *
21602  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
21603  */
21604 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
21605
21606 /**
21607  * Information on the fees and requirements that the counterparty requires when forwarding
21608  * payments to us through this channel.
21609  *
21610  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21611  */
21612 struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
21613
21614 /**
21615  * Information on the fees and requirements that the counterparty requires when forwarding
21616  * payments to us through this channel.
21617  *
21618  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21619  */
21620 void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
21621
21622 /**
21623  * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
21624  * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
21625  * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
21626  */
21627 struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_minimum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
21628
21629 /**
21630  * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
21631  * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
21632  * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
21633  */
21634 void ChannelCounterparty_set_outbound_htlc_minimum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21635
21636 /**
21637  * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
21638  */
21639 struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_maximum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
21640
21641 /**
21642  * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
21643  */
21644 void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21645
21646 /**
21647  * Constructs a new ChannelCounterparty given each field
21648  */
21649 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, struct LDKCOption_u64Z outbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z outbound_htlc_maximum_msat_arg);
21650
21651 /**
21652  * Creates a copy of the ChannelCounterparty
21653  */
21654 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
21655
21656 /**
21657  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
21658  */
21659 void ChannelDetails_free(struct LDKChannelDetails this_obj);
21660
21661 /**
21662  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
21663  * thereafter this is the txid of the funding transaction xor the funding transaction output).
21664  * Note that this means this value is *not* persistent - it can change once during the
21665  * lifetime of the channel.
21666  */
21667 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
21668
21669 /**
21670  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
21671  * thereafter this is the txid of the funding transaction xor the funding transaction output).
21672  * Note that this means this value is *not* persistent - it can change once during the
21673  * lifetime of the channel.
21674  */
21675 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21676
21677 /**
21678  * Parameters which apply to our counterparty. See individual fields for more information.
21679  */
21680 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21681
21682 /**
21683  * Parameters which apply to our counterparty. See individual fields for more information.
21684  */
21685 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
21686
21687 /**
21688  * The Channel's funding transaction output, if we've negotiated the funding transaction with
21689  * our counterparty already.
21690  *
21691  * Note that, if this has been set, `channel_id` will be equivalent to
21692  * `funding_txo.unwrap().to_channel_id()`.
21693  *
21694  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21695  */
21696 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21697
21698 /**
21699  * The Channel's funding transaction output, if we've negotiated the funding transaction with
21700  * our counterparty already.
21701  *
21702  * Note that, if this has been set, `channel_id` will be equivalent to
21703  * `funding_txo.unwrap().to_channel_id()`.
21704  *
21705  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21706  */
21707 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
21708
21709 /**
21710  * The features which this channel operates with. See individual features for more info.
21711  *
21712  * `None` until negotiation completes and the channel type is finalized.
21713  *
21714  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21715  */
21716 struct LDKChannelTypeFeatures ChannelDetails_get_channel_type(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21717
21718 /**
21719  * The features which this channel operates with. See individual features for more info.
21720  *
21721  * `None` until negotiation completes and the channel type is finalized.
21722  *
21723  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21724  */
21725 void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
21726
21727 /**
21728  * The position of the funding transaction in the chain. None if the funding transaction has
21729  * not yet been confirmed and the channel fully opened.
21730  *
21731  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
21732  * payments instead of this. See [`get_inbound_payment_scid`].
21733  *
21734  * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
21735  * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
21736  *
21737  * [`inbound_scid_alias`]: Self::inbound_scid_alias
21738  * [`outbound_scid_alias`]: Self::outbound_scid_alias
21739  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
21740  * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
21741  * [`confirmations_required`]: Self::confirmations_required
21742  */
21743 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21744
21745 /**
21746  * The position of the funding transaction in the chain. None if the funding transaction has
21747  * not yet been confirmed and the channel fully opened.
21748  *
21749  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
21750  * payments instead of this. See [`get_inbound_payment_scid`].
21751  *
21752  * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
21753  * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
21754  *
21755  * [`inbound_scid_alias`]: Self::inbound_scid_alias
21756  * [`outbound_scid_alias`]: Self::outbound_scid_alias
21757  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
21758  * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
21759  * [`confirmations_required`]: Self::confirmations_required
21760  */
21761 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21762
21763 /**
21764  * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
21765  * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
21766  * the channel has not yet been confirmed (as long as [`confirmations_required`] is
21767  * `Some(0)`).
21768  *
21769  * This will be `None` as long as the channel is not available for routing outbound payments.
21770  *
21771  * [`short_channel_id`]: Self::short_channel_id
21772  * [`confirmations_required`]: Self::confirmations_required
21773  */
21774 struct LDKCOption_u64Z ChannelDetails_get_outbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21775
21776 /**
21777  * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
21778  * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
21779  * the channel has not yet been confirmed (as long as [`confirmations_required`] is
21780  * `Some(0)`).
21781  *
21782  * This will be `None` as long as the channel is not available for routing outbound payments.
21783  *
21784  * [`short_channel_id`]: Self::short_channel_id
21785  * [`confirmations_required`]: Self::confirmations_required
21786  */
21787 void ChannelDetails_set_outbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21788
21789 /**
21790  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
21791  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
21792  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
21793  * when they see a payment to be routed to us.
21794  *
21795  * Our counterparty may choose to rotate this value at any time, though will always recognize
21796  * previous values for inbound payment forwarding.
21797  *
21798  * [`short_channel_id`]: Self::short_channel_id
21799  */
21800 struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21801
21802 /**
21803  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
21804  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
21805  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
21806  * when they see a payment to be routed to us.
21807  *
21808  * Our counterparty may choose to rotate this value at any time, though will always recognize
21809  * previous values for inbound payment forwarding.
21810  *
21811  * [`short_channel_id`]: Self::short_channel_id
21812  */
21813 void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21814
21815 /**
21816  * The value, in satoshis, of this channel as appears in the funding output
21817  */
21818 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21819
21820 /**
21821  * The value, in satoshis, of this channel as appears in the funding output
21822  */
21823 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
21824
21825 /**
21826  * The value, in satoshis, that must always be held in the channel for us. This value ensures
21827  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
21828  * this value on chain.
21829  *
21830  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
21831  *
21832  * This value will be `None` for outbound channels until the counterparty accepts the channel.
21833  *
21834  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
21835  */
21836 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21837
21838 /**
21839  * The value, in satoshis, that must always be held in the channel for us. This value ensures
21840  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
21841  * this value on chain.
21842  *
21843  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
21844  *
21845  * This value will be `None` for outbound channels until the counterparty accepts the channel.
21846  *
21847  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
21848  */
21849 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21850
21851 /**
21852  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
21853  */
21854 uint64_t ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21855
21856 /**
21857  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
21858  */
21859 void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
21860
21861 /**
21862  * Our total balance.  This is the amount we would get if we close the channel.
21863  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
21864  * amount is not likely to be recoverable on close.
21865  *
21866  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
21867  * balance is not available for inclusion in new outbound HTLCs). This further does not include
21868  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
21869  * This does not consider any on-chain fees.
21870  *
21871  * See also [`ChannelDetails::outbound_capacity_msat`]
21872  */
21873 uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21874
21875 /**
21876  * Our total balance.  This is the amount we would get if we close the channel.
21877  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
21878  * amount is not likely to be recoverable on close.
21879  *
21880  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
21881  * balance is not available for inclusion in new outbound HTLCs). This further does not include
21882  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
21883  * This does not consider any on-chain fees.
21884  *
21885  * See also [`ChannelDetails::outbound_capacity_msat`]
21886  */
21887 void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
21888
21889 /**
21890  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
21891  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
21892  * available for inclusion in new outbound HTLCs). This further does not include any pending
21893  * outgoing HTLCs which are awaiting some other resolution to be sent.
21894  *
21895  * See also [`ChannelDetails::balance_msat`]
21896  *
21897  * This value is not exact. Due to various in-flight changes, feerate changes, and our
21898  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
21899  * should be able to spend nearly this amount.
21900  */
21901 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21902
21903 /**
21904  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
21905  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
21906  * available for inclusion in new outbound HTLCs). This further does not include any pending
21907  * outgoing HTLCs which are awaiting some other resolution to be sent.
21908  *
21909  * See also [`ChannelDetails::balance_msat`]
21910  *
21911  * This value is not exact. Due to various in-flight changes, feerate changes, and our
21912  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
21913  * should be able to spend nearly this amount.
21914  */
21915 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
21916
21917 /**
21918  * The available outbound capacity for sending a single HTLC to the remote peer. This is
21919  * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
21920  * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
21921  * to use a limit as close as possible to the HTLC limit we can currently send.
21922  *
21923  * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
21924  */
21925 uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21926
21927 /**
21928  * The available outbound capacity for sending a single HTLC to the remote peer. This is
21929  * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
21930  * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
21931  * to use a limit as close as possible to the HTLC limit we can currently send.
21932  *
21933  * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
21934  */
21935 void ChannelDetails_set_next_outbound_htlc_limit_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
21936
21937 /**
21938  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
21939  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
21940  * available for inclusion in new inbound HTLCs).
21941  * Note that there are some corner cases not fully handled here, so the actual available
21942  * inbound capacity may be slightly higher than this.
21943  *
21944  * This value is not exact. Due to various in-flight changes, feerate changes, and our
21945  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
21946  * However, our counterparty should be able to spend nearly this amount.
21947  */
21948 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21949
21950 /**
21951  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
21952  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
21953  * available for inclusion in new inbound HTLCs).
21954  * Note that there are some corner cases not fully handled here, so the actual available
21955  * inbound capacity may be slightly higher than this.
21956  *
21957  * This value is not exact. Due to various in-flight changes, feerate changes, and our
21958  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
21959  * However, our counterparty should be able to spend nearly this amount.
21960  */
21961 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
21962
21963 /**
21964  * The number of required confirmations on the funding transaction before the funding will be
21965  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
21966  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
21967  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
21968  * [`ChannelHandshakeLimits::max_minimum_depth`].
21969  *
21970  * This value will be `None` for outbound channels until the counterparty accepts the channel.
21971  *
21972  * [`is_outbound`]: ChannelDetails::is_outbound
21973  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
21974  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
21975  */
21976 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
21977
21978 /**
21979  * The number of required confirmations on the funding transaction before the funding will be
21980  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
21981  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
21982  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
21983  * [`ChannelHandshakeLimits::max_minimum_depth`].
21984  *
21985  * This value will be `None` for outbound channels until the counterparty accepts the channel.
21986  *
21987  * [`is_outbound`]: ChannelDetails::is_outbound
21988  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
21989  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
21990  */
21991 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
21992
21993 /**
21994  * The number of blocks (after our commitment transaction confirms) that we will need to wait
21995  * until we can claim our funds after we force-close the channel. During this time our
21996  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
21997  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
21998  * time to claim our non-HTLC-encumbered funds.
21999  *
22000  * This value will be `None` for outbound channels until the counterparty accepts the channel.
22001  */
22002 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22003
22004 /**
22005  * The number of blocks (after our commitment transaction confirms) that we will need to wait
22006  * until we can claim our funds after we force-close the channel. During this time our
22007  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
22008  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
22009  * time to claim our non-HTLC-encumbered funds.
22010  *
22011  * This value will be `None` for outbound channels until the counterparty accepts the channel.
22012  */
22013 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
22014
22015 /**
22016  * True if the channel was initiated (and thus funded) by us.
22017  */
22018 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22019
22020 /**
22021  * True if the channel was initiated (and thus funded) by us.
22022  */
22023 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
22024
22025 /**
22026  * True if the channel is confirmed, channel_ready messages have been exchanged, and the
22027  * channel is not currently being shut down. `channel_ready` message exchange implies the
22028  * required confirmation count has been reached (and we were connected to the peer at some
22029  * point after the funding transaction received enough confirmations). The required
22030  * confirmation count is provided in [`confirmations_required`].
22031  *
22032  * [`confirmations_required`]: ChannelDetails::confirmations_required
22033  */
22034 bool ChannelDetails_get_is_channel_ready(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22035
22036 /**
22037  * True if the channel is confirmed, channel_ready messages have been exchanged, and the
22038  * channel is not currently being shut down. `channel_ready` message exchange implies the
22039  * required confirmation count has been reached (and we were connected to the peer at some
22040  * point after the funding transaction received enough confirmations). The required
22041  * confirmation count is provided in [`confirmations_required`].
22042  *
22043  * [`confirmations_required`]: ChannelDetails::confirmations_required
22044  */
22045 void ChannelDetails_set_is_channel_ready(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
22046
22047 /**
22048  * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
22049  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
22050  *
22051  * This is a strict superset of `is_channel_ready`.
22052  */
22053 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22054
22055 /**
22056  * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
22057  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
22058  *
22059  * This is a strict superset of `is_channel_ready`.
22060  */
22061 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
22062
22063 /**
22064  * True if this channel is (or will be) publicly-announced.
22065  */
22066 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22067
22068 /**
22069  * True if this channel is (or will be) publicly-announced.
22070  */
22071 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
22072
22073 /**
22074  * The smallest value HTLC (in msat) we will accept, for this channel. This field
22075  * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
22076  */
22077 struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22078
22079 /**
22080  * The smallest value HTLC (in msat) we will accept, for this channel. This field
22081  * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
22082  */
22083 void ChannelDetails_set_inbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
22084
22085 /**
22086  * The largest value HTLC (in msat) we currently will accept, for this channel.
22087  */
22088 struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_maximum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22089
22090 /**
22091  * The largest value HTLC (in msat) we currently will accept, for this channel.
22092  */
22093 void ChannelDetails_set_inbound_htlc_maximum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
22094
22095 /**
22096  * Set of configurable parameters that affect channel operation.
22097  *
22098  * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
22099  *
22100  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22101  */
22102 struct LDKChannelConfig ChannelDetails_get_config(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22103
22104 /**
22105  * Set of configurable parameters that affect channel operation.
22106  *
22107  * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
22108  *
22109  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22110  */
22111 void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
22112
22113 /**
22114  * Constructs a new ChannelDetails given each field
22115  */
22116 MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKChannelTypeFeatures channel_type_arg, struct LDKCOption_u64Z short_channel_id_arg, struct LDKCOption_u64Z outbound_scid_alias_arg, struct LDKCOption_u64Z inbound_scid_alias_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t next_outbound_htlc_limit_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_channel_ready_arg, bool is_usable_arg, bool is_public_arg, struct LDKCOption_u64Z inbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z inbound_htlc_maximum_msat_arg, struct LDKChannelConfig config_arg);
22117
22118 /**
22119  * Creates a copy of the ChannelDetails
22120  */
22121 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
22122
22123 /**
22124  * Gets the current SCID which should be used to identify this channel for inbound payments.
22125  * This should be used for providing invoice hints or in any other context where our
22126  * counterparty will forward a payment to us.
22127  *
22128  * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the
22129  * [`ChannelDetails::short_channel_id`]. See those for more information.
22130  */
22131 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
22132
22133 /**
22134  * Gets the current SCID which should be used to identify this channel for outbound payments.
22135  * This should be used in [`Route`]s to describe the first hop or in other contexts where
22136  * we're sending or forwarding a payment outbound over this channel.
22137  *
22138  * This is either the [`ChannelDetails::short_channel_id`], if set, or the
22139  * [`ChannelDetails::outbound_scid_alias`]. See those for more information.
22140  */
22141 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
22142
22143 /**
22144  * Frees any resources used by the PaymentSendFailure
22145  */
22146 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
22147
22148 /**
22149  * Creates a copy of the PaymentSendFailure
22150  */
22151 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
22152
22153 /**
22154  * Utility method to constructs a new ParameterError-variant PaymentSendFailure
22155  */
22156 struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a);
22157
22158 /**
22159  * Utility method to constructs a new PathParameterError-variant PaymentSendFailure
22160  */
22161 struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a);
22162
22163 /**
22164  * Utility method to constructs a new AllFailedRetrySafe-variant PaymentSendFailure
22165  */
22166 struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDKCVec_APIErrorZ a);
22167
22168 /**
22169  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
22170  */
22171 struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id);
22172
22173 /**
22174  * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL.
22175  */
22176 void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj);
22177
22178 /**
22179  * The list of channels to be included in the invoice route hints.
22180  */
22181 struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
22182
22183 /**
22184  * The list of channels to be included in the invoice route hints.
22185  */
22186 void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val);
22187
22188 /**
22189  * A fake scid used for representing the phantom node's fake channel in generating the invoice
22190  * route hints.
22191  */
22192 uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
22193
22194 /**
22195  * A fake scid used for representing the phantom node's fake channel in generating the invoice
22196  * route hints.
22197  */
22198 void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val);
22199
22200 /**
22201  * The pubkey of the real backing node that would ultimately receive the payment.
22202  */
22203 struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
22204
22205 /**
22206  * The pubkey of the real backing node that would ultimately receive the payment.
22207  */
22208 void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22209
22210 /**
22211  * Constructs a new PhantomRouteHints given each field
22212  */
22213 MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg);
22214
22215 /**
22216  * Creates a copy of the PhantomRouteHints
22217  */
22218 struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig);
22219
22220 /**
22221  * Constructs a new ChannelManager to hold several channels and route between them.
22222  *
22223  * This is the main \"logic hub\" for all channel-related actions, and implements
22224  * ChannelMessageHandler.
22225  *
22226  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
22227  *
22228  * Users need to notify the new ChannelManager when a new block is connected or
22229  * disconnected using its `block_connected` and `block_disconnected` methods, starting
22230  * from after `params.latest_hash`.
22231  */
22232 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);
22233
22234 /**
22235  * Gets the current configuration applied to all new channels.
22236  */
22237 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
22238
22239 /**
22240  * Creates a new outbound channel to the given remote node and with the given value.
22241  *
22242  * `user_channel_id` will be provided back as in
22243  * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
22244  * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 0
22245  * for inbound channels, so you may wish to avoid using 0 for `user_channel_id` here.
22246  * `user_channel_id` has no meaning inside of LDK, it is simply copied to events and otherwise
22247  * ignored.
22248  *
22249  * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
22250  * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
22251  *
22252  * Note that we do not check if you are currently connected to the given peer. If no
22253  * connection is available, the outbound `open_channel` message may fail to send, resulting in
22254  * the channel eventually being silently forgotten (dropped on reload).
22255  *
22256  * Returns the new Channel's temporary `channel_id`. This ID will appear as
22257  * [`Event::FundingGenerationReady::temporary_channel_id`] and in
22258  * [`ChannelDetails::channel_id`] until after
22259  * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
22260  * one derived from the funding transaction's TXID. If the counterparty rejects the channel
22261  * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
22262  *
22263  * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
22264  * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
22265  * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
22266  *
22267  * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
22268  */
22269 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);
22270
22271 /**
22272  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
22273  * more information.
22274  */
22275 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
22276
22277 /**
22278  * Gets the list of usable channels, in random order. Useful as an argument to [`find_route`]
22279  * to ensure non-announced channels are used.
22280  *
22281  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
22282  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
22283  * are.
22284  *
22285  * [`find_route`]: crate::routing::router::find_route
22286  */
22287 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
22288
22289 /**
22290  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
22291  * will be accepted on the given channel, and after additional timeout/the closing of all
22292  * pending HTLCs, the channel will be closed on chain.
22293  *
22294  *  * If we are the channel initiator, we will pay between our [`Background`] and
22295  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
22296  *    estimate.
22297  *  * If our counterparty is the channel initiator, we will require a channel closing
22298  *    transaction feerate of at least our [`Background`] feerate or the feerate which
22299  *    would appear on a force-closure transaction, whichever is lower. We will allow our
22300  *    counterparty to pay as much fee as they'd like, however.
22301  *
22302  * May generate a SendShutdown message event on success, which should be relayed.
22303  *
22304  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
22305  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
22306  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
22307  */
22308 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id);
22309
22310 /**
22311  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
22312  * will be accepted on the given channel, and after additional timeout/the closing of all
22313  * pending HTLCs, the channel will be closed on chain.
22314  *
22315  * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
22316  * the channel being closed or not:
22317  *  * If we are the channel initiator, we will pay at least this feerate on the closing
22318  *    transaction. The upper-bound is set by
22319  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
22320  *    estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
22321  *  * If our counterparty is the channel initiator, we will refuse to accept a channel closure
22322  *    transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
22323  *    will appear on a force-closure transaction, whichever is lower).
22324  *
22325  * May generate a SendShutdown message event on success, which should be relayed.
22326  *
22327  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
22328  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
22329  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
22330  */
22331 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], struct LDKPublicKey counterparty_node_id, uint32_t target_feerate_sats_per_1000_weight);
22332
22333 /**
22334  * Force closes a channel, immediately broadcasting the latest local transaction(s) and
22335  * rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to
22336  * the manager, or if the `counterparty_node_id` isn't the counterparty of the corresponding
22337  * channel.
22338  */
22339 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id);
22340
22341 /**
22342  * Force closes a channel, rejecting new HTLCs on the given channel but skips broadcasting
22343  * the latest local transaction(s). Fails if `channel_id` is unknown to the manager, or if the
22344  * `counterparty_node_id` isn't the counterparty of the corresponding channel.
22345  *
22346  * You can always get the latest local transaction(s) to broadcast from
22347  * [`ChannelMonitor::get_latest_holder_commitment_txn`].
22348  */
22349 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id);
22350
22351 /**
22352  * Force close all channels, immediately broadcasting the latest local commitment transaction
22353  * for each to the chain and rejecting new HTLCs on each.
22354  */
22355 void ChannelManager_force_close_all_channels_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg);
22356
22357 /**
22358  * Force close all channels rejecting new HTLCs on each but without broadcasting the latest
22359  * local transaction(s).
22360  */
22361 void ChannelManager_force_close_all_channels_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg);
22362
22363 /**
22364  * Sends a payment along a given route.
22365  *
22366  * Value parameters are provided via the last hop in route, see documentation for RouteHop
22367  * fields for more info.
22368  *
22369  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
22370  * payment), we don't do anything to stop you! We always try to ensure that if the provided
22371  * next hop knows the preimage to payment_hash they can claim an additional amount as
22372  * specified in the last hop in the route! Thus, you should probably do your own
22373  * payment_preimage tracking (which you should already be doing as they represent \"proof of
22374  * payment\") and prevent double-sends yourself.
22375  *
22376  * May generate SendHTLCs message(s) event on success, which should be relayed.
22377  *
22378  * Each path may have a different return value, and PaymentSendValue may return a Vec with
22379  * each entry matching the corresponding-index entry in the route paths, see
22380  * PaymentSendFailure for more info.
22381  *
22382  * In general, a path may raise:
22383  *  * [`APIError::RouteError`] when an invalid route or forwarding parameter (cltv_delta, fee,
22384  *    node public key) is specified.
22385  *  * [`APIError::ChannelUnavailable`] if the next-hop channel is not available for updates
22386  *    (including due to previous monitor update failure or new permanent monitor update
22387  *    failure).
22388  *  * [`APIError::MonitorUpdateInProgress`] if a new monitor update failure prevented sending the
22389  *    relevant updates.
22390  *
22391  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
22392  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
22393  * different route unless you intend to pay twice!
22394  *
22395  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
22396  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
22397  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
22398  * must not contain multiple paths as multi-path payments require a recipient-provided
22399  * payment_secret.
22400  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
22401  * bit set (either as required or as available). If multiple paths are present in the Route,
22402  * we assume the invoice had the basic_mpp feature set.
22403  *
22404  * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
22405  */
22406 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);
22407
22408 /**
22409  * Retries a payment along the given [`Route`].
22410  *
22411  * Errors returned are a superset of those returned from [`send_payment`], so see
22412  * [`send_payment`] documentation for more details on errors. This method will also error if the
22413  * retry amount puts the payment more than 10% over the payment's total amount, if the payment
22414  * for the given `payment_id` cannot be found (likely due to timeout or success), or if
22415  * further retries have been disabled with [`abandon_payment`].
22416  *
22417  * [`send_payment`]: [`ChannelManager::send_payment`]
22418  * [`abandon_payment`]: [`ChannelManager::abandon_payment`]
22419  */
22420 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);
22421
22422 /**
22423  * Signals that no further retries for the given payment will occur.
22424  *
22425  * After this method returns, any future calls to [`retry_payment`] for the given `payment_id`
22426  * will fail with [`PaymentSendFailure::ParameterError`]. If no such event has been generated,
22427  * an [`Event::PaymentFailed`] event will be generated as soon as there are no remaining
22428  * pending HTLCs for this payment.
22429  *
22430  * Note that calling this method does *not* prevent a payment from succeeding. You must still
22431  * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
22432  * determine the ultimate status of a payment.
22433  *
22434  * [`retry_payment`]: Self::retry_payment
22435  * [`Event::PaymentFailed`]: events::Event::PaymentFailed
22436  * [`Event::PaymentSent`]: events::Event::PaymentSent
22437  */
22438 void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id);
22439
22440 /**
22441  * Send a spontaneous payment, which is a payment that does not require the recipient to have
22442  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
22443  * the preimage, it must be a cryptographically secure random value that no intermediate node
22444  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
22445  * never reach the recipient.
22446  *
22447  * See [`send_payment`] documentation for more details on the return value of this function.
22448  *
22449  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
22450  * [`send_payment`] for more information about the risks of duplicate preimage usage.
22451  *
22452  * Note that `route` must have exactly one path.
22453  *
22454  * [`send_payment`]: Self::send_payment
22455  *
22456  * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
22457  */
22458 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);
22459
22460 /**
22461  * Send a payment that is probing the given route for liquidity. We calculate the
22462  * [`PaymentHash`] of probes based on a static secret and a random [`PaymentId`], which allows
22463  * us to easily discern them from real payments.
22464  */
22465 MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCVec_RouteHopZ hops);
22466
22467 /**
22468  * Call this upon creation of a funding transaction for the given channel.
22469  *
22470  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
22471  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
22472  *
22473  * Returns [`APIError::APIMisuseError`] if the funding transaction is not final for propagation
22474  * across the p2p network.
22475  *
22476  * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided
22477  * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`].
22478  *
22479  * May panic if the output found in the funding transaction is duplicative with some other
22480  * channel (note that this should be trivially prevented by using unique funding transaction
22481  * keys per-channel).
22482  *
22483  * Do NOT broadcast the funding transaction yourself. When we have safely received our
22484  * counterparty's signature the funding transaction will automatically be broadcast via the
22485  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
22486  *
22487  * Note that this includes RBF or similar transaction replacement strategies - lightning does
22488  * not currently support replacing a funding transaction on an existing channel. Instead,
22489  * create a new channel with a conflicting funding transaction.
22490  *
22491  * Note to keep the miner incentives aligned in moving the blockchain forward, we recommend
22492  * the wallet software generating the funding transaction to apply anti-fee sniping as
22493  * implemented by Bitcoin Core wallet. See <https://bitcoinops.org/en/topics/fee-sniping/>
22494  * for more details.
22495  *
22496  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
22497  * [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed
22498  */
22499 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 LDKPublicKey counterparty_node_id, struct LDKTransaction funding_transaction);
22500
22501 /**
22502  * Atomically updates the [`ChannelConfig`] for the given channels.
22503  *
22504  * Once the updates are applied, each eligible channel (advertised with a known short channel
22505  * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`],
22506  * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated
22507  * containing the new [`ChannelUpdate`] message which should be broadcast to the network.
22508  *
22509  * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect
22510  * `counterparty_node_id` is provided.
22511  *
22512  * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value
22513  * below [`MIN_CLTV_EXPIRY_DELTA`].
22514  *
22515  * If an error is returned, none of the updates should be considered applied.
22516  *
22517  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
22518  * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat
22519  * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta
22520  * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate
22521  * [`ChannelUpdate`]: msgs::ChannelUpdate
22522  * [`ChannelUnavailable`]: APIError::ChannelUnavailable
22523  * [`APIMisuseError`]: APIError::APIMisuseError
22524  */
22525 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_update_channel_config(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCVec_ThirtyTwoBytesZ channel_ids, const struct LDKChannelConfig *NONNULL_PTR config);
22526
22527 /**
22528  * Processes HTLCs which are pending waiting on random forward delay.
22529  *
22530  * Should only really ever be called in response to a PendingHTLCsForwardable event.
22531  * Will likely generate further events.
22532  */
22533 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
22534
22535 /**
22536  * Performs actions which should happen on startup and roughly once per minute thereafter.
22537  *
22538  * This currently includes:
22539  *  * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
22540  *  * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more
22541  *    than a minute, informing the network that they should no longer attempt to route over
22542  *    the channel.
22543  *  * Expiring a channel's previous `ChannelConfig` if necessary to only allow forwarding HTLCs
22544  *    with the current `ChannelConfig`.
22545  *
22546  * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate
22547  * estimate fetches.
22548  */
22549 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
22550
22551 /**
22552  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
22553  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
22554  * along the path (including in our own channel on which we received it).
22555  *
22556  * Note that in some cases around unclean shutdown, it is possible the payment may have
22557  * already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a
22558  * second copy of) the [`events::Event::PaymentReceived`] event. Alternatively, the payment
22559  * may have already been failed automatically by LDK if it was nearing its expiration time.
22560  *
22561  * While LDK will never claim a payment automatically on your behalf (i.e. without you calling
22562  * [`ChannelManager::claim_funds`]), you should still monitor for
22563  * [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on
22564  * startup during which time claims that were in-progress at shutdown may be replayed.
22565  */
22566 void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
22567
22568 /**
22569  * Provides a payment preimage in response to [`Event::PaymentReceived`], generating any
22570  * [`MessageSendEvent`]s needed to claim the payment.
22571  *
22572  * Note that calling this method does *not* guarantee that the payment has been claimed. You
22573  * *must* wait for an [`Event::PaymentClaimed`] event which upon a successful claim will be
22574  * provided to your [`EventHandler`] when [`process_pending_events`] is next called.
22575  *
22576  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
22577  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
22578  * event matches your expectation. If you fail to do so and call this method, you may provide
22579  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
22580  *
22581  * [`Event::PaymentReceived`]: crate::util::events::Event::PaymentReceived
22582  * [`Event::PaymentClaimed`]: crate::util::events::Event::PaymentClaimed
22583  * [`process_pending_events`]: EventsProvider::process_pending_events
22584  * [`create_inbound_payment`]: Self::create_inbound_payment
22585  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
22586  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
22587  */
22588 void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
22589
22590 /**
22591  * Gets the node_id held by this ChannelManager
22592  */
22593 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
22594
22595 /**
22596  * Accepts a request to open a channel after a [`Event::OpenChannelRequest`].
22597  *
22598  * The `temporary_channel_id` parameter indicates which inbound channel should be accepted,
22599  * and the `counterparty_node_id` parameter is the id of the peer which has requested to open
22600  * the channel.
22601  *
22602  * The `user_channel_id` parameter will be provided back in
22603  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
22604  * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
22605  *
22606  * Note that this method will return an error and reject the channel, if it requires support
22607  * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be
22608  * used to accept such channels.
22609  *
22610  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
22611  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
22612  */
22613 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, uint64_t user_channel_id);
22614
22615 /**
22616  * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating
22617  * it as confirmed immediately.
22618  *
22619  * The `user_channel_id` parameter will be provided back in
22620  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
22621  * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
22622  *
22623  * Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel
22624  * and (if the counterparty agrees), enables forwarding of payments immediately.
22625  *
22626  * This fully trusts that the counterparty has honestly and correctly constructed the funding
22627  * transaction and blindly assumes that it will eventually confirm.
22628  *
22629  * If it does not confirm before we decide to close the channel, or if the funding transaction
22630  * does not pay to the correct script the correct amount, *you will lose funds*.
22631  *
22632  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
22633  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
22634  */
22635 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, uint64_t user_channel_id);
22636
22637 /**
22638  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
22639  * to pay us.
22640  *
22641  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
22642  * [`PaymentHash`] and [`PaymentPreimage`] for you.
22643  *
22644  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
22645  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
22646  * passed directly to [`claim_funds`].
22647  *
22648  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
22649  *
22650  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
22651  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
22652  *
22653  * # Note
22654  *
22655  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
22656  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
22657  *
22658  * Errors if `min_value_msat` is greater than total bitcoin supply.
22659  *
22660  * [`claim_funds`]: Self::claim_funds
22661  * [`PaymentReceived`]: events::Event::PaymentReceived
22662  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
22663  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
22664  */
22665 MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs);
22666
22667 /**
22668  * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share
22669  * serialized state with LDK node(s) running 0.0.103 and earlier.
22670  *
22671  * May panic if `invoice_expiry_delta_secs` is greater than one year.
22672  *
22673  * # Note
22674  * This method is deprecated and will be removed soon.
22675  *
22676  * [`create_inbound_payment`]: Self::create_inbound_payment
22677  */
22678 MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ChannelManager_create_inbound_payment_legacy(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs);
22679
22680 /**
22681  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
22682  * stored external to LDK.
22683  *
22684  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
22685  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
22686  * the `min_value_msat` provided here, if one is provided.
22687  *
22688  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
22689  * note that LDK will not stop you from registering duplicate payment hashes for inbound
22690  * payments.
22691  *
22692  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
22693  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
22694  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
22695  * sender \"proof-of-payment\" unless they have paid the required amount.
22696  *
22697  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
22698  * in excess of the current time. This should roughly match the expiry time set in the invoice.
22699  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
22700  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
22701  * invoices when no timeout is set.
22702  *
22703  * Note that we use block header time to time-out pending inbound payments (with some margin
22704  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
22705  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
22706  * If you need exact expiry semantics, you should enforce them upon receipt of
22707  * [`PaymentReceived`].
22708  *
22709  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
22710  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
22711  *
22712  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
22713  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
22714  *
22715  * # Note
22716  *
22717  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
22718  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
22719  *
22720  * Errors if `min_value_msat` is greater than total bitcoin supply.
22721  *
22722  * [`create_inbound_payment`]: Self::create_inbound_payment
22723  * [`PaymentReceived`]: events::Event::PaymentReceived
22724  */
22725 MUST_USE_RES struct LDKCResult_PaymentSecretNoneZ 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);
22726
22727 /**
22728  * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
22729  * serialized state with LDK node(s) running 0.0.103 and earlier.
22730  *
22731  * May panic if `invoice_expiry_delta_secs` is greater than one year.
22732  *
22733  * # Note
22734  * This method is deprecated and will be removed soon.
22735  *
22736  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
22737  */
22738 MUST_USE_RES struct LDKCResult_PaymentSecretAPIErrorZ ChannelManager_create_inbound_payment_for_hash_legacy(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs);
22739
22740 /**
22741  * Gets an LDK-generated payment preimage from a payment hash and payment secret that were
22742  * previously returned from [`create_inbound_payment`].
22743  *
22744  * [`create_inbound_payment`]: Self::create_inbound_payment
22745  */
22746 MUST_USE_RES struct LDKCResult_PaymentPreimageAPIErrorZ ChannelManager_get_payment_preimage(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
22747
22748 /**
22749  * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
22750  * are used when constructing the phantom invoice's route hints.
22751  *
22752  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
22753  */
22754 MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg);
22755
22756 /**
22757  * Gets route hints for use in receiving [phantom node payments].
22758  *
22759  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
22760  */
22761 MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg);
22762
22763 /**
22764  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
22765  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
22766  */
22767 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
22768
22769 /**
22770  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
22771  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
22772  */
22773 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
22774
22775 /**
22776  * Constructs a new Listen which calls the relevant methods on this_arg.
22777  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
22778  */
22779 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
22780
22781 /**
22782  * Constructs a new Confirm which calls the relevant methods on this_arg.
22783  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
22784  */
22785 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
22786
22787 /**
22788  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
22789  * indicating whether persistence is necessary. Only one listener on
22790  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
22791  * up.
22792  *
22793  * Note that this method is not available with the `no-std` feature.
22794  */
22795 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
22796
22797 /**
22798  * Blocks until ChannelManager needs to be persisted. Only one listener on
22799  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
22800  * up.
22801  */
22802 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
22803
22804 /**
22805  * Gets a [`Future`] that completes when a persistable update is available. Note that
22806  * callbacks registered on the [`Future`] MUST NOT call back into this [`ChannelManager`] and
22807  * should instead register actions to be taken later.
22808  */
22809 MUST_USE_RES struct LDKFuture ChannelManager_get_persistable_update_future(const struct LDKChannelManager *NONNULL_PTR this_arg);
22810
22811 /**
22812  * Gets the latest best block which was connected either via the [`chain::Listen`] or
22813  * [`chain::Confirm`] interfaces.
22814  */
22815 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
22816
22817 /**
22818  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
22819  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
22820  */
22821 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
22822
22823 /**
22824  * Fetches the set of [`NodeFeatures`] flags which are provided by or required by
22825  * [`ChannelManager`].
22826  */
22827 struct LDKNodeFeatures provided_node_features(void);
22828
22829 /**
22830  * Fetches the set of [`ChannelFeatures`] flags which are provided by or required by
22831  * [`ChannelManager`].
22832  */
22833 struct LDKChannelFeatures provided_channel_features(void);
22834
22835 /**
22836  * Fetches the set of [`InitFeatures`] flags which are provided by or required by
22837  * [`ChannelManager`].
22838  */
22839 struct LDKInitFeatures provided_init_features(void);
22840
22841 /**
22842  * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read
22843  */
22844 struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj);
22845
22846 /**
22847  * Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write
22848  */
22849 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser);
22850
22851 /**
22852  * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read
22853  */
22854 struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj);
22855
22856 /**
22857  * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write
22858  */
22859 struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser);
22860
22861 /**
22862  * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read
22863  */
22864 struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj);
22865
22866 /**
22867  * Read a ChannelDetails from a byte array, created by ChannelDetails_write
22868  */
22869 struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser);
22870
22871 /**
22872  * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read
22873  */
22874 struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj);
22875
22876 /**
22877  * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write
22878  */
22879 struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser);
22880
22881 /**
22882  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
22883  */
22884 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
22885
22886 /**
22887  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
22888  */
22889 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
22890
22891 /**
22892  * The keys provider which will give us relevant keys. Some keys will be loaded during
22893  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
22894  * signing data.
22895  */
22896 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
22897
22898 /**
22899  * The keys provider which will give us relevant keys. Some keys will be loaded during
22900  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
22901  * signing data.
22902  */
22903 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
22904
22905 /**
22906  * The fee_estimator for use in the ChannelManager in the future.
22907  *
22908  * No calls to the FeeEstimator will be made during deserialization.
22909  */
22910 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
22911
22912 /**
22913  * The fee_estimator for use in the ChannelManager in the future.
22914  *
22915  * No calls to the FeeEstimator will be made during deserialization.
22916  */
22917 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
22918
22919 /**
22920  * The chain::Watch for use in the ChannelManager in the future.
22921  *
22922  * No calls to the chain::Watch will be made during deserialization. It is assumed that
22923  * you have deserialized ChannelMonitors separately and will add them to your
22924  * chain::Watch after deserializing this ChannelManager.
22925  */
22926 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
22927
22928 /**
22929  * The chain::Watch for use in the ChannelManager in the future.
22930  *
22931  * No calls to the chain::Watch will be made during deserialization. It is assumed that
22932  * you have deserialized ChannelMonitors separately and will add them to your
22933  * chain::Watch after deserializing this ChannelManager.
22934  */
22935 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
22936
22937 /**
22938  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
22939  * used to broadcast the latest local commitment transactions of channels which must be
22940  * force-closed during deserialization.
22941  */
22942 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
22943
22944 /**
22945  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
22946  * used to broadcast the latest local commitment transactions of channels which must be
22947  * force-closed during deserialization.
22948  */
22949 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
22950
22951 /**
22952  * The Logger for use in the ChannelManager and which may be used to log information during
22953  * deserialization.
22954  */
22955 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
22956
22957 /**
22958  * The Logger for use in the ChannelManager and which may be used to log information during
22959  * deserialization.
22960  */
22961 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
22962
22963 /**
22964  * Default settings used for new channels. Any existing channels will continue to use the
22965  * runtime settings which were stored when the ChannelManager was serialized.
22966  */
22967 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
22968
22969 /**
22970  * Default settings used for new channels. Any existing channels will continue to use the
22971  * runtime settings which were stored when the ChannelManager was serialized.
22972  */
22973 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
22974
22975 /**
22976  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
22977  * HashMap for you. This is primarily useful for C bindings where it is not practical to
22978  * populate a HashMap directly from C.
22979  */
22980 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);
22981
22982 /**
22983  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
22984  */
22985 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
22986
22987 /**
22988  * Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL.
22989  */
22990 void ExpandedKey_free(struct LDKExpandedKey this_obj);
22991
22992 /**
22993  * Create a  new [`ExpandedKey`] for generating an inbound payment hash and secret.
22994  *
22995  * It is recommended to cache this value and not regenerate it for each new inbound payment.
22996  */
22997 MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material)[32]);
22998
22999 /**
23000  * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no
23001  * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without
23002  * a `ChannelManager`.
23003  *
23004  * `keys` is generated by calling [`KeysInterface::get_inbound_payment_key_material`] and then
23005  * calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not
23006  * regenerate it for each new inbound payment.
23007  *
23008  * `current_time` is a Unix timestamp representing the current time.
23009  *
23010  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
23011  */
23012 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ create(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, const struct LDKKeysInterface *NONNULL_PTR keys_manager, uint64_t current_time);
23013
23014 /**
23015  * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`],
23016  * but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments]
23017  * without a `ChannelManager`.
23018  *
23019  * See [`create`] for information on the `keys` and `current_time` parameters.
23020  *
23021  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
23022  */
23023 struct LDKCResult_PaymentSecretNoneZ create_from_hash(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, uint64_t current_time);
23024
23025 /**
23026  * Frees any resources used by the DecodeError
23027  */
23028 void DecodeError_free(struct LDKDecodeError this_ptr);
23029
23030 /**
23031  * Creates a copy of the DecodeError
23032  */
23033 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
23034
23035 /**
23036  * Utility method to constructs a new UnknownVersion-variant DecodeError
23037  */
23038 struct LDKDecodeError DecodeError_unknown_version(void);
23039
23040 /**
23041  * Utility method to constructs a new UnknownRequiredFeature-variant DecodeError
23042  */
23043 struct LDKDecodeError DecodeError_unknown_required_feature(void);
23044
23045 /**
23046  * Utility method to constructs a new InvalidValue-variant DecodeError
23047  */
23048 struct LDKDecodeError DecodeError_invalid_value(void);
23049
23050 /**
23051  * Utility method to constructs a new ShortRead-variant DecodeError
23052  */
23053 struct LDKDecodeError DecodeError_short_read(void);
23054
23055 /**
23056  * Utility method to constructs a new BadLengthDescriptor-variant DecodeError
23057  */
23058 struct LDKDecodeError DecodeError_bad_length_descriptor(void);
23059
23060 /**
23061  * Utility method to constructs a new Io-variant DecodeError
23062  */
23063 struct LDKDecodeError DecodeError_io(enum LDKIOError a);
23064
23065 /**
23066  * Utility method to constructs a new UnsupportedCompression-variant DecodeError
23067  */
23068 struct LDKDecodeError DecodeError_unsupported_compression(void);
23069
23070 /**
23071  * Checks if two DecodeErrors contain equal inner contents.
23072  * This ignores pointers and is_owned flags and looks at the values in fields.
23073  */
23074 bool DecodeError_eq(const struct LDKDecodeError *NONNULL_PTR a, const struct LDKDecodeError *NONNULL_PTR b);
23075
23076 /**
23077  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
23078  */
23079 void Init_free(struct LDKInit this_obj);
23080
23081 /**
23082  * The relevant features which the sender supports
23083  */
23084 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
23085
23086 /**
23087  * The relevant features which the sender supports
23088  */
23089 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
23090
23091 /**
23092  * The receipient's network address. This adds the option to report a remote IP address
23093  * back to a connecting peer using the init message. A node can decide to use that information
23094  * to discover a potential update to its public IPv4 address (NAT) and use
23095  * that for a node_announcement update message containing the new address.
23096  */
23097 struct LDKCOption_NetAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr);
23098
23099 /**
23100  * The receipient's network address. This adds the option to report a remote IP address
23101  * back to a connecting peer using the init message. A node can decide to use that information
23102  * to discover a potential update to its public IPv4 address (NAT) and use
23103  * that for a node_announcement update message containing the new address.
23104  */
23105 void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_NetAddressZ val);
23106
23107 /**
23108  * Constructs a new Init given each field
23109  */
23110 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_NetAddressZ remote_network_address_arg);
23111
23112 /**
23113  * Creates a copy of the Init
23114  */
23115 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
23116
23117 /**
23118  * Checks if two Inits contain equal inner contents.
23119  * This ignores pointers and is_owned flags and looks at the values in fields.
23120  * Two objects with NULL inner values will be considered "equal" here.
23121  */
23122 bool Init_eq(const struct LDKInit *NONNULL_PTR a, const struct LDKInit *NONNULL_PTR b);
23123
23124 /**
23125  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
23126  */
23127 void ErrorMessage_free(struct LDKErrorMessage this_obj);
23128
23129 /**
23130  * The channel ID involved in the error.
23131  *
23132  * All-0s indicates a general error unrelated to a specific channel, after which all channels
23133  * with the sending peer should be closed.
23134  */
23135 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
23136
23137 /**
23138  * The channel ID involved in the error.
23139  *
23140  * All-0s indicates a general error unrelated to a specific channel, after which all channels
23141  * with the sending peer should be closed.
23142  */
23143 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23144
23145 /**
23146  * A possibly human-readable error description.
23147  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
23148  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
23149  * the terminal emulator or the logging subsystem.
23150  */
23151 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
23152
23153 /**
23154  * A possibly human-readable error description.
23155  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
23156  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
23157  * the terminal emulator or the logging subsystem.
23158  */
23159 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
23160
23161 /**
23162  * Constructs a new ErrorMessage given each field
23163  */
23164 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
23165
23166 /**
23167  * Creates a copy of the ErrorMessage
23168  */
23169 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
23170
23171 /**
23172  * Checks if two ErrorMessages contain equal inner contents.
23173  * This ignores pointers and is_owned flags and looks at the values in fields.
23174  * Two objects with NULL inner values will be considered "equal" here.
23175  */
23176 bool ErrorMessage_eq(const struct LDKErrorMessage *NONNULL_PTR a, const struct LDKErrorMessage *NONNULL_PTR b);
23177
23178 /**
23179  * Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL.
23180  */
23181 void WarningMessage_free(struct LDKWarningMessage this_obj);
23182
23183 /**
23184  * The channel ID involved in the warning.
23185  *
23186  * All-0s indicates a warning unrelated to a specific channel.
23187  */
23188 const uint8_t (*WarningMessage_get_channel_id(const struct LDKWarningMessage *NONNULL_PTR this_ptr))[32];
23189
23190 /**
23191  * The channel ID involved in the warning.
23192  *
23193  * All-0s indicates a warning unrelated to a specific channel.
23194  */
23195 void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23196
23197 /**
23198  * A possibly human-readable warning description.
23199  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
23200  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
23201  * the terminal emulator or the logging subsystem.
23202  */
23203 struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PTR this_ptr);
23204
23205 /**
23206  * A possibly human-readable warning description.
23207  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
23208  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
23209  * the terminal emulator or the logging subsystem.
23210  */
23211 void WarningMessage_set_data(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKStr val);
23212
23213 /**
23214  * Constructs a new WarningMessage given each field
23215  */
23216 MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
23217
23218 /**
23219  * Creates a copy of the WarningMessage
23220  */
23221 struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig);
23222
23223 /**
23224  * Checks if two WarningMessages contain equal inner contents.
23225  * This ignores pointers and is_owned flags and looks at the values in fields.
23226  * Two objects with NULL inner values will be considered "equal" here.
23227  */
23228 bool WarningMessage_eq(const struct LDKWarningMessage *NONNULL_PTR a, const struct LDKWarningMessage *NONNULL_PTR b);
23229
23230 /**
23231  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
23232  */
23233 void Ping_free(struct LDKPing this_obj);
23234
23235 /**
23236  * The desired response length
23237  */
23238 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
23239
23240 /**
23241  * The desired response length
23242  */
23243 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
23244
23245 /**
23246  * The ping packet size.
23247  * This field is not sent on the wire. byteslen zeros are sent.
23248  */
23249 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
23250
23251 /**
23252  * The ping packet size.
23253  * This field is not sent on the wire. byteslen zeros are sent.
23254  */
23255 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
23256
23257 /**
23258  * Constructs a new Ping given each field
23259  */
23260 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
23261
23262 /**
23263  * Creates a copy of the Ping
23264  */
23265 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
23266
23267 /**
23268  * Checks if two Pings contain equal inner contents.
23269  * This ignores pointers and is_owned flags and looks at the values in fields.
23270  * Two objects with NULL inner values will be considered "equal" here.
23271  */
23272 bool Ping_eq(const struct LDKPing *NONNULL_PTR a, const struct LDKPing *NONNULL_PTR b);
23273
23274 /**
23275  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
23276  */
23277 void Pong_free(struct LDKPong this_obj);
23278
23279 /**
23280  * The pong packet size.
23281  * This field is not sent on the wire. byteslen zeros are sent.
23282  */
23283 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
23284
23285 /**
23286  * The pong packet size.
23287  * This field is not sent on the wire. byteslen zeros are sent.
23288  */
23289 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
23290
23291 /**
23292  * Constructs a new Pong given each field
23293  */
23294 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
23295
23296 /**
23297  * Creates a copy of the Pong
23298  */
23299 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
23300
23301 /**
23302  * Checks if two Pongs contain equal inner contents.
23303  * This ignores pointers and is_owned flags and looks at the values in fields.
23304  * Two objects with NULL inner values will be considered "equal" here.
23305  */
23306 bool Pong_eq(const struct LDKPong *NONNULL_PTR a, const struct LDKPong *NONNULL_PTR b);
23307
23308 /**
23309  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
23310  */
23311 void OpenChannel_free(struct LDKOpenChannel this_obj);
23312
23313 /**
23314  * The genesis hash of the blockchain where the channel is to be opened
23315  */
23316 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
23317
23318 /**
23319  * The genesis hash of the blockchain where the channel is to be opened
23320  */
23321 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23322
23323 /**
23324  * A temporary channel ID, until the funding outpoint is announced
23325  */
23326 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
23327
23328 /**
23329  * A temporary channel ID, until the funding outpoint is announced
23330  */
23331 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23332
23333 /**
23334  * The channel value
23335  */
23336 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
23337
23338 /**
23339  * The channel value
23340  */
23341 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
23342
23343 /**
23344  * The amount to push to the counterparty as part of the open, in milli-satoshi
23345  */
23346 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
23347
23348 /**
23349  * The amount to push to the counterparty as part of the open, in milli-satoshi
23350  */
23351 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
23352
23353 /**
23354  * The threshold below which outputs on transactions broadcast by sender will be omitted
23355  */
23356 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
23357
23358 /**
23359  * The threshold below which outputs on transactions broadcast by sender will be omitted
23360  */
23361 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
23362
23363 /**
23364  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
23365  */
23366 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
23367
23368 /**
23369  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
23370  */
23371 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
23372
23373 /**
23374  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
23375  */
23376 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
23377
23378 /**
23379  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
23380  */
23381 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
23382
23383 /**
23384  * The minimum HTLC size incoming to sender, in milli-satoshi
23385  */
23386 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
23387
23388 /**
23389  * The minimum HTLC size incoming to sender, in milli-satoshi
23390  */
23391 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
23392
23393 /**
23394  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
23395  */
23396 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
23397
23398 /**
23399  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
23400  */
23401 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
23402
23403 /**
23404  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
23405  */
23406 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
23407
23408 /**
23409  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
23410  */
23411 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
23412
23413 /**
23414  * The maximum number of inbound HTLCs towards sender
23415  */
23416 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
23417
23418 /**
23419  * The maximum number of inbound HTLCs towards sender
23420  */
23421 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
23422
23423 /**
23424  * The sender's key controlling the funding transaction
23425  */
23426 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
23427
23428 /**
23429  * The sender's key controlling the funding transaction
23430  */
23431 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23432
23433 /**
23434  * Used to derive a revocation key for transactions broadcast by counterparty
23435  */
23436 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
23437
23438 /**
23439  * Used to derive a revocation key for transactions broadcast by counterparty
23440  */
23441 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23442
23443 /**
23444  * A payment key to sender for transactions broadcast by counterparty
23445  */
23446 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
23447
23448 /**
23449  * A payment key to sender for transactions broadcast by counterparty
23450  */
23451 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23452
23453 /**
23454  * Used to derive a payment key to sender for transactions broadcast by sender
23455  */
23456 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
23457
23458 /**
23459  * Used to derive a payment key to sender for transactions broadcast by sender
23460  */
23461 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23462
23463 /**
23464  * Used to derive an HTLC payment key to sender
23465  */
23466 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
23467
23468 /**
23469  * Used to derive an HTLC payment key to sender
23470  */
23471 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23472
23473 /**
23474  * The first to-be-broadcast-by-sender transaction's per commitment point
23475  */
23476 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
23477
23478 /**
23479  * The first to-be-broadcast-by-sender transaction's per commitment point
23480  */
23481 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23482
23483 /**
23484  * Channel flags
23485  */
23486 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
23487
23488 /**
23489  * Channel flags
23490  */
23491 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
23492
23493 /**
23494  * The channel type that this channel will represent. If none is set, we derive the channel
23495  * type from the intersection of our feature bits with our counterparty's feature bits from
23496  * the Init message.
23497  *
23498  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23499  */
23500 struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
23501
23502 /**
23503  * The channel type that this channel will represent. If none is set, we derive the channel
23504  * type from the intersection of our feature bits with our counterparty's feature bits from
23505  * the Init message.
23506  *
23507  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23508  */
23509 void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
23510
23511 /**
23512  * Creates a copy of the OpenChannel
23513  */
23514 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
23515
23516 /**
23517  * Checks if two OpenChannels contain equal inner contents.
23518  * This ignores pointers and is_owned flags and looks at the values in fields.
23519  * Two objects with NULL inner values will be considered "equal" here.
23520  */
23521 bool OpenChannel_eq(const struct LDKOpenChannel *NONNULL_PTR a, const struct LDKOpenChannel *NONNULL_PTR b);
23522
23523 /**
23524  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
23525  */
23526 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
23527
23528 /**
23529  * A temporary channel ID, until the funding outpoint is announced
23530  */
23531 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
23532
23533 /**
23534  * A temporary channel ID, until the funding outpoint is announced
23535  */
23536 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23537
23538 /**
23539  * The threshold below which outputs on transactions broadcast by sender will be omitted
23540  */
23541 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23542
23543 /**
23544  * The threshold below which outputs on transactions broadcast by sender will be omitted
23545  */
23546 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
23547
23548 /**
23549  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
23550  */
23551 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23552
23553 /**
23554  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
23555  */
23556 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
23557
23558 /**
23559  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
23560  */
23561 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23562
23563 /**
23564  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
23565  */
23566 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
23567
23568 /**
23569  * The minimum HTLC size incoming to sender, in milli-satoshi
23570  */
23571 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23572
23573 /**
23574  * The minimum HTLC size incoming to sender, in milli-satoshi
23575  */
23576 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
23577
23578 /**
23579  * Minimum depth of the funding transaction before the channel is considered open
23580  */
23581 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23582
23583 /**
23584  * Minimum depth of the funding transaction before the channel is considered open
23585  */
23586 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
23587
23588 /**
23589  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
23590  */
23591 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23592
23593 /**
23594  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
23595  */
23596 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
23597
23598 /**
23599  * The maximum number of inbound HTLCs towards sender
23600  */
23601 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23602
23603 /**
23604  * The maximum number of inbound HTLCs towards sender
23605  */
23606 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
23607
23608 /**
23609  * The sender's key controlling the funding transaction
23610  */
23611 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23612
23613 /**
23614  * The sender's key controlling the funding transaction
23615  */
23616 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23617
23618 /**
23619  * Used to derive a revocation key for transactions broadcast by counterparty
23620  */
23621 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23622
23623 /**
23624  * Used to derive a revocation key for transactions broadcast by counterparty
23625  */
23626 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23627
23628 /**
23629  * A payment key to sender for transactions broadcast by counterparty
23630  */
23631 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23632
23633 /**
23634  * A payment key to sender for transactions broadcast by counterparty
23635  */
23636 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23637
23638 /**
23639  * Used to derive a payment key to sender for transactions broadcast by sender
23640  */
23641 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23642
23643 /**
23644  * Used to derive a payment key to sender for transactions broadcast by sender
23645  */
23646 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23647
23648 /**
23649  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
23650  */
23651 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23652
23653 /**
23654  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
23655  */
23656 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23657
23658 /**
23659  * The first to-be-broadcast-by-sender transaction's per commitment point
23660  */
23661 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23662
23663 /**
23664  * The first to-be-broadcast-by-sender transaction's per commitment point
23665  */
23666 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23667
23668 /**
23669  * The channel type that this channel will represent. If none is set, we derive the channel
23670  * type from the intersection of our feature bits with our counterparty's feature bits from
23671  * the Init message.
23672  *
23673  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
23674  *
23675  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23676  */
23677 struct LDKChannelTypeFeatures AcceptChannel_get_channel_type(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
23678
23679 /**
23680  * The channel type that this channel will represent. If none is set, we derive the channel
23681  * type from the intersection of our feature bits with our counterparty's feature bits from
23682  * the Init message.
23683  *
23684  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
23685  *
23686  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23687  */
23688 void AcceptChannel_set_channel_type(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
23689
23690 /**
23691  * Creates a copy of the AcceptChannel
23692  */
23693 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
23694
23695 /**
23696  * Checks if two AcceptChannels contain equal inner contents.
23697  * This ignores pointers and is_owned flags and looks at the values in fields.
23698  * Two objects with NULL inner values will be considered "equal" here.
23699  */
23700 bool AcceptChannel_eq(const struct LDKAcceptChannel *NONNULL_PTR a, const struct LDKAcceptChannel *NONNULL_PTR b);
23701
23702 /**
23703  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
23704  */
23705 void FundingCreated_free(struct LDKFundingCreated this_obj);
23706
23707 /**
23708  * A temporary channel ID, until the funding is established
23709  */
23710 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
23711
23712 /**
23713  * A temporary channel ID, until the funding is established
23714  */
23715 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23716
23717 /**
23718  * The funding transaction ID
23719  */
23720 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
23721
23722 /**
23723  * The funding transaction ID
23724  */
23725 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23726
23727 /**
23728  * The specific output index funding this channel
23729  */
23730 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
23731
23732 /**
23733  * The specific output index funding this channel
23734  */
23735 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
23736
23737 /**
23738  * The signature of the channel initiator (funder) on the initial commitment transaction
23739  */
23740 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
23741
23742 /**
23743  * The signature of the channel initiator (funder) on the initial commitment transaction
23744  */
23745 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
23746
23747 /**
23748  * Constructs a new FundingCreated given each field
23749  */
23750 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);
23751
23752 /**
23753  * Creates a copy of the FundingCreated
23754  */
23755 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
23756
23757 /**
23758  * Checks if two FundingCreateds contain equal inner contents.
23759  * This ignores pointers and is_owned flags and looks at the values in fields.
23760  * Two objects with NULL inner values will be considered "equal" here.
23761  */
23762 bool FundingCreated_eq(const struct LDKFundingCreated *NONNULL_PTR a, const struct LDKFundingCreated *NONNULL_PTR b);
23763
23764 /**
23765  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
23766  */
23767 void FundingSigned_free(struct LDKFundingSigned this_obj);
23768
23769 /**
23770  * The channel ID
23771  */
23772 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
23773
23774 /**
23775  * The channel ID
23776  */
23777 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23778
23779 /**
23780  * The signature of the channel acceptor (fundee) on the initial commitment transaction
23781  */
23782 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
23783
23784 /**
23785  * The signature of the channel acceptor (fundee) on the initial commitment transaction
23786  */
23787 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
23788
23789 /**
23790  * Constructs a new FundingSigned given each field
23791  */
23792 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
23793
23794 /**
23795  * Creates a copy of the FundingSigned
23796  */
23797 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
23798
23799 /**
23800  * Checks if two FundingSigneds contain equal inner contents.
23801  * This ignores pointers and is_owned flags and looks at the values in fields.
23802  * Two objects with NULL inner values will be considered "equal" here.
23803  */
23804 bool FundingSigned_eq(const struct LDKFundingSigned *NONNULL_PTR a, const struct LDKFundingSigned *NONNULL_PTR b);
23805
23806 /**
23807  * Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL.
23808  */
23809 void ChannelReady_free(struct LDKChannelReady this_obj);
23810
23811 /**
23812  * The channel ID
23813  */
23814 const uint8_t (*ChannelReady_get_channel_id(const struct LDKChannelReady *NONNULL_PTR this_ptr))[32];
23815
23816 /**
23817  * The channel ID
23818  */
23819 void ChannelReady_set_channel_id(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23820
23821 /**
23822  * The per-commitment point of the second commitment transaction
23823  */
23824 struct LDKPublicKey ChannelReady_get_next_per_commitment_point(const struct LDKChannelReady *NONNULL_PTR this_ptr);
23825
23826 /**
23827  * The per-commitment point of the second commitment transaction
23828  */
23829 void ChannelReady_set_next_per_commitment_point(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23830
23831 /**
23832  * If set, provides a short_channel_id alias for this channel. The sender will accept payments
23833  * to be forwarded over this SCID and forward them to this messages' recipient.
23834  */
23835 struct LDKCOption_u64Z ChannelReady_get_short_channel_id_alias(const struct LDKChannelReady *NONNULL_PTR this_ptr);
23836
23837 /**
23838  * If set, provides a short_channel_id alias for this channel. The sender will accept payments
23839  * to be forwarded over this SCID and forward them to this messages' recipient.
23840  */
23841 void ChannelReady_set_short_channel_id_alias(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
23842
23843 /**
23844  * Constructs a new ChannelReady given each field
23845  */
23846 MUST_USE_RES struct LDKChannelReady ChannelReady_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg, struct LDKCOption_u64Z short_channel_id_alias_arg);
23847
23848 /**
23849  * Creates a copy of the ChannelReady
23850  */
23851 struct LDKChannelReady ChannelReady_clone(const struct LDKChannelReady *NONNULL_PTR orig);
23852
23853 /**
23854  * Checks if two ChannelReadys contain equal inner contents.
23855  * This ignores pointers and is_owned flags and looks at the values in fields.
23856  * Two objects with NULL inner values will be considered "equal" here.
23857  */
23858 bool ChannelReady_eq(const struct LDKChannelReady *NONNULL_PTR a, const struct LDKChannelReady *NONNULL_PTR b);
23859
23860 /**
23861  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
23862  */
23863 void Shutdown_free(struct LDKShutdown this_obj);
23864
23865 /**
23866  * The channel ID
23867  */
23868 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
23869
23870 /**
23871  * The channel ID
23872  */
23873 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23874
23875 /**
23876  * The destination of this peer's funds on closing.
23877  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
23878  */
23879 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
23880
23881 /**
23882  * The destination of this peer's funds on closing.
23883  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
23884  */
23885 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
23886
23887 /**
23888  * Constructs a new Shutdown given each field
23889  */
23890 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
23891
23892 /**
23893  * Creates a copy of the Shutdown
23894  */
23895 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
23896
23897 /**
23898  * Checks if two Shutdowns contain equal inner contents.
23899  * This ignores pointers and is_owned flags and looks at the values in fields.
23900  * Two objects with NULL inner values will be considered "equal" here.
23901  */
23902 bool Shutdown_eq(const struct LDKShutdown *NONNULL_PTR a, const struct LDKShutdown *NONNULL_PTR b);
23903
23904 /**
23905  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
23906  */
23907 void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
23908
23909 /**
23910  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
23911  * transaction.
23912  */
23913 uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
23914
23915 /**
23916  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
23917  * transaction.
23918  */
23919 void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
23920
23921 /**
23922  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
23923  * transaction.
23924  */
23925 uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
23926
23927 /**
23928  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
23929  * transaction.
23930  */
23931 void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
23932
23933 /**
23934  * Constructs a new ClosingSignedFeeRange given each field
23935  */
23936 MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
23937
23938 /**
23939  * Creates a copy of the ClosingSignedFeeRange
23940  */
23941 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
23942
23943 /**
23944  * Checks if two ClosingSignedFeeRanges contain equal inner contents.
23945  * This ignores pointers and is_owned flags and looks at the values in fields.
23946  * Two objects with NULL inner values will be considered "equal" here.
23947  */
23948 bool ClosingSignedFeeRange_eq(const struct LDKClosingSignedFeeRange *NONNULL_PTR a, const struct LDKClosingSignedFeeRange *NONNULL_PTR b);
23949
23950 /**
23951  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
23952  */
23953 void ClosingSigned_free(struct LDKClosingSigned this_obj);
23954
23955 /**
23956  * The channel ID
23957  */
23958 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
23959
23960 /**
23961  * The channel ID
23962  */
23963 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23964
23965 /**
23966  * The proposed total fee for the closing transaction
23967  */
23968 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
23969
23970 /**
23971  * The proposed total fee for the closing transaction
23972  */
23973 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
23974
23975 /**
23976  * A signature on the closing transaction
23977  */
23978 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
23979
23980 /**
23981  * A signature on the closing transaction
23982  */
23983 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
23984
23985 /**
23986  * The minimum and maximum fees which the sender is willing to accept, provided only by new
23987  * nodes.
23988  *
23989  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23990  */
23991 struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
23992
23993 /**
23994  * The minimum and maximum fees which the sender is willing to accept, provided only by new
23995  * nodes.
23996  *
23997  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23998  */
23999 void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
24000
24001 /**
24002  * Constructs a new ClosingSigned given each field
24003  */
24004 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);
24005
24006 /**
24007  * Creates a copy of the ClosingSigned
24008  */
24009 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
24010
24011 /**
24012  * Checks if two ClosingSigneds contain equal inner contents.
24013  * This ignores pointers and is_owned flags and looks at the values in fields.
24014  * Two objects with NULL inner values will be considered "equal" here.
24015  */
24016 bool ClosingSigned_eq(const struct LDKClosingSigned *NONNULL_PTR a, const struct LDKClosingSigned *NONNULL_PTR b);
24017
24018 /**
24019  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
24020  */
24021 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
24022
24023 /**
24024  * The channel ID
24025  */
24026 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
24027
24028 /**
24029  * The channel ID
24030  */
24031 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24032
24033 /**
24034  * The HTLC ID
24035  */
24036 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
24037
24038 /**
24039  * The HTLC ID
24040  */
24041 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
24042
24043 /**
24044  * The HTLC value in milli-satoshi
24045  */
24046 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
24047
24048 /**
24049  * The HTLC value in milli-satoshi
24050  */
24051 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
24052
24053 /**
24054  * The payment hash, the pre-image of which controls HTLC redemption
24055  */
24056 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
24057
24058 /**
24059  * The payment hash, the pre-image of which controls HTLC redemption
24060  */
24061 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24062
24063 /**
24064  * The expiry height of the HTLC
24065  */
24066 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
24067
24068 /**
24069  * The expiry height of the HTLC
24070  */
24071 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
24072
24073 /**
24074  * Creates a copy of the UpdateAddHTLC
24075  */
24076 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
24077
24078 /**
24079  * Checks if two UpdateAddHTLCs contain equal inner contents.
24080  * This ignores pointers and is_owned flags and looks at the values in fields.
24081  * Two objects with NULL inner values will be considered "equal" here.
24082  */
24083 bool UpdateAddHTLC_eq(const struct LDKUpdateAddHTLC *NONNULL_PTR a, const struct LDKUpdateAddHTLC *NONNULL_PTR b);
24084
24085 /**
24086  * Frees any resources used by the OnionMessage, if is_owned is set and inner is non-NULL.
24087  */
24088 void OnionMessage_free(struct LDKOnionMessage this_obj);
24089
24090 /**
24091  * Used in decrypting the onion packet's payload.
24092  */
24093 struct LDKPublicKey OnionMessage_get_blinding_point(const struct LDKOnionMessage *NONNULL_PTR this_ptr);
24094
24095 /**
24096  * Used in decrypting the onion packet's payload.
24097  */
24098 void OnionMessage_set_blinding_point(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24099
24100 /**
24101  * Creates a copy of the OnionMessage
24102  */
24103 struct LDKOnionMessage OnionMessage_clone(const struct LDKOnionMessage *NONNULL_PTR orig);
24104
24105 /**
24106  * Checks if two OnionMessages contain equal inner contents.
24107  * This ignores pointers and is_owned flags and looks at the values in fields.
24108  * Two objects with NULL inner values will be considered "equal" here.
24109  */
24110 bool OnionMessage_eq(const struct LDKOnionMessage *NONNULL_PTR a, const struct LDKOnionMessage *NONNULL_PTR b);
24111
24112 /**
24113  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
24114  */
24115 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
24116
24117 /**
24118  * The channel ID
24119  */
24120 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
24121
24122 /**
24123  * The channel ID
24124  */
24125 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24126
24127 /**
24128  * The HTLC ID
24129  */
24130 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
24131
24132 /**
24133  * The HTLC ID
24134  */
24135 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
24136
24137 /**
24138  * The pre-image of the payment hash, allowing HTLC redemption
24139  */
24140 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
24141
24142 /**
24143  * The pre-image of the payment hash, allowing HTLC redemption
24144  */
24145 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24146
24147 /**
24148  * Constructs a new UpdateFulfillHTLC given each field
24149  */
24150 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
24151
24152 /**
24153  * Creates a copy of the UpdateFulfillHTLC
24154  */
24155 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
24156
24157 /**
24158  * Checks if two UpdateFulfillHTLCs contain equal inner contents.
24159  * This ignores pointers and is_owned flags and looks at the values in fields.
24160  * Two objects with NULL inner values will be considered "equal" here.
24161  */
24162 bool UpdateFulfillHTLC_eq(const struct LDKUpdateFulfillHTLC *NONNULL_PTR a, const struct LDKUpdateFulfillHTLC *NONNULL_PTR b);
24163
24164 /**
24165  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
24166  */
24167 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
24168
24169 /**
24170  * The channel ID
24171  */
24172 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
24173
24174 /**
24175  * The channel ID
24176  */
24177 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24178
24179 /**
24180  * The HTLC ID
24181  */
24182 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
24183
24184 /**
24185  * The HTLC ID
24186  */
24187 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
24188
24189 /**
24190  * Creates a copy of the UpdateFailHTLC
24191  */
24192 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
24193
24194 /**
24195  * Checks if two UpdateFailHTLCs contain equal inner contents.
24196  * This ignores pointers and is_owned flags and looks at the values in fields.
24197  * Two objects with NULL inner values will be considered "equal" here.
24198  */
24199 bool UpdateFailHTLC_eq(const struct LDKUpdateFailHTLC *NONNULL_PTR a, const struct LDKUpdateFailHTLC *NONNULL_PTR b);
24200
24201 /**
24202  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
24203  */
24204 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
24205
24206 /**
24207  * The channel ID
24208  */
24209 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
24210
24211 /**
24212  * The channel ID
24213  */
24214 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24215
24216 /**
24217  * The HTLC ID
24218  */
24219 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
24220
24221 /**
24222  * The HTLC ID
24223  */
24224 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
24225
24226 /**
24227  * The failure code
24228  */
24229 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
24230
24231 /**
24232  * The failure code
24233  */
24234 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
24235
24236 /**
24237  * Creates a copy of the UpdateFailMalformedHTLC
24238  */
24239 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
24240
24241 /**
24242  * Checks if two UpdateFailMalformedHTLCs contain equal inner contents.
24243  * This ignores pointers and is_owned flags and looks at the values in fields.
24244  * Two objects with NULL inner values will be considered "equal" here.
24245  */
24246 bool UpdateFailMalformedHTLC_eq(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR a, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR b);
24247
24248 /**
24249  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
24250  */
24251 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
24252
24253 /**
24254  * The channel ID
24255  */
24256 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
24257
24258 /**
24259  * The channel ID
24260  */
24261 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24262
24263 /**
24264  * A signature on the commitment transaction
24265  */
24266 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
24267
24268 /**
24269  * A signature on the commitment transaction
24270  */
24271 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
24272
24273 /**
24274  * Signatures on the HTLC transactions
24275  *
24276  * Returns a copy of the field.
24277  */
24278 struct LDKCVec_SignatureZ CommitmentSigned_get_htlc_signatures(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
24279
24280 /**
24281  * Signatures on the HTLC transactions
24282  */
24283 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
24284
24285 /**
24286  * Constructs a new CommitmentSigned given each field
24287  */
24288 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
24289
24290 /**
24291  * Creates a copy of the CommitmentSigned
24292  */
24293 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
24294
24295 /**
24296  * Checks if two CommitmentSigneds contain equal inner contents.
24297  * This ignores pointers and is_owned flags and looks at the values in fields.
24298  * Two objects with NULL inner values will be considered "equal" here.
24299  */
24300 bool CommitmentSigned_eq(const struct LDKCommitmentSigned *NONNULL_PTR a, const struct LDKCommitmentSigned *NONNULL_PTR b);
24301
24302 /**
24303  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
24304  */
24305 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
24306
24307 /**
24308  * The channel ID
24309  */
24310 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
24311
24312 /**
24313  * The channel ID
24314  */
24315 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24316
24317 /**
24318  * The secret corresponding to the per-commitment point
24319  */
24320 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
24321
24322 /**
24323  * The secret corresponding to the per-commitment point
24324  */
24325 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24326
24327 /**
24328  * The next sender-broadcast commitment transaction's per-commitment point
24329  */
24330 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
24331
24332 /**
24333  * The next sender-broadcast commitment transaction's per-commitment point
24334  */
24335 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24336
24337 /**
24338  * Constructs a new RevokeAndACK given each field
24339  */
24340 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);
24341
24342 /**
24343  * Creates a copy of the RevokeAndACK
24344  */
24345 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
24346
24347 /**
24348  * Checks if two RevokeAndACKs contain equal inner contents.
24349  * This ignores pointers and is_owned flags and looks at the values in fields.
24350  * Two objects with NULL inner values will be considered "equal" here.
24351  */
24352 bool RevokeAndACK_eq(const struct LDKRevokeAndACK *NONNULL_PTR a, const struct LDKRevokeAndACK *NONNULL_PTR b);
24353
24354 /**
24355  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
24356  */
24357 void UpdateFee_free(struct LDKUpdateFee this_obj);
24358
24359 /**
24360  * The channel ID
24361  */
24362 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
24363
24364 /**
24365  * The channel ID
24366  */
24367 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24368
24369 /**
24370  * Fee rate per 1000-weight of the transaction
24371  */
24372 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
24373
24374 /**
24375  * Fee rate per 1000-weight of the transaction
24376  */
24377 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
24378
24379 /**
24380  * Constructs a new UpdateFee given each field
24381  */
24382 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
24383
24384 /**
24385  * Creates a copy of the UpdateFee
24386  */
24387 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
24388
24389 /**
24390  * Checks if two UpdateFees contain equal inner contents.
24391  * This ignores pointers and is_owned flags and looks at the values in fields.
24392  * Two objects with NULL inner values will be considered "equal" here.
24393  */
24394 bool UpdateFee_eq(const struct LDKUpdateFee *NONNULL_PTR a, const struct LDKUpdateFee *NONNULL_PTR b);
24395
24396 /**
24397  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
24398  */
24399 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
24400
24401 /**
24402  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
24403  * belonging to the recipient
24404  */
24405 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
24406
24407 /**
24408  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
24409  * belonging to the recipient
24410  */
24411 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24412
24413 /**
24414  * The sender's per-commitment point for their current commitment transaction
24415  */
24416 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
24417
24418 /**
24419  * The sender's per-commitment point for their current commitment transaction
24420  */
24421 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24422
24423 /**
24424  * Constructs a new DataLossProtect given each field
24425  */
24426 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
24427
24428 /**
24429  * Creates a copy of the DataLossProtect
24430  */
24431 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
24432
24433 /**
24434  * Checks if two DataLossProtects contain equal inner contents.
24435  * This ignores pointers and is_owned flags and looks at the values in fields.
24436  * Two objects with NULL inner values will be considered "equal" here.
24437  */
24438 bool DataLossProtect_eq(const struct LDKDataLossProtect *NONNULL_PTR a, const struct LDKDataLossProtect *NONNULL_PTR b);
24439
24440 /**
24441  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
24442  */
24443 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
24444
24445 /**
24446  * The channel ID
24447  */
24448 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
24449
24450 /**
24451  * The channel ID
24452  */
24453 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24454
24455 /**
24456  * The next commitment number for the sender
24457  */
24458 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
24459
24460 /**
24461  * The next commitment number for the sender
24462  */
24463 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
24464
24465 /**
24466  * The next commitment number for the recipient
24467  */
24468 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
24469
24470 /**
24471  * The next commitment number for the recipient
24472  */
24473 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
24474
24475 /**
24476  * Creates a copy of the ChannelReestablish
24477  */
24478 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
24479
24480 /**
24481  * Checks if two ChannelReestablishs contain equal inner contents.
24482  * This ignores pointers and is_owned flags and looks at the values in fields.
24483  * Two objects with NULL inner values will be considered "equal" here.
24484  */
24485 bool ChannelReestablish_eq(const struct LDKChannelReestablish *NONNULL_PTR a, const struct LDKChannelReestablish *NONNULL_PTR b);
24486
24487 /**
24488  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
24489  */
24490 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
24491
24492 /**
24493  * The channel ID
24494  */
24495 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
24496
24497 /**
24498  * The channel ID
24499  */
24500 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24501
24502 /**
24503  * The short channel ID
24504  */
24505 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
24506
24507 /**
24508  * The short channel ID
24509  */
24510 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
24511
24512 /**
24513  * A signature by the node key
24514  */
24515 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
24516
24517 /**
24518  * A signature by the node key
24519  */
24520 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
24521
24522 /**
24523  * A signature by the funding key
24524  */
24525 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
24526
24527 /**
24528  * A signature by the funding key
24529  */
24530 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
24531
24532 /**
24533  * Constructs a new AnnouncementSignatures given each field
24534  */
24535 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);
24536
24537 /**
24538  * Creates a copy of the AnnouncementSignatures
24539  */
24540 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
24541
24542 /**
24543  * Checks if two AnnouncementSignaturess contain equal inner contents.
24544  * This ignores pointers and is_owned flags and looks at the values in fields.
24545  * Two objects with NULL inner values will be considered "equal" here.
24546  */
24547 bool AnnouncementSignatures_eq(const struct LDKAnnouncementSignatures *NONNULL_PTR a, const struct LDKAnnouncementSignatures *NONNULL_PTR b);
24548
24549 /**
24550  * Frees any resources used by the NetAddress
24551  */
24552 void NetAddress_free(struct LDKNetAddress this_ptr);
24553
24554 /**
24555  * Creates a copy of the NetAddress
24556  */
24557 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
24558
24559 /**
24560  * Utility method to constructs a new IPv4-variant NetAddress
24561  */
24562 struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port);
24563
24564 /**
24565  * Utility method to constructs a new IPv6-variant NetAddress
24566  */
24567 struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port);
24568
24569 /**
24570  * Utility method to constructs a new OnionV2-variant NetAddress
24571  */
24572 struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a);
24573
24574 /**
24575  * Utility method to constructs a new OnionV3-variant NetAddress
24576  */
24577 struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port);
24578
24579 /**
24580  * Utility method to constructs a new Hostname-variant NetAddress
24581  */
24582 struct LDKNetAddress NetAddress_hostname(struct LDKHostname hostname, uint16_t port);
24583
24584 /**
24585  * Checks if two NetAddresss contain equal inner contents.
24586  * This ignores pointers and is_owned flags and looks at the values in fields.
24587  */
24588 bool NetAddress_eq(const struct LDKNetAddress *NONNULL_PTR a, const struct LDKNetAddress *NONNULL_PTR b);
24589
24590 /**
24591  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
24592  */
24593 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
24594
24595 /**
24596  * Read a NetAddress from a byte array, created by NetAddress_write
24597  */
24598 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
24599
24600 /**
24601  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
24602  */
24603 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
24604
24605 /**
24606  * The advertised features
24607  */
24608 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
24609
24610 /**
24611  * The advertised features
24612  */
24613 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
24614
24615 /**
24616  * A strictly monotonic announcement counter, with gaps allowed
24617  */
24618 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
24619
24620 /**
24621  * A strictly monotonic announcement counter, with gaps allowed
24622  */
24623 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
24624
24625 /**
24626  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
24627  * to this node).
24628  */
24629 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
24630
24631 /**
24632  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
24633  * to this node).
24634  */
24635 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24636
24637 /**
24638  * An RGB color for UI purposes
24639  */
24640 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
24641
24642 /**
24643  * An RGB color for UI purposes
24644  */
24645 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
24646
24647 /**
24648  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
24649  * of uniqueness.
24650  */
24651 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
24652
24653 /**
24654  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
24655  * of uniqueness.
24656  */
24657 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24658
24659 /**
24660  * List of addresses on which this node is reachable
24661  *
24662  * Returns a copy of the field.
24663  */
24664 struct LDKCVec_NetAddressZ UnsignedNodeAnnouncement_get_addresses(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
24665
24666 /**
24667  * List of addresses on which this node is reachable
24668  */
24669 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
24670
24671 /**
24672  * Creates a copy of the UnsignedNodeAnnouncement
24673  */
24674 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
24675
24676 /**
24677  * Checks if two UnsignedNodeAnnouncements contain equal inner contents.
24678  * This ignores pointers and is_owned flags and looks at the values in fields.
24679  * Two objects with NULL inner values will be considered "equal" here.
24680  */
24681 bool UnsignedNodeAnnouncement_eq(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR a, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR b);
24682
24683 /**
24684  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
24685  */
24686 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
24687
24688 /**
24689  * The signature by the node key
24690  */
24691 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
24692
24693 /**
24694  * The signature by the node key
24695  */
24696 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
24697
24698 /**
24699  * The actual content of the announcement
24700  */
24701 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
24702
24703 /**
24704  * The actual content of the announcement
24705  */
24706 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
24707
24708 /**
24709  * Constructs a new NodeAnnouncement given each field
24710  */
24711 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
24712
24713 /**
24714  * Creates a copy of the NodeAnnouncement
24715  */
24716 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
24717
24718 /**
24719  * Checks if two NodeAnnouncements contain equal inner contents.
24720  * This ignores pointers and is_owned flags and looks at the values in fields.
24721  * Two objects with NULL inner values will be considered "equal" here.
24722  */
24723 bool NodeAnnouncement_eq(const struct LDKNodeAnnouncement *NONNULL_PTR a, const struct LDKNodeAnnouncement *NONNULL_PTR b);
24724
24725 /**
24726  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
24727  */
24728 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
24729
24730 /**
24731  * The advertised channel features
24732  */
24733 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
24734
24735 /**
24736  * The advertised channel features
24737  */
24738 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
24739
24740 /**
24741  * The genesis hash of the blockchain where the channel is to be opened
24742  */
24743 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
24744
24745 /**
24746  * The genesis hash of the blockchain where the channel is to be opened
24747  */
24748 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24749
24750 /**
24751  * The short channel ID
24752  */
24753 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
24754
24755 /**
24756  * The short channel ID
24757  */
24758 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
24759
24760 /**
24761  * One of the two node_ids which are endpoints of this channel
24762  */
24763 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
24764
24765 /**
24766  * One of the two node_ids which are endpoints of this channel
24767  */
24768 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24769
24770 /**
24771  * The other of the two node_ids which are endpoints of this channel
24772  */
24773 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
24774
24775 /**
24776  * The other of the two node_ids which are endpoints of this channel
24777  */
24778 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24779
24780 /**
24781  * The funding key for the first node
24782  */
24783 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
24784
24785 /**
24786  * The funding key for the first node
24787  */
24788 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24789
24790 /**
24791  * The funding key for the second node
24792  */
24793 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
24794
24795 /**
24796  * The funding key for the second node
24797  */
24798 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24799
24800 /**
24801  * Creates a copy of the UnsignedChannelAnnouncement
24802  */
24803 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
24804
24805 /**
24806  * Checks if two UnsignedChannelAnnouncements contain equal inner contents.
24807  * This ignores pointers and is_owned flags and looks at the values in fields.
24808  * Two objects with NULL inner values will be considered "equal" here.
24809  */
24810 bool UnsignedChannelAnnouncement_eq(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR a, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR b);
24811
24812 /**
24813  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
24814  */
24815 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
24816
24817 /**
24818  * Authentication of the announcement by the first public node
24819  */
24820 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
24821
24822 /**
24823  * Authentication of the announcement by the first public node
24824  */
24825 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
24826
24827 /**
24828  * Authentication of the announcement by the second public node
24829  */
24830 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
24831
24832 /**
24833  * Authentication of the announcement by the second public node
24834  */
24835 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
24836
24837 /**
24838  * Proof of funding UTXO ownership by the first public node
24839  */
24840 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
24841
24842 /**
24843  * Proof of funding UTXO ownership by the first public node
24844  */
24845 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
24846
24847 /**
24848  * Proof of funding UTXO ownership by the second public node
24849  */
24850 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
24851
24852 /**
24853  * Proof of funding UTXO ownership by the second public node
24854  */
24855 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
24856
24857 /**
24858  * The actual announcement
24859  */
24860 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
24861
24862 /**
24863  * The actual announcement
24864  */
24865 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
24866
24867 /**
24868  * Constructs a new ChannelAnnouncement given each field
24869  */
24870 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);
24871
24872 /**
24873  * Creates a copy of the ChannelAnnouncement
24874  */
24875 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
24876
24877 /**
24878  * Checks if two ChannelAnnouncements contain equal inner contents.
24879  * This ignores pointers and is_owned flags and looks at the values in fields.
24880  * Two objects with NULL inner values will be considered "equal" here.
24881  */
24882 bool ChannelAnnouncement_eq(const struct LDKChannelAnnouncement *NONNULL_PTR a, const struct LDKChannelAnnouncement *NONNULL_PTR b);
24883
24884 /**
24885  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
24886  */
24887 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
24888
24889 /**
24890  * The genesis hash of the blockchain where the channel is to be opened
24891  */
24892 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
24893
24894 /**
24895  * The genesis hash of the blockchain where the channel is to be opened
24896  */
24897 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24898
24899 /**
24900  * The short channel ID
24901  */
24902 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
24903
24904 /**
24905  * The short channel ID
24906  */
24907 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
24908
24909 /**
24910  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
24911  */
24912 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
24913
24914 /**
24915  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
24916  */
24917 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
24918
24919 /**
24920  * Channel flags
24921  */
24922 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
24923
24924 /**
24925  * Channel flags
24926  */
24927 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
24928
24929 /**
24930  * The number of blocks such that if:
24931  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
24932  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
24933  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
24934  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
24935  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
24936  * forwarding. Note that the HTLC sender is the one who originally sets this value when
24937  * constructing the route.
24938  */
24939 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
24940
24941 /**
24942  * The number of blocks such that if:
24943  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
24944  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
24945  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
24946  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
24947  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
24948  * forwarding. Note that the HTLC sender is the one who originally sets this value when
24949  * constructing the route.
24950  */
24951 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
24952
24953 /**
24954  * The minimum HTLC size incoming to sender, in milli-satoshi
24955  */
24956 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
24957
24958 /**
24959  * The minimum HTLC size incoming to sender, in milli-satoshi
24960  */
24961 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
24962
24963 /**
24964  * The maximum HTLC value incoming to sender, in milli-satoshi. Used to be optional.
24965  */
24966 uint64_t UnsignedChannelUpdate_get_htlc_maximum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
24967
24968 /**
24969  * The maximum HTLC value incoming to sender, in milli-satoshi. Used to be optional.
24970  */
24971 void UnsignedChannelUpdate_set_htlc_maximum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
24972
24973 /**
24974  * The base HTLC fee charged by sender, in milli-satoshi
24975  */
24976 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
24977
24978 /**
24979  * The base HTLC fee charged by sender, in milli-satoshi
24980  */
24981 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
24982
24983 /**
24984  * The amount to fee multiplier, in micro-satoshi
24985  */
24986 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
24987
24988 /**
24989  * The amount to fee multiplier, in micro-satoshi
24990  */
24991 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
24992
24993 /**
24994  * Excess data which was signed as a part of the message which we do not (yet) understand how
24995  * to decode. This is stored to ensure forward-compatibility as new fields are added to the
24996  * lightning gossip
24997  *
24998  * Returns a copy of the field.
24999  */
25000 struct LDKCVec_u8Z UnsignedChannelUpdate_get_excess_data(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
25001
25002 /**
25003  * Excess data which was signed as a part of the message which we do not (yet) understand how
25004  * to decode. This is stored to ensure forward-compatibility as new fields are added to the
25005  * lightning gossip
25006  */
25007 void UnsignedChannelUpdate_set_excess_data(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
25008
25009 /**
25010  * Constructs a new UnsignedChannelUpdate given each field
25011  */
25012 MUST_USE_RES struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_new(struct LDKThirtyTwoBytes chain_hash_arg, uint64_t short_channel_id_arg, uint32_t timestamp_arg, uint8_t flags_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, struct LDKCVec_u8Z excess_data_arg);
25013
25014 /**
25015  * Creates a copy of the UnsignedChannelUpdate
25016  */
25017 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
25018
25019 /**
25020  * Checks if two UnsignedChannelUpdates contain equal inner contents.
25021  * This ignores pointers and is_owned flags and looks at the values in fields.
25022  * Two objects with NULL inner values will be considered "equal" here.
25023  */
25024 bool UnsignedChannelUpdate_eq(const struct LDKUnsignedChannelUpdate *NONNULL_PTR a, const struct LDKUnsignedChannelUpdate *NONNULL_PTR b);
25025
25026 /**
25027  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
25028  */
25029 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
25030
25031 /**
25032  * A signature of the channel update
25033  */
25034 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
25035
25036 /**
25037  * A signature of the channel update
25038  */
25039 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
25040
25041 /**
25042  * The actual channel update
25043  */
25044 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
25045
25046 /**
25047  * The actual channel update
25048  */
25049 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
25050
25051 /**
25052  * Constructs a new ChannelUpdate given each field
25053  */
25054 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
25055
25056 /**
25057  * Creates a copy of the ChannelUpdate
25058  */
25059 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
25060
25061 /**
25062  * Checks if two ChannelUpdates contain equal inner contents.
25063  * This ignores pointers and is_owned flags and looks at the values in fields.
25064  * Two objects with NULL inner values will be considered "equal" here.
25065  */
25066 bool ChannelUpdate_eq(const struct LDKChannelUpdate *NONNULL_PTR a, const struct LDKChannelUpdate *NONNULL_PTR b);
25067
25068 /**
25069  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
25070  */
25071 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
25072
25073 /**
25074  * The genesis hash of the blockchain being queried
25075  */
25076 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
25077
25078 /**
25079  * The genesis hash of the blockchain being queried
25080  */
25081 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25082
25083 /**
25084  * The height of the first block for the channel UTXOs being queried
25085  */
25086 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
25087
25088 /**
25089  * The height of the first block for the channel UTXOs being queried
25090  */
25091 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
25092
25093 /**
25094  * The number of blocks to include in the query results
25095  */
25096 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
25097
25098 /**
25099  * The number of blocks to include in the query results
25100  */
25101 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
25102
25103 /**
25104  * Constructs a new QueryChannelRange given each field
25105  */
25106 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
25107
25108 /**
25109  * Creates a copy of the QueryChannelRange
25110  */
25111 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
25112
25113 /**
25114  * Checks if two QueryChannelRanges contain equal inner contents.
25115  * This ignores pointers and is_owned flags and looks at the values in fields.
25116  * Two objects with NULL inner values will be considered "equal" here.
25117  */
25118 bool QueryChannelRange_eq(const struct LDKQueryChannelRange *NONNULL_PTR a, const struct LDKQueryChannelRange *NONNULL_PTR b);
25119
25120 /**
25121  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
25122  */
25123 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
25124
25125 /**
25126  * The genesis hash of the blockchain being queried
25127  */
25128 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
25129
25130 /**
25131  * The genesis hash of the blockchain being queried
25132  */
25133 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25134
25135 /**
25136  * The height of the first block in the range of the reply
25137  */
25138 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
25139
25140 /**
25141  * The height of the first block in the range of the reply
25142  */
25143 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
25144
25145 /**
25146  * The number of blocks included in the range of the reply
25147  */
25148 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
25149
25150 /**
25151  * The number of blocks included in the range of the reply
25152  */
25153 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
25154
25155 /**
25156  * True when this is the final reply for a query
25157  */
25158 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
25159
25160 /**
25161  * True when this is the final reply for a query
25162  */
25163 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
25164
25165 /**
25166  * The short_channel_ids in the channel range
25167  *
25168  * Returns a copy of the field.
25169  */
25170 struct LDKCVec_u64Z ReplyChannelRange_get_short_channel_ids(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
25171
25172 /**
25173  * The short_channel_ids in the channel range
25174  */
25175 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
25176
25177 /**
25178  * Constructs a new ReplyChannelRange given each field
25179  */
25180 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);
25181
25182 /**
25183  * Creates a copy of the ReplyChannelRange
25184  */
25185 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
25186
25187 /**
25188  * Checks if two ReplyChannelRanges contain equal inner contents.
25189  * This ignores pointers and is_owned flags and looks at the values in fields.
25190  * Two objects with NULL inner values will be considered "equal" here.
25191  */
25192 bool ReplyChannelRange_eq(const struct LDKReplyChannelRange *NONNULL_PTR a, const struct LDKReplyChannelRange *NONNULL_PTR b);
25193
25194 /**
25195  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
25196  */
25197 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
25198
25199 /**
25200  * The genesis hash of the blockchain being queried
25201  */
25202 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
25203
25204 /**
25205  * The genesis hash of the blockchain being queried
25206  */
25207 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25208
25209 /**
25210  * The short_channel_ids that are being queried
25211  *
25212  * Returns a copy of the field.
25213  */
25214 struct LDKCVec_u64Z QueryShortChannelIds_get_short_channel_ids(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr);
25215
25216 /**
25217  * The short_channel_ids that are being queried
25218  */
25219 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
25220
25221 /**
25222  * Constructs a new QueryShortChannelIds given each field
25223  */
25224 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
25225
25226 /**
25227  * Creates a copy of the QueryShortChannelIds
25228  */
25229 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
25230
25231 /**
25232  * Checks if two QueryShortChannelIdss contain equal inner contents.
25233  * This ignores pointers and is_owned flags and looks at the values in fields.
25234  * Two objects with NULL inner values will be considered "equal" here.
25235  */
25236 bool QueryShortChannelIds_eq(const struct LDKQueryShortChannelIds *NONNULL_PTR a, const struct LDKQueryShortChannelIds *NONNULL_PTR b);
25237
25238 /**
25239  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
25240  */
25241 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
25242
25243 /**
25244  * The genesis hash of the blockchain that was queried
25245  */
25246 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
25247
25248 /**
25249  * The genesis hash of the blockchain that was queried
25250  */
25251 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25252
25253 /**
25254  * Indicates if the query recipient maintains up-to-date channel
25255  * information for the chain_hash
25256  */
25257 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
25258
25259 /**
25260  * Indicates if the query recipient maintains up-to-date channel
25261  * information for the chain_hash
25262  */
25263 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
25264
25265 /**
25266  * Constructs a new ReplyShortChannelIdsEnd given each field
25267  */
25268 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
25269
25270 /**
25271  * Creates a copy of the ReplyShortChannelIdsEnd
25272  */
25273 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
25274
25275 /**
25276  * Checks if two ReplyShortChannelIdsEnds contain equal inner contents.
25277  * This ignores pointers and is_owned flags and looks at the values in fields.
25278  * Two objects with NULL inner values will be considered "equal" here.
25279  */
25280 bool ReplyShortChannelIdsEnd_eq(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR a, const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR b);
25281
25282 /**
25283  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
25284  */
25285 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
25286
25287 /**
25288  * The genesis hash of the blockchain for channel and node information
25289  */
25290 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
25291
25292 /**
25293  * The genesis hash of the blockchain for channel and node information
25294  */
25295 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25296
25297 /**
25298  * The starting unix timestamp
25299  */
25300 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
25301
25302 /**
25303  * The starting unix timestamp
25304  */
25305 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
25306
25307 /**
25308  * The range of information in seconds
25309  */
25310 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
25311
25312 /**
25313  * The range of information in seconds
25314  */
25315 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
25316
25317 /**
25318  * Constructs a new GossipTimestampFilter given each field
25319  */
25320 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
25321
25322 /**
25323  * Creates a copy of the GossipTimestampFilter
25324  */
25325 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
25326
25327 /**
25328  * Checks if two GossipTimestampFilters contain equal inner contents.
25329  * This ignores pointers and is_owned flags and looks at the values in fields.
25330  * Two objects with NULL inner values will be considered "equal" here.
25331  */
25332 bool GossipTimestampFilter_eq(const struct LDKGossipTimestampFilter *NONNULL_PTR a, const struct LDKGossipTimestampFilter *NONNULL_PTR b);
25333
25334 /**
25335  * Frees any resources used by the ErrorAction
25336  */
25337 void ErrorAction_free(struct LDKErrorAction this_ptr);
25338
25339 /**
25340  * Creates a copy of the ErrorAction
25341  */
25342 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
25343
25344 /**
25345  * Utility method to constructs a new DisconnectPeer-variant ErrorAction
25346  */
25347 struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg);
25348
25349 /**
25350  * Utility method to constructs a new IgnoreError-variant ErrorAction
25351  */
25352 struct LDKErrorAction ErrorAction_ignore_error(void);
25353
25354 /**
25355  * Utility method to constructs a new IgnoreAndLog-variant ErrorAction
25356  */
25357 struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
25358
25359 /**
25360  * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction
25361  */
25362 struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void);
25363
25364 /**
25365  * Utility method to constructs a new SendErrorMessage-variant ErrorAction
25366  */
25367 struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg);
25368
25369 /**
25370  * Utility method to constructs a new SendWarningMessage-variant ErrorAction
25371  */
25372 struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level);
25373
25374 /**
25375  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
25376  */
25377 void LightningError_free(struct LDKLightningError this_obj);
25378
25379 /**
25380  * A human-readable message describing the error
25381  */
25382 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
25383
25384 /**
25385  * A human-readable message describing the error
25386  */
25387 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
25388
25389 /**
25390  * The action which should be taken against the offending peer.
25391  */
25392 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
25393
25394 /**
25395  * The action which should be taken against the offending peer.
25396  */
25397 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
25398
25399 /**
25400  * Constructs a new LightningError given each field
25401  */
25402 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
25403
25404 /**
25405  * Creates a copy of the LightningError
25406  */
25407 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
25408
25409 /**
25410  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
25411  */
25412 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
25413
25414 /**
25415  * update_add_htlc messages which should be sent
25416  */
25417 struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
25418
25419 /**
25420  * update_add_htlc messages which should be sent
25421  */
25422 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
25423
25424 /**
25425  * update_fulfill_htlc messages which should be sent
25426  */
25427 struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
25428
25429 /**
25430  * update_fulfill_htlc messages which should be sent
25431  */
25432 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
25433
25434 /**
25435  * update_fail_htlc messages which should be sent
25436  */
25437 struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
25438
25439 /**
25440  * update_fail_htlc messages which should be sent
25441  */
25442 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
25443
25444 /**
25445  * update_fail_malformed_htlc messages which should be sent
25446  */
25447 struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
25448
25449 /**
25450  * update_fail_malformed_htlc messages which should be sent
25451  */
25452 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
25453
25454 /**
25455  * An update_fee message which should be sent
25456  *
25457  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25458  */
25459 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
25460
25461 /**
25462  * An update_fee message which should be sent
25463  *
25464  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25465  */
25466 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
25467
25468 /**
25469  * Finally, the commitment_signed message which should be sent
25470  */
25471 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
25472
25473 /**
25474  * Finally, the commitment_signed message which should be sent
25475  */
25476 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
25477
25478 /**
25479  * Constructs a new CommitmentUpdate given each field
25480  */
25481 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);
25482
25483 /**
25484  * Creates a copy of the CommitmentUpdate
25485  */
25486 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
25487
25488 /**
25489  * Checks if two CommitmentUpdates contain equal inner contents.
25490  * This ignores pointers and is_owned flags and looks at the values in fields.
25491  * Two objects with NULL inner values will be considered "equal" here.
25492  */
25493 bool CommitmentUpdate_eq(const struct LDKCommitmentUpdate *NONNULL_PTR a, const struct LDKCommitmentUpdate *NONNULL_PTR b);
25494
25495 /**
25496  * Calls the free function if one is set
25497  */
25498 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
25499
25500 /**
25501  * Calls the free function if one is set
25502  */
25503 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
25504
25505 /**
25506  * Calls the free function if one is set
25507  */
25508 void OnionMessageHandler_free(struct LDKOnionMessageHandler this_ptr);
25509
25510 /**
25511  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
25512  */
25513 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
25514
25515 /**
25516  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
25517  */
25518 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
25519
25520 /**
25521  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
25522  */
25523 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
25524
25525 /**
25526  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
25527  */
25528 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
25529
25530 /**
25531  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
25532  */
25533 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
25534
25535 /**
25536  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
25537  */
25538 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
25539
25540 /**
25541  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
25542  */
25543 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
25544
25545 /**
25546  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
25547  */
25548 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
25549
25550 /**
25551  * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
25552  */
25553 struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
25554
25555 /**
25556  * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
25557  */
25558 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
25559
25560 /**
25561  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
25562  */
25563 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
25564
25565 /**
25566  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
25567  */
25568 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
25569
25570 /**
25571  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
25572  */
25573 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
25574
25575 /**
25576  * Read a FundingCreated from a byte array, created by FundingCreated_write
25577  */
25578 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
25579
25580 /**
25581  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
25582  */
25583 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
25584
25585 /**
25586  * Read a FundingSigned from a byte array, created by FundingSigned_write
25587  */
25588 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
25589
25590 /**
25591  * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read
25592  */
25593 struct LDKCVec_u8Z ChannelReady_write(const struct LDKChannelReady *NONNULL_PTR obj);
25594
25595 /**
25596  * Read a ChannelReady from a byte array, created by ChannelReady_write
25597  */
25598 struct LDKCResult_ChannelReadyDecodeErrorZ ChannelReady_read(struct LDKu8slice ser);
25599
25600 /**
25601  * Serialize the Init object into a byte array which can be read by Init_read
25602  */
25603 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
25604
25605 /**
25606  * Read a Init from a byte array, created by Init_write
25607  */
25608 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
25609
25610 /**
25611  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
25612  */
25613 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
25614
25615 /**
25616  * Read a OpenChannel from a byte array, created by OpenChannel_write
25617  */
25618 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
25619
25620 /**
25621  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
25622  */
25623 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
25624
25625 /**
25626  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
25627  */
25628 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
25629
25630 /**
25631  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
25632  */
25633 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
25634
25635 /**
25636  * Read a Shutdown from a byte array, created by Shutdown_write
25637  */
25638 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
25639
25640 /**
25641  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
25642  */
25643 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
25644
25645 /**
25646  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
25647  */
25648 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
25649
25650 /**
25651  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
25652  */
25653 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
25654
25655 /**
25656  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
25657  */
25658 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
25659
25660 /**
25661  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
25662  */
25663 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
25664
25665 /**
25666  * Read a UpdateFee from a byte array, created by UpdateFee_write
25667  */
25668 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
25669
25670 /**
25671  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
25672  */
25673 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
25674
25675 /**
25676  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
25677  */
25678 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
25679
25680 /**
25681  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
25682  */
25683 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
25684
25685 /**
25686  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
25687  */
25688 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
25689
25690 /**
25691  * Read a OnionMessage from a byte array, created by OnionMessage_write
25692  */
25693 struct LDKCResult_OnionMessageDecodeErrorZ OnionMessage_read(struct LDKu8slice ser);
25694
25695 /**
25696  * Serialize the OnionMessage object into a byte array which can be read by OnionMessage_read
25697  */
25698 struct LDKCVec_u8Z OnionMessage_write(const struct LDKOnionMessage *NONNULL_PTR obj);
25699
25700 /**
25701  * Serialize the Ping object into a byte array which can be read by Ping_read
25702  */
25703 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
25704
25705 /**
25706  * Read a Ping from a byte array, created by Ping_write
25707  */
25708 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
25709
25710 /**
25711  * Serialize the Pong object into a byte array which can be read by Pong_read
25712  */
25713 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
25714
25715 /**
25716  * Read a Pong from a byte array, created by Pong_write
25717  */
25718 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
25719
25720 /**
25721  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
25722  */
25723 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
25724
25725 /**
25726  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
25727  */
25728 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
25729
25730 /**
25731  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
25732  */
25733 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
25734
25735 /**
25736  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
25737  */
25738 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
25739
25740 /**
25741  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
25742  */
25743 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
25744
25745 /**
25746  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
25747  */
25748 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
25749
25750 /**
25751  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
25752  */
25753 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
25754
25755 /**
25756  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
25757  */
25758 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
25759
25760 /**
25761  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
25762  */
25763 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
25764
25765 /**
25766  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
25767  */
25768 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
25769
25770 /**
25771  * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read
25772  */
25773 struct LDKCVec_u8Z WarningMessage_write(const struct LDKWarningMessage *NONNULL_PTR obj);
25774
25775 /**
25776  * Read a WarningMessage from a byte array, created by WarningMessage_write
25777  */
25778 struct LDKCResult_WarningMessageDecodeErrorZ WarningMessage_read(struct LDKu8slice ser);
25779
25780 /**
25781  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
25782  */
25783 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
25784
25785 /**
25786  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
25787  */
25788 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
25789
25790 /**
25791  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
25792  */
25793 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
25794
25795 /**
25796  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
25797  */
25798 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
25799
25800 /**
25801  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
25802  */
25803 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
25804
25805 /**
25806  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
25807  */
25808 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
25809
25810 /**
25811  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
25812  */
25813 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
25814
25815 /**
25816  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
25817  */
25818 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
25819
25820 /**
25821  *\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
25822  */
25823 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
25824
25825 /**
25826  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
25827  */
25828 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
25829
25830 /**
25831  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
25832  */
25833 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
25834
25835 /**
25836  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
25837  */
25838 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
25839
25840 /**
25841  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
25842  */
25843 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
25844
25845 /**
25846  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
25847  */
25848 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
25849
25850 /**
25851  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
25852  */
25853 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
25854
25855 /**
25856  * Calls the free function if one is set
25857  */
25858 void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
25859
25860 /**
25861  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
25862  */
25863 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
25864
25865 /**
25866  * Constructs a new IgnoringMessageHandler given each field
25867  */
25868 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
25869
25870 /**
25871  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
25872  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
25873  */
25874 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
25875
25876 /**
25877  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
25878  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
25879  */
25880 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
25881
25882 /**
25883  * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg.
25884  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is
25885  */
25886 struct LDKOnionMessageProvider IgnoringMessageHandler_as_OnionMessageProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
25887
25888 /**
25889  * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg.
25890  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is
25891  */
25892 struct LDKOnionMessageHandler IgnoringMessageHandler_as_OnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
25893
25894 /**
25895  * Constructs a new CustomOnionMessageHandler which calls the relevant methods on this_arg.
25896  * This copies the `inner` pointer in this_arg and thus the returned CustomOnionMessageHandler must be freed before this_arg is
25897  */
25898 struct LDKCustomOnionMessageHandler IgnoringMessageHandler_as_CustomOnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
25899
25900 /**
25901  * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
25902  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
25903  */
25904 struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
25905
25906 /**
25907  * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg.
25908  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is
25909  */
25910 struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
25911
25912 /**
25913  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
25914  */
25915 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
25916
25917 /**
25918  * Constructs a new ErroringMessageHandler
25919  */
25920 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
25921
25922 /**
25923  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
25924  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
25925  */
25926 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
25927
25928 /**
25929  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
25930  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
25931  */
25932 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
25933
25934 /**
25935  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
25936  */
25937 void MessageHandler_free(struct LDKMessageHandler this_obj);
25938
25939 /**
25940  * A message handler which handles messages specific to channels. Usually this is just a
25941  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
25942  *
25943  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
25944  */
25945 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
25946
25947 /**
25948  * A message handler which handles messages specific to channels. Usually this is just a
25949  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
25950  *
25951  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
25952  */
25953 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
25954
25955 /**
25956  * A message handler which handles messages updating our knowledge of the network channel
25957  * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
25958  *
25959  * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
25960  */
25961 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
25962
25963 /**
25964  * A message handler which handles messages updating our knowledge of the network channel
25965  * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
25966  *
25967  * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
25968  */
25969 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
25970
25971 /**
25972  * A message handler which handles onion messages. For now, this can only be an
25973  * [`IgnoringMessageHandler`].
25974  */
25975 const struct LDKOnionMessageHandler *MessageHandler_get_onion_message_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
25976
25977 /**
25978  * A message handler which handles onion messages. For now, this can only be an
25979  * [`IgnoringMessageHandler`].
25980  */
25981 void MessageHandler_set_onion_message_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKOnionMessageHandler val);
25982
25983 /**
25984  * Constructs a new MessageHandler given each field
25985  */
25986 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg, struct LDKOnionMessageHandler onion_message_handler_arg);
25987
25988 /**
25989  * Creates a copy of a SocketDescriptor
25990  */
25991 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
25992
25993 /**
25994  * Calls the free function if one is set
25995  */
25996 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
25997
25998 /**
25999  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
26000  */
26001 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
26002
26003 /**
26004  * Used to indicate that we probably can't make any future connections to this peer (e.g.
26005  * because we required features that our peer was missing, or vice versa).
26006  *
26007  * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close
26008  * any channels with this peer or check for new versions of LDK.
26009  *
26010  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
26011  */
26012 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
26013
26014 /**
26015  * Used to indicate that we probably can't make any future connections to this peer (e.g.
26016  * because we required features that our peer was missing, or vice versa).
26017  *
26018  * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close
26019  * any channels with this peer or check for new versions of LDK.
26020  *
26021  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
26022  */
26023 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
26024
26025 /**
26026  * Constructs a new PeerHandleError given each field
26027  */
26028 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
26029
26030 /**
26031  * Creates a copy of the PeerHandleError
26032  */
26033 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
26034
26035 /**
26036  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
26037  */
26038 void PeerManager_free(struct LDKPeerManager this_obj);
26039
26040 /**
26041  * Constructs a new PeerManager with the given message handlers and node_id secret key
26042  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
26043  * cryptographically secure random bytes.
26044  *
26045  * `current_time` is used as an always-increasing counter that survives across restarts and is
26046  * incremented irregularly internally. In general it is best to simply use the current UNIX
26047  * timestamp, however if it is not available a persistent counter that increases once per
26048  * minute should suffice.
26049  */
26050 MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, struct LDKSecretKey our_node_secret, uint32_t current_time, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger, struct LDKCustomMessageHandler custom_message_handler);
26051
26052 /**
26053  * Get the list of node ids for peers which have completed the initial handshake.
26054  *
26055  * For outbound connections, this will be the same as the their_node_id parameter passed in to
26056  * new_outbound_connection, however entries will only appear once the initial handshake has
26057  * completed and we are sure the remote peer has the private key for the given node_id.
26058  */
26059 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
26060
26061 /**
26062  * Indicates a new outbound connection has been established to a node with the given node_id
26063  * and an optional remote network address.
26064  *
26065  * The remote network address adds the option to report a remote IP address back to a connecting
26066  * peer using the init message.
26067  * The user should pass the remote network address of the host they are connected to.
26068  *
26069  * If an `Err` is returned here you must disconnect the connection immediately.
26070  *
26071  * Returns a small number of bytes to send to the remote node (currently always 50).
26072  *
26073  * Panics if descriptor is duplicative with some other descriptor which has not yet been
26074  * [`socket_disconnected()`].
26075  *
26076  * [`socket_disconnected()`]: PeerManager::socket_disconnected
26077  */
26078 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, struct LDKCOption_NetAddressZ remote_network_address);
26079
26080 /**
26081  * Indicates a new inbound connection has been established to a node with an optional remote
26082  * network address.
26083  *
26084  * The remote network address adds the option to report a remote IP address back to a connecting
26085  * peer using the init message.
26086  * The user should pass the remote network address of the host they are connected to.
26087  *
26088  * May refuse the connection by returning an Err, but will never write bytes to the remote end
26089  * (outbound connector always speaks first). If an `Err` is returned here you must disconnect
26090  * the connection immediately.
26091  *
26092  * Panics if descriptor is duplicative with some other descriptor which has not yet been
26093  * [`socket_disconnected()`].
26094  *
26095  * [`socket_disconnected()`]: PeerManager::socket_disconnected
26096  */
26097 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor, struct LDKCOption_NetAddressZ remote_network_address);
26098
26099 /**
26100  * Indicates that there is room to write data to the given socket descriptor.
26101  *
26102  * May return an Err to indicate that the connection should be closed.
26103  *
26104  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
26105  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
26106  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
26107  * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't
26108  * sufficient!
26109  *
26110  * [`send_data`]: SocketDescriptor::send_data
26111  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
26112  */
26113 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
26114
26115 /**
26116  * Indicates that data was read from the given socket descriptor.
26117  *
26118  * May return an Err to indicate that the connection should be closed.
26119  *
26120  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
26121  * Thus, however, you should call [`process_events`] after any `read_event` to generate
26122  * [`send_data`] calls to handle responses.
26123  *
26124  * If `Ok(true)` is returned, further read_events should not be triggered until a
26125  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
26126  * send buffer).
26127  *
26128  * [`send_data`]: SocketDescriptor::send_data
26129  * [`process_events`]: PeerManager::process_events
26130  */
26131 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);
26132
26133 /**
26134  * Checks for any events generated by our handlers and processes them. Includes sending most
26135  * response messages as well as messages generated by calls to handler functions directly (eg
26136  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
26137  *
26138  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
26139  * issues!
26140  *
26141  * You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
26142  * or one of the other clients provided in our language bindings.
26143  *
26144  * Note that if there are any other calls to this function waiting on lock(s) this may return
26145  * without doing any work. All available events that need handling will be handled before the
26146  * other calls return.
26147  *
26148  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
26149  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
26150  * [`send_data`]: SocketDescriptor::send_data
26151  */
26152 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
26153
26154 /**
26155  * Indicates that the given socket descriptor's connection is now closed.
26156  */
26157 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
26158
26159 /**
26160  * Disconnect a peer given its node id.
26161  *
26162  * Set `no_connection_possible` to true to prevent any further connection with this peer,
26163  * force-closing any channels we have with it.
26164  *
26165  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
26166  * peer. Thus, be very careful about reentrancy issues.
26167  *
26168  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
26169  */
26170 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
26171
26172 /**
26173  * Disconnects all currently-connected peers. This is useful on platforms where there may be
26174  * an indication that TCP sockets have stalled even if we weren't around to time them out
26175  * using regular ping/pongs.
26176  */
26177 void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg);
26178
26179 /**
26180  * Send pings to each peer and disconnect those which did not respond to the last round of
26181  * pings.
26182  *
26183  * This may be called on any timescale you want, however, roughly once every ten seconds is
26184  * preferred. The call rate determines both how often we send a ping to our peers and how much
26185  * time they have to respond before we disconnect them.
26186  *
26187  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
26188  * issues!
26189  *
26190  * [`send_data`]: SocketDescriptor::send_data
26191  */
26192 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
26193
26194 /**
26195  * Generates a signed node_announcement from the given arguments, sending it to all connected
26196  * peers. Note that peers will likely ignore this message unless we have at least one public
26197  * channel which has at least six confirmations on-chain.
26198  *
26199  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
26200  * node to humans. They carry no in-protocol meaning.
26201  *
26202  * `addresses` represent the set (possibly empty) of socket addresses on which this node
26203  * accepts incoming connections. These will be included in the node_announcement, publicly
26204  * tying these addresses together and to this node. If you wish to preserve user privacy,
26205  * addresses should likely contain only Tor Onion addresses.
26206  *
26207  * Panics if `addresses` is absurdly large (more than 100).
26208  *
26209  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
26210  */
26211 void PeerManager_broadcast_node_announcement(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
26212
26213 /**
26214  * Gets the weight for an HTLC-Success transaction.
26215  */
26216 uint64_t htlc_success_tx_weight(bool opt_anchors);
26217
26218 /**
26219  * Gets the weight for an HTLC-Timeout transaction.
26220  */
26221 uint64_t htlc_timeout_tx_weight(bool opt_anchors);
26222
26223 /**
26224  * Build the commitment secret from the seed and the commitment number
26225  */
26226 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
26227
26228 /**
26229  * Build a closing transaction
26230  */
26231 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);
26232
26233 /**
26234  * Frees any resources used by the CounterpartyCommitmentSecrets, if is_owned is set and inner is non-NULL.
26235  */
26236 void CounterpartyCommitmentSecrets_free(struct LDKCounterpartyCommitmentSecrets this_obj);
26237
26238 /**
26239  * Creates a copy of the CounterpartyCommitmentSecrets
26240  */
26241 struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_clone(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR orig);
26242
26243 /**
26244  * Creates a new empty `CounterpartyCommitmentSecrets` structure.
26245  */
26246 MUST_USE_RES struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_new(void);
26247
26248 /**
26249  * Returns the minimum index of all stored secrets. Note that indexes start
26250  * at 1 << 48 and get decremented by one for each new secret.
26251  */
26252 MUST_USE_RES uint64_t CounterpartyCommitmentSecrets_get_min_seen_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg);
26253
26254 /**
26255  * Inserts the `secret` at `idx`. Returns `Ok(())` if the secret
26256  * was generated in accordance with BOLT 3 and is consistent with previous secrets.
26257  */
26258 MUST_USE_RES struct LDKCResult_NoneNoneZ CounterpartyCommitmentSecrets_provide_secret(struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx, struct LDKThirtyTwoBytes secret);
26259
26260 /**
26261  * Returns the secret at `idx`.
26262  * Returns `None` if `idx` is < [`CounterpartyCommitmentSecrets::get_min_seen_secret`].
26263  *
26264  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26265  */
26266 MUST_USE_RES struct LDKThirtyTwoBytes CounterpartyCommitmentSecrets_get_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx);
26267
26268 /**
26269  * Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read
26270  */
26271 struct LDKCVec_u8Z CounterpartyCommitmentSecrets_write(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR obj);
26272
26273 /**
26274  * Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write
26275  */
26276 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitmentSecrets_read(struct LDKu8slice ser);
26277
26278 /**
26279  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
26280  * from the base secret and the per_commitment_point.
26281  *
26282  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
26283  * generated (ie our own).
26284  */
26285 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
26286
26287 /**
26288  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
26289  * from the base point and the per_commitment_key. This is the public equivalent of
26290  * derive_private_key - using only public keys to derive a public key instead of private keys.
26291  *
26292  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
26293  * generated (ie our own).
26294  */
26295 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
26296
26297 /**
26298  * Derives a per-commitment-transaction revocation key from its constituent parts.
26299  *
26300  * Only the cheating participant owns a valid witness to propagate a revoked
26301  * commitment transaction, thus per_commitment_secret always come from cheater
26302  * and revocation_base_secret always come from punisher, which is the broadcaster
26303  * of the transaction spending with this key knowledge.
26304  *
26305  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
26306  * generated (ie our own).
26307  */
26308 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
26309
26310 /**
26311  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
26312  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
26313  * public key instead of private keys.
26314  *
26315  * Only the cheating participant owns a valid witness to propagate a revoked
26316  * commitment transaction, thus per_commitment_point always come from cheater
26317  * and revocation_base_point always come from punisher, which is the broadcaster
26318  * of the transaction spending with this key knowledge.
26319  *
26320  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
26321  * generated (ie our own).
26322  */
26323 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
26324
26325 /**
26326  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
26327  */
26328 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
26329
26330 /**
26331  * The broadcaster's per-commitment public key which was used to derive the other keys.
26332  */
26333 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
26334
26335 /**
26336  * The broadcaster's per-commitment public key which was used to derive the other keys.
26337  */
26338 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26339
26340 /**
26341  * The revocation key which is used to allow the broadcaster of the commitment
26342  * transaction to provide their counterparty the ability to punish them if they broadcast
26343  * an old state.
26344  */
26345 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
26346
26347 /**
26348  * The revocation key which is used to allow the broadcaster of the commitment
26349  * transaction to provide their counterparty the ability to punish them if they broadcast
26350  * an old state.
26351  */
26352 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26353
26354 /**
26355  * Broadcaster's HTLC Key
26356  */
26357 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
26358
26359 /**
26360  * Broadcaster's HTLC Key
26361  */
26362 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26363
26364 /**
26365  * Countersignatory's HTLC Key
26366  */
26367 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
26368
26369 /**
26370  * Countersignatory's HTLC Key
26371  */
26372 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26373
26374 /**
26375  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
26376  */
26377 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
26378
26379 /**
26380  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
26381  */
26382 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26383
26384 /**
26385  * Constructs a new TxCreationKeys given each field
26386  */
26387 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);
26388
26389 /**
26390  * Checks if two TxCreationKeyss contain equal inner contents.
26391  * This ignores pointers and is_owned flags and looks at the values in fields.
26392  * Two objects with NULL inner values will be considered "equal" here.
26393  */
26394 bool TxCreationKeys_eq(const struct LDKTxCreationKeys *NONNULL_PTR a, const struct LDKTxCreationKeys *NONNULL_PTR b);
26395
26396 /**
26397  * Creates a copy of the TxCreationKeys
26398  */
26399 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
26400
26401 /**
26402  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
26403  */
26404 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
26405
26406 /**
26407  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
26408  */
26409 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
26410
26411 /**
26412  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
26413  */
26414 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
26415
26416 /**
26417  * The public key which is used to sign all commitment transactions, as it appears in the
26418  * on-chain channel lock-in 2-of-2 multisig output.
26419  */
26420 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
26421
26422 /**
26423  * The public key which is used to sign all commitment transactions, as it appears in the
26424  * on-chain channel lock-in 2-of-2 multisig output.
26425  */
26426 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26427
26428 /**
26429  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
26430  * revocation keys. This is combined with the per-commitment-secret generated by the
26431  * counterparty to create a secret which the counterparty can reveal to revoke previous
26432  * states.
26433  */
26434 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
26435
26436 /**
26437  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
26438  * revocation keys. This is combined with the per-commitment-secret generated by the
26439  * counterparty to create a secret which the counterparty can reveal to revoke previous
26440  * states.
26441  */
26442 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26443
26444 /**
26445  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
26446  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
26447  * static across every commitment transaction.
26448  */
26449 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
26450
26451 /**
26452  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
26453  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
26454  * static across every commitment transaction.
26455  */
26456 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26457
26458 /**
26459  * The base point which is used (with derive_public_key) to derive a per-commitment payment
26460  * public key which receives non-HTLC-encumbered funds which are only available for spending
26461  * after some delay (or can be claimed via the revocation path).
26462  */
26463 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
26464
26465 /**
26466  * The base point which is used (with derive_public_key) to derive a per-commitment payment
26467  * public key which receives non-HTLC-encumbered funds which are only available for spending
26468  * after some delay (or can be claimed via the revocation path).
26469  */
26470 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26471
26472 /**
26473  * The base point which is used (with derive_public_key) to derive a per-commitment public key
26474  * which is used to encumber HTLC-in-flight outputs.
26475  */
26476 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
26477
26478 /**
26479  * The base point which is used (with derive_public_key) to derive a per-commitment public key
26480  * which is used to encumber HTLC-in-flight outputs.
26481  */
26482 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26483
26484 /**
26485  * Constructs a new ChannelPublicKeys given each field
26486  */
26487 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);
26488
26489 /**
26490  * Creates a copy of the ChannelPublicKeys
26491  */
26492 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
26493
26494 /**
26495  * Checks if two ChannelPublicKeyss contain equal inner contents.
26496  * This ignores pointers and is_owned flags and looks at the values in fields.
26497  * Two objects with NULL inner values will be considered "equal" here.
26498  */
26499 bool ChannelPublicKeys_eq(const struct LDKChannelPublicKeys *NONNULL_PTR a, const struct LDKChannelPublicKeys *NONNULL_PTR b);
26500
26501 /**
26502  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
26503  */
26504 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
26505
26506 /**
26507  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
26508  */
26509 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
26510
26511 /**
26512  * Create per-state keys from channel base points and the per-commitment point.
26513  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
26514  */
26515 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);
26516
26517 /**
26518  * Generate per-state keys from channel static keys.
26519  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
26520  */
26521 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);
26522
26523 /**
26524  * A script either spendable by the revocation
26525  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
26526  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
26527  */
26528 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
26529
26530 /**
26531  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
26532  */
26533 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
26534
26535 /**
26536  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
26537  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
26538  * need to compare this value to whether the commitment transaction in question is that of
26539  * the counterparty or our own.
26540  */
26541 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
26542
26543 /**
26544  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
26545  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
26546  * need to compare this value to whether the commitment transaction in question is that of
26547  * the counterparty or our own.
26548  */
26549 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
26550
26551 /**
26552  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
26553  * this divided by 1000.
26554  */
26555 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
26556
26557 /**
26558  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
26559  * this divided by 1000.
26560  */
26561 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
26562
26563 /**
26564  * The CLTV lock-time at which this HTLC expires.
26565  */
26566 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
26567
26568 /**
26569  * The CLTV lock-time at which this HTLC expires.
26570  */
26571 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
26572
26573 /**
26574  * The hash of the preimage which unlocks this HTLC.
26575  */
26576 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
26577
26578 /**
26579  * The hash of the preimage which unlocks this HTLC.
26580  */
26581 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26582
26583 /**
26584  * The position within the commitment transactions' outputs. This may be None if the value is
26585  * below the dust limit (in which case no output appears in the commitment transaction and the
26586  * value is spent to additional transaction fees).
26587  */
26588 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
26589
26590 /**
26591  * The position within the commitment transactions' outputs. This may be None if the value is
26592  * below the dust limit (in which case no output appears in the commitment transaction and the
26593  * value is spent to additional transaction fees).
26594  */
26595 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
26596
26597 /**
26598  * Constructs a new HTLCOutputInCommitment given each field
26599  */
26600 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);
26601
26602 /**
26603  * Creates a copy of the HTLCOutputInCommitment
26604  */
26605 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
26606
26607 /**
26608  * Checks if two HTLCOutputInCommitments contain equal inner contents.
26609  * This ignores pointers and is_owned flags and looks at the values in fields.
26610  * Two objects with NULL inner values will be considered "equal" here.
26611  */
26612 bool HTLCOutputInCommitment_eq(const struct LDKHTLCOutputInCommitment *NONNULL_PTR a, const struct LDKHTLCOutputInCommitment *NONNULL_PTR b);
26613
26614 /**
26615  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
26616  */
26617 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
26618
26619 /**
26620  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
26621  */
26622 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
26623
26624 /**
26625  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
26626  * does not need to have its previous_output_index filled.
26627  */
26628 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, const struct LDKTxCreationKeys *NONNULL_PTR keys);
26629
26630 /**
26631  * Gets the redeemscript for a funding output from the two funding public keys.
26632  * Note that the order of funding public keys does not matter.
26633  */
26634 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
26635
26636 /**
26637  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
26638  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
26639  * transaction which needs signing, and can be used to construct an HTLC transaction which is
26640  * broadcastable given a counterparty HTLC signature.
26641  *
26642  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
26643  * commitment transaction).
26644  */
26645 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, bool opt_anchors, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key);
26646
26647 /**
26648  * Gets the witnessScript for an anchor output from the funding public key.
26649  * The witness in the spending input must be:
26650  * <BIP 143 funding_signature>
26651  * After 16 blocks of confirmation, an alternative satisfying witness could be:
26652  * <>
26653  * (empty vector required to satisfy compliance with MINIMALIF-standard rule)
26654  */
26655 struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey);
26656
26657 /**
26658  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
26659  */
26660 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
26661
26662 /**
26663  * Holder public keys
26664  */
26665 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
26666
26667 /**
26668  * Holder public keys
26669  */
26670 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
26671
26672 /**
26673  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
26674  */
26675 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
26676
26677 /**
26678  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
26679  */
26680 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
26681
26682 /**
26683  * Whether the holder is the initiator of this channel.
26684  * This is an input to the commitment number obscure factor computation.
26685  */
26686 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
26687
26688 /**
26689  * Whether the holder is the initiator of this channel.
26690  * This is an input to the commitment number obscure factor computation.
26691  */
26692 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
26693
26694 /**
26695  * The late-bound counterparty channel transaction parameters.
26696  * These parameters are populated at the point in the protocol where the counterparty provides them.
26697  *
26698  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26699  */
26700 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
26701
26702 /**
26703  * The late-bound counterparty channel transaction parameters.
26704  * These parameters are populated at the point in the protocol where the counterparty provides them.
26705  *
26706  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26707  */
26708 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
26709
26710 /**
26711  * The late-bound funding outpoint
26712  *
26713  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26714  */
26715 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
26716
26717 /**
26718  * The late-bound funding outpoint
26719  *
26720  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26721  */
26722 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
26723
26724 /**
26725  * Are anchors (zero fee HTLC transaction variant) used for this channel. Boolean is
26726  * serialization backwards-compatible.
26727  */
26728 enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
26729
26730 /**
26731  * Are anchors (zero fee HTLC transaction variant) used for this channel. Boolean is
26732  * serialization backwards-compatible.
26733  */
26734 void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
26735
26736 /**
26737  * Constructs a new ChannelTransactionParameters given each field
26738  */
26739 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, enum LDKCOption_NoneZ opt_anchors_arg);
26740
26741 /**
26742  * Creates a copy of the ChannelTransactionParameters
26743  */
26744 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
26745
26746 /**
26747  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
26748  */
26749 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
26750
26751 /**
26752  * Counter-party public keys
26753  */
26754 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
26755
26756 /**
26757  * Counter-party public keys
26758  */
26759 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
26760
26761 /**
26762  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
26763  */
26764 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
26765
26766 /**
26767  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
26768  */
26769 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
26770
26771 /**
26772  * Constructs a new CounterpartyChannelTransactionParameters given each field
26773  */
26774 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
26775
26776 /**
26777  * Creates a copy of the CounterpartyChannelTransactionParameters
26778  */
26779 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
26780
26781 /**
26782  * Whether the late bound parameters are populated.
26783  */
26784 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
26785
26786 /**
26787  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
26788  * given that the holder is the broadcaster.
26789  *
26790  * self.is_populated() must be true before calling this function.
26791  */
26792 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
26793
26794 /**
26795  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
26796  * given that the counterparty is the broadcaster.
26797  *
26798  * self.is_populated() must be true before calling this function.
26799  */
26800 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
26801
26802 /**
26803  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
26804  */
26805 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
26806
26807 /**
26808  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
26809  */
26810 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
26811
26812 /**
26813  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
26814  */
26815 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
26816
26817 /**
26818  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
26819  */
26820 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
26821
26822 /**
26823  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
26824  */
26825 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
26826
26827 /**
26828  * Get the channel pubkeys for the broadcaster
26829  */
26830 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
26831
26832 /**
26833  * Get the channel pubkeys for the countersignatory
26834  */
26835 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
26836
26837 /**
26838  * Get the contest delay applicable to the transactions.
26839  * Note that the contest delay was selected by the countersignatory.
26840  */
26841 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
26842
26843 /**
26844  * Whether the channel is outbound from the broadcaster.
26845  *
26846  * The boolean representing the side that initiated the channel is
26847  * an input to the commitment number obscure factor computation.
26848  */
26849 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
26850
26851 /**
26852  * The funding outpoint
26853  */
26854 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
26855
26856 /**
26857  * Whether to use anchors for this channel
26858  */
26859 MUST_USE_RES bool DirectedChannelTransactionParameters_opt_anchors(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
26860
26861 /**
26862  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
26863  */
26864 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
26865
26866 /**
26867  * Our counterparty's signature for the transaction
26868  */
26869 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
26870
26871 /**
26872  * Our counterparty's signature for the transaction
26873  */
26874 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
26875
26876 /**
26877  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
26878  *
26879  * Returns a copy of the field.
26880  */
26881 struct LDKCVec_SignatureZ HolderCommitmentTransaction_get_counterparty_htlc_sigs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
26882
26883 /**
26884  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
26885  */
26886 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
26887
26888 /**
26889  * Creates a copy of the HolderCommitmentTransaction
26890  */
26891 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
26892
26893 /**
26894  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
26895  */
26896 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
26897
26898 /**
26899  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
26900  */
26901 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
26902
26903 /**
26904  * Create a new holder transaction with the given counterparty signatures.
26905  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
26906  */
26907 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);
26908
26909 /**
26910  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
26911  */
26912 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
26913
26914 /**
26915  * The commitment transaction
26916  */
26917 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
26918
26919 /**
26920  * The commitment transaction
26921  */
26922 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
26923
26924 /**
26925  * The txid for the commitment transaction.
26926  *
26927  * This is provided as a performance optimization, instead of calling transaction.txid()
26928  * multiple times.
26929  */
26930 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
26931
26932 /**
26933  * The txid for the commitment transaction.
26934  *
26935  * This is provided as a performance optimization, instead of calling transaction.txid()
26936  * multiple times.
26937  */
26938 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26939
26940 /**
26941  * Constructs a new BuiltCommitmentTransaction given each field
26942  */
26943 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
26944
26945 /**
26946  * Creates a copy of the BuiltCommitmentTransaction
26947  */
26948 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
26949
26950 /**
26951  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
26952  */
26953 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
26954
26955 /**
26956  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
26957  */
26958 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
26959
26960 /**
26961  * Get the SIGHASH_ALL sighash value of the transaction.
26962  *
26963  * This can be used to verify a signature.
26964  */
26965 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);
26966
26967 /**
26968  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
26969  * because we are about to broadcast a holder transaction.
26970  */
26971 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);
26972
26973 /**
26974  * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL.
26975  */
26976 void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
26977
26978 /**
26979  * Creates a copy of the ClosingTransaction
26980  */
26981 struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig);
26982
26983 /**
26984  * Checks if two ClosingTransactions contain equal inner contents.
26985  */
26986 uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o);
26987
26988 /**
26989  * Checks if two ClosingTransactions contain equal inner contents.
26990  * This ignores pointers and is_owned flags and looks at the values in fields.
26991  * Two objects with NULL inner values will be considered "equal" here.
26992  */
26993 bool ClosingTransaction_eq(const struct LDKClosingTransaction *NONNULL_PTR a, const struct LDKClosingTransaction *NONNULL_PTR b);
26994
26995 /**
26996  * Construct an object of the class
26997  */
26998 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);
26999
27000 /**
27001  * Trust our pre-built transaction.
27002  *
27003  * Applies a wrapper which allows access to the transaction.
27004  *
27005  * This should only be used if you fully trust the builder of this object. It should not
27006  * be used by an external signer - instead use the verify function.
27007  */
27008 MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
27009
27010 /**
27011  * Verify our pre-built transaction.
27012  *
27013  * Applies a wrapper which allows access to the transaction.
27014  *
27015  * An external validating signer must call this method before signing
27016  * or using the built transaction.
27017  */
27018 MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
27019
27020 /**
27021  * The value to be sent to the holder, or zero if the output will be omitted
27022  */
27023 MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
27024
27025 /**
27026  * The value to be sent to the counterparty, or zero if the output will be omitted
27027  */
27028 MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
27029
27030 /**
27031  * The destination of the holder's output
27032  */
27033 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
27034
27035 /**
27036  * The destination of the counterparty's output
27037  */
27038 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
27039
27040 /**
27041  * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL.
27042  */
27043 void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
27044
27045 /**
27046  * The pre-built Bitcoin commitment transaction
27047  */
27048 MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
27049
27050 /**
27051  * Get the SIGHASH_ALL sighash value of the transaction.
27052  *
27053  * This can be used to verify a signature.
27054  */
27055 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);
27056
27057 /**
27058  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
27059  * because we are about to broadcast a holder transaction.
27060  */
27061 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);
27062
27063 /**
27064  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
27065  */
27066 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
27067
27068 /**
27069  * Creates a copy of the CommitmentTransaction
27070  */
27071 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
27072
27073 /**
27074  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
27075  */
27076 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
27077
27078 /**
27079  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
27080  */
27081 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
27082
27083 /**
27084  * The backwards-counting commitment number
27085  */
27086 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
27087
27088 /**
27089  * The value to be sent to the broadcaster
27090  */
27091 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
27092
27093 /**
27094  * The value to be sent to the counterparty
27095  */
27096 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
27097
27098 /**
27099  * The feerate paid per 1000-weight-unit in this commitment transaction.
27100  */
27101 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
27102
27103 /**
27104  * Trust our pre-built transaction and derived transaction creation public keys.
27105  *
27106  * Applies a wrapper which allows access to these fields.
27107  *
27108  * This should only be used if you fully trust the builder of this object.  It should not
27109  * be used by an external signer - instead use the verify function.
27110  */
27111 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
27112
27113 /**
27114  * Verify our pre-built transaction and derived transaction creation public keys.
27115  *
27116  * Applies a wrapper which allows access to these fields.
27117  *
27118  * An external validating signer must call this method before signing
27119  * or using the built transaction.
27120  */
27121 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);
27122
27123 /**
27124  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
27125  */
27126 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
27127
27128 /**
27129  * The transaction ID of the built Bitcoin transaction
27130  */
27131 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
27132
27133 /**
27134  * The pre-built Bitcoin commitment transaction
27135  */
27136 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
27137
27138 /**
27139  * The pre-calculated transaction creation public keys.
27140  */
27141 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
27142
27143 /**
27144  * Should anchors be used.
27145  */
27146 MUST_USE_RES bool TrustedCommitmentTransaction_opt_anchors(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
27147
27148 /**
27149  * Get a signature for each HTLC which was included in the commitment transaction (ie for
27150  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
27151  *
27152  * The returned Vec has one entry for each HTLC, and in the same order.
27153  *
27154  * This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All.
27155  */
27156 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);
27157
27158 /**
27159  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
27160  * shared secret first. This prevents on-chain observers from discovering how many commitment
27161  * transactions occurred in a channel before it was closed.
27162  *
27163  * This function gets the shared secret from relevant channel public keys and can be used to
27164  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
27165  */
27166 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
27167
27168 /**
27169  * Checks if two InitFeaturess contain equal inner contents.
27170  * This ignores pointers and is_owned flags and looks at the values in fields.
27171  * Two objects with NULL inner values will be considered "equal" here.
27172  */
27173 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
27174
27175 /**
27176  * Checks if two NodeFeaturess contain equal inner contents.
27177  * This ignores pointers and is_owned flags and looks at the values in fields.
27178  * Two objects with NULL inner values will be considered "equal" here.
27179  */
27180 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
27181
27182 /**
27183  * Checks if two ChannelFeaturess contain equal inner contents.
27184  * This ignores pointers and is_owned flags and looks at the values in fields.
27185  * Two objects with NULL inner values will be considered "equal" here.
27186  */
27187 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
27188
27189 /**
27190  * Checks if two InvoiceFeaturess contain equal inner contents.
27191  * This ignores pointers and is_owned flags and looks at the values in fields.
27192  * Two objects with NULL inner values will be considered "equal" here.
27193  */
27194 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
27195
27196 /**
27197  * Checks if two ChannelTypeFeaturess contain equal inner contents.
27198  * This ignores pointers and is_owned flags and looks at the values in fields.
27199  * Two objects with NULL inner values will be considered "equal" here.
27200  */
27201 bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b);
27202
27203 /**
27204  * Creates a copy of the InitFeatures
27205  */
27206 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
27207
27208 /**
27209  * Creates a copy of the NodeFeatures
27210  */
27211 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
27212
27213 /**
27214  * Creates a copy of the ChannelFeatures
27215  */
27216 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
27217
27218 /**
27219  * Creates a copy of the InvoiceFeatures
27220  */
27221 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
27222
27223 /**
27224  * Creates a copy of the ChannelTypeFeatures
27225  */
27226 struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig);
27227
27228 /**
27229  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
27230  */
27231 void InitFeatures_free(struct LDKInitFeatures this_obj);
27232
27233 /**
27234  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
27235  */
27236 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
27237
27238 /**
27239  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
27240  */
27241 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
27242
27243 /**
27244  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
27245  */
27246 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
27247
27248 /**
27249  * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL.
27250  */
27251 void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj);
27252
27253 /**
27254  * Create a blank Features with no features set
27255  */
27256 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
27257
27258 /**
27259  * Returns true if this `Features` object contains unknown feature flags which are set as
27260  * \"required\".
27261  */
27262 MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27263
27264 /**
27265  * Create a blank Features with no features set
27266  */
27267 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
27268
27269 /**
27270  * Returns true if this `Features` object contains unknown feature flags which are set as
27271  * \"required\".
27272  */
27273 MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27274
27275 /**
27276  * Create a blank Features with no features set
27277  */
27278 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
27279
27280 /**
27281  * Returns true if this `Features` object contains unknown feature flags which are set as
27282  * \"required\".
27283  */
27284 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
27285
27286 /**
27287  * Create a blank Features with no features set
27288  */
27289 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
27290
27291 /**
27292  * Returns true if this `Features` object contains unknown feature flags which are set as
27293  * \"required\".
27294  */
27295 MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
27296
27297 /**
27298  * Create a blank Features with no features set
27299  */
27300 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void);
27301
27302 /**
27303  * Returns true if this `Features` object contains unknown feature flags which are set as
27304  * \"required\".
27305  */
27306 MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
27307
27308 /**
27309  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
27310  */
27311 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
27312
27313 /**
27314  * Read a InitFeatures from a byte array, created by InitFeatures_write
27315  */
27316 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
27317
27318 /**
27319  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
27320  */
27321 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
27322
27323 /**
27324  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
27325  */
27326 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
27327
27328 /**
27329  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
27330  */
27331 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
27332
27333 /**
27334  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
27335  */
27336 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
27337
27338 /**
27339  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
27340  */
27341 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
27342
27343 /**
27344  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
27345  */
27346 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
27347
27348 /**
27349  * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
27350  */
27351 struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj);
27352
27353 /**
27354  * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
27355  */
27356 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser);
27357
27358 /**
27359  * Set this feature as optional.
27360  */
27361 void InitFeatures_set_data_loss_protect_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
27362
27363 /**
27364  * Set this feature as required.
27365  */
27366 void InitFeatures_set_data_loss_protect_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
27367
27368 /**
27369  * Checks if this feature is supported.
27370  */
27371 MUST_USE_RES bool InitFeatures_supports_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27372
27373 /**
27374  * Set this feature as optional.
27375  */
27376 void NodeFeatures_set_data_loss_protect_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27377
27378 /**
27379  * Set this feature as required.
27380  */
27381 void NodeFeatures_set_data_loss_protect_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27382
27383 /**
27384  * Checks if this feature is supported.
27385  */
27386 MUST_USE_RES bool NodeFeatures_supports_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27387
27388 /**
27389  * Checks if this feature is required.
27390  */
27391 MUST_USE_RES bool InitFeatures_requires_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27392
27393 /**
27394  * Checks if this feature is required.
27395  */
27396 MUST_USE_RES bool NodeFeatures_requires_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27397
27398 /**
27399  * Set this feature as optional.
27400  */
27401 void InitFeatures_set_initial_routing_sync_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
27402
27403 /**
27404  * Set this feature as required.
27405  */
27406 void InitFeatures_set_initial_routing_sync_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
27407
27408 /**
27409  * Checks if this feature is supported.
27410  */
27411 MUST_USE_RES bool InitFeatures_initial_routing_sync(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27412
27413 /**
27414  * Set this feature as optional.
27415  */
27416 void InitFeatures_set_upfront_shutdown_script_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
27417
27418 /**
27419  * Set this feature as required.
27420  */
27421 void InitFeatures_set_upfront_shutdown_script_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
27422
27423 /**
27424  * Checks if this feature is supported.
27425  */
27426 MUST_USE_RES bool InitFeatures_supports_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27427
27428 /**
27429  * Set this feature as optional.
27430  */
27431 void NodeFeatures_set_upfront_shutdown_script_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27432
27433 /**
27434  * Set this feature as required.
27435  */
27436 void NodeFeatures_set_upfront_shutdown_script_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27437
27438 /**
27439  * Checks if this feature is supported.
27440  */
27441 MUST_USE_RES bool NodeFeatures_supports_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27442
27443 /**
27444  * Checks if this feature is required.
27445  */
27446 MUST_USE_RES bool InitFeatures_requires_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27447
27448 /**
27449  * Checks if this feature is required.
27450  */
27451 MUST_USE_RES bool NodeFeatures_requires_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27452
27453 /**
27454  * Set this feature as optional.
27455  */
27456 void InitFeatures_set_gossip_queries_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
27457
27458 /**
27459  * Set this feature as required.
27460  */
27461 void InitFeatures_set_gossip_queries_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
27462
27463 /**
27464  * Checks if this feature is supported.
27465  */
27466 MUST_USE_RES bool InitFeatures_supports_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27467
27468 /**
27469  * Set this feature as optional.
27470  */
27471 void NodeFeatures_set_gossip_queries_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27472
27473 /**
27474  * Set this feature as required.
27475  */
27476 void NodeFeatures_set_gossip_queries_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27477
27478 /**
27479  * Checks if this feature is supported.
27480  */
27481 MUST_USE_RES bool NodeFeatures_supports_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27482
27483 /**
27484  * Checks if this feature is required.
27485  */
27486 MUST_USE_RES bool InitFeatures_requires_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27487
27488 /**
27489  * Checks if this feature is required.
27490  */
27491 MUST_USE_RES bool NodeFeatures_requires_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27492
27493 /**
27494  * Set this feature as optional.
27495  */
27496 void InitFeatures_set_variable_length_onion_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
27497
27498 /**
27499  * Set this feature as required.
27500  */
27501 void InitFeatures_set_variable_length_onion_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
27502
27503 /**
27504  * Checks if this feature is supported.
27505  */
27506 MUST_USE_RES bool InitFeatures_supports_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27507
27508 /**
27509  * Set this feature as optional.
27510  */
27511 void NodeFeatures_set_variable_length_onion_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27512
27513 /**
27514  * Set this feature as required.
27515  */
27516 void NodeFeatures_set_variable_length_onion_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27517
27518 /**
27519  * Checks if this feature is supported.
27520  */
27521 MUST_USE_RES bool NodeFeatures_supports_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27522
27523 /**
27524  * Set this feature as optional.
27525  */
27526 void InvoiceFeatures_set_variable_length_onion_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
27527
27528 /**
27529  * Set this feature as required.
27530  */
27531 void InvoiceFeatures_set_variable_length_onion_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
27532
27533 /**
27534  * Checks if this feature is supported.
27535  */
27536 MUST_USE_RES bool InvoiceFeatures_supports_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
27537
27538 /**
27539  * Checks if this feature is required.
27540  */
27541 MUST_USE_RES bool InitFeatures_requires_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27542
27543 /**
27544  * Checks if this feature is required.
27545  */
27546 MUST_USE_RES bool NodeFeatures_requires_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27547
27548 /**
27549  * Checks if this feature is required.
27550  */
27551 MUST_USE_RES bool InvoiceFeatures_requires_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
27552
27553 /**
27554  * Set this feature as optional.
27555  */
27556 void InitFeatures_set_static_remote_key_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
27557
27558 /**
27559  * Set this feature as required.
27560  */
27561 void InitFeatures_set_static_remote_key_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
27562
27563 /**
27564  * Checks if this feature is supported.
27565  */
27566 MUST_USE_RES bool InitFeatures_supports_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27567
27568 /**
27569  * Set this feature as optional.
27570  */
27571 void NodeFeatures_set_static_remote_key_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27572
27573 /**
27574  * Set this feature as required.
27575  */
27576 void NodeFeatures_set_static_remote_key_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27577
27578 /**
27579  * Checks if this feature is supported.
27580  */
27581 MUST_USE_RES bool NodeFeatures_supports_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27582
27583 /**
27584  * Set this feature as optional.
27585  */
27586 void ChannelTypeFeatures_set_static_remote_key_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
27587
27588 /**
27589  * Set this feature as required.
27590  */
27591 void ChannelTypeFeatures_set_static_remote_key_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
27592
27593 /**
27594  * Checks if this feature is supported.
27595  */
27596 MUST_USE_RES bool ChannelTypeFeatures_supports_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
27597
27598 /**
27599  * Checks if this feature is required.
27600  */
27601 MUST_USE_RES bool InitFeatures_requires_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27602
27603 /**
27604  * Checks if this feature is required.
27605  */
27606 MUST_USE_RES bool NodeFeatures_requires_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27607
27608 /**
27609  * Checks if this feature is required.
27610  */
27611 MUST_USE_RES bool ChannelTypeFeatures_requires_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
27612
27613 /**
27614  * Set this feature as optional.
27615  */
27616 void InitFeatures_set_payment_secret_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
27617
27618 /**
27619  * Set this feature as required.
27620  */
27621 void InitFeatures_set_payment_secret_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
27622
27623 /**
27624  * Checks if this feature is supported.
27625  */
27626 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27627
27628 /**
27629  * Set this feature as optional.
27630  */
27631 void NodeFeatures_set_payment_secret_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27632
27633 /**
27634  * Set this feature as required.
27635  */
27636 void NodeFeatures_set_payment_secret_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27637
27638 /**
27639  * Checks if this feature is supported.
27640  */
27641 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27642
27643 /**
27644  * Set this feature as optional.
27645  */
27646 void InvoiceFeatures_set_payment_secret_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
27647
27648 /**
27649  * Set this feature as required.
27650  */
27651 void InvoiceFeatures_set_payment_secret_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
27652
27653 /**
27654  * Checks if this feature is supported.
27655  */
27656 MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
27657
27658 /**
27659  * Checks if this feature is required.
27660  */
27661 MUST_USE_RES bool InitFeatures_requires_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27662
27663 /**
27664  * Checks if this feature is required.
27665  */
27666 MUST_USE_RES bool NodeFeatures_requires_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27667
27668 /**
27669  * Checks if this feature is required.
27670  */
27671 MUST_USE_RES bool InvoiceFeatures_requires_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
27672
27673 /**
27674  * Set this feature as optional.
27675  */
27676 void InitFeatures_set_basic_mpp_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
27677
27678 /**
27679  * Set this feature as required.
27680  */
27681 void InitFeatures_set_basic_mpp_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
27682
27683 /**
27684  * Checks if this feature is supported.
27685  */
27686 MUST_USE_RES bool InitFeatures_supports_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27687
27688 /**
27689  * Set this feature as optional.
27690  */
27691 void NodeFeatures_set_basic_mpp_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27692
27693 /**
27694  * Set this feature as required.
27695  */
27696 void NodeFeatures_set_basic_mpp_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27697
27698 /**
27699  * Checks if this feature is supported.
27700  */
27701 MUST_USE_RES bool NodeFeatures_supports_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27702
27703 /**
27704  * Set this feature as optional.
27705  */
27706 void InvoiceFeatures_set_basic_mpp_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
27707
27708 /**
27709  * Set this feature as required.
27710  */
27711 void InvoiceFeatures_set_basic_mpp_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
27712
27713 /**
27714  * Checks if this feature is supported.
27715  */
27716 MUST_USE_RES bool InvoiceFeatures_supports_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
27717
27718 /**
27719  * Checks if this feature is required.
27720  */
27721 MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27722
27723 /**
27724  * Checks if this feature is required.
27725  */
27726 MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27727
27728 /**
27729  * Checks if this feature is required.
27730  */
27731 MUST_USE_RES bool InvoiceFeatures_requires_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
27732
27733 /**
27734  * Set this feature as optional.
27735  */
27736 void InitFeatures_set_wumbo_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
27737
27738 /**
27739  * Set this feature as required.
27740  */
27741 void InitFeatures_set_wumbo_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
27742
27743 /**
27744  * Checks if this feature is supported.
27745  */
27746 MUST_USE_RES bool InitFeatures_supports_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27747
27748 /**
27749  * Set this feature as optional.
27750  */
27751 void NodeFeatures_set_wumbo_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27752
27753 /**
27754  * Set this feature as required.
27755  */
27756 void NodeFeatures_set_wumbo_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27757
27758 /**
27759  * Checks if this feature is supported.
27760  */
27761 MUST_USE_RES bool NodeFeatures_supports_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27762
27763 /**
27764  * Checks if this feature is required.
27765  */
27766 MUST_USE_RES bool InitFeatures_requires_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27767
27768 /**
27769  * Checks if this feature is required.
27770  */
27771 MUST_USE_RES bool NodeFeatures_requires_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27772
27773 /**
27774  * Set this feature as optional.
27775  */
27776 void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
27777
27778 /**
27779  * Set this feature as required.
27780  */
27781 void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
27782
27783 /**
27784  * Checks if this feature is supported.
27785  */
27786 MUST_USE_RES bool InitFeatures_supports_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27787
27788 /**
27789  * Set this feature as optional.
27790  */
27791 void NodeFeatures_set_shutdown_any_segwit_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27792
27793 /**
27794  * Set this feature as required.
27795  */
27796 void NodeFeatures_set_shutdown_any_segwit_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27797
27798 /**
27799  * Checks if this feature is supported.
27800  */
27801 MUST_USE_RES bool NodeFeatures_supports_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27802
27803 /**
27804  * Checks if this feature is required.
27805  */
27806 MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27807
27808 /**
27809  * Checks if this feature is required.
27810  */
27811 MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27812
27813 /**
27814  * Set this feature as optional.
27815  */
27816 void InitFeatures_set_onion_messages_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
27817
27818 /**
27819  * Set this feature as required.
27820  */
27821 void InitFeatures_set_onion_messages_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
27822
27823 /**
27824  * Checks if this feature is supported.
27825  */
27826 MUST_USE_RES bool InitFeatures_supports_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27827
27828 /**
27829  * Set this feature as optional.
27830  */
27831 void NodeFeatures_set_onion_messages_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27832
27833 /**
27834  * Set this feature as required.
27835  */
27836 void NodeFeatures_set_onion_messages_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27837
27838 /**
27839  * Checks if this feature is supported.
27840  */
27841 MUST_USE_RES bool NodeFeatures_supports_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27842
27843 /**
27844  * Checks if this feature is required.
27845  */
27846 MUST_USE_RES bool InitFeatures_requires_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27847
27848 /**
27849  * Checks if this feature is required.
27850  */
27851 MUST_USE_RES bool NodeFeatures_requires_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27852
27853 /**
27854  * Set this feature as optional.
27855  */
27856 void InitFeatures_set_channel_type_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
27857
27858 /**
27859  * Set this feature as required.
27860  */
27861 void InitFeatures_set_channel_type_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
27862
27863 /**
27864  * Checks if this feature is supported.
27865  */
27866 MUST_USE_RES bool InitFeatures_supports_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27867
27868 /**
27869  * Set this feature as optional.
27870  */
27871 void NodeFeatures_set_channel_type_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27872
27873 /**
27874  * Set this feature as required.
27875  */
27876 void NodeFeatures_set_channel_type_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27877
27878 /**
27879  * Checks if this feature is supported.
27880  */
27881 MUST_USE_RES bool NodeFeatures_supports_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27882
27883 /**
27884  * Checks if this feature is required.
27885  */
27886 MUST_USE_RES bool InitFeatures_requires_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27887
27888 /**
27889  * Checks if this feature is required.
27890  */
27891 MUST_USE_RES bool NodeFeatures_requires_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27892
27893 /**
27894  * Set this feature as optional.
27895  */
27896 void InitFeatures_set_scid_privacy_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
27897
27898 /**
27899  * Set this feature as required.
27900  */
27901 void InitFeatures_set_scid_privacy_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
27902
27903 /**
27904  * Checks if this feature is supported.
27905  */
27906 MUST_USE_RES bool InitFeatures_supports_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27907
27908 /**
27909  * Set this feature as optional.
27910  */
27911 void NodeFeatures_set_scid_privacy_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27912
27913 /**
27914  * Set this feature as required.
27915  */
27916 void NodeFeatures_set_scid_privacy_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27917
27918 /**
27919  * Checks if this feature is supported.
27920  */
27921 MUST_USE_RES bool NodeFeatures_supports_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27922
27923 /**
27924  * Set this feature as optional.
27925  */
27926 void ChannelTypeFeatures_set_scid_privacy_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
27927
27928 /**
27929  * Set this feature as required.
27930  */
27931 void ChannelTypeFeatures_set_scid_privacy_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
27932
27933 /**
27934  * Checks if this feature is supported.
27935  */
27936 MUST_USE_RES bool ChannelTypeFeatures_supports_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
27937
27938 /**
27939  * Checks if this feature is required.
27940  */
27941 MUST_USE_RES bool InitFeatures_requires_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27942
27943 /**
27944  * Checks if this feature is required.
27945  */
27946 MUST_USE_RES bool NodeFeatures_requires_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27947
27948 /**
27949  * Checks if this feature is required.
27950  */
27951 MUST_USE_RES bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
27952
27953 /**
27954  * Set this feature as optional.
27955  */
27956 void InitFeatures_set_zero_conf_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
27957
27958 /**
27959  * Set this feature as required.
27960  */
27961 void InitFeatures_set_zero_conf_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
27962
27963 /**
27964  * Checks if this feature is supported.
27965  */
27966 MUST_USE_RES bool InitFeatures_supports_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
27967
27968 /**
27969  * Set this feature as optional.
27970  */
27971 void NodeFeatures_set_zero_conf_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27972
27973 /**
27974  * Set this feature as required.
27975  */
27976 void NodeFeatures_set_zero_conf_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
27977
27978 /**
27979  * Checks if this feature is supported.
27980  */
27981 MUST_USE_RES bool NodeFeatures_supports_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
27982
27983 /**
27984  * Set this feature as optional.
27985  */
27986 void ChannelTypeFeatures_set_zero_conf_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
27987
27988 /**
27989  * Set this feature as required.
27990  */
27991 void ChannelTypeFeatures_set_zero_conf_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
27992
27993 /**
27994  * Checks if this feature is supported.
27995  */
27996 MUST_USE_RES bool ChannelTypeFeatures_supports_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
27997
27998 /**
27999  * Checks if this feature is required.
28000  */
28001 MUST_USE_RES bool InitFeatures_requires_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28002
28003 /**
28004  * Checks if this feature is required.
28005  */
28006 MUST_USE_RES bool NodeFeatures_requires_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28007
28008 /**
28009  * Checks if this feature is required.
28010  */
28011 MUST_USE_RES bool ChannelTypeFeatures_requires_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
28012
28013 /**
28014  * Set this feature as optional.
28015  */
28016 void NodeFeatures_set_keysend_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28017
28018 /**
28019  * Set this feature as required.
28020  */
28021 void NodeFeatures_set_keysend_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28022
28023 /**
28024  * Checks if this feature is supported.
28025  */
28026 MUST_USE_RES bool NodeFeatures_supports_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28027
28028 /**
28029  * Checks if this feature is required.
28030  */
28031 MUST_USE_RES bool NodeFeatures_requires_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28032
28033 /**
28034  * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
28035  */
28036 void ShutdownScript_free(struct LDKShutdownScript this_obj);
28037
28038 /**
28039  * Creates a copy of the ShutdownScript
28040  */
28041 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
28042
28043 /**
28044  * Checks if two ShutdownScripts contain equal inner contents.
28045  * This ignores pointers and is_owned flags and looks at the values in fields.
28046  * Two objects with NULL inner values will be considered "equal" here.
28047  */
28048 bool ShutdownScript_eq(const struct LDKShutdownScript *NONNULL_PTR a, const struct LDKShutdownScript *NONNULL_PTR b);
28049
28050 /**
28051  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
28052  */
28053 void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
28054
28055 /**
28056  * The script that did not meet the requirements from [BOLT #2].
28057  *
28058  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
28059  */
28060 struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
28061
28062 /**
28063  * The script that did not meet the requirements from [BOLT #2].
28064  *
28065  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
28066  */
28067 void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
28068
28069 /**
28070  * Constructs a new InvalidShutdownScript given each field
28071  */
28072 MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
28073
28074 /**
28075  * Creates a copy of the InvalidShutdownScript
28076  */
28077 struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig);
28078
28079 /**
28080  * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
28081  */
28082 struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
28083
28084 /**
28085  * Read a ShutdownScript from a byte array, created by ShutdownScript_write
28086  */
28087 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
28088
28089 /**
28090  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
28091  */
28092 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
28093
28094 /**
28095  * Generates a P2WSH script pubkey from the given [`WScriptHash`].
28096  */
28097 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
28098
28099 /**
28100  * Generates a witness script pubkey from the given segwit version and program.
28101  *
28102  * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
28103  * [`ShutdownScript::new_p2wsh`] instead.
28104  *
28105  * # Errors
28106  *
28107  * This function may return an error if `program` is invalid for the segwit `version`.
28108  */
28109 MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(struct LDKWitnessVersion version, struct LDKu8slice program);
28110
28111 /**
28112  * Converts the shutdown script into the underlying [`Script`].
28113  */
28114 MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
28115
28116 /**
28117  * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
28118  *
28119  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28120  */
28121 MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
28122
28123 /**
28124  * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
28125  *
28126  * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
28127  */
28128 MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
28129
28130 /**
28131  * Calls the free function if one is set
28132  */
28133 void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
28134
28135 /**
28136  * Calls the free function if one is set
28137  */
28138 void Type_free(struct LDKType this_ptr);
28139
28140 /**
28141  * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
28142  */
28143 void NodeId_free(struct LDKNodeId this_obj);
28144
28145 /**
28146  * Creates a copy of the NodeId
28147  */
28148 struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig);
28149
28150 /**
28151  * Create a new NodeId from a public key
28152  */
28153 MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey);
28154
28155 /**
28156  * Get the public key slice from this NodeId
28157  */
28158 MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
28159
28160 /**
28161  * Checks if two NodeIds contain equal inner contents.
28162  */
28163 uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
28164
28165 /**
28166  * Serialize the NodeId object into a byte array which can be read by NodeId_read
28167  */
28168 struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj);
28169
28170 /**
28171  * Read a NodeId from a byte array, created by NodeId_write
28172  */
28173 struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser);
28174
28175 /**
28176  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
28177  */
28178 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
28179
28180 /**
28181  * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
28182  */
28183 void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
28184
28185 /**
28186  * Frees any resources used by the NetworkUpdate
28187  */
28188 void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
28189
28190 /**
28191  * Creates a copy of the NetworkUpdate
28192  */
28193 struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
28194
28195 /**
28196  * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
28197  */
28198 struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
28199
28200 /**
28201  * Utility method to constructs a new ChannelFailure-variant NetworkUpdate
28202  */
28203 struct LDKNetworkUpdate NetworkUpdate_channel_failure(uint64_t short_channel_id, bool is_permanent);
28204
28205 /**
28206  * Utility method to constructs a new NodeFailure-variant NetworkUpdate
28207  */
28208 struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
28209
28210 /**
28211  * Checks if two NetworkUpdates contain equal inner contents.
28212  * This ignores pointers and is_owned flags and looks at the values in fields.
28213  */
28214 bool NetworkUpdate_eq(const struct LDKNetworkUpdate *NONNULL_PTR a, const struct LDKNetworkUpdate *NONNULL_PTR b);
28215
28216 /**
28217  * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
28218  */
28219 struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
28220
28221 /**
28222  * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
28223  */
28224 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser);
28225
28226 /**
28227  * Frees any resources used by the P2PGossipSync, if is_owned is set and inner is non-NULL.
28228  */
28229 void P2PGossipSync_free(struct LDKP2PGossipSync this_obj);
28230
28231 /**
28232  * Creates a new tracker of the actual state of the network of channels and nodes,
28233  * assuming an existing Network Graph.
28234  * Chain monitor is used to make sure announced channels exist on-chain,
28235  * channel data is correct, and that the announcement is signed with
28236  * channel owners' keys.
28237  */
28238 MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
28239
28240 /**
28241  * Adds a provider used to check new announcements. Does not affect
28242  * existing announcements unless they are updated.
28243  * Add, update or remove the provider would replace the current one.
28244  */
28245 void P2PGossipSync_add_chain_access(struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access);
28246
28247 /**
28248  * Constructs a new EventHandler which calls the relevant methods on this_arg.
28249  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
28250  */
28251 struct LDKEventHandler NetworkGraph_as_EventHandler(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
28252
28253 /**
28254  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
28255  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
28256  */
28257 struct LDKRoutingMessageHandler P2PGossipSync_as_RoutingMessageHandler(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
28258
28259 /**
28260  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
28261  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
28262  */
28263 struct LDKMessageSendEventsProvider P2PGossipSync_as_MessageSendEventsProvider(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
28264
28265 /**
28266  * Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL.
28267  */
28268 void ChannelUpdateInfo_free(struct LDKChannelUpdateInfo this_obj);
28269
28270 /**
28271  * When the last update to the channel direction was issued.
28272  * Value is opaque, as set in the announcement.
28273  */
28274 uint32_t ChannelUpdateInfo_get_last_update(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
28275
28276 /**
28277  * When the last update to the channel direction was issued.
28278  * Value is opaque, as set in the announcement.
28279  */
28280 void ChannelUpdateInfo_set_last_update(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint32_t val);
28281
28282 /**
28283  * Whether the channel can be currently used for payments (in this one direction).
28284  */
28285 bool ChannelUpdateInfo_get_enabled(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
28286
28287 /**
28288  * Whether the channel can be currently used for payments (in this one direction).
28289  */
28290 void ChannelUpdateInfo_set_enabled(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, bool val);
28291
28292 /**
28293  * The difference in CLTV values that you must have when routing through this channel.
28294  */
28295 uint16_t ChannelUpdateInfo_get_cltv_expiry_delta(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
28296
28297 /**
28298  * The difference in CLTV values that you must have when routing through this channel.
28299  */
28300 void ChannelUpdateInfo_set_cltv_expiry_delta(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint16_t val);
28301
28302 /**
28303  * The minimum value, which must be relayed to the next hop via the channel
28304  */
28305 uint64_t ChannelUpdateInfo_get_htlc_minimum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
28306
28307 /**
28308  * The minimum value, which must be relayed to the next hop via the channel
28309  */
28310 void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
28311
28312 /**
28313  * The maximum value which may be relayed to the next hop via the channel.
28314  */
28315 uint64_t ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
28316
28317 /**
28318  * The maximum value which may be relayed to the next hop via the channel.
28319  */
28320 void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
28321
28322 /**
28323  * Fees charged when the channel is used for routing
28324  */
28325 struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
28326
28327 /**
28328  * Fees charged when the channel is used for routing
28329  */
28330 void ChannelUpdateInfo_set_fees(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
28331
28332 /**
28333  * Most recent update for the channel received from the network
28334  * Mostly redundant with the data we store in fields explicitly.
28335  * Everything else is useful only for sending out for initial routing sync.
28336  * Not stored if contains excess data to prevent DoS.
28337  *
28338  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28339  */
28340 struct LDKChannelUpdate ChannelUpdateInfo_get_last_update_message(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
28341
28342 /**
28343  * Most recent update for the channel received from the network
28344  * Mostly redundant with the data we store in fields explicitly.
28345  * Everything else is useful only for sending out for initial routing sync.
28346  * Not stored if contains excess data to prevent DoS.
28347  *
28348  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
28349  */
28350 void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
28351
28352 /**
28353  * Constructs a new ChannelUpdateInfo given each field
28354  */
28355 MUST_USE_RES struct LDKChannelUpdateInfo ChannelUpdateInfo_new(uint32_t last_update_arg, bool enabled_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, struct LDKChannelUpdate last_update_message_arg);
28356
28357 /**
28358  * Creates a copy of the ChannelUpdateInfo
28359  */
28360 struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig);
28361
28362 /**
28363  * Checks if two ChannelUpdateInfos contain equal inner contents.
28364  * This ignores pointers and is_owned flags and looks at the values in fields.
28365  * Two objects with NULL inner values will be considered "equal" here.
28366  */
28367 bool ChannelUpdateInfo_eq(const struct LDKChannelUpdateInfo *NONNULL_PTR a, const struct LDKChannelUpdateInfo *NONNULL_PTR b);
28368
28369 /**
28370  * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read
28371  */
28372 struct LDKCVec_u8Z ChannelUpdateInfo_write(const struct LDKChannelUpdateInfo *NONNULL_PTR obj);
28373
28374 /**
28375  * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write
28376  */
28377 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ ChannelUpdateInfo_read(struct LDKu8slice ser);
28378
28379 /**
28380  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
28381  */
28382 void ChannelInfo_free(struct LDKChannelInfo this_obj);
28383
28384 /**
28385  * Protocol features of a channel communicated during its announcement
28386  */
28387 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
28388
28389 /**
28390  * Protocol features of a channel communicated during its announcement
28391  */
28392 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
28393
28394 /**
28395  * Source node of the first direction of a channel
28396  */
28397 struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
28398
28399 /**
28400  * Source node of the first direction of a channel
28401  */
28402 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
28403
28404 /**
28405  * Details about the first direction of a channel
28406  *
28407  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28408  */
28409 struct LDKChannelUpdateInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
28410
28411 /**
28412  * Details about the first direction of a channel
28413  *
28414  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
28415  */
28416 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
28417
28418 /**
28419  * Source node of the second direction of a channel
28420  */
28421 struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
28422
28423 /**
28424  * Source node of the second direction of a channel
28425  */
28426 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
28427
28428 /**
28429  * Details about the second direction of a channel
28430  *
28431  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28432  */
28433 struct LDKChannelUpdateInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
28434
28435 /**
28436  * Details about the second direction of a channel
28437  *
28438  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
28439  */
28440 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
28441
28442 /**
28443  * The channel capacity as seen on-chain, if chain lookup is available.
28444  */
28445 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
28446
28447 /**
28448  * The channel capacity as seen on-chain, if chain lookup is available.
28449  */
28450 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
28451
28452 /**
28453  * An initial announcement of the channel
28454  * Mostly redundant with the data we store in fields explicitly.
28455  * Everything else is useful only for sending out for initial routing sync.
28456  * Not stored if contains excess data to prevent DoS.
28457  *
28458  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28459  */
28460 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
28461
28462 /**
28463  * An initial announcement of the channel
28464  * Mostly redundant with the data we store in fields explicitly.
28465  * Everything else is useful only for sending out for initial routing sync.
28466  * Not stored if contains excess data to prevent DoS.
28467  *
28468  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
28469  */
28470 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
28471
28472 /**
28473  * Creates a copy of the ChannelInfo
28474  */
28475 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
28476
28477 /**
28478  * Checks if two ChannelInfos contain equal inner contents.
28479  * This ignores pointers and is_owned flags and looks at the values in fields.
28480  * Two objects with NULL inner values will be considered "equal" here.
28481  */
28482 bool ChannelInfo_eq(const struct LDKChannelInfo *NONNULL_PTR a, const struct LDKChannelInfo *NONNULL_PTR b);
28483
28484 /**
28485  * Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag.
28486  *
28487  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28488  */
28489 MUST_USE_RES struct LDKChannelUpdateInfo ChannelInfo_get_directional_info(const struct LDKChannelInfo *NONNULL_PTR this_arg, uint8_t channel_flags);
28490
28491 /**
28492  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
28493  */
28494 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
28495
28496 /**
28497  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
28498  */
28499 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
28500
28501 /**
28502  * Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL.
28503  */
28504 void DirectedChannelInfo_free(struct LDKDirectedChannelInfo this_obj);
28505
28506 /**
28507  * Creates a copy of the DirectedChannelInfo
28508  */
28509 struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirectedChannelInfo *NONNULL_PTR orig);
28510
28511 /**
28512  * Returns information for the channel.
28513  */
28514 MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
28515
28516 /**
28517  * Returns information for the direction.
28518  *
28519  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28520  */
28521 MUST_USE_RES struct LDKChannelUpdateInfo DirectedChannelInfo_direction(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
28522
28523 /**
28524  * Returns the maximum HTLC amount allowed over the channel in the direction.
28525  */
28526 MUST_USE_RES uint64_t DirectedChannelInfo_htlc_maximum_msat(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
28527
28528 /**
28529  * Returns the [`EffectiveCapacity`] of the channel in the direction.
28530  *
28531  * This is either the total capacity from the funding transaction, if known, or the
28532  * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
28533  * otherwise.
28534  */
28535 MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
28536
28537 /**
28538  * Frees any resources used by the EffectiveCapacity
28539  */
28540 void EffectiveCapacity_free(struct LDKEffectiveCapacity this_ptr);
28541
28542 /**
28543  * Creates a copy of the EffectiveCapacity
28544  */
28545 struct LDKEffectiveCapacity EffectiveCapacity_clone(const struct LDKEffectiveCapacity *NONNULL_PTR orig);
28546
28547 /**
28548  * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity
28549  */
28550 struct LDKEffectiveCapacity EffectiveCapacity_exact_liquidity(uint64_t liquidity_msat);
28551
28552 /**
28553  * Utility method to constructs a new MaximumHTLC-variant EffectiveCapacity
28554  */
28555 struct LDKEffectiveCapacity EffectiveCapacity_maximum_htlc(uint64_t amount_msat);
28556
28557 /**
28558  * Utility method to constructs a new Total-variant EffectiveCapacity
28559  */
28560 struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat, struct LDKCOption_u64Z htlc_maximum_msat);
28561
28562 /**
28563  * Utility method to constructs a new Infinite-variant EffectiveCapacity
28564  */
28565 struct LDKEffectiveCapacity EffectiveCapacity_infinite(void);
28566
28567 /**
28568  * Utility method to constructs a new Unknown-variant EffectiveCapacity
28569  */
28570 struct LDKEffectiveCapacity EffectiveCapacity_unknown(void);
28571
28572 /**
28573  * Returns the effective capacity denominated in millisatoshi.
28574  */
28575 MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacity *NONNULL_PTR this_arg);
28576
28577 /**
28578  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
28579  */
28580 void RoutingFees_free(struct LDKRoutingFees this_obj);
28581
28582 /**
28583  * Flat routing fee in satoshis
28584  */
28585 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
28586
28587 /**
28588  * Flat routing fee in satoshis
28589  */
28590 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
28591
28592 /**
28593  * Liquidity-based routing fee in millionths of a routed amount.
28594  * In other words, 10000 is 1%.
28595  */
28596 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
28597
28598 /**
28599  * Liquidity-based routing fee in millionths of a routed amount.
28600  * In other words, 10000 is 1%.
28601  */
28602 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
28603
28604 /**
28605  * Constructs a new RoutingFees given each field
28606  */
28607 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
28608
28609 /**
28610  * Checks if two RoutingFeess contain equal inner contents.
28611  * This ignores pointers and is_owned flags and looks at the values in fields.
28612  * Two objects with NULL inner values will be considered "equal" here.
28613  */
28614 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
28615
28616 /**
28617  * Creates a copy of the RoutingFees
28618  */
28619 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
28620
28621 /**
28622  * Checks if two RoutingFeess contain equal inner contents.
28623  */
28624 uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
28625
28626 /**
28627  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
28628  */
28629 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
28630
28631 /**
28632  * Read a RoutingFees from a byte array, created by RoutingFees_write
28633  */
28634 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
28635
28636 /**
28637  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
28638  */
28639 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
28640
28641 /**
28642  * Protocol features the node announced support for
28643  */
28644 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
28645
28646 /**
28647  * Protocol features the node announced support for
28648  */
28649 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
28650
28651 /**
28652  * When the last known update to the node state was issued.
28653  * Value is opaque, as set in the announcement.
28654  */
28655 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
28656
28657 /**
28658  * When the last known update to the node state was issued.
28659  * Value is opaque, as set in the announcement.
28660  */
28661 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
28662
28663 /**
28664  * Color assigned to the node
28665  */
28666 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
28667
28668 /**
28669  * Color assigned to the node
28670  */
28671 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
28672
28673 /**
28674  * Moniker assigned to the node.
28675  * May be invalid or malicious (eg control chars),
28676  * should not be exposed to the user.
28677  */
28678 struct LDKNodeAlias NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
28679
28680 /**
28681  * Moniker assigned to the node.
28682  * May be invalid or malicious (eg control chars),
28683  * should not be exposed to the user.
28684  */
28685 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAlias val);
28686
28687 /**
28688  * Internet-level addresses via which one can connect to the node
28689  *
28690  * Returns a copy of the field.
28691  */
28692 struct LDKCVec_NetAddressZ NodeAnnouncementInfo_get_addresses(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
28693
28694 /**
28695  * Internet-level addresses via which one can connect to the node
28696  */
28697 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
28698
28699 /**
28700  * An initial announcement of the node
28701  * Mostly redundant with the data we store in fields explicitly.
28702  * Everything else is useful only for sending out for initial routing sync.
28703  * Not stored if contains excess data to prevent DoS.
28704  *
28705  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28706  */
28707 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
28708
28709 /**
28710  * An initial announcement of the node
28711  * Mostly redundant with the data we store in fields explicitly.
28712  * Everything else is useful only for sending out for initial routing sync.
28713  * Not stored if contains excess data to prevent DoS.
28714  *
28715  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
28716  */
28717 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
28718
28719 /**
28720  * Constructs a new NodeAnnouncementInfo given each field
28721  */
28722 MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKNodeAlias alias_arg, struct LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg);
28723
28724 /**
28725  * Creates a copy of the NodeAnnouncementInfo
28726  */
28727 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
28728
28729 /**
28730  * Checks if two NodeAnnouncementInfos contain equal inner contents.
28731  * This ignores pointers and is_owned flags and looks at the values in fields.
28732  * Two objects with NULL inner values will be considered "equal" here.
28733  */
28734 bool NodeAnnouncementInfo_eq(const struct LDKNodeAnnouncementInfo *NONNULL_PTR a, const struct LDKNodeAnnouncementInfo *NONNULL_PTR b);
28735
28736 /**
28737  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
28738  */
28739 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
28740
28741 /**
28742  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
28743  */
28744 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
28745
28746 /**
28747  * Frees any resources used by the NodeAlias, if is_owned is set and inner is non-NULL.
28748  */
28749 void NodeAlias_free(struct LDKNodeAlias this_obj);
28750
28751 const uint8_t (*NodeAlias_get_a(const struct LDKNodeAlias *NONNULL_PTR this_ptr))[32];
28752
28753 void NodeAlias_set_a(struct LDKNodeAlias *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
28754
28755 /**
28756  * Constructs a new NodeAlias given each field
28757  */
28758 MUST_USE_RES struct LDKNodeAlias NodeAlias_new(struct LDKThirtyTwoBytes a_arg);
28759
28760 /**
28761  * Creates a copy of the NodeAlias
28762  */
28763 struct LDKNodeAlias NodeAlias_clone(const struct LDKNodeAlias *NONNULL_PTR orig);
28764
28765 /**
28766  * Checks if two NodeAliass contain equal inner contents.
28767  * This ignores pointers and is_owned flags and looks at the values in fields.
28768  * Two objects with NULL inner values will be considered "equal" here.
28769  */
28770 bool NodeAlias_eq(const struct LDKNodeAlias *NONNULL_PTR a, const struct LDKNodeAlias *NONNULL_PTR b);
28771
28772 /**
28773  * Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read
28774  */
28775 struct LDKCVec_u8Z NodeAlias_write(const struct LDKNodeAlias *NONNULL_PTR obj);
28776
28777 /**
28778  * Read a NodeAlias from a byte array, created by NodeAlias_write
28779  */
28780 struct LDKCResult_NodeAliasDecodeErrorZ NodeAlias_read(struct LDKu8slice ser);
28781
28782 /**
28783  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
28784  */
28785 void NodeInfo_free(struct LDKNodeInfo this_obj);
28786
28787 /**
28788  * All valid channels a node has announced
28789  *
28790  * Returns a copy of the field.
28791  */
28792 struct LDKCVec_u64Z NodeInfo_get_channels(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
28793
28794 /**
28795  * All valid channels a node has announced
28796  */
28797 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
28798
28799 /**
28800  * Lowest fees enabling routing via any of the enabled, known channels to a node.
28801  * The two fields (flat and proportional fee) are independent,
28802  * meaning they don't have to refer to the same channel.
28803  *
28804  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28805  */
28806 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
28807
28808 /**
28809  * Lowest fees enabling routing via any of the enabled, known channels to a node.
28810  * The two fields (flat and proportional fee) are independent,
28811  * meaning they don't have to refer to the same channel.
28812  *
28813  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
28814  */
28815 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
28816
28817 /**
28818  * More information about a node from node_announcement.
28819  * Optional because we store a Node entry after learning about it from
28820  * a channel announcement, but before receiving a node announcement.
28821  *
28822  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28823  */
28824 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
28825
28826 /**
28827  * More information about a node from node_announcement.
28828  * Optional because we store a Node entry after learning about it from
28829  * a channel announcement, but before receiving a node announcement.
28830  *
28831  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
28832  */
28833 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
28834
28835 /**
28836  * Constructs a new NodeInfo given each field
28837  */
28838 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
28839
28840 /**
28841  * Creates a copy of the NodeInfo
28842  */
28843 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
28844
28845 /**
28846  * Checks if two NodeInfos contain equal inner contents.
28847  * This ignores pointers and is_owned flags and looks at the values in fields.
28848  * Two objects with NULL inner values will be considered "equal" here.
28849  */
28850 bool NodeInfo_eq(const struct LDKNodeInfo *NONNULL_PTR a, const struct LDKNodeInfo *NONNULL_PTR b);
28851
28852 /**
28853  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
28854  */
28855 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
28856
28857 /**
28858  * Read a NodeInfo from a byte array, created by NodeInfo_write
28859  */
28860 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
28861
28862 /**
28863  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
28864  */
28865 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
28866
28867 /**
28868  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
28869  */
28870 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser, struct LDKLogger arg);
28871
28872 /**
28873  * Creates a new, empty, network graph.
28874  */
28875 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKLogger logger);
28876
28877 /**
28878  * Returns a read-only view of the network graph.
28879  */
28880 MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
28881
28882 /**
28883  * The unix timestamp provided by the most recent rapid gossip sync.
28884  * It will be set by the rapid sync process after every sync completion.
28885  */
28886 MUST_USE_RES struct LDKCOption_u32Z NetworkGraph_get_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
28887
28888 /**
28889  * Update the unix timestamp provided by the most recent rapid gossip sync.
28890  * This should be done automatically by the rapid sync process after every sync completion.
28891  */
28892 void NetworkGraph_set_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint32_t last_rapid_gossip_sync_timestamp);
28893
28894 /**
28895  * For an already known node (from channel announcements), update its stored properties from a
28896  * given node announcement.
28897  *
28898  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
28899  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
28900  * routing messages from a source using a protocol other than the lightning P2P protocol.
28901  */
28902 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
28903
28904 /**
28905  * For an already known node (from channel announcements), update its stored properties from a
28906  * given node announcement without verifying the associated signatures. Because we aren't
28907  * given the associated signatures here we cannot relay the node announcement to any of our
28908  * peers.
28909  */
28910 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);
28911
28912 /**
28913  * Store or update channel info from a channel announcement.
28914  *
28915  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
28916  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
28917  * routing messages from a source using a protocol other than the lightning P2P protocol.
28918  *
28919  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
28920  * the corresponding UTXO exists on chain and is correctly-formatted.
28921  */
28922 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);
28923
28924 /**
28925  * Store or update channel info from a channel announcement without verifying the associated
28926  * signatures. Because we aren't given the associated signatures here we cannot relay the
28927  * channel announcement to any of our peers.
28928  *
28929  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
28930  * the corresponding UTXO exists on chain and is correctly-formatted.
28931  */
28932 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);
28933
28934 /**
28935  * Update channel from partial announcement data received via rapid gossip sync
28936  *
28937  * `timestamp: u64`: Timestamp emulating the backdated original announcement receipt (by the
28938  * rapid gossip sync server)
28939  *
28940  * All other parameters as used in [`msgs::UnsignedChannelAnnouncement`] fields.
28941  */
28942 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_add_channel_from_partial_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, uint64_t timestamp, struct LDKChannelFeatures features, struct LDKPublicKey node_id_1, struct LDKPublicKey node_id_2);
28943
28944 /**
28945  * Marks a channel in the graph as failed if a corresponding HTLC fail was sent.
28946  * If permanent, removes a channel from the local storage.
28947  * May cause the removal of nodes too, if this was their last channel.
28948  * If not permanent, makes channels unavailable for routing.
28949  */
28950 void NetworkGraph_channel_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
28951
28952 /**
28953  * Marks a node in the graph as permanently failed, effectively removing it and its channels
28954  * from local storage.
28955  */
28956 void NetworkGraph_node_failed_permanent(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey node_id);
28957
28958 /**
28959  * Removes information about channels that we haven't heard any updates about in some time.
28960  * This can be used regularly to prune the network graph of channels that likely no longer
28961  * exist.
28962  *
28963  * While there is no formal requirement that nodes regularly re-broadcast their channel
28964  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
28965  * pruning occur for updates which are at least two weeks old, which we implement here.
28966  *
28967  * Note that for users of the `lightning-background-processor` crate this method may be
28968  * automatically called regularly for you.
28969  *
28970  * This method will also cause us to stop tracking removed nodes and channels if they have been
28971  * in the map for a while so that these can be resynced from gossip in the future.
28972  *
28973  * This method is only available with the `std` feature. See
28974  * [`NetworkGraph::remove_stale_channels_and_tracking_with_time`] for `no-std` use.
28975  */
28976 void NetworkGraph_remove_stale_channels_and_tracking(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
28977
28978 /**
28979  * Removes information about channels that we haven't heard any updates about in some time.
28980  * This can be used regularly to prune the network graph of channels that likely no longer
28981  * exist.
28982  *
28983  * While there is no formal requirement that nodes regularly re-broadcast their channel
28984  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
28985  * pruning occur for updates which are at least two weeks old, which we implement here.
28986  *
28987  * This method will also cause us to stop tracking removed nodes and channels if they have been
28988  * in the map for a while so that these can be resynced from gossip in the future.
28989  *
28990  * This function takes the current unix time as an argument. For users with the `std` feature
28991  * enabled, [`NetworkGraph::remove_stale_channels_and_tracking`] may be preferable.
28992  */
28993 void NetworkGraph_remove_stale_channels_and_tracking_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix);
28994
28995 /**
28996  * For an already known (from announcement) channel, update info about one of the directions
28997  * of the channel.
28998  *
28999  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
29000  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
29001  * routing messages from a source using a protocol other than the lightning P2P protocol.
29002  *
29003  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
29004  * materially in the future will be rejected.
29005  */
29006 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
29007
29008 /**
29009  * For an already known (from announcement) channel, update info about one of the directions
29010  * of the channel without verifying the associated signatures. Because we aren't given the
29011  * associated signatures here we cannot relay the channel update to any of our peers.
29012  *
29013  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
29014  * materially in the future will be rejected.
29015  */
29016 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
29017
29018 /**
29019  * Returns information on a channel with the given id.
29020  *
29021  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
29022  */
29023 MUST_USE_RES struct LDKChannelInfo ReadOnlyNetworkGraph_channel(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id);
29024
29025 /**
29026  * Returns the list of channels in the graph
29027  */
29028 MUST_USE_RES struct LDKCVec_u64Z ReadOnlyNetworkGraph_list_channels(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg);
29029
29030 /**
29031  * Returns information on a node with the given id.
29032  *
29033  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
29034  */
29035 MUST_USE_RES struct LDKNodeInfo ReadOnlyNetworkGraph_node(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
29036
29037 /**
29038  * Returns the list of nodes in the graph
29039  */
29040 MUST_USE_RES struct LDKCVec_NodeIdZ ReadOnlyNetworkGraph_list_nodes(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg);
29041
29042 /**
29043  * Get network addresses by node id.
29044  * Returns None if the requested node is completely unknown,
29045  * or if node announcement for the node was never received.
29046  */
29047 MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey);
29048
29049 /**
29050  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
29051  */
29052 void RouteHop_free(struct LDKRouteHop this_obj);
29053
29054 /**
29055  * The node_id of the node at this hop.
29056  */
29057 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
29058
29059 /**
29060  * The node_id of the node at this hop.
29061  */
29062 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
29063
29064 /**
29065  * The node_announcement features of the node at this hop. For the last hop, these may be
29066  * amended to match the features present in the invoice this node generated.
29067  */
29068 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
29069
29070 /**
29071  * The node_announcement features of the node at this hop. For the last hop, these may be
29072  * amended to match the features present in the invoice this node generated.
29073  */
29074 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
29075
29076 /**
29077  * The channel that should be used from the previous hop to reach this node.
29078  */
29079 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
29080
29081 /**
29082  * The channel that should be used from the previous hop to reach this node.
29083  */
29084 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
29085
29086 /**
29087  * The channel_announcement features of the channel that should be used from the previous hop
29088  * to reach this node.
29089  */
29090 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
29091
29092 /**
29093  * The channel_announcement features of the channel that should be used from the previous hop
29094  * to reach this node.
29095  */
29096 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
29097
29098 /**
29099  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
29100  * For the last hop, this should be the full value of the payment (might be more than
29101  * requested if we had to match htlc_minimum_msat).
29102  */
29103 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
29104
29105 /**
29106  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
29107  * For the last hop, this should be the full value of the payment (might be more than
29108  * requested if we had to match htlc_minimum_msat).
29109  */
29110 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
29111
29112 /**
29113  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
29114  * expected at the destination, in excess of the current block height.
29115  */
29116 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
29117
29118 /**
29119  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
29120  * expected at the destination, in excess of the current block height.
29121  */
29122 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
29123
29124 /**
29125  * Constructs a new RouteHop given each field
29126  */
29127 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);
29128
29129 /**
29130  * Creates a copy of the RouteHop
29131  */
29132 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
29133
29134 /**
29135  * Checks if two RouteHops contain equal inner contents.
29136  */
29137 uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
29138
29139 /**
29140  * Checks if two RouteHops contain equal inner contents.
29141  * This ignores pointers and is_owned flags and looks at the values in fields.
29142  * Two objects with NULL inner values will be considered "equal" here.
29143  */
29144 bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
29145
29146 /**
29147  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
29148  */
29149 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
29150
29151 /**
29152  * Read a RouteHop from a byte array, created by RouteHop_write
29153  */
29154 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
29155
29156 /**
29157  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
29158  */
29159 void Route_free(struct LDKRoute this_obj);
29160
29161 /**
29162  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
29163  * last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
29164  * INCLUDING our own, where the last hop is the destination. Thus, this must always be at
29165  * least length one. While the maximum length of any given path is variable, keeping the length
29166  * of any path less or equal to 19 should currently ensure it is viable.
29167  */
29168 struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
29169
29170 /**
29171  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
29172  * last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
29173  * INCLUDING our own, where the last hop is the destination. Thus, this must always be at
29174  * least length one. While the maximum length of any given path is variable, keeping the length
29175  * of any path less or equal to 19 should currently ensure it is viable.
29176  */
29177 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
29178
29179 /**
29180  * The `payment_params` parameter passed to [`find_route`].
29181  * This is used by `ChannelManager` to track information which may be required for retries,
29182  * provided back to you via [`Event::PaymentPathFailed`].
29183  *
29184  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
29185  *
29186  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
29187  */
29188 struct LDKPaymentParameters Route_get_payment_params(const struct LDKRoute *NONNULL_PTR this_ptr);
29189
29190 /**
29191  * The `payment_params` parameter passed to [`find_route`].
29192  * This is used by `ChannelManager` to track information which may be required for retries,
29193  * provided back to you via [`Event::PaymentPathFailed`].
29194  *
29195  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
29196  *
29197  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
29198  */
29199 void Route_set_payment_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
29200
29201 /**
29202  * Constructs a new Route given each field
29203  */
29204 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPaymentParameters payment_params_arg);
29205
29206 /**
29207  * Creates a copy of the Route
29208  */
29209 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
29210
29211 /**
29212  * Checks if two Routes contain equal inner contents.
29213  */
29214 uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
29215
29216 /**
29217  * Checks if two Routes contain equal inner contents.
29218  * This ignores pointers and is_owned flags and looks at the values in fields.
29219  * Two objects with NULL inner values will be considered "equal" here.
29220  */
29221 bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
29222
29223 /**
29224  * Returns the total amount of fees paid on this [`Route`].
29225  *
29226  * This doesn't include any extra payment made to the recipient, which can happen in excess of
29227  * the amount passed to [`find_route`]'s `params.final_value_msat`.
29228  */
29229 MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
29230
29231 /**
29232  * Returns the total amount paid on this [`Route`], excluding the fees.
29233  */
29234 MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
29235
29236 /**
29237  * Serialize the Route object into a byte array which can be read by Route_read
29238  */
29239 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
29240
29241 /**
29242  * Read a Route from a byte array, created by Route_write
29243  */
29244 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
29245
29246 /**
29247  * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL.
29248  */
29249 void RouteParameters_free(struct LDKRouteParameters this_obj);
29250
29251 /**
29252  * The parameters of the failed payment path.
29253  */
29254 struct LDKPaymentParameters RouteParameters_get_payment_params(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
29255
29256 /**
29257  * The parameters of the failed payment path.
29258  */
29259 void RouteParameters_set_payment_params(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
29260
29261 /**
29262  * The amount in msats sent on the failed payment path.
29263  */
29264 uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
29265
29266 /**
29267  * The amount in msats sent on the failed payment path.
29268  */
29269 void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val);
29270
29271 /**
29272  * The CLTV on the final hop of the failed payment path.
29273  */
29274 uint32_t RouteParameters_get_final_cltv_expiry_delta(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
29275
29276 /**
29277  * The CLTV on the final hop of the failed payment path.
29278  */
29279 void RouteParameters_set_final_cltv_expiry_delta(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint32_t val);
29280
29281 /**
29282  * Constructs a new RouteParameters given each field
29283  */
29284 MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPaymentParameters payment_params_arg, uint64_t final_value_msat_arg, uint32_t final_cltv_expiry_delta_arg);
29285
29286 /**
29287  * Creates a copy of the RouteParameters
29288  */
29289 struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig);
29290
29291 /**
29292  * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
29293  */
29294 struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj);
29295
29296 /**
29297  * Read a RouteParameters from a byte array, created by RouteParameters_write
29298  */
29299 struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser);
29300
29301 /**
29302  * Frees any resources used by the PaymentParameters, if is_owned is set and inner is non-NULL.
29303  */
29304 void PaymentParameters_free(struct LDKPaymentParameters this_obj);
29305
29306 /**
29307  * The node id of the payee.
29308  */
29309 struct LDKPublicKey PaymentParameters_get_payee_pubkey(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
29310
29311 /**
29312  * The node id of the payee.
29313  */
29314 void PaymentParameters_set_payee_pubkey(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKPublicKey val);
29315
29316 /**
29317  * Features supported by the payee.
29318  *
29319  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
29320  * does not contain any features.
29321  *
29322  * [`for_keysend`]: Self::for_keysend
29323  *
29324  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
29325  */
29326 struct LDKInvoiceFeatures PaymentParameters_get_features(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
29327
29328 /**
29329  * Features supported by the payee.
29330  *
29331  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
29332  * does not contain any features.
29333  *
29334  * [`for_keysend`]: Self::for_keysend
29335  *
29336  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
29337  */
29338 void PaymentParameters_set_features(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val);
29339
29340 /**
29341  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
29342  */
29343 struct LDKCVec_RouteHintZ PaymentParameters_get_route_hints(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
29344
29345 /**
29346  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
29347  */
29348 void PaymentParameters_set_route_hints(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val);
29349
29350 /**
29351  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
29352  */
29353 struct LDKCOption_u64Z PaymentParameters_get_expiry_time(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
29354
29355 /**
29356  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
29357  */
29358 void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
29359
29360 /**
29361  * The maximum total CLTV delta we accept for the route.
29362  * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`].
29363  */
29364 uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
29365
29366 /**
29367  * The maximum total CLTV delta we accept for the route.
29368  * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`].
29369  */
29370 void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val);
29371
29372 /**
29373  * The maximum number of paths that may be used by (MPP) payments.
29374  * Defaults to [`DEFAULT_MAX_PATH_COUNT`].
29375  */
29376 uint8_t PaymentParameters_get_max_path_count(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
29377
29378 /**
29379  * The maximum number of paths that may be used by (MPP) payments.
29380  * Defaults to [`DEFAULT_MAX_PATH_COUNT`].
29381  */
29382 void PaymentParameters_set_max_path_count(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val);
29383
29384 /**
29385  * Selects the maximum share of a channel's total capacity which will be sent over a channel,
29386  * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas
29387  * a lower value prefers to send larger MPP parts, potentially saturating channels and
29388  * increasing failure probability for those paths.
29389  *
29390  * Note that this restriction will be relaxed during pathfinding after paths which meet this
29391  * restriction have been found. While paths which meet this criteria will be searched for, it
29392  * is ultimately up to the scorer to select them over other paths.
29393  *
29394  * A value of 0 will allow payments up to and including a channel's total announced usable
29395  * capacity, a value of one will only use up to half its capacity, two 1/4, etc.
29396  *
29397  * Default value: 2
29398  */
29399 uint8_t PaymentParameters_get_max_channel_saturation_power_of_half(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
29400
29401 /**
29402  * Selects the maximum share of a channel's total capacity which will be sent over a channel,
29403  * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas
29404  * a lower value prefers to send larger MPP parts, potentially saturating channels and
29405  * increasing failure probability for those paths.
29406  *
29407  * Note that this restriction will be relaxed during pathfinding after paths which meet this
29408  * restriction have been found. While paths which meet this criteria will be searched for, it
29409  * is ultimately up to the scorer to select them over other paths.
29410  *
29411  * A value of 0 will allow payments up to and including a channel's total announced usable
29412  * capacity, a value of one will only use up to half its capacity, two 1/4, etc.
29413  *
29414  * Default value: 2
29415  */
29416 void PaymentParameters_set_max_channel_saturation_power_of_half(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val);
29417
29418 /**
29419  * A list of SCIDs which this payment was previously attempted over and which caused the
29420  * payment to fail. Future attempts for the same payment shouldn't be relayed through any of
29421  * these SCIDs.
29422  *
29423  * Returns a copy of the field.
29424  */
29425 struct LDKCVec_u64Z PaymentParameters_get_previously_failed_channels(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
29426
29427 /**
29428  * A list of SCIDs which this payment was previously attempted over and which caused the
29429  * payment to fail. Future attempts for the same payment shouldn't be relayed through any of
29430  * these SCIDs.
29431  */
29432 void PaymentParameters_set_previously_failed_channels(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
29433
29434 /**
29435  * Constructs a new PaymentParameters given each field
29436  */
29437 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_new(struct LDKPublicKey payee_pubkey_arg, struct LDKInvoiceFeatures features_arg, struct LDKCVec_RouteHintZ route_hints_arg, struct LDKCOption_u64Z expiry_time_arg, uint32_t max_total_cltv_expiry_delta_arg, uint8_t max_path_count_arg, uint8_t max_channel_saturation_power_of_half_arg, struct LDKCVec_u64Z previously_failed_channels_arg);
29438
29439 /**
29440  * Creates a copy of the PaymentParameters
29441  */
29442 struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig);
29443
29444 /**
29445  * Checks if two PaymentParameterss contain equal inner contents.
29446  */
29447 uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o);
29448
29449 /**
29450  * Checks if two PaymentParameterss contain equal inner contents.
29451  * This ignores pointers and is_owned flags and looks at the values in fields.
29452  * Two objects with NULL inner values will be considered "equal" here.
29453  */
29454 bool PaymentParameters_eq(const struct LDKPaymentParameters *NONNULL_PTR a, const struct LDKPaymentParameters *NONNULL_PTR b);
29455
29456 /**
29457  * Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read
29458  */
29459 struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NONNULL_PTR obj);
29460
29461 /**
29462  * Read a PaymentParameters from a byte array, created by PaymentParameters_write
29463  */
29464 struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser);
29465
29466 /**
29467  * Creates a payee with the node id of the given `pubkey`.
29468  */
29469 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey);
29470
29471 /**
29472  * Creates a payee with the node id of the given `pubkey` to use for keysend payments.
29473  */
29474 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey);
29475
29476 /**
29477  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
29478  */
29479 void RouteHint_free(struct LDKRouteHint this_obj);
29480
29481 struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr);
29482
29483 void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val);
29484
29485 /**
29486  * Constructs a new RouteHint given each field
29487  */
29488 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg);
29489
29490 /**
29491  * Creates a copy of the RouteHint
29492  */
29493 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
29494
29495 /**
29496  * Checks if two RouteHints contain equal inner contents.
29497  */
29498 uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
29499
29500 /**
29501  * Checks if two RouteHints contain equal inner contents.
29502  * This ignores pointers and is_owned flags and looks at the values in fields.
29503  * Two objects with NULL inner values will be considered "equal" here.
29504  */
29505 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
29506
29507 /**
29508  * Serialize the RouteHint object into a byte array which can be read by RouteHint_read
29509  */
29510 struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj);
29511
29512 /**
29513  * Read a RouteHint from a byte array, created by RouteHint_write
29514  */
29515 struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser);
29516
29517 /**
29518  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
29519  */
29520 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
29521
29522 /**
29523  * The node_id of the non-target end of the route
29524  */
29525 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
29526
29527 /**
29528  * The node_id of the non-target end of the route
29529  */
29530 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
29531
29532 /**
29533  * The short_channel_id of this channel
29534  */
29535 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
29536
29537 /**
29538  * The short_channel_id of this channel
29539  */
29540 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
29541
29542 /**
29543  * The fees which must be paid to use this channel
29544  */
29545 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
29546
29547 /**
29548  * The fees which must be paid to use this channel
29549  */
29550 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
29551
29552 /**
29553  * The difference in CLTV values between this node and the next node.
29554  */
29555 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
29556
29557 /**
29558  * The difference in CLTV values between this node and the next node.
29559  */
29560 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
29561
29562 /**
29563  * The minimum value, in msat, which must be relayed to the next hop.
29564  */
29565 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
29566
29567 /**
29568  * The minimum value, in msat, which must be relayed to the next hop.
29569  */
29570 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
29571
29572 /**
29573  * The maximum value in msat available for routing with a single HTLC.
29574  */
29575 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
29576
29577 /**
29578  * The maximum value in msat available for routing with a single HTLC.
29579  */
29580 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
29581
29582 /**
29583  * Constructs a new RouteHintHop given each field
29584  */
29585 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);
29586
29587 /**
29588  * Creates a copy of the RouteHintHop
29589  */
29590 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
29591
29592 /**
29593  * Checks if two RouteHintHops contain equal inner contents.
29594  */
29595 uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
29596
29597 /**
29598  * Checks if two RouteHintHops contain equal inner contents.
29599  * This ignores pointers and is_owned flags and looks at the values in fields.
29600  * Two objects with NULL inner values will be considered "equal" here.
29601  */
29602 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
29603
29604 /**
29605  * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
29606  */
29607 struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj);
29608
29609 /**
29610  * Read a RouteHintHop from a byte array, created by RouteHintHop_write
29611  */
29612 struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser);
29613
29614 /**
29615  * Finds a route from us (payer) to the given target node (payee).
29616  *
29617  * If the payee provided features in their invoice, they should be provided via `params.payee`.
29618  * Without this, MPP will only be used if the payee's features are available in the network graph.
29619  *
29620  * Private routing paths between a public node and the target may be included in `params.payee`.
29621  *
29622  * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
29623  * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels
29624  * from `network_graph` will be ignored, and only those in `first_hops` will be used.
29625  *
29626  * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
29627  * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
29628  * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
29629  *
29630  * # Note
29631  *
29632  * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
29633  * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
29634  * function.
29635  *
29636  * # Panics
29637  *
29638  * Panics if first_hops contains channels without short_channel_ids;
29639  * [`ChannelManager::list_usable_channels`] will never include such channels.
29640  *
29641  * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
29642  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
29643  * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
29644  *
29645  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
29646  */
29647 struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer, const uint8_t (*random_seed_bytes)[32]);
29648
29649 /**
29650  * Construct a route from us (payer) to the target node (payee) via the given hops (which should
29651  * exclude the payer, but include the payee). This may be useful, e.g., for probing the chosen path.
29652  *
29653  * Re-uses logic from `find_route`, so the restrictions described there also apply here.
29654  */
29655 struct LDKCResult_RouteLightningErrorZ build_route_from_hops(struct LDKPublicKey our_node_pubkey, struct LDKCVec_PublicKeyZ hops, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, const uint8_t (*random_seed_bytes)[32]);
29656
29657 /**
29658  * Calls the free function if one is set
29659  */
29660 void Score_free(struct LDKScore this_ptr);
29661
29662 /**
29663  * Calls the free function if one is set
29664  */
29665 void LockableScore_free(struct LDKLockableScore this_ptr);
29666
29667 /**
29668  * Calls the free function if one is set
29669  */
29670 void WriteableScore_free(struct LDKWriteableScore this_ptr);
29671
29672 /**
29673  * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL.
29674  */
29675 void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj);
29676
29677 /**
29678  * Frees any resources used by the MultiThreadedScoreLock, if is_owned is set and inner is non-NULL.
29679  */
29680 void MultiThreadedScoreLock_free(struct LDKMultiThreadedScoreLock this_obj);
29681
29682 /**
29683  * Constructs a new Score which calls the relevant methods on this_arg.
29684  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
29685  */
29686 struct LDKScore MultiThreadedScoreLock_as_Score(const struct LDKMultiThreadedScoreLock *NONNULL_PTR this_arg);
29687
29688 /**
29689  * Serialize the MultiThreadedScoreLock object into a byte array which can be read by MultiThreadedScoreLock_read
29690  */
29691 struct LDKCVec_u8Z MultiThreadedScoreLock_write(const struct LDKMultiThreadedScoreLock *NONNULL_PTR obj);
29692
29693 /**
29694  * Constructs a new LockableScore which calls the relevant methods on this_arg.
29695  * This copies the `inner` pointer in this_arg and thus the returned LockableScore must be freed before this_arg is
29696  */
29697 struct LDKLockableScore MultiThreadedLockableScore_as_LockableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg);
29698
29699 /**
29700  * Serialize the MultiThreadedLockableScore object into a byte array which can be read by MultiThreadedLockableScore_read
29701  */
29702 struct LDKCVec_u8Z MultiThreadedLockableScore_write(const struct LDKMultiThreadedLockableScore *NONNULL_PTR obj);
29703
29704 /**
29705  * Constructs a new WriteableScore which calls the relevant methods on this_arg.
29706  * This copies the `inner` pointer in this_arg and thus the returned WriteableScore must be freed before this_arg is
29707  */
29708 struct LDKWriteableScore MultiThreadedLockableScore_as_WriteableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg);
29709
29710 /**
29711  * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
29712  */
29713 MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score);
29714
29715 /**
29716  * Frees any resources used by the ChannelUsage, if is_owned is set and inner is non-NULL.
29717  */
29718 void ChannelUsage_free(struct LDKChannelUsage this_obj);
29719
29720 /**
29721  * The amount to send through the channel, denominated in millisatoshis.
29722  */
29723 uint64_t ChannelUsage_get_amount_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
29724
29725 /**
29726  * The amount to send through the channel, denominated in millisatoshis.
29727  */
29728 void ChannelUsage_set_amount_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
29729
29730 /**
29731  * Total amount, denominated in millisatoshis, already allocated to send through the channel
29732  * as part of a multi-path payment.
29733  */
29734 uint64_t ChannelUsage_get_inflight_htlc_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
29735
29736 /**
29737  * Total amount, denominated in millisatoshis, already allocated to send through the channel
29738  * as part of a multi-path payment.
29739  */
29740 void ChannelUsage_set_inflight_htlc_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
29741
29742 /**
29743  * The effective capacity of the channel.
29744  */
29745 struct LDKEffectiveCapacity ChannelUsage_get_effective_capacity(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
29746
29747 /**
29748  * The effective capacity of the channel.
29749  */
29750 void ChannelUsage_set_effective_capacity(struct LDKChannelUsage *NONNULL_PTR this_ptr, struct LDKEffectiveCapacity val);
29751
29752 /**
29753  * Constructs a new ChannelUsage given each field
29754  */
29755 MUST_USE_RES struct LDKChannelUsage ChannelUsage_new(uint64_t amount_msat_arg, uint64_t inflight_htlc_msat_arg, struct LDKEffectiveCapacity effective_capacity_arg);
29756
29757 /**
29758  * Creates a copy of the ChannelUsage
29759  */
29760 struct LDKChannelUsage ChannelUsage_clone(const struct LDKChannelUsage *NONNULL_PTR orig);
29761
29762 /**
29763  * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL.
29764  */
29765 void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj);
29766
29767 /**
29768  * Creates a copy of the FixedPenaltyScorer
29769  */
29770 struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig);
29771
29772 /**
29773  * Creates a new scorer using `penalty_msat`.
29774  */
29775 MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat);
29776
29777 /**
29778  * Constructs a new Score which calls the relevant methods on this_arg.
29779  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
29780  */
29781 struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg);
29782
29783 /**
29784  * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
29785  */
29786 struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj);
29787
29788 /**
29789  * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
29790  */
29791 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg);
29792
29793 /**
29794  * Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL.
29795  */
29796 void ProbabilisticScorer_free(struct LDKProbabilisticScorer this_obj);
29797
29798 /**
29799  * Frees any resources used by the ProbabilisticScoringParameters, if is_owned is set and inner is non-NULL.
29800  */
29801 void ProbabilisticScoringParameters_free(struct LDKProbabilisticScoringParameters this_obj);
29802
29803 /**
29804  * A fixed penalty in msats to apply to each channel.
29805  *
29806  * Default value: 500 msat
29807  */
29808 uint64_t ProbabilisticScoringParameters_get_base_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
29809
29810 /**
29811  * A fixed penalty in msats to apply to each channel.
29812  *
29813  * Default value: 500 msat
29814  */
29815 void ProbabilisticScoringParameters_set_base_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
29816
29817 /**
29818  * A multiplier used with the payment amount to calculate a fixed penalty applied to each
29819  * channel, in excess of the [`base_penalty_msat`].
29820  *
29821  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
29822  * fees plus penalty) for large payments. The penalty is computed as the product of this
29823  * multiplier and `2^30`ths of the payment amount.
29824  *
29825  * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30`
29826  *
29827  * Default value: 8,192 msat
29828  *
29829  * [`base_penalty_msat`]: Self::base_penalty_msat
29830  */
29831 uint64_t ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
29832
29833 /**
29834  * A multiplier used with the payment amount to calculate a fixed penalty applied to each
29835  * channel, in excess of the [`base_penalty_msat`].
29836  *
29837  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
29838  * fees plus penalty) for large payments. The penalty is computed as the product of this
29839  * multiplier and `2^30`ths of the payment amount.
29840  *
29841  * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30`
29842  *
29843  * Default value: 8,192 msat
29844  *
29845  * [`base_penalty_msat`]: Self::base_penalty_msat
29846  */
29847 void ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
29848
29849 /**
29850  * A multiplier used in conjunction with the negative `log10` of the channel's success
29851  * probability for a payment, as determined by our latest estimates of the channel's
29852  * liquidity, to determine the liquidity penalty.
29853  *
29854  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
29855  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
29856  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
29857  * lower bounding the success probability to `0.01`) when the amount falls within the
29858  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
29859  * result in a `u64::max_value` penalty, however.
29860  *
29861  * `-log10(success_probability) * liquidity_penalty_multiplier_msat`
29862  *
29863  * Default value: 30,000 msat
29864  *
29865  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
29866  */
29867 uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
29868
29869 /**
29870  * A multiplier used in conjunction with the negative `log10` of the channel's success
29871  * probability for a payment, as determined by our latest estimates of the channel's
29872  * liquidity, to determine the liquidity penalty.
29873  *
29874  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
29875  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
29876  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
29877  * lower bounding the success probability to `0.01`) when the amount falls within the
29878  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
29879  * result in a `u64::max_value` penalty, however.
29880  *
29881  * `-log10(success_probability) * liquidity_penalty_multiplier_msat`
29882  *
29883  * Default value: 30,000 msat
29884  *
29885  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
29886  */
29887 void ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
29888
29889 /**
29890  * Whenever this amount of time elapses since the last update to a channel's liquidity bounds,
29891  * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on
29892  * the available liquidity is halved and the upper-bound moves half-way to the channel's total
29893  * capacity.
29894  *
29895  * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity,
29896  * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`]
29897  * struct documentation for more info on the way the liquidity bounds are used.
29898  *
29899  * For example, if the channel's capacity is 1 million sats, and the current upper and lower
29900  * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper
29901  * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats.
29902  *
29903  * Default value: 6 hours
29904  *
29905  * # Note
29906  *
29907  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
29908  * liquidity knowledge will never decay except when the bounds cross.
29909  */
29910 uint64_t ProbabilisticScoringParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
29911
29912 /**
29913  * Whenever this amount of time elapses since the last update to a channel's liquidity bounds,
29914  * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on
29915  * the available liquidity is halved and the upper-bound moves half-way to the channel's total
29916  * capacity.
29917  *
29918  * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity,
29919  * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`]
29920  * struct documentation for more info on the way the liquidity bounds are used.
29921  *
29922  * For example, if the channel's capacity is 1 million sats, and the current upper and lower
29923  * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper
29924  * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats.
29925  *
29926  * Default value: 6 hours
29927  *
29928  * # Note
29929  *
29930  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
29931  * liquidity knowledge will never decay except when the bounds cross.
29932  */
29933 void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
29934
29935 /**
29936  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
29937  * channel's success probability for the payment, as determined by our latest estimates of the
29938  * channel's liquidity, to determine the amount penalty.
29939  *
29940  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
29941  * fees plus penalty) for large payments. The penalty is computed as the product of this
29942  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
29943  * success probability.
29944  *
29945  * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20`
29946  *
29947  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
29948  * the amount will result in a penalty of the multiplier. And, as the success probability
29949  * decreases, the negative `log10` weighting will increase dramatically. For higher success
29950  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
29951  * fall below `1`.
29952  *
29953  * Default value: 192 msat
29954  */
29955 uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
29956
29957 /**
29958  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
29959  * channel's success probability for the payment, as determined by our latest estimates of the
29960  * channel's liquidity, to determine the amount penalty.
29961  *
29962  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
29963  * fees plus penalty) for large payments. The penalty is computed as the product of this
29964  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
29965  * success probability.
29966  *
29967  * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20`
29968  *
29969  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
29970  * the amount will result in a penalty of the multiplier. And, as the success probability
29971  * decreases, the negative `log10` weighting will increase dramatically. For higher success
29972  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
29973  * fall below `1`.
29974  *
29975  * Default value: 192 msat
29976  */
29977 void ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
29978
29979 /**
29980  * A multiplier used in conjunction with the negative `log10` of the channel's success
29981  * probability for the payment, as determined based on the history of our estimates of the
29982  * channel's available liquidity, to determine a penalty.
29983  *
29984  * This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using
29985  * only our latest estimate for the current liquidity available in the channel, it estimates
29986  * success probability based on the estimated liquidity available in the channel through
29987  * history. Specifically, every time we update our liquidity bounds on a given channel, we
29988  * track which of several buckets those bounds fall into, exponentially decaying the
29989  * probability of each bucket as new samples are added.
29990  *
29991  * Default value: 10,000 msat
29992  *
29993  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
29994  */
29995 uint64_t ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
29996
29997 /**
29998  * A multiplier used in conjunction with the negative `log10` of the channel's success
29999  * probability for the payment, as determined based on the history of our estimates of the
30000  * channel's available liquidity, to determine a penalty.
30001  *
30002  * This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using
30003  * only our latest estimate for the current liquidity available in the channel, it estimates
30004  * success probability based on the estimated liquidity available in the channel through
30005  * history. Specifically, every time we update our liquidity bounds on a given channel, we
30006  * track which of several buckets those bounds fall into, exponentially decaying the
30007  * probability of each bucket as new samples are added.
30008  *
30009  * Default value: 10,000 msat
30010  *
30011  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
30012  */
30013 void ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
30014
30015 /**
30016  * A multiplier used in conjunction with the payment amount and the negative `log10` of the
30017  * channel's success probability for the payment, as determined based on the history of our
30018  * estimates of the channel's available liquidity, to determine a penalty.
30019  *
30020  * The purpose of the amount penalty is to avoid having fees dominate the channel cost for
30021  * large payments. The penalty is computed as the product of this multiplier and the `2^20`ths
30022  * of the payment amount, weighted by the negative `log10` of the success probability.
30023  *
30024  * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead
30025  * of using only our latest estimate for the current liquidity available in the channel, it
30026  * estimates success probability based on the estimated liquidity available in the channel
30027  * through history. Specifically, every time we update our liquidity bounds on a given
30028  * channel, we track which of several buckets those bounds fall into, exponentially decaying
30029  * the probability of each bucket as new samples are added.
30030  *
30031  * Default value: 64 msat
30032  *
30033  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
30034  */
30035 uint64_t ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
30036
30037 /**
30038  * A multiplier used in conjunction with the payment amount and the negative `log10` of the
30039  * channel's success probability for the payment, as determined based on the history of our
30040  * estimates of the channel's available liquidity, to determine a penalty.
30041  *
30042  * The purpose of the amount penalty is to avoid having fees dominate the channel cost for
30043  * large payments. The penalty is computed as the product of this multiplier and the `2^20`ths
30044  * of the payment amount, weighted by the negative `log10` of the success probability.
30045  *
30046  * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead
30047  * of using only our latest estimate for the current liquidity available in the channel, it
30048  * estimates success probability based on the estimated liquidity available in the channel
30049  * through history. Specifically, every time we update our liquidity bounds on a given
30050  * channel, we track which of several buckets those bounds fall into, exponentially decaying
30051  * the probability of each bucket as new samples are added.
30052  *
30053  * Default value: 64 msat
30054  *
30055  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
30056  */
30057 void ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
30058
30059 /**
30060  * If we aren't learning any new datapoints for a channel, the historical liquidity bounds
30061  * tracking can simply live on with increasingly stale data. Instead, when a channel has not
30062  * seen a liquidity estimate update for this amount of time, the historical datapoints are
30063  * decayed by half.
30064  *
30065  * Note that after 16 or more half lives all historical data will be completely gone.
30066  *
30067  * Default value: 14 days
30068  */
30069 uint64_t ProbabilisticScoringParameters_get_historical_no_updates_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
30070
30071 /**
30072  * If we aren't learning any new datapoints for a channel, the historical liquidity bounds
30073  * tracking can simply live on with increasingly stale data. Instead, when a channel has not
30074  * seen a liquidity estimate update for this amount of time, the historical datapoints are
30075  * decayed by half.
30076  *
30077  * Note that after 16 or more half lives all historical data will be completely gone.
30078  *
30079  * Default value: 14 days
30080  */
30081 void ProbabilisticScoringParameters_set_historical_no_updates_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
30082
30083 /**
30084  * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the
30085  * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We
30086  * treat such nodes preferentially as this makes balance discovery attacks harder to execute,
30087  * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy.
30088  *
30089  * Default value: 250 msat
30090  */
30091 uint64_t ProbabilisticScoringParameters_get_anti_probing_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
30092
30093 /**
30094  * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the
30095  * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We
30096  * treat such nodes preferentially as this makes balance discovery attacks harder to execute,
30097  * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy.
30098  *
30099  * Default value: 250 msat
30100  */
30101 void ProbabilisticScoringParameters_set_anti_probing_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
30102
30103 /**
30104  * This penalty is applied when the amount we're attempting to send over a channel exceeds our
30105  * current estimate of the channel's available liquidity.
30106  *
30107  * Note that in this case all other penalties, including the
30108  * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based
30109  * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if
30110  * applicable, are still included in the overall penalty.
30111  *
30112  * If you wish to avoid creating paths with such channels entirely, setting this to a value of
30113  * `u64::max_value()` will guarantee that.
30114  *
30115  * Default value: 1_0000_0000_000 msat (1 Bitcoin)
30116  *
30117  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
30118  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
30119  * [`base_penalty_msat`]: Self::base_penalty_msat
30120  * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat
30121  */
30122 uint64_t ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
30123
30124 /**
30125  * This penalty is applied when the amount we're attempting to send over a channel exceeds our
30126  * current estimate of the channel's available liquidity.
30127  *
30128  * Note that in this case all other penalties, including the
30129  * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based
30130  * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if
30131  * applicable, are still included in the overall penalty.
30132  *
30133  * If you wish to avoid creating paths with such channels entirely, setting this to a value of
30134  * `u64::max_value()` will guarantee that.
30135  *
30136  * Default value: 1_0000_0000_000 msat (1 Bitcoin)
30137  *
30138  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
30139  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
30140  * [`base_penalty_msat`]: Self::base_penalty_msat
30141  * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat
30142  */
30143 void ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
30144
30145 /**
30146  * Creates a copy of the ProbabilisticScoringParameters
30147  */
30148 struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_clone(const struct LDKProbabilisticScoringParameters *NONNULL_PTR orig);
30149
30150 /**
30151  * Creates a new scorer using the given scoring parameters for sending payments from a node
30152  * through a network graph.
30153  */
30154 MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringParameters params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
30155
30156 /**
30157  * Dump the contents of this scorer into the configured logger.
30158  *
30159  * Note that this writes roughly one line per channel for which we have a liquidity estimate,
30160  * which may be a substantial amount of log output.
30161  */
30162 void ProbabilisticScorer_debug_log_liquidity_stats(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
30163
30164 /**
30165  * Query the estimated minimum and maximum liquidity available for sending a payment over the
30166  * channel with `scid` towards the given `target` node.
30167  */
30168 MUST_USE_RES struct LDKCOption_C2Tuple_u64u64ZZ ProbabilisticScorer_estimated_channel_liquidity_range(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target);
30169
30170 /**
30171  * Marks the node with the given `node_id` as banned, i.e.,
30172  * it will be avoided during path finding.
30173  */
30174 void ProbabilisticScorer_add_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
30175
30176 /**
30177  * Removes the node with the given `node_id` from the list of nodes to avoid.
30178  */
30179 void ProbabilisticScorer_remove_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
30180
30181 /**
30182  * Sets a manual penalty for the given node.
30183  */
30184 void ProbabilisticScorer_set_manual_penalty(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id, uint64_t penalty);
30185
30186 /**
30187  * Removes the node with the given `node_id` from the list of manual penalties.
30188  */
30189 void ProbabilisticScorer_remove_manual_penalty(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
30190
30191 /**
30192  * Clears the list of manual penalties that are applied during path finding.
30193  */
30194 void ProbabilisticScorer_clear_manual_penalties(struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
30195
30196 /**
30197  * Marks all nodes in the given list as banned, i.e.,
30198  * they will be avoided during path finding.
30199  */
30200 void ProbabilisticScoringParameters_add_banned_from_list(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_arg, struct LDKCVec_NodeIdZ node_ids);
30201
30202 /**
30203  * Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used.
30204  */
30205 MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_default(void);
30206
30207 /**
30208  * Constructs a new Score which calls the relevant methods on this_arg.
30209  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
30210  */
30211 struct LDKScore ProbabilisticScorer_as_Score(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
30212
30213 /**
30214  * Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read
30215  */
30216 struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj);
30217
30218 /**
30219  * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write
30220  */
30221 struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b, struct LDKLogger arg_c);
30222
30223 /**
30224  * Frees any resources used by the BlindedRoute, if is_owned is set and inner is non-NULL.
30225  */
30226 void BlindedRoute_free(struct LDKBlindedRoute this_obj);
30227
30228 /**
30229  * Frees any resources used by the BlindedHop, if is_owned is set and inner is non-NULL.
30230  */
30231 void BlindedHop_free(struct LDKBlindedHop this_obj);
30232
30233 /**
30234  * Create a blinded route to be forwarded along `node_pks`. The last node pubkey in `node_pks`
30235  * will be the destination node.
30236  *
30237  * Errors if less than two hops are provided or if `node_pk`(s) are invalid.
30238  */
30239 MUST_USE_RES struct LDKCResult_BlindedRouteNoneZ BlindedRoute_new(struct LDKCVec_PublicKeyZ node_pks, const struct LDKKeysInterface *NONNULL_PTR keys_manager);
30240
30241 /**
30242  * Serialize the BlindedRoute object into a byte array which can be read by BlindedRoute_read
30243  */
30244 struct LDKCVec_u8Z BlindedRoute_write(const struct LDKBlindedRoute *NONNULL_PTR obj);
30245
30246 /**
30247  * Read a BlindedRoute from a byte array, created by BlindedRoute_write
30248  */
30249 struct LDKCResult_BlindedRouteDecodeErrorZ BlindedRoute_read(struct LDKu8slice ser);
30250
30251 /**
30252  * Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read
30253  */
30254 struct LDKCVec_u8Z BlindedHop_write(const struct LDKBlindedHop *NONNULL_PTR obj);
30255
30256 /**
30257  * Read a BlindedHop from a byte array, created by BlindedHop_write
30258  */
30259 struct LDKCResult_BlindedHopDecodeErrorZ BlindedHop_read(struct LDKu8slice ser);
30260
30261 /**
30262  * Frees any resources used by the OnionMessenger, if is_owned is set and inner is non-NULL.
30263  */
30264 void OnionMessenger_free(struct LDKOnionMessenger this_obj);
30265
30266 /**
30267  * Frees any resources used by the Destination
30268  */
30269 void Destination_free(struct LDKDestination this_ptr);
30270
30271 /**
30272  * Utility method to constructs a new Node-variant Destination
30273  */
30274 struct LDKDestination Destination_node(struct LDKPublicKey a);
30275
30276 /**
30277  * Utility method to constructs a new BlindedRoute-variant Destination
30278  */
30279 struct LDKDestination Destination_blinded_route(struct LDKBlindedRoute a);
30280
30281 /**
30282  * Frees any resources used by the SendError
30283  */
30284 void SendError_free(struct LDKSendError this_ptr);
30285
30286 /**
30287  * Creates a copy of the SendError
30288  */
30289 struct LDKSendError SendError_clone(const struct LDKSendError *NONNULL_PTR orig);
30290
30291 /**
30292  * Utility method to constructs a new Secp256k1-variant SendError
30293  */
30294 struct LDKSendError SendError_secp256k1(enum LDKSecp256k1Error a);
30295
30296 /**
30297  * Utility method to constructs a new TooBigPacket-variant SendError
30298  */
30299 struct LDKSendError SendError_too_big_packet(void);
30300
30301 /**
30302  * Utility method to constructs a new TooFewBlindedHops-variant SendError
30303  */
30304 struct LDKSendError SendError_too_few_blinded_hops(void);
30305
30306 /**
30307  * Utility method to constructs a new InvalidFirstHop-variant SendError
30308  */
30309 struct LDKSendError SendError_invalid_first_hop(void);
30310
30311 /**
30312  * Utility method to constructs a new InvalidMessage-variant SendError
30313  */
30314 struct LDKSendError SendError_invalid_message(void);
30315
30316 /**
30317  * Utility method to constructs a new BufferFull-variant SendError
30318  */
30319 struct LDKSendError SendError_buffer_full(void);
30320
30321 /**
30322  * Checks if two SendErrors contain equal inner contents.
30323  * This ignores pointers and is_owned flags and looks at the values in fields.
30324  */
30325 bool SendError_eq(const struct LDKSendError *NONNULL_PTR a, const struct LDKSendError *NONNULL_PTR b);
30326
30327 /**
30328  * Calls the free function if one is set
30329  */
30330 void CustomOnionMessageHandler_free(struct LDKCustomOnionMessageHandler this_ptr);
30331
30332 /**
30333  * Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to
30334  * their respective handlers.
30335  */
30336 MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKKeysInterface keys_manager, struct LDKLogger logger, struct LDKCustomOnionMessageHandler custom_handler);
30337
30338 /**
30339  * Send an onion message with contents `message` to `destination`, routing it through `intermediate_nodes`.
30340  * See [`OnionMessenger`] for example usage.
30341  *
30342  * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None
30343  */
30344 MUST_USE_RES struct LDKCResult_NoneSendErrorZ OnionMessenger_send_custom_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKCVec_PublicKeyZ intermediate_nodes, struct LDKDestination destination, struct LDKCustomOnionMessageContents msg, struct LDKBlindedRoute reply_path);
30345
30346 /**
30347  * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg.
30348  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is
30349  */
30350 struct LDKOnionMessageHandler OnionMessenger_as_OnionMessageHandler(const struct LDKOnionMessenger *NONNULL_PTR this_arg);
30351
30352 /**
30353  * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg.
30354  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is
30355  */
30356 struct LDKOnionMessageProvider OnionMessenger_as_OnionMessageProvider(const struct LDKOnionMessenger *NONNULL_PTR this_arg);
30357
30358 /**
30359  * Calls the free function if one is set
30360  */
30361 void CustomOnionMessageContents_free(struct LDKCustomOnionMessageContents this_ptr);
30362
30363 /**
30364  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
30365  */
30366 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
30367
30368 /**
30369  * Initialize a new FilesystemPersister and set the path to the individual channels'
30370  * files.
30371  */
30372 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
30373
30374 /**
30375  * Get the directory which was provided when this persister was initialized.
30376  */
30377 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
30378
30379 /**
30380  * Read `ChannelMonitor`s from disk.
30381  */
30382 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
30383
30384 /**
30385  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
30386  */
30387 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
30388
30389 /**
30390  * Frees any resources used by the GossipSync
30391  */
30392 void GossipSync_free(struct LDKGossipSync this_ptr);
30393
30394 /**
30395  * Utility method to constructs a new P2P-variant GossipSync
30396  */
30397 struct LDKGossipSync GossipSync_p2_p(const struct LDKP2PGossipSync *NONNULL_PTR a);
30398
30399 /**
30400  * Utility method to constructs a new Rapid-variant GossipSync
30401  */
30402 struct LDKGossipSync GossipSync_rapid(const struct LDKRapidGossipSync *NONNULL_PTR a);
30403
30404 /**
30405  * Utility method to constructs a new None-variant GossipSync
30406  */
30407 struct LDKGossipSync GossipSync_none(void);
30408
30409 /**
30410  * Start a background thread that takes care of responsibilities enumerated in the [top-level
30411  * documentation].
30412  *
30413  * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
30414  * [`Persister::persist_manager`] returns an error. In case of an error, the error is retrieved by calling
30415  * either [`join`] or [`stop`].
30416  *
30417  * # Data Persistence
30418  *
30419  * [`Persister::persist_manager`] is responsible for writing out the [`ChannelManager`] to disk, and/or
30420  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
30421  * [`ChannelManager`]. See the `lightning-persister` crate for LDK's
30422  * provided implementation.
30423  *
30424  * [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk, if
30425  * [`GossipSync`] is supplied. See [`NetworkGraph::write`] for writing out a [`NetworkGraph`].
30426  * See the `lightning-persister` crate for LDK's provided implementation.
30427  *
30428  * Typically, users should either implement [`Persister::persist_manager`] to never return an
30429  * error or call [`join`] and handle any error that may arise. For the latter case,
30430  * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
30431  *
30432  * # Event Handling
30433  *
30434  * `event_handler` is responsible for handling events that users should be notified of (e.g.,
30435  * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
30436  * functionality implemented by other handlers.
30437  * * [`P2PGossipSync`] if given will update the [`NetworkGraph`] based on payment failures.
30438  *
30439  * # Rapid Gossip Sync
30440  *
30441  * If rapid gossip sync is meant to run at startup, pass [`RapidGossipSync`] via `gossip_sync`
30442  * to indicate that the [`BackgroundProcessor`] should not prune the [`NetworkGraph`] instance
30443  * until the [`RapidGossipSync`] instance completes its first sync.
30444  *
30445  * [top-level documentation]: BackgroundProcessor
30446  * [`join`]: Self::join
30447  * [`stop`]: Self::stop
30448  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
30449  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
30450  * [`Persister::persist_manager`]: lightning::util::persist::Persister::persist_manager
30451  * [`Persister::persist_graph`]: lightning::util::persist::Persister::persist_graph
30452  * [`NetworkGraph`]: lightning::routing::gossip::NetworkGraph
30453  * [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable
30454  */
30455 MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, struct LDKGossipSync gossip_sync, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger, struct LDKCOption_WriteableScoreZ scorer);
30456
30457 /**
30458  * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
30459  * [`ChannelManager`].
30460  *
30461  * # Panics
30462  *
30463  * This function panics if the background thread has panicked such as while persisting or
30464  * handling events.
30465  *
30466  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
30467  */
30468 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
30469
30470 /**
30471  * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
30472  * [`ChannelManager`].
30473  *
30474  * # Panics
30475  *
30476  * This function panics if the background thread has panicked such as while persisting or
30477  * handling events.
30478  *
30479  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
30480  */
30481 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
30482
30483 /**
30484  * Frees any resources used by the ParseError
30485  */
30486 void ParseError_free(struct LDKParseError this_ptr);
30487
30488 /**
30489  * Creates a copy of the ParseError
30490  */
30491 struct LDKParseError ParseError_clone(const struct LDKParseError *NONNULL_PTR orig);
30492
30493 /**
30494  * Utility method to constructs a new Bech32Error-variant ParseError
30495  */
30496 struct LDKParseError ParseError_bech32_error(struct LDKBech32Error a);
30497
30498 /**
30499  * Utility method to constructs a new ParseAmountError-variant ParseError
30500  */
30501 struct LDKParseError ParseError_parse_amount_error(struct LDKError a);
30502
30503 /**
30504  * Utility method to constructs a new MalformedSignature-variant ParseError
30505  */
30506 struct LDKParseError ParseError_malformed_signature(enum LDKSecp256k1Error a);
30507
30508 /**
30509  * Utility method to constructs a new BadPrefix-variant ParseError
30510  */
30511 struct LDKParseError ParseError_bad_prefix(void);
30512
30513 /**
30514  * Utility method to constructs a new UnknownCurrency-variant ParseError
30515  */
30516 struct LDKParseError ParseError_unknown_currency(void);
30517
30518 /**
30519  * Utility method to constructs a new UnknownSiPrefix-variant ParseError
30520  */
30521 struct LDKParseError ParseError_unknown_si_prefix(void);
30522
30523 /**
30524  * Utility method to constructs a new MalformedHRP-variant ParseError
30525  */
30526 struct LDKParseError ParseError_malformed_hrp(void);
30527
30528 /**
30529  * Utility method to constructs a new TooShortDataPart-variant ParseError
30530  */
30531 struct LDKParseError ParseError_too_short_data_part(void);
30532
30533 /**
30534  * Utility method to constructs a new UnexpectedEndOfTaggedFields-variant ParseError
30535  */
30536 struct LDKParseError ParseError_unexpected_end_of_tagged_fields(void);
30537
30538 /**
30539  * Utility method to constructs a new DescriptionDecodeError-variant ParseError
30540  */
30541 struct LDKParseError ParseError_description_decode_error(struct LDKError a);
30542
30543 /**
30544  * Utility method to constructs a new PaddingError-variant ParseError
30545  */
30546 struct LDKParseError ParseError_padding_error(void);
30547
30548 /**
30549  * Utility method to constructs a new IntegerOverflowError-variant ParseError
30550  */
30551 struct LDKParseError ParseError_integer_overflow_error(void);
30552
30553 /**
30554  * Utility method to constructs a new InvalidSegWitProgramLength-variant ParseError
30555  */
30556 struct LDKParseError ParseError_invalid_seg_wit_program_length(void);
30557
30558 /**
30559  * Utility method to constructs a new InvalidPubKeyHashLength-variant ParseError
30560  */
30561 struct LDKParseError ParseError_invalid_pub_key_hash_length(void);
30562
30563 /**
30564  * Utility method to constructs a new InvalidScriptHashLength-variant ParseError
30565  */
30566 struct LDKParseError ParseError_invalid_script_hash_length(void);
30567
30568 /**
30569  * Utility method to constructs a new InvalidRecoveryId-variant ParseError
30570  */
30571 struct LDKParseError ParseError_invalid_recovery_id(void);
30572
30573 /**
30574  * Utility method to constructs a new InvalidSliceLength-variant ParseError
30575  */
30576 struct LDKParseError ParseError_invalid_slice_length(struct LDKStr a);
30577
30578 /**
30579  * Utility method to constructs a new Skip-variant ParseError
30580  */
30581 struct LDKParseError ParseError_skip(void);
30582
30583 /**
30584  * Checks if two ParseErrors contain equal inner contents.
30585  * This ignores pointers and is_owned flags and looks at the values in fields.
30586  */
30587 bool ParseError_eq(const struct LDKParseError *NONNULL_PTR a, const struct LDKParseError *NONNULL_PTR b);
30588
30589 /**
30590  * Frees any resources used by the ParseOrSemanticError
30591  */
30592 void ParseOrSemanticError_free(struct LDKParseOrSemanticError this_ptr);
30593
30594 /**
30595  * Creates a copy of the ParseOrSemanticError
30596  */
30597 struct LDKParseOrSemanticError ParseOrSemanticError_clone(const struct LDKParseOrSemanticError *NONNULL_PTR orig);
30598
30599 /**
30600  * Utility method to constructs a new ParseError-variant ParseOrSemanticError
30601  */
30602 struct LDKParseOrSemanticError ParseOrSemanticError_parse_error(struct LDKParseError a);
30603
30604 /**
30605  * Utility method to constructs a new SemanticError-variant ParseOrSemanticError
30606  */
30607 struct LDKParseOrSemanticError ParseOrSemanticError_semantic_error(enum LDKSemanticError a);
30608
30609 /**
30610  * Checks if two ParseOrSemanticErrors contain equal inner contents.
30611  * This ignores pointers and is_owned flags and looks at the values in fields.
30612  */
30613 bool ParseOrSemanticError_eq(const struct LDKParseOrSemanticError *NONNULL_PTR a, const struct LDKParseOrSemanticError *NONNULL_PTR b);
30614
30615 /**
30616  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
30617  */
30618 void Invoice_free(struct LDKInvoice this_obj);
30619
30620 /**
30621  * Checks if two Invoices contain equal inner contents.
30622  * This ignores pointers and is_owned flags and looks at the values in fields.
30623  * Two objects with NULL inner values will be considered "equal" here.
30624  */
30625 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
30626
30627 /**
30628  * Creates a copy of the Invoice
30629  */
30630 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
30631
30632 /**
30633  * Checks if two Invoices contain equal inner contents.
30634  */
30635 uint64_t Invoice_hash(const struct LDKInvoice *NONNULL_PTR o);
30636
30637 /**
30638  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
30639  */
30640 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
30641
30642 /**
30643  * Checks if two SignedRawInvoices contain equal inner contents.
30644  * This ignores pointers and is_owned flags and looks at the values in fields.
30645  * Two objects with NULL inner values will be considered "equal" here.
30646  */
30647 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
30648
30649 /**
30650  * Creates a copy of the SignedRawInvoice
30651  */
30652 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
30653
30654 /**
30655  * Checks if two SignedRawInvoices contain equal inner contents.
30656  */
30657 uint64_t SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR o);
30658
30659 /**
30660  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
30661  */
30662 void RawInvoice_free(struct LDKRawInvoice this_obj);
30663
30664 /**
30665  * data part
30666  */
30667 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
30668
30669 /**
30670  * data part
30671  */
30672 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
30673
30674 /**
30675  * Checks if two RawInvoices contain equal inner contents.
30676  * This ignores pointers and is_owned flags and looks at the values in fields.
30677  * Two objects with NULL inner values will be considered "equal" here.
30678  */
30679 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
30680
30681 /**
30682  * Creates a copy of the RawInvoice
30683  */
30684 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
30685
30686 /**
30687  * Checks if two RawInvoices contain equal inner contents.
30688  */
30689 uint64_t RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR o);
30690
30691 /**
30692  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
30693  */
30694 void RawDataPart_free(struct LDKRawDataPart this_obj);
30695
30696 /**
30697  * generation time of the invoice
30698  */
30699 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
30700
30701 /**
30702  * generation time of the invoice
30703  */
30704 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
30705
30706 /**
30707  * Checks if two RawDataParts contain equal inner contents.
30708  * This ignores pointers and is_owned flags and looks at the values in fields.
30709  * Two objects with NULL inner values will be considered "equal" here.
30710  */
30711 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
30712
30713 /**
30714  * Creates a copy of the RawDataPart
30715  */
30716 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
30717
30718 /**
30719  * Checks if two RawDataParts contain equal inner contents.
30720  */
30721 uint64_t RawDataPart_hash(const struct LDKRawDataPart *NONNULL_PTR o);
30722
30723 /**
30724  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
30725  */
30726 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
30727
30728 /**
30729  * Checks if two PositiveTimestamps contain equal inner contents.
30730  * This ignores pointers and is_owned flags and looks at the values in fields.
30731  * Two objects with NULL inner values will be considered "equal" here.
30732  */
30733 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
30734
30735 /**
30736  * Creates a copy of the PositiveTimestamp
30737  */
30738 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
30739
30740 /**
30741  * Checks if two PositiveTimestamps contain equal inner contents.
30742  */
30743 uint64_t PositiveTimestamp_hash(const struct LDKPositiveTimestamp *NONNULL_PTR o);
30744
30745 /**
30746  * Creates a copy of the SiPrefix
30747  */
30748 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
30749
30750 /**
30751  * Utility method to constructs a new Milli-variant SiPrefix
30752  */
30753 enum LDKSiPrefix SiPrefix_milli(void);
30754
30755 /**
30756  * Utility method to constructs a new Micro-variant SiPrefix
30757  */
30758 enum LDKSiPrefix SiPrefix_micro(void);
30759
30760 /**
30761  * Utility method to constructs a new Nano-variant SiPrefix
30762  */
30763 enum LDKSiPrefix SiPrefix_nano(void);
30764
30765 /**
30766  * Utility method to constructs a new Pico-variant SiPrefix
30767  */
30768 enum LDKSiPrefix SiPrefix_pico(void);
30769
30770 /**
30771  * Checks if two SiPrefixs contain equal inner contents.
30772  * This ignores pointers and is_owned flags and looks at the values in fields.
30773  */
30774 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
30775
30776 /**
30777  * Checks if two SiPrefixs contain equal inner contents.
30778  */
30779 uint64_t SiPrefix_hash(const enum LDKSiPrefix *NONNULL_PTR o);
30780
30781 /**
30782  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
30783  * This is effectively 10^12 * the prefix multiplier
30784  */
30785 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
30786
30787 /**
30788  * Creates a copy of the Currency
30789  */
30790 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
30791
30792 /**
30793  * Utility method to constructs a new Bitcoin-variant Currency
30794  */
30795 enum LDKCurrency Currency_bitcoin(void);
30796
30797 /**
30798  * Utility method to constructs a new BitcoinTestnet-variant Currency
30799  */
30800 enum LDKCurrency Currency_bitcoin_testnet(void);
30801
30802 /**
30803  * Utility method to constructs a new Regtest-variant Currency
30804  */
30805 enum LDKCurrency Currency_regtest(void);
30806
30807 /**
30808  * Utility method to constructs a new Simnet-variant Currency
30809  */
30810 enum LDKCurrency Currency_simnet(void);
30811
30812 /**
30813  * Utility method to constructs a new Signet-variant Currency
30814  */
30815 enum LDKCurrency Currency_signet(void);
30816
30817 /**
30818  * Checks if two Currencys contain equal inner contents.
30819  */
30820 uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
30821
30822 /**
30823  * Checks if two Currencys contain equal inner contents.
30824  * This ignores pointers and is_owned flags and looks at the values in fields.
30825  */
30826 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
30827
30828 /**
30829  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
30830  */
30831 void Sha256_free(struct LDKSha256 this_obj);
30832
30833 /**
30834  * Creates a copy of the Sha256
30835  */
30836 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
30837
30838 /**
30839  * Checks if two Sha256s contain equal inner contents.
30840  */
30841 uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
30842
30843 /**
30844  * Checks if two Sha256s contain equal inner contents.
30845  * This ignores pointers and is_owned flags and looks at the values in fields.
30846  * Two objects with NULL inner values will be considered "equal" here.
30847  */
30848 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
30849
30850 /**
30851  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
30852  */
30853 void Description_free(struct LDKDescription this_obj);
30854
30855 /**
30856  * Creates a copy of the Description
30857  */
30858 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
30859
30860 /**
30861  * Checks if two Descriptions contain equal inner contents.
30862  */
30863 uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
30864
30865 /**
30866  * Checks if two Descriptions contain equal inner contents.
30867  * This ignores pointers and is_owned flags and looks at the values in fields.
30868  * Two objects with NULL inner values will be considered "equal" here.
30869  */
30870 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
30871
30872 /**
30873  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
30874  */
30875 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
30876
30877 struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr);
30878
30879 void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30880
30881 /**
30882  * Constructs a new PayeePubKey given each field
30883  */
30884 MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg);
30885
30886 /**
30887  * Creates a copy of the PayeePubKey
30888  */
30889 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
30890
30891 /**
30892  * Checks if two PayeePubKeys contain equal inner contents.
30893  */
30894 uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
30895
30896 /**
30897  * Checks if two PayeePubKeys contain equal inner contents.
30898  * This ignores pointers and is_owned flags and looks at the values in fields.
30899  * Two objects with NULL inner values will be considered "equal" here.
30900  */
30901 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
30902
30903 /**
30904  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
30905  */
30906 void ExpiryTime_free(struct LDKExpiryTime this_obj);
30907
30908 /**
30909  * Creates a copy of the ExpiryTime
30910  */
30911 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
30912
30913 /**
30914  * Checks if two ExpiryTimes contain equal inner contents.
30915  */
30916 uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
30917
30918 /**
30919  * Checks if two ExpiryTimes contain equal inner contents.
30920  * This ignores pointers and is_owned flags and looks at the values in fields.
30921  * Two objects with NULL inner values will be considered "equal" here.
30922  */
30923 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
30924
30925 /**
30926  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
30927  */
30928 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
30929
30930 uint64_t MinFinalCltvExpiry_get_a(const struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr);
30931
30932 void MinFinalCltvExpiry_set_a(struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr, uint64_t val);
30933
30934 /**
30935  * Constructs a new MinFinalCltvExpiry given each field
30936  */
30937 MUST_USE_RES struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_new(uint64_t a_arg);
30938
30939 /**
30940  * Creates a copy of the MinFinalCltvExpiry
30941  */
30942 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
30943
30944 /**
30945  * Checks if two MinFinalCltvExpirys contain equal inner contents.
30946  */
30947 uint64_t MinFinalCltvExpiry_hash(const struct LDKMinFinalCltvExpiry *NONNULL_PTR o);
30948
30949 /**
30950  * Checks if two MinFinalCltvExpirys contain equal inner contents.
30951  * This ignores pointers and is_owned flags and looks at the values in fields.
30952  * Two objects with NULL inner values will be considered "equal" here.
30953  */
30954 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
30955
30956 /**
30957  * Frees any resources used by the Fallback
30958  */
30959 void Fallback_free(struct LDKFallback this_ptr);
30960
30961 /**
30962  * Creates a copy of the Fallback
30963  */
30964 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
30965
30966 /**
30967  * Utility method to constructs a new SegWitProgram-variant Fallback
30968  */
30969 struct LDKFallback Fallback_seg_wit_program(struct LDKu5 version, struct LDKCVec_u8Z program);
30970
30971 /**
30972  * Utility method to constructs a new PubKeyHash-variant Fallback
30973  */
30974 struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a);
30975
30976 /**
30977  * Utility method to constructs a new ScriptHash-variant Fallback
30978  */
30979 struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
30980
30981 /**
30982  * Checks if two Fallbacks contain equal inner contents.
30983  */
30984 uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
30985
30986 /**
30987  * Checks if two Fallbacks contain equal inner contents.
30988  * This ignores pointers and is_owned flags and looks at the values in fields.
30989  */
30990 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
30991
30992 /**
30993  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
30994  */
30995 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
30996
30997 /**
30998  * Creates a copy of the InvoiceSignature
30999  */
31000 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
31001
31002 /**
31003  * Checks if two InvoiceSignatures contain equal inner contents.
31004  */
31005 uint64_t InvoiceSignature_hash(const struct LDKInvoiceSignature *NONNULL_PTR o);
31006
31007 /**
31008  * Checks if two InvoiceSignatures contain equal inner contents.
31009  * This ignores pointers and is_owned flags and looks at the values in fields.
31010  * Two objects with NULL inner values will be considered "equal" here.
31011  */
31012 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
31013
31014 /**
31015  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
31016  */
31017 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
31018
31019 /**
31020  * Creates a copy of the PrivateRoute
31021  */
31022 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
31023
31024 /**
31025  * Checks if two PrivateRoutes contain equal inner contents.
31026  */
31027 uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
31028
31029 /**
31030  * Checks if two PrivateRoutes contain equal inner contents.
31031  * This ignores pointers and is_owned flags and looks at the values in fields.
31032  * Two objects with NULL inner values will be considered "equal" here.
31033  */
31034 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
31035
31036 /**
31037  * Disassembles the `SignedRawInvoice` into its three parts:
31038  *  1. raw invoice
31039  *  2. hash of the raw invoice
31040  *  3. signature
31041  */
31042 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
31043
31044 /**
31045  * The `RawInvoice` which was signed.
31046  */
31047 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
31048
31049 /**
31050  * The hash of the `RawInvoice` that was signed.
31051  */
31052 MUST_USE_RES const uint8_t (*SignedRawInvoice_signable_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
31053
31054 /**
31055  * InvoiceSignature for the invoice.
31056  */
31057 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
31058
31059 /**
31060  * Recovers the public key used for signing the invoice from the recoverable signature.
31061  */
31062 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
31063
31064 /**
31065  * Checks if the signature is valid for the included payee public key or if none exists if it's
31066  * valid for the recovered signature (which should always be true?).
31067  */
31068 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
31069
31070 /**
31071  * Calculate the hash of the encoded `RawInvoice` which should be signed.
31072  */
31073 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_signable_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
31074
31075 /**
31076  *
31077  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31078  */
31079 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
31080
31081 /**
31082  *
31083  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31084  */
31085 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
31086
31087 /**
31088  *
31089  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31090  */
31091 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
31092
31093 /**
31094  *
31095  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31096  */
31097 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
31098
31099 /**
31100  *
31101  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31102  */
31103 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
31104
31105 /**
31106  *
31107  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31108  */
31109 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
31110
31111 /**
31112  *
31113  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31114  */
31115 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
31116
31117 /**
31118  *
31119  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31120  */
31121 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
31122
31123 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
31124
31125 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
31126
31127 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
31128
31129 /**
31130  * Creates a `PositiveTimestamp` from a Unix timestamp in the range `0..=MAX_TIMESTAMP`.
31131  *
31132  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
31133  */
31134 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
31135
31136 /**
31137  * Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding Unix timestamp in
31138  * the range `0..=MAX_TIMESTAMP`.
31139  *
31140  * Note that the subsecond part is dropped as it is not representable in BOLT 11 invoices.
31141  *
31142  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
31143  */
31144 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
31145
31146 /**
31147  * Creates a `PositiveTimestamp` from a [`Duration`] since the Unix epoch in the range
31148  * `0..=MAX_TIMESTAMP`.
31149  *
31150  * Note that the subsecond part is dropped as it is not representable in BOLT 11 invoices.
31151  *
31152  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
31153  */
31154 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_duration_since_epoch(uint64_t duration);
31155
31156 /**
31157  * Returns the Unix timestamp representing the stored time
31158  */
31159 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
31160
31161 /**
31162  * Returns the duration of the stored time since the Unix epoch
31163  */
31164 MUST_USE_RES uint64_t PositiveTimestamp_as_duration_since_epoch(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
31165
31166 /**
31167  * Returns the [`SystemTime`] representing the stored time
31168  */
31169 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
31170
31171 /**
31172  * Transform the `Invoice` into it's unchecked version
31173  */
31174 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
31175
31176 /**
31177  * Check that the invoice is signed correctly and that key recovery works
31178  */
31179 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
31180
31181 /**
31182  * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
31183  * ```
31184  * use lightning_invoice::*;
31185  *
31186  * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\
31187  * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\
31188  * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\
31189  * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\
31190  * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\
31191  * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\
31192  * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\
31193  * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\
31194  * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\
31195  * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\
31196  * j5r6drg6k6zcqj0fcwg\";
31197  *
31198  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
31199  *
31200  * assert!(Invoice::from_signed(signed).is_ok());
31201  * ```
31202  */
31203 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
31204
31205 /**
31206  * Returns the `Invoice`'s timestamp (should equal its creation time)
31207  */
31208 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
31209
31210 /**
31211  * Returns the `Invoice`'s timestamp as a duration since the Unix epoch
31212  */
31213 MUST_USE_RES uint64_t Invoice_duration_since_epoch(const struct LDKInvoice *NONNULL_PTR this_arg);
31214
31215 /**
31216  * Returns the hash to which we will receive the preimage on completion of the payment
31217  */
31218 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
31219
31220 /**
31221  * Get the payee's public key if one was included in the invoice
31222  *
31223  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31224  */
31225 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
31226
31227 /**
31228  * Get the payment secret if one was included in the invoice
31229  */
31230 MUST_USE_RES const uint8_t (*Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
31231
31232 /**
31233  * Get the invoice features if they were included in the invoice
31234  *
31235  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31236  */
31237 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
31238
31239 /**
31240  * Recover the payee's public key (only to be used if none was included in the invoice)
31241  */
31242 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
31243
31244 /**
31245  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
31246  */
31247 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
31248
31249 /**
31250  * Returns whether the invoice has expired.
31251  */
31252 MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg);
31253
31254 /**
31255  * Returns whether the expiry time would pass at the given point in time.
31256  * `at_time` is the timestamp as a duration since the Unix epoch.
31257  */
31258 MUST_USE_RES bool Invoice_would_expire(const struct LDKInvoice *NONNULL_PTR this_arg, uint64_t at_time);
31259
31260 /**
31261  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
31262  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
31263  */
31264 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
31265
31266 /**
31267  * Returns a list of all routes included in the invoice
31268  */
31269 MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
31270
31271 /**
31272  * Returns a list of all routes included in the invoice as the underlying hints
31273  */
31274 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
31275
31276 /**
31277  * Returns the currency for which the invoice was issued
31278  */
31279 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
31280
31281 /**
31282  * Returns the amount if specified in the invoice as millisatoshis.
31283  */
31284 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_milli_satoshis(const struct LDKInvoice *NONNULL_PTR this_arg);
31285
31286 /**
31287  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
31288  * returns `CreationError::DescriptionTooLong` otherwise
31289  *
31290  * Please note that single characters may use more than one byte due to UTF8 encoding.
31291  */
31292 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
31293
31294 /**
31295  * Returns the underlying description `String`
31296  */
31297 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
31298
31299 /**
31300  * Construct an `ExpiryTime` from seconds.
31301  */
31302 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_seconds(uint64_t seconds);
31303
31304 /**
31305  * Construct an `ExpiryTime` from a `Duration`, dropping the sub-second part.
31306  */
31307 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_duration(uint64_t duration);
31308
31309 /**
31310  * Returns the expiry time in seconds
31311  */
31312 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
31313
31314 /**
31315  * Returns a reference to the underlying `Duration` (=expiry time)
31316  */
31317 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
31318
31319 /**
31320  * Creates a new (partial) route from a list of hops
31321  */
31322 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
31323
31324 /**
31325  * Returns the underlying list of hops
31326  */
31327 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
31328
31329 /**
31330  * Creates a copy of the CreationError
31331  */
31332 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
31333
31334 /**
31335  * Utility method to constructs a new DescriptionTooLong-variant CreationError
31336  */
31337 enum LDKCreationError CreationError_description_too_long(void);
31338
31339 /**
31340  * Utility method to constructs a new RouteTooLong-variant CreationError
31341  */
31342 enum LDKCreationError CreationError_route_too_long(void);
31343
31344 /**
31345  * Utility method to constructs a new TimestampOutOfBounds-variant CreationError
31346  */
31347 enum LDKCreationError CreationError_timestamp_out_of_bounds(void);
31348
31349 /**
31350  * Utility method to constructs a new InvalidAmount-variant CreationError
31351  */
31352 enum LDKCreationError CreationError_invalid_amount(void);
31353
31354 /**
31355  * Utility method to constructs a new MissingRouteHints-variant CreationError
31356  */
31357 enum LDKCreationError CreationError_missing_route_hints(void);
31358
31359 /**
31360  * Checks if two CreationErrors contain equal inner contents.
31361  * This ignores pointers and is_owned flags and looks at the values in fields.
31362  */
31363 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
31364
31365 /**
31366  * Get the string representation of a CreationError object
31367  */
31368 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
31369
31370 /**
31371  * Creates a copy of the SemanticError
31372  */
31373 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
31374
31375 /**
31376  * Utility method to constructs a new NoPaymentHash-variant SemanticError
31377  */
31378 enum LDKSemanticError SemanticError_no_payment_hash(void);
31379
31380 /**
31381  * Utility method to constructs a new MultiplePaymentHashes-variant SemanticError
31382  */
31383 enum LDKSemanticError SemanticError_multiple_payment_hashes(void);
31384
31385 /**
31386  * Utility method to constructs a new NoDescription-variant SemanticError
31387  */
31388 enum LDKSemanticError SemanticError_no_description(void);
31389
31390 /**
31391  * Utility method to constructs a new MultipleDescriptions-variant SemanticError
31392  */
31393 enum LDKSemanticError SemanticError_multiple_descriptions(void);
31394
31395 /**
31396  * Utility method to constructs a new NoPaymentSecret-variant SemanticError
31397  */
31398 enum LDKSemanticError SemanticError_no_payment_secret(void);
31399
31400 /**
31401  * Utility method to constructs a new MultiplePaymentSecrets-variant SemanticError
31402  */
31403 enum LDKSemanticError SemanticError_multiple_payment_secrets(void);
31404
31405 /**
31406  * Utility method to constructs a new InvalidFeatures-variant SemanticError
31407  */
31408 enum LDKSemanticError SemanticError_invalid_features(void);
31409
31410 /**
31411  * Utility method to constructs a new InvalidRecoveryId-variant SemanticError
31412  */
31413 enum LDKSemanticError SemanticError_invalid_recovery_id(void);
31414
31415 /**
31416  * Utility method to constructs a new InvalidSignature-variant SemanticError
31417  */
31418 enum LDKSemanticError SemanticError_invalid_signature(void);
31419
31420 /**
31421  * Utility method to constructs a new ImpreciseAmount-variant SemanticError
31422  */
31423 enum LDKSemanticError SemanticError_imprecise_amount(void);
31424
31425 /**
31426  * Checks if two SemanticErrors contain equal inner contents.
31427  * This ignores pointers and is_owned flags and looks at the values in fields.
31428  */
31429 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
31430
31431 /**
31432  * Get the string representation of a SemanticError object
31433  */
31434 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
31435
31436 /**
31437  * Frees any resources used by the SignOrCreationError
31438  */
31439 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
31440
31441 /**
31442  * Creates a copy of the SignOrCreationError
31443  */
31444 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
31445
31446 /**
31447  * Utility method to constructs a new SignError-variant SignOrCreationError
31448  */
31449 struct LDKSignOrCreationError SignOrCreationError_sign_error(void);
31450
31451 /**
31452  * Utility method to constructs a new CreationError-variant SignOrCreationError
31453  */
31454 struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a);
31455
31456 /**
31457  * Checks if two SignOrCreationErrors contain equal inner contents.
31458  * This ignores pointers and is_owned flags and looks at the values in fields.
31459  */
31460 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
31461
31462 /**
31463  * Get the string representation of a SignOrCreationError object
31464  */
31465 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
31466
31467 /**
31468  * Frees any resources used by the InvoicePayer, if is_owned is set and inner is non-NULL.
31469  */
31470 void InvoicePayer_free(struct LDKInvoicePayer this_obj);
31471
31472 /**
31473  * Calls the free function if one is set
31474  */
31475 void Payer_free(struct LDKPayer this_ptr);
31476
31477 /**
31478  * Calls the free function if one is set
31479  */
31480 void Router_free(struct LDKRouter this_ptr);
31481
31482 /**
31483  * Frees any resources used by the Retry
31484  */
31485 void Retry_free(struct LDKRetry this_ptr);
31486
31487 /**
31488  * Creates a copy of the Retry
31489  */
31490 struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig);
31491
31492 /**
31493  * Utility method to constructs a new Attempts-variant Retry
31494  */
31495 struct LDKRetry Retry_attempts(uintptr_t a);
31496
31497 /**
31498  * Utility method to constructs a new Timeout-variant Retry
31499  */
31500 struct LDKRetry Retry_timeout(uint64_t a);
31501
31502 /**
31503  * Checks if two Retrys contain equal inner contents.
31504  * This ignores pointers and is_owned flags and looks at the values in fields.
31505  */
31506 bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b);
31507
31508 /**
31509  * Checks if two Retrys contain equal inner contents.
31510  */
31511 uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o);
31512
31513 /**
31514  * Frees any resources used by the PaymentError
31515  */
31516 void PaymentError_free(struct LDKPaymentError this_ptr);
31517
31518 /**
31519  * Creates a copy of the PaymentError
31520  */
31521 struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig);
31522
31523 /**
31524  * Utility method to constructs a new Invoice-variant PaymentError
31525  */
31526 struct LDKPaymentError PaymentError_invoice(struct LDKStr a);
31527
31528 /**
31529  * Utility method to constructs a new Routing-variant PaymentError
31530  */
31531 struct LDKPaymentError PaymentError_routing(struct LDKLightningError a);
31532
31533 /**
31534  * Utility method to constructs a new Sending-variant PaymentError
31535  */
31536 struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a);
31537
31538 /**
31539  * Creates an invoice payer that retries failed payment paths.
31540  *
31541  * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once
31542  * `retry` has been exceeded for a given [`Invoice`].
31543  */
31544 MUST_USE_RES struct LDKInvoicePayer InvoicePayer_new(struct LDKPayer payer, struct LDKRouter router, struct LDKLogger logger, struct LDKEventHandler event_handler, struct LDKRetry retry);
31545
31546 /**
31547  * Pays the given [`Invoice`], caching it for later use in case a retry is needed.
31548  *
31549  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
31550  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
31551  * for you.
31552  */
31553 MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice);
31554
31555 /**
31556  * Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in
31557  * case a retry is needed.
31558  *
31559  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
31560  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
31561  * for you.
31562  */
31563 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);
31564
31565 /**
31566  * Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in
31567  * case a retry is needed.
31568  *
31569  * You should ensure that `payment_preimage` is unique and that its `payment_hash` has never
31570  * been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so for you.
31571  */
31572 MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_pubkey(const struct LDKInvoicePayer *NONNULL_PTR this_arg, struct LDKPublicKey pubkey, struct LDKThirtyTwoBytes payment_preimage, uint64_t amount_msats, uint32_t final_cltv_expiry_delta);
31573
31574 /**
31575  * Removes the payment cached by the given payment hash.
31576  *
31577  * Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an
31578  * [`EventHandler`]. Otherwise, calling this method is unnecessary.
31579  */
31580 void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
31581
31582 /**
31583  * Constructs a new EventHandler which calls the relevant methods on this_arg.
31584  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
31585  */
31586 struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg);
31587
31588 /**
31589  * Frees any resources used by the InFlightHtlcs, if is_owned is set and inner is non-NULL.
31590  */
31591 void InFlightHtlcs_free(struct LDKInFlightHtlcs this_obj);
31592
31593 /**
31594  * Returns liquidity in msat given the public key of the HTLC source, target, and short channel
31595  * id.
31596  */
31597 MUST_USE_RES struct LDKCOption_u64Z InFlightHtlcs_used_liquidity_msat(const struct LDKInFlightHtlcs *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, uint64_t channel_scid);
31598
31599 /**
31600  * Serialize the InFlightHtlcs object into a byte array which can be read by InFlightHtlcs_read
31601  */
31602 struct LDKCVec_u8Z InFlightHtlcs_write(const struct LDKInFlightHtlcs *NONNULL_PTR obj);
31603
31604 /**
31605  * Read a InFlightHtlcs from a byte array, created by InFlightHtlcs_write
31606  */
31607 struct LDKCResult_InFlightHtlcsDecodeErrorZ InFlightHtlcs_read(struct LDKu8slice ser);
31608
31609 /**
31610  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
31611  * See [`PhantomKeysManager`] for more information on phantom node payments.
31612  *
31613  * `phantom_route_hints` parameter:
31614  * * Contains channel info for all nodes participating in the phantom invoice
31615  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
31616  *   participating node
31617  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
31618  *   updated when a channel becomes disabled or closes
31619  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
31620  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
31621  *   down
31622  *
31623  * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
31624  * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
31625  * If `None` is provided for `payment_hash`, then one will be created.
31626  *
31627  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
31628  * in excess of the current time.
31629  *
31630  * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
31631  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
31632  * requirement).
31633  *
31634  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
31635  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
31636  * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
31637  * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
31638  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
31639  *
31640  * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
31641  */
31642 struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKThirtyTwoBytes payment_hash, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network);
31643
31644 /**
31645  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
31646  * See [`PhantomKeysManager`] for more information on phantom node payments.
31647  *
31648  * `phantom_route_hints` parameter:
31649  * * Contains channel info for all nodes participating in the phantom invoice
31650  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
31651  *   participating node
31652  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
31653  *   updated when a channel becomes disabled or closes
31654  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
31655  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
31656  *   down
31657  *
31658  * `description_hash` is a SHA-256 hash of the description text
31659  *
31660  * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
31661  * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
31662  * If `None` is provided for `payment_hash`, then one will be created.
31663  *
31664  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
31665  * in excess of the current time.
31666  *
31667  * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
31668  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
31669  * requirement).
31670  *
31671  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
31672  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
31673  * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
31674  * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
31675  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
31676  *
31677  * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
31678  */
31679 struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, struct LDKSha256 description_hash, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network);
31680
31681 /**
31682  * Utility to construct an invoice. Generally, unless you want to do something like a custom
31683  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
31684  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
31685  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
31686  * that the payment secret is valid when the invoice is paid.
31687  *
31688  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
31689  * in excess of the current time.
31690  */
31691 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint32_t invoice_expiry_delta_secs);
31692
31693 /**
31694  * Utility to construct an invoice. Generally, unless you want to do something like a custom
31695  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
31696  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
31697  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
31698  * that the payment secret is valid when the invoice is paid.
31699  * Use this variant if you want to pass the `description_hash` to the invoice.
31700  *
31701  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
31702  * in excess of the current time.
31703  */
31704 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint32_t invoice_expiry_delta_secs);
31705
31706 /**
31707  * See [`create_invoice_from_channelmanager_with_description_hash`]
31708  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
31709  * available and the current time is supplied by the caller.
31710  */
31711 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs);
31712
31713 /**
31714  * See [`create_invoice_from_channelmanager`]
31715  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
31716  * available and the current time is supplied by the caller.
31717  */
31718 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs);
31719
31720 /**
31721  * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
31722  */
31723 void DefaultRouter_free(struct LDKDefaultRouter this_obj);
31724
31725 /**
31726  * Creates a new router using the given [`NetworkGraph`], a [`Logger`], and a randomness source
31727  * `random_seed_bytes`.
31728  */
31729 MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, struct LDKThirtyTwoBytes random_seed_bytes, struct LDKLockableScore scorer);
31730
31731 /**
31732  * Constructs a new Router which calls the relevant methods on this_arg.
31733  * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
31734  */
31735 struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg);
31736
31737 /**
31738  * Constructs a new Payer which calls the relevant methods on this_arg.
31739  * This copies the `inner` pointer in this_arg and thus the returned Payer must be freed before this_arg is
31740  */
31741 struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_PTR this_arg);
31742
31743 /**
31744  * Read a SiPrefix object from a string
31745  */
31746 struct LDKCResult_SiPrefixParseErrorZ SiPrefix_from_str(struct LDKStr s);
31747
31748 /**
31749  * Read a Invoice object from a string
31750  */
31751 struct LDKCResult_InvoiceParseOrSemanticErrorZ Invoice_from_str(struct LDKStr s);
31752
31753 /**
31754  * Read a SignedRawInvoice object from a string
31755  */
31756 struct LDKCResult_SignedRawInvoiceParseErrorZ SignedRawInvoice_from_str(struct LDKStr s);
31757
31758 /**
31759  * Get the string representation of a ParseError object
31760  */
31761 struct LDKStr ParseError_to_str(const struct LDKParseError *NONNULL_PTR o);
31762
31763 /**
31764  * Get the string representation of a ParseOrSemanticError object
31765  */
31766 struct LDKStr ParseOrSemanticError_to_str(const struct LDKParseOrSemanticError *NONNULL_PTR o);
31767
31768 /**
31769  * Get the string representation of a Invoice object
31770  */
31771 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
31772
31773 /**
31774  * Get the string representation of a SignedRawInvoice object
31775  */
31776 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
31777
31778 /**
31779  * Get the string representation of a Currency object
31780  */
31781 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
31782
31783 /**
31784  * Get the string representation of a SiPrefix object
31785  */
31786 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
31787
31788 /**
31789  * Frees any resources used by the RapidGossipSync, if is_owned is set and inner is non-NULL.
31790  */
31791 void RapidGossipSync_free(struct LDKRapidGossipSync this_obj);
31792
31793 /**
31794  * Instantiate a new [`RapidGossipSync`] instance.
31795  */
31796 MUST_USE_RES struct LDKRapidGossipSync RapidGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph);
31797
31798 /**
31799  * Update network graph from binary data.
31800  * Returns the last sync timestamp to be used the next time rapid sync data is queried.
31801  *
31802  * `network_graph`: network graph to be updated
31803  *
31804  * `update_data`: `&[u8]` binary stream that comprises the update data
31805  */
31806 MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data);
31807
31808 /**
31809  * Returns whether a rapid gossip sync has completed at least once.
31810  */
31811 MUST_USE_RES bool RapidGossipSync_is_initial_sync_complete(const struct LDKRapidGossipSync *NONNULL_PTR this_arg);
31812
31813 /**
31814  * Frees any resources used by the GraphSyncError
31815  */
31816 void GraphSyncError_free(struct LDKGraphSyncError this_ptr);
31817
31818 /**
31819  * Creates a copy of the GraphSyncError
31820  */
31821 struct LDKGraphSyncError GraphSyncError_clone(const struct LDKGraphSyncError *NONNULL_PTR orig);
31822
31823 /**
31824  * Utility method to constructs a new DecodeError-variant GraphSyncError
31825  */
31826 struct LDKGraphSyncError GraphSyncError_decode_error(struct LDKDecodeError a);
31827
31828 /**
31829  * Utility method to constructs a new LightningError-variant GraphSyncError
31830  */
31831 struct LDKGraphSyncError GraphSyncError_lightning_error(struct LDKLightningError a);
31832
31833 #endif /* LDK_C_BINDINGS_H */
31834
31835 #include "ldk_ver.h"