Update auto-generated bindings to 0.0.113
[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  * Describes the type of HTLC claim as determined by analyzing the witness.
226  */
227 typedef enum LDKHTLCClaim {
228    /**
229     * Claims an offered output on a commitment transaction through the timeout path.
230     */
231    LDKHTLCClaim_OfferedTimeout,
232    /**
233     * Claims an offered output on a commitment transaction through the success path.
234     */
235    LDKHTLCClaim_OfferedPreimage,
236    /**
237     * Claims an accepted output on a commitment transaction through the timeout path.
238     */
239    LDKHTLCClaim_AcceptedTimeout,
240    /**
241     * Claims an accepted output on a commitment transaction through the success path.
242     */
243    LDKHTLCClaim_AcceptedPreimage,
244    /**
245     * Claims an offered/accepted output on a commitment transaction through the revocation path.
246     */
247    LDKHTLCClaim_Revocation,
248    /**
249     * Must be last for serialization purposes
250     */
251    LDKHTLCClaim_Sentinel,
252 } LDKHTLCClaim;
253
254 /**
255  * Represents an IO Error. Note that some information is lost in the conversion from Rust.
256  */
257 typedef enum LDKIOError {
258    LDKIOError_NotFound,
259    LDKIOError_PermissionDenied,
260    LDKIOError_ConnectionRefused,
261    LDKIOError_ConnectionReset,
262    LDKIOError_ConnectionAborted,
263    LDKIOError_NotConnected,
264    LDKIOError_AddrInUse,
265    LDKIOError_AddrNotAvailable,
266    LDKIOError_BrokenPipe,
267    LDKIOError_AlreadyExists,
268    LDKIOError_WouldBlock,
269    LDKIOError_InvalidInput,
270    LDKIOError_InvalidData,
271    LDKIOError_TimedOut,
272    LDKIOError_WriteZero,
273    LDKIOError_Interrupted,
274    LDKIOError_Other,
275    LDKIOError_UnexpectedEof,
276    /**
277     * Must be last for serialization purposes
278     */
279    LDKIOError_Sentinel,
280 } LDKIOError;
281
282 /**
283  * An enum representing the available verbosity levels of the logger.
284  */
285 typedef enum LDKLevel {
286    /**
287     * Designates extremely verbose information, including gossip-induced messages
288     */
289    LDKLevel_Gossip,
290    /**
291     * Designates very low priority, often extremely verbose, information
292     */
293    LDKLevel_Trace,
294    /**
295     * Designates lower priority information
296     */
297    LDKLevel_Debug,
298    /**
299     * Designates useful information
300     */
301    LDKLevel_Info,
302    /**
303     * Designates hazardous situations
304     */
305    LDKLevel_Warn,
306    /**
307     * Designates very serious errors
308     */
309    LDKLevel_Error,
310    /**
311     * Must be last for serialization purposes
312     */
313    LDKLevel_Sentinel,
314 } LDKLevel;
315
316 /**
317  * An enum representing the possible Bitcoin or test networks which we can run on
318  */
319 typedef enum LDKNetwork {
320    /**
321     * The main Bitcoin blockchain.
322     */
323    LDKNetwork_Bitcoin,
324    /**
325     * The testnet3 blockchain.
326     */
327    LDKNetwork_Testnet,
328    /**
329     * A local test blockchain.
330     */
331    LDKNetwork_Regtest,
332    /**
333     * A blockchain on which blocks are signed instead of mined.
334     */
335    LDKNetwork_Signet,
336    /**
337     * Must be last for serialization purposes
338     */
339    LDKNetwork_Sentinel,
340 } LDKNetwork;
341
342 /**
343  * Specifies the recipient of an invoice.
344  *
345  * This indicates to [`KeysInterface::sign_invoice`] what node secret key should be used to sign
346  * the invoice.
347  */
348 typedef enum LDKRecipient {
349    /**
350     * The invoice should be signed with the local node secret key.
351     */
352    LDKRecipient_Node,
353    /**
354     * The invoice should be signed with the phantom node secret key. This secret key must be the
355     * same for all nodes participating in the [phantom node payment].
356     *
357     * [phantom node payment]: PhantomKeysManager
358     */
359    LDKRecipient_PhantomNode,
360    /**
361     * Must be last for serialization purposes
362     */
363    LDKRecipient_Sentinel,
364 } LDKRecipient;
365
366 /**
367  * Represents an error returned from libsecp256k1 during validation of some secp256k1 data
368  */
369 typedef enum LDKSecp256k1Error {
370    /**
371     * Signature failed verification
372     */
373    LDKSecp256k1Error_IncorrectSignature,
374    /**
375     * Badly sized message ("messages" are actually fixed-sized digests; see the MESSAGE_SIZE constant)
376     */
377    LDKSecp256k1Error_InvalidMessage,
378    /**
379     * Bad public key
380     */
381    LDKSecp256k1Error_InvalidPublicKey,
382    /**
383     * Bad signature
384     */
385    LDKSecp256k1Error_InvalidSignature,
386    /**
387     * Bad secret key
388     */
389    LDKSecp256k1Error_InvalidSecretKey,
390    /**
391     * Bad shared secret.
392     */
393    LDKSecp256k1Error_InvalidSharedSecret,
394    /**
395     * Bad recovery id
396     */
397    LDKSecp256k1Error_InvalidRecoveryId,
398    /**
399     * Invalid tweak for add_assign or mul_assign
400     */
401    LDKSecp256k1Error_InvalidTweak,
402    /**
403     * Didn't pass enough memory to context creation with preallocated memory
404     */
405    LDKSecp256k1Error_NotEnoughMemory,
406    /**
407     * Bad set of public keys.
408     */
409    LDKSecp256k1Error_InvalidPublicKeySum,
410    /**
411     * The only valid parity values are 0 or 1.
412     */
413    LDKSecp256k1Error_InvalidParityValue,
414    /**
415     * Must be last for serialization purposes
416     */
417    LDKSecp256k1Error_Sentinel,
418 } LDKSecp256k1Error;
419
420 /**
421  * Errors that may occur when converting a `RawInvoice` to an `Invoice`. They relate to the
422  * requirements sections in BOLT #11
423  */
424 typedef enum LDKSemanticError {
425    /**
426     * The invoice is missing the mandatory payment hash
427     */
428    LDKSemanticError_NoPaymentHash,
429    /**
430     * The invoice has multiple payment hashes which isn't allowed
431     */
432    LDKSemanticError_MultiplePaymentHashes,
433    /**
434     * No description or description hash are part of the invoice
435     */
436    LDKSemanticError_NoDescription,
437    /**
438     * The invoice contains multiple descriptions and/or description hashes which isn't allowed
439     */
440    LDKSemanticError_MultipleDescriptions,
441    /**
442     * The invoice is missing the mandatory payment secret, which all modern lightning nodes
443     * should provide.
444     */
445    LDKSemanticError_NoPaymentSecret,
446    /**
447     * The invoice contains multiple payment secrets
448     */
449    LDKSemanticError_MultiplePaymentSecrets,
450    /**
451     * The invoice's features are invalid
452     */
453    LDKSemanticError_InvalidFeatures,
454    /**
455     * The recovery id doesn't fit the signature/pub key
456     */
457    LDKSemanticError_InvalidRecoveryId,
458    /**
459     * The invoice's signature is invalid
460     */
461    LDKSemanticError_InvalidSignature,
462    /**
463     * The invoice's amount was not a whole number of millisatoshis
464     */
465    LDKSemanticError_ImpreciseAmount,
466    /**
467     * Must be last for serialization purposes
468     */
469    LDKSemanticError_Sentinel,
470 } LDKSemanticError;
471
472 /**
473  * SI prefixes for the human readable part
474  */
475 typedef enum LDKSiPrefix {
476    /**
477     * 10^-3
478     */
479    LDKSiPrefix_Milli,
480    /**
481     * 10^-6
482     */
483    LDKSiPrefix_Micro,
484    /**
485     * 10^-9
486     */
487    LDKSiPrefix_Nano,
488    /**
489     * 10^-12
490     */
491    LDKSiPrefix_Pico,
492    /**
493     * Must be last for serialization purposes
494     */
495    LDKSiPrefix_Sentinel,
496 } LDKSiPrefix;
497
498 /**
499  * A Rust str object, ie a reference to a UTF8-valid string.
500  * This is *not* null-terminated so cannot be used directly as a C string!
501  */
502 typedef struct LDKStr {
503    /**
504     * A pointer to the string's bytes, in UTF8 encoding
505     */
506    const uint8_t *chars;
507    /**
508     * The number of bytes (not characters!) pointed to by `chars`
509     */
510    uintptr_t len;
511    /**
512     * Whether the data pointed to by `chars` should be freed or not.
513     */
514    bool chars_is_owned;
515 } LDKStr;
516
517 /**
518  * A 16-byte byte array.
519  */
520 typedef struct LDKSixteenBytes {
521    /**
522     * The sixteen bytes
523     */
524    uint8_t data[16];
525 } LDKSixteenBytes;
526
527 /**
528  * Unsigned, 128-bit integer.
529  *
530  * Because LLVM implements an incorrect ABI for 128-bit integers, a wrapper type is defined here.
531  * See https://github.com/rust-lang/rust/issues/54341 for more details.
532  */
533 typedef struct LDKU128 {
534    /**
535     * The 128-bit integer, as 16 little-endian bytes
536     */
537    uint8_t le_bytes[16];
538 } LDKU128;
539
540 /**
541  * Represents a scalar value between zero and the secp256k1 curve order, in big endian.
542  */
543 typedef struct LDKBigEndianScalar {
544    /**
545     * The bytes of the scalar value.
546     */
547    uint8_t big_endian_bytes[32];
548 } LDKBigEndianScalar;
549
550 /**
551  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
552  * look up the corresponding function in rust-lightning's docs.
553  */
554 typedef struct LDKThirtyTwoBytes {
555    /**
556     * The thirty-two bytes
557     */
558    uint8_t data[32];
559 } LDKThirtyTwoBytes;
560
561 /**
562  * Represents an error returned from the bech32 library during validation of some bech32 data
563  */
564 typedef enum LDKBech32Error_Tag {
565    /**
566     * String does not contain the separator character
567     */
568    LDKBech32Error_MissingSeparator,
569    /**
570     * The checksum does not match the rest of the data
571     */
572    LDKBech32Error_InvalidChecksum,
573    /**
574     * The data or human-readable part is too long or too short
575     */
576    LDKBech32Error_InvalidLength,
577    /**
578     * Some part of the string contains an invalid character
579     */
580    LDKBech32Error_InvalidChar,
581    /**
582     * Some part of the data has an invalid value
583     */
584    LDKBech32Error_InvalidData,
585    /**
586     * The bit conversion failed due to a padding issue
587     */
588    LDKBech32Error_InvalidPadding,
589    /**
590     * The whole string must be of one case
591     */
592    LDKBech32Error_MixedCase,
593    /**
594     * Must be last for serialization purposes
595     */
596    LDKBech32Error_Sentinel,
597 } LDKBech32Error_Tag;
598
599 typedef struct LDKBech32Error {
600    LDKBech32Error_Tag tag;
601    union {
602       struct {
603          uint32_t invalid_char;
604       };
605       struct {
606          uint8_t invalid_data;
607       };
608    };
609 } LDKBech32Error;
610
611 /**
612  * A serialized transaction, in (pointer, length) form.
613  *
614  * This type optionally owns its own memory, and thus the semantics around access change based on
615  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
616  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
617  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
618  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
619  * you would be invalid.
620  *
621  * Note that, while it may change in the future, because transactions on the Rust side are stored
622  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
623  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
624  * `data_is_owned` either set or unset at your discretion.
625  */
626 typedef struct LDKTransaction {
627    /**
628     * The serialized transaction data.
629     *
630     * This is non-const for your convenience, an object passed to Rust is never written to.
631     */
632    uint8_t *data;
633    /**
634     * The length of the serialized transaction
635     */
636    uintptr_t datalen;
637    /**
638     * Whether the data pointed to by `data` should be freed or not.
639     */
640    bool data_is_owned;
641 } LDKTransaction;
642
643 /**
644  * A serialized witness.
645  */
646 typedef struct LDKWitness {
647    /**
648     * The serialized transaction data.
649     *
650     * This is non-const for your convenience, an object passed to Rust is never written to.
651     */
652    uint8_t *data;
653    /**
654     * The length of the serialized transaction
655     */
656    uintptr_t datalen;
657    /**
658     * Whether the data pointed to by `data` should be freed or not.
659     */
660    bool data_is_owned;
661 } LDKWitness;
662
663 /**
664  * A dynamically-allocated array of u8s of arbitrary size.
665  * This corresponds to std::vector in C++
666  */
667 typedef struct LDKCVec_u8Z {
668    /**
669     * The elements in the array.
670     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
671     */
672    uint8_t *data;
673    /**
674     * The number of elements pointed to by `data`.
675     */
676    uintptr_t datalen;
677 } LDKCVec_u8Z;
678
679 /**
680  * A transaction output including a scriptPubKey and value.
681  * This type *does* own its own memory, so must be free'd appropriately.
682  */
683 typedef struct LDKTxOut {
684    /**
685     * The script_pubkey in this output
686     */
687    struct LDKCVec_u8Z script_pubkey;
688    /**
689     * The value, in satoshis, of this output
690     */
691    uint64_t value;
692 } LDKTxOut;
693
694 /**
695  * An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
696  */
697 typedef enum LDKCOption_HTLCClaimZ_Tag {
698    /**
699     * When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
700     */
701    LDKCOption_HTLCClaimZ_Some,
702    /**
703     * When we're in this state, this COption_HTLCClaimZ contains nothing
704     */
705    LDKCOption_HTLCClaimZ_None,
706    /**
707     * Must be last for serialization purposes
708     */
709    LDKCOption_HTLCClaimZ_Sentinel,
710 } LDKCOption_HTLCClaimZ_Tag;
711
712 typedef struct LDKCOption_HTLCClaimZ {
713    LDKCOption_HTLCClaimZ_Tag tag;
714    union {
715       struct {
716          enum LDKHTLCClaim some;
717       };
718    };
719 } LDKCOption_HTLCClaimZ;
720
721 /**
722  * The contents of CResult_NoneNoneZ
723  */
724 typedef union LDKCResult_NoneNoneZPtr {
725    /**
726     * Note that this value is always NULL, as there are no contents in the OK variant
727     */
728    void *result;
729    /**
730     * Note that this value is always NULL, as there are no contents in the Err variant
731     */
732    void *err;
733 } LDKCResult_NoneNoneZPtr;
734
735 /**
736  * A CResult_NoneNoneZ represents the result of a fallible operation,
737  * containing a () on success and a () on failure.
738  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
739  */
740 typedef struct LDKCResult_NoneNoneZ {
741    /**
742     * The contents of this CResult_NoneNoneZ, accessible via either
743     * `err` or `result` depending on the state of `result_ok`.
744     */
745    union LDKCResult_NoneNoneZPtr contents;
746    /**
747     * Whether this CResult_NoneNoneZ represents a success state.
748     */
749    bool result_ok;
750 } LDKCResult_NoneNoneZ;
751
752
753
754 /**
755  * Implements the per-commitment secret storage scheme from
756  * [BOLT 3](https://github.com/lightning/bolts/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage).
757  *
758  * Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes
759  * or so.
760  */
761 typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets {
762    /**
763     * A pointer to the opaque Rust object.
764     * Nearly everywhere, inner must be non-null, however in places where
765     * the Rust equivalent takes an Option, it may be set to null to indicate None.
766     */
767    LDKnativeCounterpartyCommitmentSecrets *inner;
768    /**
769     * Indicates that this is the only struct which contains the same pointer.
770     * Rust functions which take ownership of an object provided via an argument require
771     * this to be true and invalidate the object pointed to by inner.
772     */
773    bool is_owned;
774 } LDKCounterpartyCommitmentSecrets;
775
776 /**
777  * An error in decoding a message or struct.
778  */
779 typedef enum LDKDecodeError_Tag {
780    /**
781     * A version byte specified something we don't know how to handle.
782     * Includes unknown realm byte in an OnionHopData packet
783     */
784    LDKDecodeError_UnknownVersion,
785    /**
786     * Unknown feature mandating we fail to parse message (eg TLV with an even, unknown type)
787     */
788    LDKDecodeError_UnknownRequiredFeature,
789    /**
790     * Value was invalid, eg a byte which was supposed to be a bool was something other than a 0
791     * or 1, a public key/private key/signature was invalid, text wasn't UTF-8, TLV was
792     * syntactically incorrect, etc
793     */
794    LDKDecodeError_InvalidValue,
795    /**
796     * Buffer too short
797     */
798    LDKDecodeError_ShortRead,
799    /**
800     * A length descriptor in the packet didn't describe the later data correctly
801     */
802    LDKDecodeError_BadLengthDescriptor,
803    /**
804     * Error from std::io
805     */
806    LDKDecodeError_Io,
807    /**
808     * The message included zlib-compressed values, which we don't support.
809     */
810    LDKDecodeError_UnsupportedCompression,
811    /**
812     * Must be last for serialization purposes
813     */
814    LDKDecodeError_Sentinel,
815 } LDKDecodeError_Tag;
816
817 typedef struct MUST_USE_STRUCT LDKDecodeError {
818    LDKDecodeError_Tag tag;
819    union {
820       struct {
821          enum LDKIOError io;
822       };
823    };
824 } LDKDecodeError;
825
826 /**
827  * The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
828  */
829 typedef union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
830    /**
831     * A pointer to the contents in the success state.
832     * Reading from this pointer when `result_ok` is not set is undefined.
833     */
834    struct LDKCounterpartyCommitmentSecrets *result;
835    /**
836     * A pointer to the contents in the error state.
837     * Reading from this pointer when `result_ok` is set is undefined.
838     */
839    struct LDKDecodeError *err;
840 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr;
841
842 /**
843  * A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
844  * containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
845  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
846  */
847 typedef struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ {
848    /**
849     * The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
850     * `err` or `result` depending on the state of `result_ok`.
851     */
852    union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr contents;
853    /**
854     * Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
855     */
856    bool result_ok;
857 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ;
858
859
860
861 /**
862  * The set of public keys which are used in the creation of one commitment transaction.
863  * These are derived from the channel base keys and per-commitment data.
864  *
865  * A broadcaster key is provided from potential broadcaster of the computed transaction.
866  * A countersignatory key is coming from a protocol participant unable to broadcast the
867  * transaction.
868  *
869  * These keys are assumed to be good, either because the code derived them from
870  * channel basepoints via the new function, or they were obtained via
871  * CommitmentTransaction.trust().keys() because we trusted the source of the
872  * pre-calculated keys.
873  */
874 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
875    /**
876     * A pointer to the opaque Rust object.
877     * Nearly everywhere, inner must be non-null, however in places where
878     * the Rust equivalent takes an Option, it may be set to null to indicate None.
879     */
880    LDKnativeTxCreationKeys *inner;
881    /**
882     * Indicates that this is the only struct which contains the same pointer.
883     * Rust functions which take ownership of an object provided via an argument require
884     * this to be true and invalidate the object pointed to by inner.
885     */
886    bool is_owned;
887 } LDKTxCreationKeys;
888
889 /**
890  * The contents of CResult_TxCreationKeysDecodeErrorZ
891  */
892 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
893    /**
894     * A pointer to the contents in the success state.
895     * Reading from this pointer when `result_ok` is not set is undefined.
896     */
897    struct LDKTxCreationKeys *result;
898    /**
899     * A pointer to the contents in the error state.
900     * Reading from this pointer when `result_ok` is set is undefined.
901     */
902    struct LDKDecodeError *err;
903 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
904
905 /**
906  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
907  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
908  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
909  */
910 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
911    /**
912     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
913     * `err` or `result` depending on the state of `result_ok`.
914     */
915    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
916    /**
917     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
918     */
919    bool result_ok;
920 } LDKCResult_TxCreationKeysDecodeErrorZ;
921
922
923
924 /**
925  * One counterparty's public keys which do not change over the life of a channel.
926  */
927 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
928    /**
929     * A pointer to the opaque Rust object.
930     * Nearly everywhere, inner must be non-null, however in places where
931     * the Rust equivalent takes an Option, it may be set to null to indicate None.
932     */
933    LDKnativeChannelPublicKeys *inner;
934    /**
935     * Indicates that this is the only struct which contains the same pointer.
936     * Rust functions which take ownership of an object provided via an argument require
937     * this to be true and invalidate the object pointed to by inner.
938     */
939    bool is_owned;
940 } LDKChannelPublicKeys;
941
942 /**
943  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
944  */
945 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
946    /**
947     * A pointer to the contents in the success state.
948     * Reading from this pointer when `result_ok` is not set is undefined.
949     */
950    struct LDKChannelPublicKeys *result;
951    /**
952     * A pointer to the contents in the error state.
953     * Reading from this pointer when `result_ok` is set is undefined.
954     */
955    struct LDKDecodeError *err;
956 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
957
958 /**
959  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
960  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
961  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
962  */
963 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
964    /**
965     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
966     * `err` or `result` depending on the state of `result_ok`.
967     */
968    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
969    /**
970     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
971     */
972    bool result_ok;
973 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
974
975 /**
976  * An enum which can either contain a u32 or not
977  */
978 typedef enum LDKCOption_u32Z_Tag {
979    /**
980     * When we're in this state, this COption_u32Z contains a u32
981     */
982    LDKCOption_u32Z_Some,
983    /**
984     * When we're in this state, this COption_u32Z contains nothing
985     */
986    LDKCOption_u32Z_None,
987    /**
988     * Must be last for serialization purposes
989     */
990    LDKCOption_u32Z_Sentinel,
991 } LDKCOption_u32Z_Tag;
992
993 typedef struct LDKCOption_u32Z {
994    LDKCOption_u32Z_Tag tag;
995    union {
996       struct {
997          uint32_t some;
998       };
999    };
1000 } LDKCOption_u32Z;
1001
1002
1003
1004 /**
1005  * Information about an HTLC as it appears in a commitment transaction
1006  */
1007 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
1008    /**
1009     * A pointer to the opaque Rust object.
1010     * Nearly everywhere, inner must be non-null, however in places where
1011     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1012     */
1013    LDKnativeHTLCOutputInCommitment *inner;
1014    /**
1015     * Indicates that this is the only struct which contains the same pointer.
1016     * Rust functions which take ownership of an object provided via an argument require
1017     * this to be true and invalidate the object pointed to by inner.
1018     */
1019    bool is_owned;
1020 } LDKHTLCOutputInCommitment;
1021
1022 /**
1023  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
1024  */
1025 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
1026    /**
1027     * A pointer to the contents in the success state.
1028     * Reading from this pointer when `result_ok` is not set is undefined.
1029     */
1030    struct LDKHTLCOutputInCommitment *result;
1031    /**
1032     * A pointer to the contents in the error state.
1033     * Reading from this pointer when `result_ok` is set is undefined.
1034     */
1035    struct LDKDecodeError *err;
1036 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
1037
1038 /**
1039  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
1040  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
1041  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1042  */
1043 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
1044    /**
1045     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
1046     * `err` or `result` depending on the state of `result_ok`.
1047     */
1048    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
1049    /**
1050     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
1051     */
1052    bool result_ok;
1053 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
1054
1055
1056
1057 /**
1058  * Late-bound per-channel counterparty data used to build transactions.
1059  */
1060 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
1061    /**
1062     * A pointer to the opaque Rust object.
1063     * Nearly everywhere, inner must be non-null, however in places where
1064     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1065     */
1066    LDKnativeCounterpartyChannelTransactionParameters *inner;
1067    /**
1068     * Indicates that this is the only struct which contains the same pointer.
1069     * Rust functions which take ownership of an object provided via an argument require
1070     * this to be true and invalidate the object pointed to by inner.
1071     */
1072    bool is_owned;
1073 } LDKCounterpartyChannelTransactionParameters;
1074
1075 /**
1076  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
1077  */
1078 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1079    /**
1080     * A pointer to the contents in the success state.
1081     * Reading from this pointer when `result_ok` is not set is undefined.
1082     */
1083    struct LDKCounterpartyChannelTransactionParameters *result;
1084    /**
1085     * A pointer to the contents in the error state.
1086     * Reading from this pointer when `result_ok` is set is undefined.
1087     */
1088    struct LDKDecodeError *err;
1089 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
1090
1091 /**
1092  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1093  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1094  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1095  */
1096 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1097    /**
1098     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
1099     * `err` or `result` depending on the state of `result_ok`.
1100     */
1101    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
1102    /**
1103     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
1104     */
1105    bool result_ok;
1106 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
1107
1108
1109
1110 /**
1111  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
1112  * The fields are organized by holder/counterparty.
1113  *
1114  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
1115  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
1116  */
1117 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
1118    /**
1119     * A pointer to the opaque Rust object.
1120     * Nearly everywhere, inner must be non-null, however in places where
1121     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1122     */
1123    LDKnativeChannelTransactionParameters *inner;
1124    /**
1125     * Indicates that this is the only struct which contains the same pointer.
1126     * Rust functions which take ownership of an object provided via an argument require
1127     * this to be true and invalidate the object pointed to by inner.
1128     */
1129    bool is_owned;
1130 } LDKChannelTransactionParameters;
1131
1132 /**
1133  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
1134  */
1135 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
1136    /**
1137     * A pointer to the contents in the success state.
1138     * Reading from this pointer when `result_ok` is not set is undefined.
1139     */
1140    struct LDKChannelTransactionParameters *result;
1141    /**
1142     * A pointer to the contents in the error state.
1143     * Reading from this pointer when `result_ok` is set is undefined.
1144     */
1145    struct LDKDecodeError *err;
1146 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
1147
1148 /**
1149  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1150  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1151  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1152  */
1153 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
1154    /**
1155     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
1156     * `err` or `result` depending on the state of `result_ok`.
1157     */
1158    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
1159    /**
1160     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
1161     */
1162    bool result_ok;
1163 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
1164
1165 /**
1166  * Represents a secp256k1 signature serialized as two 32-byte numbers
1167  */
1168 typedef struct LDKSignature {
1169    /**
1170     * The bytes of the signature in "compact" form
1171     */
1172    uint8_t compact_form[64];
1173 } LDKSignature;
1174
1175 /**
1176  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1177  * This corresponds to std::vector in C++
1178  */
1179 typedef struct LDKCVec_SignatureZ {
1180    /**
1181     * The elements in the array.
1182     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1183     */
1184    struct LDKSignature *data;
1185    /**
1186     * The number of elements pointed to by `data`.
1187     */
1188    uintptr_t datalen;
1189 } LDKCVec_SignatureZ;
1190
1191
1192
1193 /**
1194  * Information needed to build and sign a holder's commitment transaction.
1195  *
1196  * The transaction is only signed once we are ready to broadcast.
1197  */
1198 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
1199    /**
1200     * A pointer to the opaque Rust object.
1201     * Nearly everywhere, inner must be non-null, however in places where
1202     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1203     */
1204    LDKnativeHolderCommitmentTransaction *inner;
1205    /**
1206     * Indicates that this is the only struct which contains the same pointer.
1207     * Rust functions which take ownership of an object provided via an argument require
1208     * this to be true and invalidate the object pointed to by inner.
1209     */
1210    bool is_owned;
1211 } LDKHolderCommitmentTransaction;
1212
1213 /**
1214  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1215  */
1216 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
1217    /**
1218     * A pointer to the contents in the success state.
1219     * Reading from this pointer when `result_ok` is not set is undefined.
1220     */
1221    struct LDKHolderCommitmentTransaction *result;
1222    /**
1223     * A pointer to the contents in the error state.
1224     * Reading from this pointer when `result_ok` is set is undefined.
1225     */
1226    struct LDKDecodeError *err;
1227 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
1228
1229 /**
1230  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1231  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1232  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1233  */
1234 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
1235    /**
1236     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1237     * `err` or `result` depending on the state of `result_ok`.
1238     */
1239    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
1240    /**
1241     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1242     */
1243    bool result_ok;
1244 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
1245
1246
1247
1248 /**
1249  * A pre-built Bitcoin commitment transaction and its txid.
1250  */
1251 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
1252    /**
1253     * A pointer to the opaque Rust object.
1254     * Nearly everywhere, inner must be non-null, however in places where
1255     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1256     */
1257    LDKnativeBuiltCommitmentTransaction *inner;
1258    /**
1259     * Indicates that this is the only struct which contains the same pointer.
1260     * Rust functions which take ownership of an object provided via an argument require
1261     * this to be true and invalidate the object pointed to by inner.
1262     */
1263    bool is_owned;
1264 } LDKBuiltCommitmentTransaction;
1265
1266 /**
1267  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1268  */
1269 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1270    /**
1271     * A pointer to the contents in the success state.
1272     * Reading from this pointer when `result_ok` is not set is undefined.
1273     */
1274    struct LDKBuiltCommitmentTransaction *result;
1275    /**
1276     * A pointer to the contents in the error state.
1277     * Reading from this pointer when `result_ok` is set is undefined.
1278     */
1279    struct LDKDecodeError *err;
1280 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
1281
1282 /**
1283  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1284  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1285  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1286  */
1287 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
1288    /**
1289     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1290     * `err` or `result` depending on the state of `result_ok`.
1291     */
1292    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
1293    /**
1294     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1295     */
1296    bool result_ok;
1297 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
1298
1299
1300
1301 /**
1302  * A wrapper on ClosingTransaction indicating that the built bitcoin
1303  * transaction is trusted.
1304  *
1305  * See trust() and verify() functions on CommitmentTransaction.
1306  *
1307  * This structure implements Deref.
1308  */
1309 typedef struct MUST_USE_STRUCT LDKTrustedClosingTransaction {
1310    /**
1311     * A pointer to the opaque Rust object.
1312     * Nearly everywhere, inner must be non-null, however in places where
1313     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1314     */
1315    LDKnativeTrustedClosingTransaction *inner;
1316    /**
1317     * Indicates that this is the only struct which contains the same pointer.
1318     * Rust functions which take ownership of an object provided via an argument require
1319     * this to be true and invalidate the object pointed to by inner.
1320     */
1321    bool is_owned;
1322 } LDKTrustedClosingTransaction;
1323
1324 /**
1325  * The contents of CResult_TrustedClosingTransactionNoneZ
1326  */
1327 typedef union LDKCResult_TrustedClosingTransactionNoneZPtr {
1328    /**
1329     * A pointer to the contents in the success state.
1330     * Reading from this pointer when `result_ok` is not set is undefined.
1331     */
1332    struct LDKTrustedClosingTransaction *result;
1333    /**
1334     * Note that this value is always NULL, as there are no contents in the Err variant
1335     */
1336    void *err;
1337 } LDKCResult_TrustedClosingTransactionNoneZPtr;
1338
1339 /**
1340  * A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1341  * containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1342  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1343  */
1344 typedef struct LDKCResult_TrustedClosingTransactionNoneZ {
1345    /**
1346     * The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1347     * `err` or `result` depending on the state of `result_ok`.
1348     */
1349    union LDKCResult_TrustedClosingTransactionNoneZPtr contents;
1350    /**
1351     * Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1352     */
1353    bool result_ok;
1354 } LDKCResult_TrustedClosingTransactionNoneZ;
1355
1356
1357
1358 /**
1359  * This class tracks the per-transaction information needed to build a commitment transaction and will
1360  * actually build it and sign.  It is used for holder transactions that we sign only when needed
1361  * and for transactions we sign for the counterparty.
1362  *
1363  * This class can be used inside a signer implementation to generate a signature given the relevant
1364  * secret key.
1365  */
1366 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1367    /**
1368     * A pointer to the opaque Rust object.
1369     * Nearly everywhere, inner must be non-null, however in places where
1370     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1371     */
1372    LDKnativeCommitmentTransaction *inner;
1373    /**
1374     * Indicates that this is the only struct which contains the same pointer.
1375     * Rust functions which take ownership of an object provided via an argument require
1376     * this to be true and invalidate the object pointed to by inner.
1377     */
1378    bool is_owned;
1379 } LDKCommitmentTransaction;
1380
1381 /**
1382  * The contents of CResult_CommitmentTransactionDecodeErrorZ
1383  */
1384 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
1385    /**
1386     * A pointer to the contents in the success state.
1387     * Reading from this pointer when `result_ok` is not set is undefined.
1388     */
1389    struct LDKCommitmentTransaction *result;
1390    /**
1391     * A pointer to the contents in the error state.
1392     * Reading from this pointer when `result_ok` is set is undefined.
1393     */
1394    struct LDKDecodeError *err;
1395 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
1396
1397 /**
1398  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1399  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1400  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1401  */
1402 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
1403    /**
1404     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1405     * `err` or `result` depending on the state of `result_ok`.
1406     */
1407    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
1408    /**
1409     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1410     */
1411    bool result_ok;
1412 } LDKCResult_CommitmentTransactionDecodeErrorZ;
1413
1414
1415
1416 /**
1417  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1418  * transaction and the transaction creation keys) are trusted.
1419  *
1420  * See trust() and verify() functions on CommitmentTransaction.
1421  *
1422  * This structure implements Deref.
1423  */
1424 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
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    LDKnativeTrustedCommitmentTransaction *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 } LDKTrustedCommitmentTransaction;
1438
1439 /**
1440  * The contents of CResult_TrustedCommitmentTransactionNoneZ
1441  */
1442 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
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 LDKTrustedCommitmentTransaction *result;
1448    /**
1449     * Note that this value is always NULL, as there are no contents in the Err variant
1450     */
1451    void *err;
1452 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
1453
1454 /**
1455  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1456  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1457  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1458  */
1459 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
1460    /**
1461     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1462     * `err` or `result` depending on the state of `result_ok`.
1463     */
1464    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
1465    /**
1466     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1467     */
1468    bool result_ok;
1469 } LDKCResult_TrustedCommitmentTransactionNoneZ;
1470
1471 /**
1472  * The contents of CResult_CVec_SignatureZNoneZ
1473  */
1474 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
1475    /**
1476     * A pointer to the contents in the success state.
1477     * Reading from this pointer when `result_ok` is not set is undefined.
1478     */
1479    struct LDKCVec_SignatureZ *result;
1480    /**
1481     * Note that this value is always NULL, as there are no contents in the Err variant
1482     */
1483    void *err;
1484 } LDKCResult_CVec_SignatureZNoneZPtr;
1485
1486 /**
1487  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1488  * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1489  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1490  */
1491 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1492    /**
1493     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1494     * `err` or `result` depending on the state of `result_ok`.
1495     */
1496    union LDKCResult_CVec_SignatureZNoneZPtr contents;
1497    /**
1498     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1499     */
1500    bool result_ok;
1501 } LDKCResult_CVec_SignatureZNoneZ;
1502
1503
1504
1505 /**
1506  * A script pubkey for shutting down a channel as defined by [BOLT #2].
1507  *
1508  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
1509  */
1510 typedef struct MUST_USE_STRUCT LDKShutdownScript {
1511    /**
1512     * A pointer to the opaque Rust object.
1513     * Nearly everywhere, inner must be non-null, however in places where
1514     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1515     */
1516    LDKnativeShutdownScript *inner;
1517    /**
1518     * Indicates that this is the only struct which contains the same pointer.
1519     * Rust functions which take ownership of an object provided via an argument require
1520     * this to be true and invalidate the object pointed to by inner.
1521     */
1522    bool is_owned;
1523 } LDKShutdownScript;
1524
1525 /**
1526  * The contents of CResult_ShutdownScriptDecodeErrorZ
1527  */
1528 typedef union LDKCResult_ShutdownScriptDecodeErrorZPtr {
1529    /**
1530     * A pointer to the contents in the success state.
1531     * Reading from this pointer when `result_ok` is not set is undefined.
1532     */
1533    struct LDKShutdownScript *result;
1534    /**
1535     * A pointer to the contents in the error state.
1536     * Reading from this pointer when `result_ok` is set is undefined.
1537     */
1538    struct LDKDecodeError *err;
1539 } LDKCResult_ShutdownScriptDecodeErrorZPtr;
1540
1541 /**
1542  * A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1543  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1544  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1545  */
1546 typedef struct LDKCResult_ShutdownScriptDecodeErrorZ {
1547    /**
1548     * The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1549     * `err` or `result` depending on the state of `result_ok`.
1550     */
1551    union LDKCResult_ShutdownScriptDecodeErrorZPtr contents;
1552    /**
1553     * Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1554     */
1555    bool result_ok;
1556 } LDKCResult_ShutdownScriptDecodeErrorZ;
1557
1558
1559
1560 /**
1561  * An error occurring when converting from [`Script`] to [`ShutdownScript`].
1562  */
1563 typedef struct MUST_USE_STRUCT LDKInvalidShutdownScript {
1564    /**
1565     * A pointer to the opaque Rust object.
1566     * Nearly everywhere, inner must be non-null, however in places where
1567     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1568     */
1569    LDKnativeInvalidShutdownScript *inner;
1570    /**
1571     * Indicates that this is the only struct which contains the same pointer.
1572     * Rust functions which take ownership of an object provided via an argument require
1573     * this to be true and invalidate the object pointed to by inner.
1574     */
1575    bool is_owned;
1576 } LDKInvalidShutdownScript;
1577
1578 /**
1579  * The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1580  */
1581 typedef union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr {
1582    /**
1583     * A pointer to the contents in the success state.
1584     * Reading from this pointer when `result_ok` is not set is undefined.
1585     */
1586    struct LDKShutdownScript *result;
1587    /**
1588     * A pointer to the contents in the error state.
1589     * Reading from this pointer when `result_ok` is set is undefined.
1590     */
1591    struct LDKInvalidShutdownScript *err;
1592 } LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr;
1593
1594 /**
1595  * A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1596  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1597  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1598  */
1599 typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ {
1600    /**
1601     * The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1602     * `err` or `result` depending on the state of `result_ok`.
1603     */
1604    union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr contents;
1605    /**
1606     * Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1607     */
1608    bool result_ok;
1609 } LDKCResult_ShutdownScriptInvalidShutdownScriptZ;
1610
1611 /**
1612  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
1613  */
1614 typedef struct LDKPublicKey {
1615    /**
1616     * The bytes of the public key
1617     */
1618    uint8_t compressed_form[33];
1619 } LDKPublicKey;
1620
1621 /**
1622  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
1623  * This corresponds to std::vector in C++
1624  */
1625 typedef struct LDKCVec_PublicKeyZ {
1626    /**
1627     * The elements in the array.
1628     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1629     */
1630    struct LDKPublicKey *data;
1631    /**
1632     * The number of elements pointed to by `data`.
1633     */
1634    uintptr_t datalen;
1635 } LDKCVec_PublicKeyZ;
1636
1637
1638
1639 /**
1640  * Onion messages can be sent and received to blinded paths, which serve to hide the identity of
1641  * the recipient.
1642  */
1643 typedef struct MUST_USE_STRUCT LDKBlindedPath {
1644    /**
1645     * A pointer to the opaque Rust object.
1646     * Nearly everywhere, inner must be non-null, however in places where
1647     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1648     */
1649    LDKnativeBlindedPath *inner;
1650    /**
1651     * Indicates that this is the only struct which contains the same pointer.
1652     * Rust functions which take ownership of an object provided via an argument require
1653     * this to be true and invalidate the object pointed to by inner.
1654     */
1655    bool is_owned;
1656 } LDKBlindedPath;
1657
1658 /**
1659  * The contents of CResult_BlindedPathNoneZ
1660  */
1661 typedef union LDKCResult_BlindedPathNoneZPtr {
1662    /**
1663     * A pointer to the contents in the success state.
1664     * Reading from this pointer when `result_ok` is not set is undefined.
1665     */
1666    struct LDKBlindedPath *result;
1667    /**
1668     * Note that this value is always NULL, as there are no contents in the Err variant
1669     */
1670    void *err;
1671 } LDKCResult_BlindedPathNoneZPtr;
1672
1673 /**
1674  * A CResult_BlindedPathNoneZ represents the result of a fallible operation,
1675  * containing a crate::lightning::onion_message::blinded_path::BlindedPath on success and a () on failure.
1676  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1677  */
1678 typedef struct LDKCResult_BlindedPathNoneZ {
1679    /**
1680     * The contents of this CResult_BlindedPathNoneZ, accessible via either
1681     * `err` or `result` depending on the state of `result_ok`.
1682     */
1683    union LDKCResult_BlindedPathNoneZPtr contents;
1684    /**
1685     * Whether this CResult_BlindedPathNoneZ represents a success state.
1686     */
1687    bool result_ok;
1688 } LDKCResult_BlindedPathNoneZ;
1689
1690 /**
1691  * The contents of CResult_BlindedPathDecodeErrorZ
1692  */
1693 typedef union LDKCResult_BlindedPathDecodeErrorZPtr {
1694    /**
1695     * A pointer to the contents in the success state.
1696     * Reading from this pointer when `result_ok` is not set is undefined.
1697     */
1698    struct LDKBlindedPath *result;
1699    /**
1700     * A pointer to the contents in the error state.
1701     * Reading from this pointer when `result_ok` is set is undefined.
1702     */
1703    struct LDKDecodeError *err;
1704 } LDKCResult_BlindedPathDecodeErrorZPtr;
1705
1706 /**
1707  * A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
1708  * containing a crate::lightning::onion_message::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
1709  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1710  */
1711 typedef struct LDKCResult_BlindedPathDecodeErrorZ {
1712    /**
1713     * The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
1714     * `err` or `result` depending on the state of `result_ok`.
1715     */
1716    union LDKCResult_BlindedPathDecodeErrorZPtr contents;
1717    /**
1718     * Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
1719     */
1720    bool result_ok;
1721 } LDKCResult_BlindedPathDecodeErrorZ;
1722
1723
1724
1725 /**
1726  * Used to construct the blinded hops portion of a blinded path. These hops cannot be identified
1727  * by outside observers and thus can be used to hide the identity of the recipient.
1728  */
1729 typedef struct MUST_USE_STRUCT LDKBlindedHop {
1730    /**
1731     * A pointer to the opaque Rust object.
1732     * Nearly everywhere, inner must be non-null, however in places where
1733     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1734     */
1735    LDKnativeBlindedHop *inner;
1736    /**
1737     * Indicates that this is the only struct which contains the same pointer.
1738     * Rust functions which take ownership of an object provided via an argument require
1739     * this to be true and invalidate the object pointed to by inner.
1740     */
1741    bool is_owned;
1742 } LDKBlindedHop;
1743
1744 /**
1745  * The contents of CResult_BlindedHopDecodeErrorZ
1746  */
1747 typedef union LDKCResult_BlindedHopDecodeErrorZPtr {
1748    /**
1749     * A pointer to the contents in the success state.
1750     * Reading from this pointer when `result_ok` is not set is undefined.
1751     */
1752    struct LDKBlindedHop *result;
1753    /**
1754     * A pointer to the contents in the error state.
1755     * Reading from this pointer when `result_ok` is set is undefined.
1756     */
1757    struct LDKDecodeError *err;
1758 } LDKCResult_BlindedHopDecodeErrorZPtr;
1759
1760 /**
1761  * A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
1762  * containing a crate::lightning::onion_message::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1763  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1764  */
1765 typedef struct LDKCResult_BlindedHopDecodeErrorZ {
1766    /**
1767     * The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
1768     * `err` or `result` depending on the state of `result_ok`.
1769     */
1770    union LDKCResult_BlindedHopDecodeErrorZPtr contents;
1771    /**
1772     * Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
1773     */
1774    bool result_ok;
1775 } LDKCResult_BlindedHopDecodeErrorZ;
1776
1777
1778
1779 /**
1780  * Represents the compressed public key of a node
1781  */
1782 typedef struct MUST_USE_STRUCT LDKNodeId {
1783    /**
1784     * A pointer to the opaque Rust object.
1785     * Nearly everywhere, inner must be non-null, however in places where
1786     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1787     */
1788    LDKnativeNodeId *inner;
1789    /**
1790     * Indicates that this is the only struct which contains the same pointer.
1791     * Rust functions which take ownership of an object provided via an argument require
1792     * this to be true and invalidate the object pointed to by inner.
1793     */
1794    bool is_owned;
1795 } LDKNodeId;
1796
1797
1798
1799 /**
1800  * Proposed use of a channel passed as a parameter to [`Score::channel_penalty_msat`].
1801  */
1802 typedef struct MUST_USE_STRUCT LDKChannelUsage {
1803    /**
1804     * A pointer to the opaque Rust object.
1805     * Nearly everywhere, inner must be non-null, however in places where
1806     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1807     */
1808    LDKnativeChannelUsage *inner;
1809    /**
1810     * Indicates that this is the only struct which contains the same pointer.
1811     * Rust functions which take ownership of an object provided via an argument require
1812     * this to be true and invalidate the object pointed to by inner.
1813     */
1814    bool is_owned;
1815 } LDKChannelUsage;
1816
1817
1818
1819 /**
1820  * A hop in a route
1821  */
1822 typedef struct MUST_USE_STRUCT LDKRouteHop {
1823    /**
1824     * A pointer to the opaque Rust object.
1825     * Nearly everywhere, inner must be non-null, however in places where
1826     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1827     */
1828    LDKnativeRouteHop *inner;
1829    /**
1830     * Indicates that this is the only struct which contains the same pointer.
1831     * Rust functions which take ownership of an object provided via an argument require
1832     * this to be true and invalidate the object pointed to by inner.
1833     */
1834    bool is_owned;
1835 } LDKRouteHop;
1836
1837 /**
1838  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1839  * This corresponds to std::vector in C++
1840  */
1841 typedef struct LDKCVec_RouteHopZ {
1842    /**
1843     * The elements in the array.
1844     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1845     */
1846    struct LDKRouteHop *data;
1847    /**
1848     * The number of elements pointed to by `data`.
1849     */
1850    uintptr_t datalen;
1851 } LDKCVec_RouteHopZ;
1852
1853 /**
1854  * An interface used to score payment channels for path finding.
1855  *
1856  *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
1857  */
1858 typedef struct LDKScore {
1859    /**
1860     * An opaque pointer which is passed to your function implementations as an argument.
1861     * This has no meaning in the LDK, and can be NULL or any other value.
1862     */
1863    void *this_arg;
1864    /**
1865     * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
1866     * given channel in the direction from `source` to `target`.
1867     *
1868     * The channel's capacity (less any other MPP parts that are also being considered for use in
1869     * the same payment) is given by `capacity_msat`. It may be determined from various sources
1870     * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near
1871     * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount.
1872     * Thus, implementations should be overflow-safe.
1873     */
1874    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);
1875    /**
1876     * Handles updating channel penalties after failing to route through a channel.
1877     */
1878    void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
1879    /**
1880     * Handles updating channel penalties after successfully routing along a path.
1881     */
1882    void (*payment_path_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
1883    /**
1884     * Handles updating channel penalties after a probe over the given path failed.
1885     */
1886    void (*probe_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
1887    /**
1888     * Handles updating channel penalties after a probe over the given path succeeded.
1889     */
1890    void (*probe_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
1891    /**
1892     * Serialize the object into a byte array
1893     */
1894    struct LDKCVec_u8Z (*write)(const void *this_arg);
1895    /**
1896     * Frees any resources associated with this object given its this_arg pointer.
1897     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
1898     */
1899    void (*free)(void *this_arg);
1900 } LDKScore;
1901
1902 /**
1903  * A scorer that is accessed under a lock.
1904  *
1905  * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while
1906  * having shared ownership of a scorer but without requiring internal locking in [`Score`]
1907  * implementations. Internal locking would be detrimental to route finding performance and could
1908  * result in [`Score::channel_penalty_msat`] returning a different value for the same channel.
1909  *
1910  * [`find_route`]: crate::routing::router::find_route
1911  */
1912 typedef struct LDKLockableScore {
1913    /**
1914     * An opaque pointer which is passed to your function implementations as an argument.
1915     * This has no meaning in the LDK, and can be NULL or any other value.
1916     */
1917    void *this_arg;
1918    /**
1919     * Returns the locked scorer.
1920     */
1921    struct LDKScore (*lock)(const void *this_arg);
1922    /**
1923     * Frees any resources associated with this object given its this_arg pointer.
1924     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
1925     */
1926    void (*free)(void *this_arg);
1927 } LDKLockableScore;
1928
1929 /**
1930  * Refers to a scorer that is accessible under lock and also writeable to disk
1931  *
1932  * We need this trait to be able to pass in a scorer to `lightning-background-processor` that will enable us to
1933  * use the Persister to persist it.
1934  */
1935 typedef struct LDKWriteableScore {
1936    /**
1937     * An opaque pointer which is passed to your function implementations as an argument.
1938     * This has no meaning in the LDK, and can be NULL or any other value.
1939     */
1940    void *this_arg;
1941    /**
1942     * Implementation of LockableScore for this object.
1943     */
1944    struct LDKLockableScore LockableScore;
1945    /**
1946     * Serialize the object into a byte array
1947     */
1948    struct LDKCVec_u8Z (*write)(const void *this_arg);
1949    /**
1950     * Frees any resources associated with this object given its this_arg pointer.
1951     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
1952     */
1953    void (*free)(void *this_arg);
1954 } LDKWriteableScore;
1955
1956 /**
1957  * An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
1958  */
1959 typedef enum LDKCOption_WriteableScoreZ_Tag {
1960    /**
1961     * When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
1962     */
1963    LDKCOption_WriteableScoreZ_Some,
1964    /**
1965     * When we're in this state, this COption_WriteableScoreZ contains nothing
1966     */
1967    LDKCOption_WriteableScoreZ_None,
1968    /**
1969     * Must be last for serialization purposes
1970     */
1971    LDKCOption_WriteableScoreZ_Sentinel,
1972 } LDKCOption_WriteableScoreZ_Tag;
1973
1974 typedef struct LDKCOption_WriteableScoreZ {
1975    LDKCOption_WriteableScoreZ_Tag tag;
1976    union {
1977       struct {
1978          struct LDKWriteableScore some;
1979       };
1980    };
1981 } LDKCOption_WriteableScoreZ;
1982
1983 /**
1984  * The contents of CResult_NoneErrorZ
1985  */
1986 typedef union LDKCResult_NoneErrorZPtr {
1987    /**
1988     * Note that this value is always NULL, as there are no contents in the OK variant
1989     */
1990    void *result;
1991    /**
1992     * A pointer to the contents in the error state.
1993     * Reading from this pointer when `result_ok` is set is undefined.
1994     */
1995    enum LDKIOError *err;
1996 } LDKCResult_NoneErrorZPtr;
1997
1998 /**
1999  * A CResult_NoneErrorZ represents the result of a fallible operation,
2000  * containing a () on success and a crate::c_types::IOError on failure.
2001  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2002  */
2003 typedef struct LDKCResult_NoneErrorZ {
2004    /**
2005     * The contents of this CResult_NoneErrorZ, accessible via either
2006     * `err` or `result` depending on the state of `result_ok`.
2007     */
2008    union LDKCResult_NoneErrorZPtr contents;
2009    /**
2010     * Whether this CResult_NoneErrorZ represents a success state.
2011     */
2012    bool result_ok;
2013 } LDKCResult_NoneErrorZ;
2014
2015
2016
2017 /**
2018  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
2019  */
2020 typedef struct MUST_USE_STRUCT LDKChannelDetails {
2021    /**
2022     * A pointer to the opaque Rust object.
2023     * Nearly everywhere, inner must be non-null, however in places where
2024     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2025     */
2026    LDKnativeChannelDetails *inner;
2027    /**
2028     * Indicates that this is the only struct which contains the same pointer.
2029     * Rust functions which take ownership of an object provided via an argument require
2030     * this to be true and invalidate the object pointed to by inner.
2031     */
2032    bool is_owned;
2033 } LDKChannelDetails;
2034
2035 /**
2036  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2037  * This corresponds to std::vector in C++
2038  */
2039 typedef struct LDKCVec_ChannelDetailsZ {
2040    /**
2041     * The elements in the array.
2042     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2043     */
2044    struct LDKChannelDetails *data;
2045    /**
2046     * The number of elements pointed to by `data`.
2047     */
2048    uintptr_t datalen;
2049 } LDKCVec_ChannelDetailsZ;
2050
2051
2052
2053 /**
2054  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
2055  * it can take multiple paths. Each path is composed of one or more hops through the network.
2056  */
2057 typedef struct MUST_USE_STRUCT LDKRoute {
2058    /**
2059     * A pointer to the opaque Rust object.
2060     * Nearly everywhere, inner must be non-null, however in places where
2061     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2062     */
2063    LDKnativeRoute *inner;
2064    /**
2065     * Indicates that this is the only struct which contains the same pointer.
2066     * Rust functions which take ownership of an object provided via an argument require
2067     * this to be true and invalidate the object pointed to by inner.
2068     */
2069    bool is_owned;
2070 } LDKRoute;
2071
2072
2073
2074 /**
2075  * An Err type for failure to process messages.
2076  */
2077 typedef struct MUST_USE_STRUCT LDKLightningError {
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    LDKnativeLightningError *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 } LDKLightningError;
2091
2092 /**
2093  * The contents of CResult_RouteLightningErrorZ
2094  */
2095 typedef union LDKCResult_RouteLightningErrorZPtr {
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 LDKLightningError *err;
2106 } LDKCResult_RouteLightningErrorZPtr;
2107
2108 /**
2109  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2110  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2111  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2112  */
2113 typedef struct LDKCResult_RouteLightningErrorZ {
2114    /**
2115     * The contents of this CResult_RouteLightningErrorZ, accessible via either
2116     * `err` or `result` depending on the state of `result_ok`.
2117     */
2118    union LDKCResult_RouteLightningErrorZPtr contents;
2119    /**
2120     * Whether this CResult_RouteLightningErrorZ represents a success state.
2121     */
2122    bool result_ok;
2123 } LDKCResult_RouteLightningErrorZ;
2124
2125 /**
2126  * An enum which can either contain a u64 or not
2127  */
2128 typedef enum LDKCOption_u64Z_Tag {
2129    /**
2130     * When we're in this state, this COption_u64Z contains a u64
2131     */
2132    LDKCOption_u64Z_Some,
2133    /**
2134     * When we're in this state, this COption_u64Z contains nothing
2135     */
2136    LDKCOption_u64Z_None,
2137    /**
2138     * Must be last for serialization purposes
2139     */
2140    LDKCOption_u64Z_Sentinel,
2141 } LDKCOption_u64Z_Tag;
2142
2143 typedef struct LDKCOption_u64Z {
2144    LDKCOption_u64Z_Tag tag;
2145    union {
2146       struct {
2147          uint64_t some;
2148       };
2149    };
2150 } LDKCOption_u64Z;
2151
2152
2153
2154 /**
2155  * A data structure for tracking in-flight HTLCs. May be used during pathfinding to account for
2156  * in-use channel liquidity.
2157  */
2158 typedef struct MUST_USE_STRUCT LDKInFlightHtlcs {
2159    /**
2160     * A pointer to the opaque Rust object.
2161     * Nearly everywhere, inner must be non-null, however in places where
2162     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2163     */
2164    LDKnativeInFlightHtlcs *inner;
2165    /**
2166     * Indicates that this is the only struct which contains the same pointer.
2167     * Rust functions which take ownership of an object provided via an argument require
2168     * this to be true and invalidate the object pointed to by inner.
2169     */
2170    bool is_owned;
2171 } LDKInFlightHtlcs;
2172
2173 /**
2174  * The contents of CResult_InFlightHtlcsDecodeErrorZ
2175  */
2176 typedef union LDKCResult_InFlightHtlcsDecodeErrorZPtr {
2177    /**
2178     * A pointer to the contents in the success state.
2179     * Reading from this pointer when `result_ok` is not set is undefined.
2180     */
2181    struct LDKInFlightHtlcs *result;
2182    /**
2183     * A pointer to the contents in the error state.
2184     * Reading from this pointer when `result_ok` is set is undefined.
2185     */
2186    struct LDKDecodeError *err;
2187 } LDKCResult_InFlightHtlcsDecodeErrorZPtr;
2188
2189 /**
2190  * A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
2191  * containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
2192  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2193  */
2194 typedef struct LDKCResult_InFlightHtlcsDecodeErrorZ {
2195    /**
2196     * The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
2197     * `err` or `result` depending on the state of `result_ok`.
2198     */
2199    union LDKCResult_InFlightHtlcsDecodeErrorZPtr contents;
2200    /**
2201     * Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
2202     */
2203    bool result_ok;
2204 } LDKCResult_InFlightHtlcsDecodeErrorZ;
2205
2206 /**
2207  * The contents of CResult_RouteHopDecodeErrorZ
2208  */
2209 typedef union LDKCResult_RouteHopDecodeErrorZPtr {
2210    /**
2211     * A pointer to the contents in the success state.
2212     * Reading from this pointer when `result_ok` is not set is undefined.
2213     */
2214    struct LDKRouteHop *result;
2215    /**
2216     * A pointer to the contents in the error state.
2217     * Reading from this pointer when `result_ok` is set is undefined.
2218     */
2219    struct LDKDecodeError *err;
2220 } LDKCResult_RouteHopDecodeErrorZPtr;
2221
2222 /**
2223  * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
2224  * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2225  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2226  */
2227 typedef struct LDKCResult_RouteHopDecodeErrorZ {
2228    /**
2229     * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
2230     * `err` or `result` depending on the state of `result_ok`.
2231     */
2232    union LDKCResult_RouteHopDecodeErrorZPtr contents;
2233    /**
2234     * Whether this CResult_RouteHopDecodeErrorZ represents a success state.
2235     */
2236    bool result_ok;
2237 } LDKCResult_RouteHopDecodeErrorZ;
2238
2239 /**
2240  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2241  * This corresponds to std::vector in C++
2242  */
2243 typedef struct LDKCVec_CVec_RouteHopZZ {
2244    /**
2245     * The elements in the array.
2246     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2247     */
2248    struct LDKCVec_RouteHopZ *data;
2249    /**
2250     * The number of elements pointed to by `data`.
2251     */
2252    uintptr_t datalen;
2253 } LDKCVec_CVec_RouteHopZZ;
2254
2255 /**
2256  * The contents of CResult_RouteDecodeErrorZ
2257  */
2258 typedef union LDKCResult_RouteDecodeErrorZPtr {
2259    /**
2260     * A pointer to the contents in the success state.
2261     * Reading from this pointer when `result_ok` is not set is undefined.
2262     */
2263    struct LDKRoute *result;
2264    /**
2265     * A pointer to the contents in the error state.
2266     * Reading from this pointer when `result_ok` is set is undefined.
2267     */
2268    struct LDKDecodeError *err;
2269 } LDKCResult_RouteDecodeErrorZPtr;
2270
2271 /**
2272  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2273  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2274  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2275  */
2276 typedef struct LDKCResult_RouteDecodeErrorZ {
2277    /**
2278     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
2279     * `err` or `result` depending on the state of `result_ok`.
2280     */
2281    union LDKCResult_RouteDecodeErrorZPtr contents;
2282    /**
2283     * Whether this CResult_RouteDecodeErrorZ represents a success state.
2284     */
2285    bool result_ok;
2286 } LDKCResult_RouteDecodeErrorZ;
2287
2288
2289
2290 /**
2291  * Parameters needed to find a [`Route`].
2292  *
2293  * Passed to [`find_route`] and [`build_route_from_hops`], but also provided in
2294  * [`Event::PaymentPathFailed`] for retrying a failed payment path.
2295  *
2296  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
2297  */
2298 typedef struct MUST_USE_STRUCT LDKRouteParameters {
2299    /**
2300     * A pointer to the opaque Rust object.
2301     * Nearly everywhere, inner must be non-null, however in places where
2302     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2303     */
2304    LDKnativeRouteParameters *inner;
2305    /**
2306     * Indicates that this is the only struct which contains the same pointer.
2307     * Rust functions which take ownership of an object provided via an argument require
2308     * this to be true and invalidate the object pointed to by inner.
2309     */
2310    bool is_owned;
2311 } LDKRouteParameters;
2312
2313 /**
2314  * The contents of CResult_RouteParametersDecodeErrorZ
2315  */
2316 typedef union LDKCResult_RouteParametersDecodeErrorZPtr {
2317    /**
2318     * A pointer to the contents in the success state.
2319     * Reading from this pointer when `result_ok` is not set is undefined.
2320     */
2321    struct LDKRouteParameters *result;
2322    /**
2323     * A pointer to the contents in the error state.
2324     * Reading from this pointer when `result_ok` is set is undefined.
2325     */
2326    struct LDKDecodeError *err;
2327 } LDKCResult_RouteParametersDecodeErrorZPtr;
2328
2329 /**
2330  * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2331  * containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2332  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2333  */
2334 typedef struct LDKCResult_RouteParametersDecodeErrorZ {
2335    /**
2336     * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2337     * `err` or `result` depending on the state of `result_ok`.
2338     */
2339    union LDKCResult_RouteParametersDecodeErrorZPtr contents;
2340    /**
2341     * Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2342     */
2343    bool result_ok;
2344 } LDKCResult_RouteParametersDecodeErrorZ;
2345
2346
2347
2348 /**
2349  * A list of hops along a payment path terminating with a channel to the recipient.
2350  */
2351 typedef struct MUST_USE_STRUCT LDKRouteHint {
2352    /**
2353     * A pointer to the opaque Rust object.
2354     * Nearly everywhere, inner must be non-null, however in places where
2355     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2356     */
2357    LDKnativeRouteHint *inner;
2358    /**
2359     * Indicates that this is the only struct which contains the same pointer.
2360     * Rust functions which take ownership of an object provided via an argument require
2361     * this to be true and invalidate the object pointed to by inner.
2362     */
2363    bool is_owned;
2364 } LDKRouteHint;
2365
2366 /**
2367  * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2368  * This corresponds to std::vector in C++
2369  */
2370 typedef struct LDKCVec_RouteHintZ {
2371    /**
2372     * The elements in the array.
2373     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2374     */
2375    struct LDKRouteHint *data;
2376    /**
2377     * The number of elements pointed to by `data`.
2378     */
2379    uintptr_t datalen;
2380 } LDKCVec_RouteHintZ;
2381
2382 /**
2383  * A dynamically-allocated array of u64s of arbitrary size.
2384  * This corresponds to std::vector in C++
2385  */
2386 typedef struct LDKCVec_u64Z {
2387    /**
2388     * The elements in the array.
2389     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2390     */
2391    uint64_t *data;
2392    /**
2393     * The number of elements pointed to by `data`.
2394     */
2395    uintptr_t datalen;
2396 } LDKCVec_u64Z;
2397
2398
2399
2400 /**
2401  * The recipient of a payment.
2402  */
2403 typedef struct MUST_USE_STRUCT LDKPaymentParameters {
2404    /**
2405     * A pointer to the opaque Rust object.
2406     * Nearly everywhere, inner must be non-null, however in places where
2407     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2408     */
2409    LDKnativePaymentParameters *inner;
2410    /**
2411     * Indicates that this is the only struct which contains the same pointer.
2412     * Rust functions which take ownership of an object provided via an argument require
2413     * this to be true and invalidate the object pointed to by inner.
2414     */
2415    bool is_owned;
2416 } LDKPaymentParameters;
2417
2418 /**
2419  * The contents of CResult_PaymentParametersDecodeErrorZ
2420  */
2421 typedef union LDKCResult_PaymentParametersDecodeErrorZPtr {
2422    /**
2423     * A pointer to the contents in the success state.
2424     * Reading from this pointer when `result_ok` is not set is undefined.
2425     */
2426    struct LDKPaymentParameters *result;
2427    /**
2428     * A pointer to the contents in the error state.
2429     * Reading from this pointer when `result_ok` is set is undefined.
2430     */
2431    struct LDKDecodeError *err;
2432 } LDKCResult_PaymentParametersDecodeErrorZPtr;
2433
2434 /**
2435  * A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2436  * containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2437  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2438  */
2439 typedef struct LDKCResult_PaymentParametersDecodeErrorZ {
2440    /**
2441     * The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2442     * `err` or `result` depending on the state of `result_ok`.
2443     */
2444    union LDKCResult_PaymentParametersDecodeErrorZPtr contents;
2445    /**
2446     * Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2447     */
2448    bool result_ok;
2449 } LDKCResult_PaymentParametersDecodeErrorZ;
2450
2451
2452
2453 /**
2454  * A channel descriptor for a hop along a payment path.
2455  */
2456 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
2457    /**
2458     * A pointer to the opaque Rust object.
2459     * Nearly everywhere, inner must be non-null, however in places where
2460     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2461     */
2462    LDKnativeRouteHintHop *inner;
2463    /**
2464     * Indicates that this is the only struct which contains the same pointer.
2465     * Rust functions which take ownership of an object provided via an argument require
2466     * this to be true and invalidate the object pointed to by inner.
2467     */
2468    bool is_owned;
2469 } LDKRouteHintHop;
2470
2471 /**
2472  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2473  * This corresponds to std::vector in C++
2474  */
2475 typedef struct LDKCVec_RouteHintHopZ {
2476    /**
2477     * The elements in the array.
2478     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2479     */
2480    struct LDKRouteHintHop *data;
2481    /**
2482     * The number of elements pointed to by `data`.
2483     */
2484    uintptr_t datalen;
2485 } LDKCVec_RouteHintHopZ;
2486
2487 /**
2488  * The contents of CResult_RouteHintDecodeErrorZ
2489  */
2490 typedef union LDKCResult_RouteHintDecodeErrorZPtr {
2491    /**
2492     * A pointer to the contents in the success state.
2493     * Reading from this pointer when `result_ok` is not set is undefined.
2494     */
2495    struct LDKRouteHint *result;
2496    /**
2497     * A pointer to the contents in the error state.
2498     * Reading from this pointer when `result_ok` is set is undefined.
2499     */
2500    struct LDKDecodeError *err;
2501 } LDKCResult_RouteHintDecodeErrorZPtr;
2502
2503 /**
2504  * A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2505  * containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2506  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2507  */
2508 typedef struct LDKCResult_RouteHintDecodeErrorZ {
2509    /**
2510     * The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2511     * `err` or `result` depending on the state of `result_ok`.
2512     */
2513    union LDKCResult_RouteHintDecodeErrorZPtr contents;
2514    /**
2515     * Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2516     */
2517    bool result_ok;
2518 } LDKCResult_RouteHintDecodeErrorZ;
2519
2520 /**
2521  * The contents of CResult_RouteHintHopDecodeErrorZ
2522  */
2523 typedef union LDKCResult_RouteHintHopDecodeErrorZPtr {
2524    /**
2525     * A pointer to the contents in the success state.
2526     * Reading from this pointer when `result_ok` is not set is undefined.
2527     */
2528    struct LDKRouteHintHop *result;
2529    /**
2530     * A pointer to the contents in the error state.
2531     * Reading from this pointer when `result_ok` is set is undefined.
2532     */
2533    struct LDKDecodeError *err;
2534 } LDKCResult_RouteHintHopDecodeErrorZPtr;
2535
2536 /**
2537  * A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2538  * containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2539  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2540  */
2541 typedef struct LDKCResult_RouteHintHopDecodeErrorZ {
2542    /**
2543     * The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2544     * `err` or `result` depending on the state of `result_ok`.
2545     */
2546    union LDKCResult_RouteHintHopDecodeErrorZPtr contents;
2547    /**
2548     * Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2549     */
2550    bool result_ok;
2551 } LDKCResult_RouteHintHopDecodeErrorZ;
2552
2553 /**
2554  * Some information provided on receipt of payment depends on whether the payment received is a
2555  * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
2556  */
2557 typedef enum LDKPaymentPurpose_Tag {
2558    /**
2559     * Information for receiving a payment that we generated an invoice for.
2560     */
2561    LDKPaymentPurpose_InvoicePayment,
2562    /**
2563     * Because this is a spontaneous payment, the payer generated their own preimage rather than us
2564     * (the payee) providing a preimage.
2565     */
2566    LDKPaymentPurpose_SpontaneousPayment,
2567    /**
2568     * Must be last for serialization purposes
2569     */
2570    LDKPaymentPurpose_Sentinel,
2571 } LDKPaymentPurpose_Tag;
2572
2573 typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
2574    /**
2575     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
2576     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
2577     * [`ChannelManager::claim_funds`].
2578     *
2579     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2580     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2581     *
2582     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2583     */
2584    struct LDKThirtyTwoBytes payment_preimage;
2585    /**
2586     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
2587     * number of deanonymization attacks during the routing process.
2588     * It is provided here for your reference, however its accuracy is enforced directly by
2589     * [`ChannelManager`] using the values you previously provided to
2590     * [`ChannelManager::create_inbound_payment`] or
2591     * [`ChannelManager::create_inbound_payment_for_hash`].
2592     *
2593     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2594     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2595     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
2596     */
2597    struct LDKThirtyTwoBytes payment_secret;
2598 } LDKPaymentPurpose_LDKInvoicePayment_Body;
2599
2600 typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
2601    LDKPaymentPurpose_Tag tag;
2602    union {
2603       LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
2604       struct {
2605          struct LDKThirtyTwoBytes spontaneous_payment;
2606       };
2607    };
2608 } LDKPaymentPurpose;
2609
2610 /**
2611  * The contents of CResult_PaymentPurposeDecodeErrorZ
2612  */
2613 typedef union LDKCResult_PaymentPurposeDecodeErrorZPtr {
2614    /**
2615     * A pointer to the contents in the success state.
2616     * Reading from this pointer when `result_ok` is not set is undefined.
2617     */
2618    struct LDKPaymentPurpose *result;
2619    /**
2620     * A pointer to the contents in the error state.
2621     * Reading from this pointer when `result_ok` is set is undefined.
2622     */
2623    struct LDKDecodeError *err;
2624 } LDKCResult_PaymentPurposeDecodeErrorZPtr;
2625
2626 /**
2627  * A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
2628  * containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
2629  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2630  */
2631 typedef struct LDKCResult_PaymentPurposeDecodeErrorZ {
2632    /**
2633     * The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
2634     * `err` or `result` depending on the state of `result_ok`.
2635     */
2636    union LDKCResult_PaymentPurposeDecodeErrorZPtr contents;
2637    /**
2638     * Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
2639     */
2640    bool result_ok;
2641 } LDKCResult_PaymentPurposeDecodeErrorZ;
2642
2643 /**
2644  * The reason the channel was closed. See individual variants more details.
2645  */
2646 typedef enum LDKClosureReason_Tag {
2647    /**
2648     * Closure generated from receiving a peer error message.
2649     *
2650     * Our counterparty may have broadcasted their latest commitment state, and we have
2651     * as well.
2652     */
2653    LDKClosureReason_CounterpartyForceClosed,
2654    /**
2655     * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
2656     *
2657     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
2658     */
2659    LDKClosureReason_HolderForceClosed,
2660    /**
2661     * The channel was closed after negotiating a cooperative close and we've now broadcasted
2662     * the cooperative close transaction. Note the shutdown may have been initiated by us.
2663     */
2664    LDKClosureReason_CooperativeClosure,
2665    /**
2666     * A commitment transaction was confirmed on chain, closing the channel. Most likely this
2667     * commitment transaction came from our counterparty, but it may also have come from
2668     * a copy of our own `ChannelMonitor`.
2669     */
2670    LDKClosureReason_CommitmentTxConfirmed,
2671    /**
2672     * The funding transaction failed to confirm in a timely manner on an inbound channel.
2673     */
2674    LDKClosureReason_FundingTimedOut,
2675    /**
2676     * Closure generated from processing an event, likely a HTLC forward/relay/reception.
2677     */
2678    LDKClosureReason_ProcessingError,
2679    /**
2680     * The peer disconnected prior to funding completing. In this case the spec mandates that we
2681     * forget the channel entirely - we can attempt again if the peer reconnects.
2682     *
2683     * This includes cases where we restarted prior to funding completion, including prior to the
2684     * initial [`ChannelMonitor`] persistence completing.
2685     *
2686     * In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the
2687     * peer because of mutual incompatibility between us and our channel counterparty.
2688     *
2689     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
2690     */
2691    LDKClosureReason_DisconnectedPeer,
2692    /**
2693     * Closure generated from `ChannelManager::read` if the [`ChannelMonitor`] is newer than
2694     * the [`ChannelManager`] deserialized.
2695     *
2696     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
2697     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2698     */
2699    LDKClosureReason_OutdatedChannelManager,
2700    /**
2701     * Must be last for serialization purposes
2702     */
2703    LDKClosureReason_Sentinel,
2704 } LDKClosureReason_Tag;
2705
2706 typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
2707    /**
2708     * The error which the peer sent us.
2709     *
2710     * The string should be sanitized before it is used (e.g emitted to logs
2711     * or printed to stdout). Otherwise, a well crafted error message may exploit
2712     * a security vulnerability in the terminal emulator or the logging subsystem.
2713     */
2714    struct LDKStr peer_msg;
2715 } LDKClosureReason_LDKCounterpartyForceClosed_Body;
2716
2717 typedef struct LDKClosureReason_LDKProcessingError_Body {
2718    /**
2719     * A developer-readable error message which we generated.
2720     */
2721    struct LDKStr err;
2722 } LDKClosureReason_LDKProcessingError_Body;
2723
2724 typedef struct MUST_USE_STRUCT LDKClosureReason {
2725    LDKClosureReason_Tag tag;
2726    union {
2727       LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
2728       LDKClosureReason_LDKProcessingError_Body processing_error;
2729    };
2730 } LDKClosureReason;
2731
2732 /**
2733  * An enum which can either contain a crate::lightning::util::events::ClosureReason or not
2734  */
2735 typedef enum LDKCOption_ClosureReasonZ_Tag {
2736    /**
2737     * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
2738     */
2739    LDKCOption_ClosureReasonZ_Some,
2740    /**
2741     * When we're in this state, this COption_ClosureReasonZ contains nothing
2742     */
2743    LDKCOption_ClosureReasonZ_None,
2744    /**
2745     * Must be last for serialization purposes
2746     */
2747    LDKCOption_ClosureReasonZ_Sentinel,
2748 } LDKCOption_ClosureReasonZ_Tag;
2749
2750 typedef struct LDKCOption_ClosureReasonZ {
2751    LDKCOption_ClosureReasonZ_Tag tag;
2752    union {
2753       struct {
2754          struct LDKClosureReason some;
2755       };
2756    };
2757 } LDKCOption_ClosureReasonZ;
2758
2759 /**
2760  * The contents of CResult_COption_ClosureReasonZDecodeErrorZ
2761  */
2762 typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr {
2763    /**
2764     * A pointer to the contents in the success state.
2765     * Reading from this pointer when `result_ok` is not set is undefined.
2766     */
2767    struct LDKCOption_ClosureReasonZ *result;
2768    /**
2769     * A pointer to the contents in the error state.
2770     * Reading from this pointer when `result_ok` is set is undefined.
2771     */
2772    struct LDKDecodeError *err;
2773 } LDKCResult_COption_ClosureReasonZDecodeErrorZPtr;
2774
2775 /**
2776  * A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
2777  * containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2778  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2779  */
2780 typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ {
2781    /**
2782     * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
2783     * `err` or `result` depending on the state of `result_ok`.
2784     */
2785    union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents;
2786    /**
2787     * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
2788     */
2789    bool result_ok;
2790 } LDKCResult_COption_ClosureReasonZDecodeErrorZ;
2791
2792 /**
2793  * Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`].
2794  */
2795 typedef enum LDKHTLCDestination_Tag {
2796    /**
2797     * We tried forwarding to a channel but failed to do so. An example of such an instance is when
2798     * there is insufficient capacity in our outbound channel.
2799     */
2800    LDKHTLCDestination_NextHopChannel,
2801    /**
2802     * Scenario where we are unsure of the next node to forward the HTLC to.
2803     */
2804    LDKHTLCDestination_UnknownNextHop,
2805    /**
2806     * We couldn't forward to the outgoing scid. An example would be attempting to send a duplicate
2807     * intercept HTLC.
2808     */
2809    LDKHTLCDestination_InvalidForward,
2810    /**
2811     * Failure scenario where an HTLC may have been forwarded to be intended for us,
2812     * but is invalid for some reason, so we reject it.
2813     *
2814     * Some of the reasons may include:
2815     * * HTLC Timeouts
2816     * * Expected MPP amount to claim does not equal HTLC total
2817     * * Claimable amount does not match expected amount
2818     */
2819    LDKHTLCDestination_FailedPayment,
2820    /**
2821     * Must be last for serialization purposes
2822     */
2823    LDKHTLCDestination_Sentinel,
2824 } LDKHTLCDestination_Tag;
2825
2826 typedef struct LDKHTLCDestination_LDKNextHopChannel_Body {
2827    /**
2828     * The `node_id` of the next node. For backwards compatibility, this field is
2829     * marked as optional, versions prior to 0.0.110 may not always be able to provide
2830     * counterparty node information.
2831     *
2832     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2833     */
2834    struct LDKPublicKey node_id;
2835    /**
2836     * The outgoing `channel_id` between us and the next node.
2837     */
2838    struct LDKThirtyTwoBytes channel_id;
2839 } LDKHTLCDestination_LDKNextHopChannel_Body;
2840
2841 typedef struct LDKHTLCDestination_LDKUnknownNextHop_Body {
2842    /**
2843     * Short channel id we are requesting to forward an HTLC to.
2844     */
2845    uint64_t requested_forward_scid;
2846 } LDKHTLCDestination_LDKUnknownNextHop_Body;
2847
2848 typedef struct LDKHTLCDestination_LDKInvalidForward_Body {
2849    /**
2850     * Short channel id we are requesting to forward an HTLC to.
2851     */
2852    uint64_t requested_forward_scid;
2853 } LDKHTLCDestination_LDKInvalidForward_Body;
2854
2855 typedef struct LDKHTLCDestination_LDKFailedPayment_Body {
2856    /**
2857     * The payment hash of the payment we attempted to process.
2858     */
2859    struct LDKThirtyTwoBytes payment_hash;
2860 } LDKHTLCDestination_LDKFailedPayment_Body;
2861
2862 typedef struct MUST_USE_STRUCT LDKHTLCDestination {
2863    LDKHTLCDestination_Tag tag;
2864    union {
2865       LDKHTLCDestination_LDKNextHopChannel_Body next_hop_channel;
2866       LDKHTLCDestination_LDKUnknownNextHop_Body unknown_next_hop;
2867       LDKHTLCDestination_LDKInvalidForward_Body invalid_forward;
2868       LDKHTLCDestination_LDKFailedPayment_Body failed_payment;
2869    };
2870 } LDKHTLCDestination;
2871
2872 /**
2873  * An enum which can either contain a crate::lightning::util::events::HTLCDestination or not
2874  */
2875 typedef enum LDKCOption_HTLCDestinationZ_Tag {
2876    /**
2877     * When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::util::events::HTLCDestination
2878     */
2879    LDKCOption_HTLCDestinationZ_Some,
2880    /**
2881     * When we're in this state, this COption_HTLCDestinationZ contains nothing
2882     */
2883    LDKCOption_HTLCDestinationZ_None,
2884    /**
2885     * Must be last for serialization purposes
2886     */
2887    LDKCOption_HTLCDestinationZ_Sentinel,
2888 } LDKCOption_HTLCDestinationZ_Tag;
2889
2890 typedef struct LDKCOption_HTLCDestinationZ {
2891    LDKCOption_HTLCDestinationZ_Tag tag;
2892    union {
2893       struct {
2894          struct LDKHTLCDestination some;
2895       };
2896    };
2897 } LDKCOption_HTLCDestinationZ;
2898
2899 /**
2900  * The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
2901  */
2902 typedef union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr {
2903    /**
2904     * A pointer to the contents in the success state.
2905     * Reading from this pointer when `result_ok` is not set is undefined.
2906     */
2907    struct LDKCOption_HTLCDestinationZ *result;
2908    /**
2909     * A pointer to the contents in the error state.
2910     * Reading from this pointer when `result_ok` is set is undefined.
2911     */
2912    struct LDKDecodeError *err;
2913 } LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr;
2914
2915 /**
2916  * A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
2917  * containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2918  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2919  */
2920 typedef struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ {
2921    /**
2922     * The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
2923     * `err` or `result` depending on the state of `result_ok`.
2924     */
2925    union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr contents;
2926    /**
2927     * Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
2928     */
2929    bool result_ok;
2930 } LDKCResult_COption_HTLCDestinationZDecodeErrorZ;
2931
2932 /**
2933  * An enum which can either contain a crate::c_types::U128 or not
2934  */
2935 typedef enum LDKCOption_u128Z_Tag {
2936    /**
2937     * When we're in this state, this COption_u128Z contains a crate::c_types::U128
2938     */
2939    LDKCOption_u128Z_Some,
2940    /**
2941     * When we're in this state, this COption_u128Z contains nothing
2942     */
2943    LDKCOption_u128Z_None,
2944    /**
2945     * Must be last for serialization purposes
2946     */
2947    LDKCOption_u128Z_Sentinel,
2948 } LDKCOption_u128Z_Tag;
2949
2950 typedef struct LDKCOption_u128Z {
2951    LDKCOption_u128Z_Tag tag;
2952    union {
2953       struct {
2954          struct LDKU128 some;
2955       };
2956    };
2957 } LDKCOption_u128Z;
2958
2959
2960
2961 /**
2962  * A channel_update message to be sent or received from a peer
2963  */
2964 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
2965    /**
2966     * A pointer to the opaque Rust object.
2967     * Nearly everywhere, inner must be non-null, however in places where
2968     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2969     */
2970    LDKnativeChannelUpdate *inner;
2971    /**
2972     * Indicates that this is the only struct which contains the same pointer.
2973     * Rust functions which take ownership of an object provided via an argument require
2974     * this to be true and invalidate the object pointed to by inner.
2975     */
2976    bool is_owned;
2977 } LDKChannelUpdate;
2978
2979 /**
2980  * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
2981  * return packet by a node along the route. See [BOLT #4] for details.
2982  *
2983  * [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md
2984  */
2985 typedef enum LDKNetworkUpdate_Tag {
2986    /**
2987     * An error indicating a `channel_update` messages should be applied via
2988     * [`NetworkGraph::update_channel`].
2989     */
2990    LDKNetworkUpdate_ChannelUpdateMessage,
2991    /**
2992     * An error indicating that a channel failed to route a payment, which should be applied via
2993     * [`NetworkGraph::channel_failed`].
2994     */
2995    LDKNetworkUpdate_ChannelFailure,
2996    /**
2997     * An error indicating that a node failed to route a payment, which should be applied via
2998     * [`NetworkGraph::node_failed_permanent`] if permanent.
2999     */
3000    LDKNetworkUpdate_NodeFailure,
3001    /**
3002     * Must be last for serialization purposes
3003     */
3004    LDKNetworkUpdate_Sentinel,
3005 } LDKNetworkUpdate_Tag;
3006
3007 typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body {
3008    /**
3009     * The update to apply via [`NetworkGraph::update_channel`].
3010     */
3011    struct LDKChannelUpdate msg;
3012 } LDKNetworkUpdate_LDKChannelUpdateMessage_Body;
3013
3014 typedef struct LDKNetworkUpdate_LDKChannelFailure_Body {
3015    /**
3016     * The short channel id of the closed channel.
3017     */
3018    uint64_t short_channel_id;
3019    /**
3020     * Whether the channel should be permanently removed or temporarily disabled until a new
3021     * `channel_update` message is received.
3022     */
3023    bool is_permanent;
3024 } LDKNetworkUpdate_LDKChannelFailure_Body;
3025
3026 typedef struct LDKNetworkUpdate_LDKNodeFailure_Body {
3027    /**
3028     * The node id of the failed node.
3029     */
3030    struct LDKPublicKey node_id;
3031    /**
3032     * Whether the node should be permanently removed from consideration or can be restored
3033     * when a new `channel_update` message is received.
3034     */
3035    bool is_permanent;
3036 } LDKNetworkUpdate_LDKNodeFailure_Body;
3037
3038 typedef struct MUST_USE_STRUCT LDKNetworkUpdate {
3039    LDKNetworkUpdate_Tag tag;
3040    union {
3041       LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message;
3042       LDKNetworkUpdate_LDKChannelFailure_Body channel_failure;
3043       LDKNetworkUpdate_LDKNodeFailure_Body node_failure;
3044    };
3045 } LDKNetworkUpdate;
3046
3047 /**
3048  * An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
3049  */
3050 typedef enum LDKCOption_NetworkUpdateZ_Tag {
3051    /**
3052     * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
3053     */
3054    LDKCOption_NetworkUpdateZ_Some,
3055    /**
3056     * When we're in this state, this COption_NetworkUpdateZ contains nothing
3057     */
3058    LDKCOption_NetworkUpdateZ_None,
3059    /**
3060     * Must be last for serialization purposes
3061     */
3062    LDKCOption_NetworkUpdateZ_Sentinel,
3063 } LDKCOption_NetworkUpdateZ_Tag;
3064
3065 typedef struct LDKCOption_NetworkUpdateZ {
3066    LDKCOption_NetworkUpdateZ_Tag tag;
3067    union {
3068       struct {
3069          struct LDKNetworkUpdate some;
3070       };
3071    };
3072 } LDKCOption_NetworkUpdateZ;
3073
3074
3075
3076 /**
3077  * A reference to a transaction output.
3078  *
3079  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
3080  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
3081  */
3082 typedef struct MUST_USE_STRUCT LDKOutPoint {
3083    /**
3084     * A pointer to the opaque Rust object.
3085     * Nearly everywhere, inner must be non-null, however in places where
3086     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3087     */
3088    LDKnativeOutPoint *inner;
3089    /**
3090     * Indicates that this is the only struct which contains the same pointer.
3091     * Rust functions which take ownership of an object provided via an argument require
3092     * this to be true and invalidate the object pointed to by inner.
3093     */
3094    bool is_owned;
3095 } LDKOutPoint;
3096
3097
3098
3099 /**
3100  * Information about a spendable output to a P2WSH script.
3101  *
3102  * See [`SpendableOutputDescriptor::DelayedPaymentOutput`] for more details on how to spend this.
3103  */
3104 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
3105    /**
3106     * A pointer to the opaque Rust object.
3107     * Nearly everywhere, inner must be non-null, however in places where
3108     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3109     */
3110    LDKnativeDelayedPaymentOutputDescriptor *inner;
3111    /**
3112     * Indicates that this is the only struct which contains the same pointer.
3113     * Rust functions which take ownership of an object provided via an argument require
3114     * this to be true and invalidate the object pointed to by inner.
3115     */
3116    bool is_owned;
3117 } LDKDelayedPaymentOutputDescriptor;
3118
3119
3120
3121 /**
3122  * Information about a spendable output to our \"payment key\".
3123  *
3124  * See [`SpendableOutputDescriptor::StaticPaymentOutput`] for more details on how to spend this.
3125  */
3126 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
3127    /**
3128     * A pointer to the opaque Rust object.
3129     * Nearly everywhere, inner must be non-null, however in places where
3130     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3131     */
3132    LDKnativeStaticPaymentOutputDescriptor *inner;
3133    /**
3134     * Indicates that this is the only struct which contains the same pointer.
3135     * Rust functions which take ownership of an object provided via an argument require
3136     * this to be true and invalidate the object pointed to by inner.
3137     */
3138    bool is_owned;
3139 } LDKStaticPaymentOutputDescriptor;
3140
3141 /**
3142  * Describes the necessary information to spend a spendable output.
3143  *
3144  * When on-chain outputs are created by LDK (which our counterparty is not able to claim at any
3145  * point in the future) a [`SpendableOutputs`] event is generated which you must track and be able
3146  * to spend on-chain. The information needed to do this is provided in this enum, including the
3147  * outpoint describing which `txid` and output `index` is available, the full output which exists
3148  * at that `txid`/`index`, and any keys or other information required to sign.
3149  *
3150  * [`SpendableOutputs`]: crate::util::events::Event::SpendableOutputs
3151  */
3152 typedef enum LDKSpendableOutputDescriptor_Tag {
3153    /**
3154     * An output to a script which was provided via [`KeysInterface`] directly, either from
3155     * [`get_destination_script`] or [`get_shutdown_scriptpubkey`], thus you should already
3156     * know how to spend it. No secret keys are provided as LDK was never given any key.
3157     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
3158     * on-chain using the payment preimage or after it has timed out.
3159     *
3160     * [`get_shutdown_scriptpubkey`]: KeysInterface::get_shutdown_scriptpubkey
3161     * [`get_destination_script`]: KeysInterface::get_shutdown_scriptpubkey
3162     */
3163    LDKSpendableOutputDescriptor_StaticOutput,
3164    /**
3165     * An output to a P2WSH script which can be spent with a single signature after an `OP_CSV`
3166     * delay.
3167     *
3168     * The witness in the spending input should be:
3169     * ```bitcoin
3170     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
3171     * ```
3172     *
3173     * Note that the `nSequence` field in the spending input must be set to
3174     * [`DelayedPaymentOutputDescriptor::to_self_delay`] (which means the transaction is not
3175     * broadcastable until at least [`DelayedPaymentOutputDescriptor::to_self_delay`] blocks after
3176     * the outpoint confirms, see [BIP
3177     * 68](https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki)). Also note that LDK
3178     * won't generate a [`SpendableOutputDescriptor`] until the corresponding block height
3179     * is reached.
3180     *
3181     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
3182     * it is an output from an old state which we broadcast (which should never happen).
3183     *
3184     * To derive the delayed payment key which is used to sign this input, you must pass the
3185     * holder [`InMemorySigner::delayed_payment_base_key`] (i.e., the private key which corresponds to the
3186     * [`ChannelPublicKeys::delayed_payment_basepoint`] in [`BaseSign::pubkeys`]) and the provided
3187     * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to [`chan_utils::derive_private_key`]. The public key can be
3188     * generated without the secret key using [`chan_utils::derive_public_key`] and only the
3189     * [`ChannelPublicKeys::delayed_payment_basepoint`] which appears in [`BaseSign::pubkeys`].
3190     *
3191     * To derive the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] provided here (which is
3192     * used in the witness script generation), you must pass the counterparty
3193     * [`ChannelPublicKeys::revocation_basepoint`] (which appears in the call to
3194     * [`BaseSign::provide_channel_parameters`]) and the provided
3195     * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to
3196     * [`chan_utils::derive_public_revocation_key`].
3197     *
3198     * The witness script which is hashed and included in the output `script_pubkey` may be
3199     * regenerated by passing the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] (derived
3200     * as explained above), our delayed payment pubkey (derived as explained above), and the
3201     * [`DelayedPaymentOutputDescriptor::to_self_delay`] contained here to
3202     * [`chan_utils::get_revokeable_redeemscript`].
3203     */
3204    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
3205    /**
3206     * An output to a P2WPKH, spendable exclusively by our payment key (i.e., the private key
3207     * which corresponds to the `payment_point` in [`BaseSign::pubkeys`]). The witness
3208     * in the spending input is, thus, simply:
3209     * ```bitcoin
3210     * <BIP 143 signature> <payment key>
3211     * ```
3212     *
3213     * These are generally the result of our counterparty having broadcast the current state,
3214     * allowing us to claim the non-HTLC-encumbered outputs immediately.
3215     */
3216    LDKSpendableOutputDescriptor_StaticPaymentOutput,
3217    /**
3218     * Must be last for serialization purposes
3219     */
3220    LDKSpendableOutputDescriptor_Sentinel,
3221 } LDKSpendableOutputDescriptor_Tag;
3222
3223 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
3224    /**
3225     * The outpoint which is spendable.
3226     */
3227    struct LDKOutPoint outpoint;
3228    /**
3229     * The output which is referenced by the given outpoint.
3230     */
3231    struct LDKTxOut output;
3232 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
3233
3234 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
3235    LDKSpendableOutputDescriptor_Tag tag;
3236    union {
3237       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
3238       struct {
3239          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
3240       };
3241       struct {
3242          struct LDKStaticPaymentOutputDescriptor static_payment_output;
3243       };
3244    };
3245 } LDKSpendableOutputDescriptor;
3246
3247 /**
3248  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3249  * This corresponds to std::vector in C++
3250  */
3251 typedef struct LDKCVec_SpendableOutputDescriptorZ {
3252    /**
3253     * The elements in the array.
3254     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3255     */
3256    struct LDKSpendableOutputDescriptor *data;
3257    /**
3258     * The number of elements pointed to by `data`.
3259     */
3260    uintptr_t datalen;
3261 } LDKCVec_SpendableOutputDescriptorZ;
3262
3263
3264
3265 /**
3266  * Features used within the channel_type field in an OpenChannel message.
3267  *
3268  * A channel is always of some known \"type\", describing the transaction formats used and the exact
3269  * semantics of our interaction with our peer.
3270  *
3271  * Note that because a channel is a specific type which is proposed by the opener and accepted by
3272  * the counterparty, only required features are allowed here.
3273  *
3274  * This is serialized differently from other feature types - it is not prefixed by a length, and
3275  * thus must only appear inside a TLV where its length is known in advance.
3276  */
3277 typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures {
3278    /**
3279     * A pointer to the opaque Rust object.
3280     * Nearly everywhere, inner must be non-null, however in places where
3281     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3282     */
3283    LDKnativeChannelTypeFeatures *inner;
3284    /**
3285     * Indicates that this is the only struct which contains the same pointer.
3286     * Rust functions which take ownership of an object provided via an argument require
3287     * this to be true and invalidate the object pointed to by inner.
3288     */
3289    bool is_owned;
3290 } LDKChannelTypeFeatures;
3291
3292 /**
3293  * An Event which you should probably take some action in response to.
3294  *
3295  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
3296  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
3297  * written as it makes no sense to respond to it after reconnecting to peers).
3298  */
3299 typedef enum LDKEvent_Tag {
3300    /**
3301     * Used to indicate that the client should generate a funding transaction with the given
3302     * parameters and then call [`ChannelManager::funding_transaction_generated`].
3303     * Generated in [`ChannelManager`] message handling.
3304     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
3305     * counterparty can steal your funds!
3306     *
3307     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
3308     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
3309     */
3310    LDKEvent_FundingGenerationReady,
3311    /**
3312     * Indicates that we've been offered a payment and it needs to be claimed via calling
3313     * [`ChannelManager::claim_funds`] with the preimage given in [`PaymentPurpose`].
3314     *
3315     * Note that if the preimage is not known, you should call
3316     * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
3317     * network congestion.
3318     * If you fail to call either [`ChannelManager::claim_funds`] or
3319     * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
3320     * automatically failed.
3321     *
3322     * # Note
3323     * LDK will not stop an inbound payment from being paid multiple times, so multiple
3324     * `PaymentClaimable` events may be generated for the same payment.
3325     *
3326     * # Note
3327     * This event used to be called `PaymentReceived` in LDK versions 0.0.112 and earlier.
3328     *
3329     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
3330     * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
3331     */
3332    LDKEvent_PaymentClaimable,
3333    /**
3334     * Indicates a payment has been claimed and we've received money!
3335     *
3336     * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response
3337     * to an [`Event::PaymentClaimable`]. However, if we previously crashed during a
3338     * [`ChannelManager::claim_funds`] call you may see this event without a corresponding
3339     * [`Event::PaymentClaimable`] event.
3340     *
3341     * # Note
3342     * LDK will not stop an inbound payment from being paid multiple times, so multiple
3343     * `PaymentClaimable` events may be generated for the same payment. If you then call
3344     * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentClaimable`] you may get
3345     * multiple `PaymentClaimed` events.
3346     *
3347     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
3348     */
3349    LDKEvent_PaymentClaimed,
3350    /**
3351     * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
3352     * and we got back the payment preimage for it).
3353     *
3354     * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
3355     * event. In this situation, you SHOULD treat this payment as having succeeded.
3356     */
3357    LDKEvent_PaymentSent,
3358    /**
3359     * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
3360     * provide failure information for each MPP part in the payment.
3361     *
3362     * This event is provided once there are no further pending HTLCs for the payment and the
3363     * payment is no longer retryable due to [`ChannelManager::abandon_payment`] having been
3364     * called for the corresponding payment.
3365     *
3366     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3367     */
3368    LDKEvent_PaymentFailed,
3369    /**
3370     * Indicates that a path for an outbound payment was successful.
3371     *
3372     * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
3373     * [`Event::PaymentSent`] for obtaining the payment preimage.
3374     */
3375    LDKEvent_PaymentPathSuccessful,
3376    /**
3377     * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped
3378     * something. You may wish to retry with a different route.
3379     *
3380     * If you have given up retrying this payment and wish to fail it, you MUST call
3381     * [`ChannelManager::abandon_payment`] at least once for a given [`PaymentId`] or memory
3382     * related to payment tracking will leak.
3383     *
3384     * Note that this does *not* indicate that all paths for an MPP payment have failed, see
3385     * [`Event::PaymentFailed`] and [`all_paths_failed`].
3386     *
3387     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3388     * [`all_paths_failed`]: Self::PaymentPathFailed::all_paths_failed
3389     */
3390    LDKEvent_PaymentPathFailed,
3391    /**
3392     * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination.
3393     */
3394    LDKEvent_ProbeSuccessful,
3395    /**
3396     * Indicates that a probe payment we sent failed at an intermediary node on the path.
3397     */
3398    LDKEvent_ProbeFailed,
3399    /**
3400     * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
3401     * a time in the future.
3402     *
3403     * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
3404     */
3405    LDKEvent_PendingHTLCsForwardable,
3406    /**
3407     * Used to indicate that we've intercepted an HTLC forward. This event will only be generated if
3408     * you've encoded an intercept scid in the receiver's invoice route hints using
3409     * [`ChannelManager::get_intercept_scid`] and have set [`UserConfig::accept_intercept_htlcs`].
3410     *
3411     * [`ChannelManager::forward_intercepted_htlc`] or
3412     * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to this event. See
3413     * their docs for more information.
3414     *
3415     * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
3416     * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
3417     * [`ChannelManager::forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
3418     * [`ChannelManager::fail_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::fail_intercepted_htlc
3419     */
3420    LDKEvent_HTLCIntercepted,
3421    /**
3422     * Used to indicate that an output which you should know how to spend was confirmed on chain
3423     * and is now spendable.
3424     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
3425     * counterparty spending them due to some kind of timeout. Thus, you need to store them
3426     * somewhere and spend them when you create on-chain transactions.
3427     */
3428    LDKEvent_SpendableOutputs,
3429    /**
3430     * This event is generated when a payment has been successfully forwarded through us and a
3431     * forwarding fee earned.
3432     */
3433    LDKEvent_PaymentForwarded,
3434    /**
3435     * Used to indicate that a channel with the given `channel_id` is ready to
3436     * be used. This event is emitted either when the funding transaction has been confirmed
3437     * on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel
3438     * establishment.
3439     */
3440    LDKEvent_ChannelReady,
3441    /**
3442     * Used to indicate that a previously opened channel with the given `channel_id` is in the
3443     * process of closure.
3444     */
3445    LDKEvent_ChannelClosed,
3446    /**
3447     * Used to indicate to the user that they can abandon the funding transaction and recycle the
3448     * inputs for another purpose.
3449     */
3450    LDKEvent_DiscardFunding,
3451    /**
3452     * Indicates a request to open a new channel by a peer.
3453     *
3454     * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the
3455     * request, call [`ChannelManager::force_close_without_broadcasting_txn`].
3456     *
3457     * The event is only triggered when a new open channel request is received and the
3458     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
3459     *
3460     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3461     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
3462     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
3463     */
3464    LDKEvent_OpenChannelRequest,
3465    /**
3466     * Indicates that the HTLC was accepted, but could not be processed when or after attempting to
3467     * forward it.
3468     *
3469     * Some scenarios where this event may be sent include:
3470     * * Insufficient capacity in the outbound channel
3471     * * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes
3472     * * When an unknown SCID is requested for forwarding a payment.
3473     * * Claiming an amount for an MPP payment that exceeds the HTLC total
3474     * * The HTLC has timed out
3475     *
3476     * This event, however, does not get generated if an HTLC fails to meet the forwarding
3477     * requirements (i.e. insufficient fees paid, or a CLTV that is too soon).
3478     */
3479    LDKEvent_HTLCHandlingFailed,
3480    /**
3481     * Must be last for serialization purposes
3482     */
3483    LDKEvent_Sentinel,
3484 } LDKEvent_Tag;
3485
3486 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
3487    /**
3488     * The random channel_id we picked which you'll need to pass into
3489     * [`ChannelManager::funding_transaction_generated`].
3490     *
3491     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
3492     */
3493    struct LDKThirtyTwoBytes temporary_channel_id;
3494    /**
3495     * The counterparty's node_id, which you'll need to pass back into
3496     * [`ChannelManager::funding_transaction_generated`].
3497     *
3498     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
3499     */
3500    struct LDKPublicKey counterparty_node_id;
3501    /**
3502     * The value, in satoshis, that the output should have.
3503     */
3504    uint64_t channel_value_satoshis;
3505    /**
3506     * The script which should be used in the transaction output.
3507     */
3508    struct LDKCVec_u8Z output_script;
3509    /**
3510     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or a
3511     * random value for an inbound channel. This may be zero for objects serialized with LDK
3512     * versions prior to 0.0.113.
3513     *
3514     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
3515     */
3516    struct LDKU128 user_channel_id;
3517 } LDKEvent_LDKFundingGenerationReady_Body;
3518
3519 typedef struct LDKEvent_LDKPaymentClaimable_Body {
3520    /**
3521     * The node that will receive the payment after it has been claimed.
3522     * This is useful to identify payments received via [phantom nodes].
3523     * This field will always be filled in when the event was generated by LDK versions
3524     * 0.0.113 and above.
3525     *
3526     * [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager
3527     *
3528     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3529     */
3530    struct LDKPublicKey receiver_node_id;
3531    /**
3532     * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
3533     * not stop you from registering duplicate payment hashes for inbound payments.
3534     */
3535    struct LDKThirtyTwoBytes payment_hash;
3536    /**
3537     * The value, in thousandths of a satoshi, that this payment is for.
3538     */
3539    uint64_t amount_msat;
3540    /**
3541     * Information for claiming this received payment, based on whether the purpose of the
3542     * payment is to pay an invoice or to send a spontaneous payment.
3543     */
3544    struct LDKPaymentPurpose purpose;
3545    /**
3546     * The `channel_id` indicating over which channel we received the payment.
3547     *
3548     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3549     */
3550    struct LDKThirtyTwoBytes via_channel_id;
3551    /**
3552     * The `user_channel_id` indicating over which channel we received the payment.
3553     */
3554    struct LDKCOption_u128Z via_user_channel_id;
3555 } LDKEvent_LDKPaymentClaimable_Body;
3556
3557 typedef struct LDKEvent_LDKPaymentClaimed_Body {
3558    /**
3559     * The node that received the payment.
3560     * This is useful to identify payments which were received via [phantom nodes].
3561     * This field will always be filled in when the event was generated by LDK versions
3562     * 0.0.113 and above.
3563     *
3564     * [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager
3565     *
3566     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3567     */
3568    struct LDKPublicKey receiver_node_id;
3569    /**
3570     * The payment hash of the claimed payment. Note that LDK will not stop you from
3571     * registering duplicate payment hashes for inbound payments.
3572     */
3573    struct LDKThirtyTwoBytes payment_hash;
3574    /**
3575     * The value, in thousandths of a satoshi, that this payment is for.
3576     */
3577    uint64_t amount_msat;
3578    /**
3579     * The purpose of the claimed payment, i.e. whether the payment was for an invoice or a
3580     * spontaneous payment.
3581     */
3582    struct LDKPaymentPurpose purpose;
3583 } LDKEvent_LDKPaymentClaimed_Body;
3584
3585 typedef struct LDKEvent_LDKPaymentSent_Body {
3586    /**
3587     * The id returned by [`ChannelManager::send_payment`] and used with
3588     * [`ChannelManager::retry_payment`].
3589     *
3590     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3591     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3592     *
3593     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3594     */
3595    struct LDKThirtyTwoBytes payment_id;
3596    /**
3597     * The preimage to the hash given to ChannelManager::send_payment.
3598     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
3599     * store it somehow!
3600     */
3601    struct LDKThirtyTwoBytes payment_preimage;
3602    /**
3603     * The hash that was given to [`ChannelManager::send_payment`].
3604     *
3605     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3606     */
3607    struct LDKThirtyTwoBytes payment_hash;
3608    /**
3609     * The total fee which was spent at intermediate hops in this payment, across all paths.
3610     *
3611     * Note that, like [`Route::get_total_fees`] this does *not* include any potential
3612     * overpayment to the recipient node.
3613     *
3614     * If the recipient or an intermediate node misbehaves and gives us free money, this may
3615     * overstate the amount paid, though this is unlikely.
3616     *
3617     * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
3618     */
3619    struct LDKCOption_u64Z fee_paid_msat;
3620 } LDKEvent_LDKPaymentSent_Body;
3621
3622 typedef struct LDKEvent_LDKPaymentFailed_Body {
3623    /**
3624     * The id returned by [`ChannelManager::send_payment`] and used with
3625     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
3626     *
3627     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3628     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3629     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3630     */
3631    struct LDKThirtyTwoBytes payment_id;
3632    /**
3633     * The hash that was given to [`ChannelManager::send_payment`].
3634     *
3635     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3636     */
3637    struct LDKThirtyTwoBytes payment_hash;
3638 } LDKEvent_LDKPaymentFailed_Body;
3639
3640 typedef struct LDKEvent_LDKPaymentPathSuccessful_Body {
3641    /**
3642     * The id returned by [`ChannelManager::send_payment`] and used with
3643     * [`ChannelManager::retry_payment`].
3644     *
3645     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3646     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3647     */
3648    struct LDKThirtyTwoBytes payment_id;
3649    /**
3650     * The hash that was given to [`ChannelManager::send_payment`].
3651     *
3652     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3653     *
3654     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3655     */
3656    struct LDKThirtyTwoBytes payment_hash;
3657    /**
3658     * The payment path that was successful.
3659     *
3660     * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
3661     */
3662    struct LDKCVec_RouteHopZ path;
3663 } LDKEvent_LDKPaymentPathSuccessful_Body;
3664
3665 typedef struct LDKEvent_LDKPaymentPathFailed_Body {
3666    /**
3667     * The id returned by [`ChannelManager::send_payment`] and used with
3668     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
3669     *
3670     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3671     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3672     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3673     *
3674     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3675     */
3676    struct LDKThirtyTwoBytes payment_id;
3677    /**
3678     * The hash that was given to [`ChannelManager::send_payment`].
3679     *
3680     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3681     */
3682    struct LDKThirtyTwoBytes payment_hash;
3683    /**
3684     * Indicates the payment was rejected for some reason by the recipient. This implies that
3685     * the payment has failed, not just the route in question. If this is not set, you may
3686     * retry the payment via a different route.
3687     */
3688    bool payment_failed_permanently;
3689    /**
3690     * Any failure information conveyed via the Onion return packet by a node along the failed
3691     * payment route.
3692     *
3693     * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
3694     * account the update.
3695     *
3696     * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
3697     */
3698    struct LDKCOption_NetworkUpdateZ network_update;
3699    /**
3700     * For both single-path and multi-path payments, this is set if all paths of the payment have
3701     * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
3702     * larger MPP payment were still in flight when this event was generated.
3703     *
3704     * Note that if you are retrying individual MPP parts, using this value to determine if a
3705     * payment has fully failed is race-y. Because multiple failures can happen prior to events
3706     * being processed, you may retry in response to a first failure, with a second failure
3707     * (with `all_paths_failed` set) still pending. Then, when the second failure is processed
3708     * you will see `all_paths_failed` set even though the retry of the first failure still
3709     * has an associated in-flight HTLC. See (1) for an example of such a failure.
3710     *
3711     * If you wish to retry individual MPP parts and learn when a payment has failed, you must
3712     * call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event.
3713     *
3714     * (1) <https://github.com/lightningdevkit/rust-lightning/issues/1164>
3715     *
3716     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3717     */
3718    bool all_paths_failed;
3719    /**
3720     * The payment path that failed.
3721     */
3722    struct LDKCVec_RouteHopZ path;
3723    /**
3724     * The channel responsible for the failed payment path.
3725     *
3726     * Note that for route hints or for the first hop in a path this may be an SCID alias and
3727     * may not refer to a channel in the public network graph. These aliases may also collide
3728     * with channels in the public network graph.
3729     *
3730     * If this is `Some`, then the corresponding channel should be avoided when the payment is
3731     * retried. May be `None` for older [`Event`] serializations.
3732     */
3733    struct LDKCOption_u64Z short_channel_id;
3734    /**
3735     * Parameters needed to compute a new [`Route`] when retrying the failed payment path.
3736     *
3737     * See [`find_route`] for details.
3738     *
3739     * [`Route`]: crate::routing::router::Route
3740     * [`find_route`]: crate::routing::router::find_route
3741     *
3742     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3743     */
3744    struct LDKRouteParameters retry;
3745 } LDKEvent_LDKPaymentPathFailed_Body;
3746
3747 typedef struct LDKEvent_LDKProbeSuccessful_Body {
3748    /**
3749     * The id returned by [`ChannelManager::send_probe`].
3750     *
3751     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
3752     */
3753    struct LDKThirtyTwoBytes payment_id;
3754    /**
3755     * The hash generated by [`ChannelManager::send_probe`].
3756     *
3757     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
3758     */
3759    struct LDKThirtyTwoBytes payment_hash;
3760    /**
3761     * The payment path that was successful.
3762     */
3763    struct LDKCVec_RouteHopZ path;
3764 } LDKEvent_LDKProbeSuccessful_Body;
3765
3766 typedef struct LDKEvent_LDKProbeFailed_Body {
3767    /**
3768     * The id returned by [`ChannelManager::send_probe`].
3769     *
3770     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
3771     */
3772    struct LDKThirtyTwoBytes payment_id;
3773    /**
3774     * The hash generated by [`ChannelManager::send_probe`].
3775     *
3776     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
3777     */
3778    struct LDKThirtyTwoBytes payment_hash;
3779    /**
3780     * The payment path that failed.
3781     */
3782    struct LDKCVec_RouteHopZ path;
3783    /**
3784     * The channel responsible for the failed probe.
3785     *
3786     * Note that for route hints or for the first hop in a path this may be an SCID alias and
3787     * may not refer to a channel in the public network graph. These aliases may also collide
3788     * with channels in the public network graph.
3789     */
3790    struct LDKCOption_u64Z short_channel_id;
3791 } LDKEvent_LDKProbeFailed_Body;
3792
3793 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
3794    /**
3795     * The minimum amount of time that should be waited prior to calling
3796     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
3797     * you should wait a random amount of time in roughly the range (now + time_forwardable,
3798     * now + 5*time_forwardable).
3799     */
3800    uint64_t time_forwardable;
3801 } LDKEvent_LDKPendingHTLCsForwardable_Body;
3802
3803 typedef struct LDKEvent_LDKHTLCIntercepted_Body {
3804    /**
3805     * An id to help LDK identify which HTLC is being forwarded or failed.
3806     */
3807    struct LDKThirtyTwoBytes intercept_id;
3808    /**
3809     * The fake scid that was programmed as the next hop's scid, generated using
3810     * [`ChannelManager::get_intercept_scid`].
3811     *
3812     * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
3813     */
3814    uint64_t requested_next_hop_scid;
3815    /**
3816     * The payment hash used for this HTLC.
3817     */
3818    struct LDKThirtyTwoBytes payment_hash;
3819    /**
3820     * How many msats were received on the inbound edge of this HTLC.
3821     */
3822    uint64_t inbound_amount_msat;
3823    /**
3824     * How many msats the payer intended to route to the next node. Depending on the reason you are
3825     * intercepting this payment, you might take a fee by forwarding less than this amount.
3826     *
3827     * Note that LDK will NOT check that expected fees were factored into this value. You MUST
3828     * check that whatever fee you want has been included here or subtract it as required. Further,
3829     * LDK will not stop you from forwarding more than you received.
3830     */
3831    uint64_t expected_outbound_amount_msat;
3832 } LDKEvent_LDKHTLCIntercepted_Body;
3833
3834 typedef struct LDKEvent_LDKSpendableOutputs_Body {
3835    /**
3836     * The outputs which you should store as spendable by you.
3837     */
3838    struct LDKCVec_SpendableOutputDescriptorZ outputs;
3839 } LDKEvent_LDKSpendableOutputs_Body;
3840
3841 typedef struct LDKEvent_LDKPaymentForwarded_Body {
3842    /**
3843     * The incoming channel between the previous node and us. This is only `None` for events
3844     * generated or serialized by versions prior to 0.0.107.
3845     *
3846     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3847     */
3848    struct LDKThirtyTwoBytes prev_channel_id;
3849    /**
3850     * The outgoing channel between the next node and us. This is only `None` for events
3851     * generated or serialized by versions prior to 0.0.107.
3852     *
3853     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3854     */
3855    struct LDKThirtyTwoBytes next_channel_id;
3856    /**
3857     * The fee, in milli-satoshis, which was earned as a result of the payment.
3858     *
3859     * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
3860     * was pending, the amount the next hop claimed will have been rounded down to the nearest
3861     * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
3862     * claimed the full value in millisatoshis from the source. In this case,
3863     * `claim_from_onchain_tx` will be set.
3864     *
3865     * If the channel which sent us the payment has been force-closed, we will claim the funds
3866     * via an on-chain transaction. In that case we do not yet know the on-chain transaction
3867     * fees which we will spend and will instead set this to `None`. It is possible duplicate
3868     * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
3869     * `None`.
3870     */
3871    struct LDKCOption_u64Z fee_earned_msat;
3872    /**
3873     * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
3874     * transaction.
3875     */
3876    bool claim_from_onchain_tx;
3877 } LDKEvent_LDKPaymentForwarded_Body;
3878
3879 typedef struct LDKEvent_LDKChannelReady_Body {
3880    /**
3881     * The channel_id of the channel that is ready.
3882     */
3883    struct LDKThirtyTwoBytes channel_id;
3884    /**
3885     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
3886     * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
3887     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
3888     * `user_channel_id` will be randomized for an inbound channel.
3889     *
3890     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
3891     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3892     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
3893     */
3894    struct LDKU128 user_channel_id;
3895    /**
3896     * The node_id of the channel counterparty.
3897     */
3898    struct LDKPublicKey counterparty_node_id;
3899    /**
3900     * The features that this channel will operate with.
3901     */
3902    struct LDKChannelTypeFeatures channel_type;
3903 } LDKEvent_LDKChannelReady_Body;
3904
3905 typedef struct LDKEvent_LDKChannelClosed_Body {
3906    /**
3907     * The channel_id of the channel which has been closed. Note that on-chain transactions
3908     * resolving the channel are likely still awaiting confirmation.
3909     */
3910    struct LDKThirtyTwoBytes channel_id;
3911    /**
3912     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
3913     * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
3914     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
3915     * `user_channel_id` will be randomized for inbound channels.
3916     * This may be zero for inbound channels serialized prior to 0.0.113 and will always be
3917     * zero for objects serialized with LDK versions prior to 0.0.102.
3918     *
3919     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
3920     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3921     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
3922     */
3923    struct LDKU128 user_channel_id;
3924    /**
3925     * The reason the channel was closed.
3926     */
3927    struct LDKClosureReason reason;
3928 } LDKEvent_LDKChannelClosed_Body;
3929
3930 typedef struct LDKEvent_LDKDiscardFunding_Body {
3931    /**
3932     * The channel_id of the channel which has been closed.
3933     */
3934    struct LDKThirtyTwoBytes channel_id;
3935    /**
3936     * The full transaction received from the user
3937     */
3938    struct LDKTransaction transaction;
3939 } LDKEvent_LDKDiscardFunding_Body;
3940
3941 typedef struct LDKEvent_LDKOpenChannelRequest_Body {
3942    /**
3943     * The temporary channel ID of the channel requested to be opened.
3944     *
3945     * When responding to the request, the `temporary_channel_id` should be passed
3946     * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
3947     * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject.
3948     *
3949     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3950     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
3951     */
3952    struct LDKThirtyTwoBytes temporary_channel_id;
3953    /**
3954     * The node_id of the counterparty requesting to open the channel.
3955     *
3956     * When responding to the request, the `counterparty_node_id` should be passed
3957     * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
3958     * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
3959     * request.
3960     *
3961     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3962     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
3963     */
3964    struct LDKPublicKey counterparty_node_id;
3965    /**
3966     * The channel value of the requested channel.
3967     */
3968    uint64_t funding_satoshis;
3969    /**
3970     * Our starting balance in the channel if the request is accepted, in milli-satoshi.
3971     */
3972    uint64_t push_msat;
3973    /**
3974     * The features that this channel will operate with. If you reject the channel, a
3975     * well-behaved counterparty may automatically re-attempt the channel with a new set of
3976     * feature flags.
3977     *
3978     * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
3979     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
3980     * 0.0.106.
3981     *
3982     * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
3983     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
3984     * 0.0.107. Channels setting this type also need to get manually accepted via
3985     * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
3986     * or will be rejected otherwise.
3987     *
3988     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
3989     */
3990    struct LDKChannelTypeFeatures channel_type;
3991 } LDKEvent_LDKOpenChannelRequest_Body;
3992
3993 typedef struct LDKEvent_LDKHTLCHandlingFailed_Body {
3994    /**
3995     * The channel over which the HTLC was received.
3996     */
3997    struct LDKThirtyTwoBytes prev_channel_id;
3998    /**
3999     * Destination of the HTLC that failed to be processed.
4000     */
4001    struct LDKHTLCDestination failed_next_destination;
4002 } LDKEvent_LDKHTLCHandlingFailed_Body;
4003
4004 typedef struct MUST_USE_STRUCT LDKEvent {
4005    LDKEvent_Tag tag;
4006    union {
4007       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
4008       LDKEvent_LDKPaymentClaimable_Body payment_claimable;
4009       LDKEvent_LDKPaymentClaimed_Body payment_claimed;
4010       LDKEvent_LDKPaymentSent_Body payment_sent;
4011       LDKEvent_LDKPaymentFailed_Body payment_failed;
4012       LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful;
4013       LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
4014       LDKEvent_LDKProbeSuccessful_Body probe_successful;
4015       LDKEvent_LDKProbeFailed_Body probe_failed;
4016       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
4017       LDKEvent_LDKHTLCIntercepted_Body htlc_intercepted;
4018       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
4019       LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
4020       LDKEvent_LDKChannelReady_Body channel_ready;
4021       LDKEvent_LDKChannelClosed_Body channel_closed;
4022       LDKEvent_LDKDiscardFunding_Body discard_funding;
4023       LDKEvent_LDKOpenChannelRequest_Body open_channel_request;
4024       LDKEvent_LDKHTLCHandlingFailed_Body htlc_handling_failed;
4025    };
4026 } LDKEvent;
4027
4028 /**
4029  * An enum which can either contain a crate::lightning::util::events::Event or not
4030  */
4031 typedef enum LDKCOption_EventZ_Tag {
4032    /**
4033     * When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
4034     */
4035    LDKCOption_EventZ_Some,
4036    /**
4037     * When we're in this state, this COption_EventZ contains nothing
4038     */
4039    LDKCOption_EventZ_None,
4040    /**
4041     * Must be last for serialization purposes
4042     */
4043    LDKCOption_EventZ_Sentinel,
4044 } LDKCOption_EventZ_Tag;
4045
4046 typedef struct LDKCOption_EventZ {
4047    LDKCOption_EventZ_Tag tag;
4048    union {
4049       struct {
4050          struct LDKEvent some;
4051       };
4052    };
4053 } LDKCOption_EventZ;
4054
4055 /**
4056  * The contents of CResult_COption_EventZDecodeErrorZ
4057  */
4058 typedef union LDKCResult_COption_EventZDecodeErrorZPtr {
4059    /**
4060     * A pointer to the contents in the success state.
4061     * Reading from this pointer when `result_ok` is not set is undefined.
4062     */
4063    struct LDKCOption_EventZ *result;
4064    /**
4065     * A pointer to the contents in the error state.
4066     * Reading from this pointer when `result_ok` is set is undefined.
4067     */
4068    struct LDKDecodeError *err;
4069 } LDKCResult_COption_EventZDecodeErrorZPtr;
4070
4071 /**
4072  * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
4073  * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4074  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4075  */
4076 typedef struct LDKCResult_COption_EventZDecodeErrorZ {
4077    /**
4078     * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
4079     * `err` or `result` depending on the state of `result_ok`.
4080     */
4081    union LDKCResult_COption_EventZDecodeErrorZPtr contents;
4082    /**
4083     * Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
4084     */
4085    bool result_ok;
4086 } LDKCResult_COption_EventZDecodeErrorZ;
4087
4088
4089
4090 /**
4091  * An accept_channel message to be sent or received from a peer
4092  */
4093 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
4094    /**
4095     * A pointer to the opaque Rust object.
4096     * Nearly everywhere, inner must be non-null, however in places where
4097     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4098     */
4099    LDKnativeAcceptChannel *inner;
4100    /**
4101     * Indicates that this is the only struct which contains the same pointer.
4102     * Rust functions which take ownership of an object provided via an argument require
4103     * this to be true and invalidate the object pointed to by inner.
4104     */
4105    bool is_owned;
4106 } LDKAcceptChannel;
4107
4108
4109
4110 /**
4111  * An open_channel message to be sent or received from a peer
4112  */
4113 typedef struct MUST_USE_STRUCT LDKOpenChannel {
4114    /**
4115     * A pointer to the opaque Rust object.
4116     * Nearly everywhere, inner must be non-null, however in places where
4117     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4118     */
4119    LDKnativeOpenChannel *inner;
4120    /**
4121     * Indicates that this is the only struct which contains the same pointer.
4122     * Rust functions which take ownership of an object provided via an argument require
4123     * this to be true and invalidate the object pointed to by inner.
4124     */
4125    bool is_owned;
4126 } LDKOpenChannel;
4127
4128
4129
4130 /**
4131  * A funding_created message to be sent or received from a peer
4132  */
4133 typedef struct MUST_USE_STRUCT LDKFundingCreated {
4134    /**
4135     * A pointer to the opaque Rust object.
4136     * Nearly everywhere, inner must be non-null, however in places where
4137     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4138     */
4139    LDKnativeFundingCreated *inner;
4140    /**
4141     * Indicates that this is the only struct which contains the same pointer.
4142     * Rust functions which take ownership of an object provided via an argument require
4143     * this to be true and invalidate the object pointed to by inner.
4144     */
4145    bool is_owned;
4146 } LDKFundingCreated;
4147
4148
4149
4150 /**
4151  * A funding_signed message to be sent or received from a peer
4152  */
4153 typedef struct MUST_USE_STRUCT LDKFundingSigned {
4154    /**
4155     * A pointer to the opaque Rust object.
4156     * Nearly everywhere, inner must be non-null, however in places where
4157     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4158     */
4159    LDKnativeFundingSigned *inner;
4160    /**
4161     * Indicates that this is the only struct which contains the same pointer.
4162     * Rust functions which take ownership of an object provided via an argument require
4163     * this to be true and invalidate the object pointed to by inner.
4164     */
4165    bool is_owned;
4166 } LDKFundingSigned;
4167
4168
4169
4170 /**
4171  * A channel_ready message to be sent or received from a peer
4172  */
4173 typedef struct MUST_USE_STRUCT LDKChannelReady {
4174    /**
4175     * A pointer to the opaque Rust object.
4176     * Nearly everywhere, inner must be non-null, however in places where
4177     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4178     */
4179    LDKnativeChannelReady *inner;
4180    /**
4181     * Indicates that this is the only struct which contains the same pointer.
4182     * Rust functions which take ownership of an object provided via an argument require
4183     * this to be true and invalidate the object pointed to by inner.
4184     */
4185    bool is_owned;
4186 } LDKChannelReady;
4187
4188
4189
4190 /**
4191  * An announcement_signatures message to be sent or received from a peer
4192  */
4193 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
4194    /**
4195     * A pointer to the opaque Rust object.
4196     * Nearly everywhere, inner must be non-null, however in places where
4197     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4198     */
4199    LDKnativeAnnouncementSignatures *inner;
4200    /**
4201     * Indicates that this is the only struct which contains the same pointer.
4202     * Rust functions which take ownership of an object provided via an argument require
4203     * this to be true and invalidate the object pointed to by inner.
4204     */
4205    bool is_owned;
4206 } LDKAnnouncementSignatures;
4207
4208
4209
4210 /**
4211  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
4212  * transaction updates if they were pending.
4213  */
4214 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
4215    /**
4216     * A pointer to the opaque Rust object.
4217     * Nearly everywhere, inner must be non-null, however in places where
4218     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4219     */
4220    LDKnativeCommitmentUpdate *inner;
4221    /**
4222     * Indicates that this is the only struct which contains the same pointer.
4223     * Rust functions which take ownership of an object provided via an argument require
4224     * this to be true and invalidate the object pointed to by inner.
4225     */
4226    bool is_owned;
4227 } LDKCommitmentUpdate;
4228
4229
4230
4231 /**
4232  * A revoke_and_ack message to be sent or received from a peer
4233  */
4234 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
4235    /**
4236     * A pointer to the opaque Rust object.
4237     * Nearly everywhere, inner must be non-null, however in places where
4238     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4239     */
4240    LDKnativeRevokeAndACK *inner;
4241    /**
4242     * Indicates that this is the only struct which contains the same pointer.
4243     * Rust functions which take ownership of an object provided via an argument require
4244     * this to be true and invalidate the object pointed to by inner.
4245     */
4246    bool is_owned;
4247 } LDKRevokeAndACK;
4248
4249
4250
4251 /**
4252  * A closing_signed message to be sent or received from a peer
4253  */
4254 typedef struct MUST_USE_STRUCT LDKClosingSigned {
4255    /**
4256     * A pointer to the opaque Rust object.
4257     * Nearly everywhere, inner must be non-null, however in places where
4258     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4259     */
4260    LDKnativeClosingSigned *inner;
4261    /**
4262     * Indicates that this is the only struct which contains the same pointer.
4263     * Rust functions which take ownership of an object provided via an argument require
4264     * this to be true and invalidate the object pointed to by inner.
4265     */
4266    bool is_owned;
4267 } LDKClosingSigned;
4268
4269
4270
4271 /**
4272  * A shutdown message to be sent or received from a peer
4273  */
4274 typedef struct MUST_USE_STRUCT LDKShutdown {
4275    /**
4276     * A pointer to the opaque Rust object.
4277     * Nearly everywhere, inner must be non-null, however in places where
4278     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4279     */
4280    LDKnativeShutdown *inner;
4281    /**
4282     * Indicates that this is the only struct which contains the same pointer.
4283     * Rust functions which take ownership of an object provided via an argument require
4284     * this to be true and invalidate the object pointed to by inner.
4285     */
4286    bool is_owned;
4287 } LDKShutdown;
4288
4289
4290
4291 /**
4292  * A channel_reestablish message to be sent or received from a peer
4293  */
4294 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
4295    /**
4296     * A pointer to the opaque Rust object.
4297     * Nearly everywhere, inner must be non-null, however in places where
4298     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4299     */
4300    LDKnativeChannelReestablish *inner;
4301    /**
4302     * Indicates that this is the only struct which contains the same pointer.
4303     * Rust functions which take ownership of an object provided via an argument require
4304     * this to be true and invalidate the object pointed to by inner.
4305     */
4306    bool is_owned;
4307 } LDKChannelReestablish;
4308
4309
4310
4311 /**
4312  * A channel_announcement message to be sent or received from a peer
4313  */
4314 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
4315    /**
4316     * A pointer to the opaque Rust object.
4317     * Nearly everywhere, inner must be non-null, however in places where
4318     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4319     */
4320    LDKnativeChannelAnnouncement *inner;
4321    /**
4322     * Indicates that this is the only struct which contains the same pointer.
4323     * Rust functions which take ownership of an object provided via an argument require
4324     * this to be true and invalidate the object pointed to by inner.
4325     */
4326    bool is_owned;
4327 } LDKChannelAnnouncement;
4328
4329
4330
4331 /**
4332  * An error message to be sent or received from a peer
4333  */
4334 typedef struct MUST_USE_STRUCT LDKErrorMessage {
4335    /**
4336     * A pointer to the opaque Rust object.
4337     * Nearly everywhere, inner must be non-null, however in places where
4338     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4339     */
4340    LDKnativeErrorMessage *inner;
4341    /**
4342     * Indicates that this is the only struct which contains the same pointer.
4343     * Rust functions which take ownership of an object provided via an argument require
4344     * this to be true and invalidate the object pointed to by inner.
4345     */
4346    bool is_owned;
4347 } LDKErrorMessage;
4348
4349
4350
4351 /**
4352  * A warning message to be sent or received from a peer
4353  */
4354 typedef struct MUST_USE_STRUCT LDKWarningMessage {
4355    /**
4356     * A pointer to the opaque Rust object.
4357     * Nearly everywhere, inner must be non-null, however in places where
4358     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4359     */
4360    LDKnativeWarningMessage *inner;
4361    /**
4362     * Indicates that this is the only struct which contains the same pointer.
4363     * Rust functions which take ownership of an object provided via an argument require
4364     * this to be true and invalidate the object pointed to by inner.
4365     */
4366    bool is_owned;
4367 } LDKWarningMessage;
4368
4369 /**
4370  * Used to put an error message in a LightningError
4371  */
4372 typedef enum LDKErrorAction_Tag {
4373    /**
4374     * The peer took some action which made us think they were useless. Disconnect them.
4375     */
4376    LDKErrorAction_DisconnectPeer,
4377    /**
4378     * The peer did something harmless that we weren't able to process, just log and ignore
4379     */
4380    LDKErrorAction_IgnoreError,
4381    /**
4382     * The peer did something harmless that we weren't able to meaningfully process.
4383     * If the error is logged, log it at the given level.
4384     */
4385    LDKErrorAction_IgnoreAndLog,
4386    /**
4387     * The peer provided us with a gossip message which we'd already seen. In most cases this
4388     * should be ignored, but it may result in the message being forwarded if it is a duplicate of
4389     * our own channel announcements.
4390     */
4391    LDKErrorAction_IgnoreDuplicateGossip,
4392    /**
4393     * The peer did something incorrect. Tell them.
4394     */
4395    LDKErrorAction_SendErrorMessage,
4396    /**
4397     * The peer did something incorrect. Tell them without closing any channels.
4398     */
4399    LDKErrorAction_SendWarningMessage,
4400    /**
4401     * Must be last for serialization purposes
4402     */
4403    LDKErrorAction_Sentinel,
4404 } LDKErrorAction_Tag;
4405
4406 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
4407    /**
4408     * An error message which we should make an effort to send before we disconnect.
4409     *
4410     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
4411     */
4412    struct LDKErrorMessage msg;
4413 } LDKErrorAction_LDKDisconnectPeer_Body;
4414
4415 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
4416    /**
4417     * The message to send.
4418     */
4419    struct LDKErrorMessage msg;
4420 } LDKErrorAction_LDKSendErrorMessage_Body;
4421
4422 typedef struct LDKErrorAction_LDKSendWarningMessage_Body {
4423    /**
4424     * The message to send.
4425     */
4426    struct LDKWarningMessage msg;
4427    /**
4428     * The peer may have done something harmless that we weren't able to meaningfully process,
4429     * though we should still tell them about it.
4430     * If this event is logged, log it at the given level.
4431     */
4432    enum LDKLevel log_level;
4433 } LDKErrorAction_LDKSendWarningMessage_Body;
4434
4435 typedef struct MUST_USE_STRUCT LDKErrorAction {
4436    LDKErrorAction_Tag tag;
4437    union {
4438       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
4439       struct {
4440          enum LDKLevel ignore_and_log;
4441       };
4442       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
4443       LDKErrorAction_LDKSendWarningMessage_Body send_warning_message;
4444    };
4445 } LDKErrorAction;
4446
4447
4448
4449 /**
4450  * A query_channel_range message is used to query a peer for channel
4451  * UTXOs in a range of blocks. The recipient of a query makes a best
4452  * effort to reply to the query using one or more reply_channel_range
4453  * messages.
4454  */
4455 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
4456    /**
4457     * A pointer to the opaque Rust object.
4458     * Nearly everywhere, inner must be non-null, however in places where
4459     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4460     */
4461    LDKnativeQueryChannelRange *inner;
4462    /**
4463     * Indicates that this is the only struct which contains the same pointer.
4464     * Rust functions which take ownership of an object provided via an argument require
4465     * this to be true and invalidate the object pointed to by inner.
4466     */
4467    bool is_owned;
4468 } LDKQueryChannelRange;
4469
4470
4471
4472 /**
4473  * A query_short_channel_ids message is used to query a peer for
4474  * routing gossip messages related to one or more short_channel_ids.
4475  * The query recipient will reply with the latest, if available,
4476  * channel_announcement, channel_update and node_announcement messages
4477  * it maintains for the requested short_channel_ids followed by a
4478  * reply_short_channel_ids_end message. The short_channel_ids sent in
4479  * this query are encoded. We only support encoding_type=0 uncompressed
4480  * serialization and do not support encoding_type=1 zlib serialization.
4481  */
4482 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
4483    /**
4484     * A pointer to the opaque Rust object.
4485     * Nearly everywhere, inner must be non-null, however in places where
4486     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4487     */
4488    LDKnativeQueryShortChannelIds *inner;
4489    /**
4490     * Indicates that this is the only struct which contains the same pointer.
4491     * Rust functions which take ownership of an object provided via an argument require
4492     * this to be true and invalidate the object pointed to by inner.
4493     */
4494    bool is_owned;
4495 } LDKQueryShortChannelIds;
4496
4497
4498
4499 /**
4500  * A reply_channel_range message is a reply to a query_channel_range
4501  * message. Multiple reply_channel_range messages can be sent in reply
4502  * to a single query_channel_range message. The query recipient makes a
4503  * best effort to respond based on their local network view which may
4504  * not be a perfect view of the network. The short_channel_ids in the
4505  * reply are encoded. We only support encoding_type=0 uncompressed
4506  * serialization and do not support encoding_type=1 zlib serialization.
4507  */
4508 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
4509    /**
4510     * A pointer to the opaque Rust object.
4511     * Nearly everywhere, inner must be non-null, however in places where
4512     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4513     */
4514    LDKnativeReplyChannelRange *inner;
4515    /**
4516     * Indicates that this is the only struct which contains the same pointer.
4517     * Rust functions which take ownership of an object provided via an argument require
4518     * this to be true and invalidate the object pointed to by inner.
4519     */
4520    bool is_owned;
4521 } LDKReplyChannelRange;
4522
4523
4524
4525 /**
4526  * A gossip_timestamp_filter message is used by a node to request
4527  * gossip relay for messages in the requested time range when the
4528  * gossip_queries feature has been negotiated.
4529  */
4530 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
4531    /**
4532     * A pointer to the opaque Rust object.
4533     * Nearly everywhere, inner must be non-null, however in places where
4534     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4535     */
4536    LDKnativeGossipTimestampFilter *inner;
4537    /**
4538     * Indicates that this is the only struct which contains the same pointer.
4539     * Rust functions which take ownership of an object provided via an argument require
4540     * this to be true and invalidate the object pointed to by inner.
4541     */
4542    bool is_owned;
4543 } LDKGossipTimestampFilter;
4544
4545 /**
4546  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
4547  * broadcast to most peers).
4548  * These events are handled by PeerManager::process_events if you are using a PeerManager.
4549  */
4550 typedef enum LDKMessageSendEvent_Tag {
4551    /**
4552     * Used to indicate that we've accepted a channel open and should send the accept_channel
4553     * message provided to the given peer.
4554     */
4555    LDKMessageSendEvent_SendAcceptChannel,
4556    /**
4557     * Used to indicate that we've initiated a channel open and should send the open_channel
4558     * message provided to the given peer.
4559     */
4560    LDKMessageSendEvent_SendOpenChannel,
4561    /**
4562     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
4563     */
4564    LDKMessageSendEvent_SendFundingCreated,
4565    /**
4566     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
4567     */
4568    LDKMessageSendEvent_SendFundingSigned,
4569    /**
4570     * Used to indicate that a channel_ready message should be sent to the peer with the given node_id.
4571     */
4572    LDKMessageSendEvent_SendChannelReady,
4573    /**
4574     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
4575     */
4576    LDKMessageSendEvent_SendAnnouncementSignatures,
4577    /**
4578     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
4579     * message should be sent to the peer with the given node_id.
4580     */
4581    LDKMessageSendEvent_UpdateHTLCs,
4582    /**
4583     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
4584     */
4585    LDKMessageSendEvent_SendRevokeAndACK,
4586    /**
4587     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
4588     */
4589    LDKMessageSendEvent_SendClosingSigned,
4590    /**
4591     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
4592     */
4593    LDKMessageSendEvent_SendShutdown,
4594    /**
4595     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
4596     */
4597    LDKMessageSendEvent_SendChannelReestablish,
4598    /**
4599     * Used to send a channel_announcement and channel_update to a specific peer, likely on
4600     * initial connection to ensure our peers know about our channels.
4601     */
4602    LDKMessageSendEvent_SendChannelAnnouncement,
4603    /**
4604     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
4605     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
4606     *
4607     * Note that after doing so, you very likely (unless you did so very recently) want to
4608     * broadcast a node_announcement (e.g. via [`PeerManager::broadcast_node_announcement`]). This
4609     * ensures that any nodes which see our channel_announcement also have a relevant
4610     * node_announcement, including relevant feature flags which may be important for routing
4611     * through or to us.
4612     *
4613     * [`PeerManager::broadcast_node_announcement`]: crate::ln::peer_handler::PeerManager::broadcast_node_announcement
4614     */
4615    LDKMessageSendEvent_BroadcastChannelAnnouncement,
4616    /**
4617     * Used to indicate that a channel_update should be broadcast to all peers.
4618     */
4619    LDKMessageSendEvent_BroadcastChannelUpdate,
4620    /**
4621     * Used to indicate that a channel_update should be sent to a single peer.
4622     * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
4623     * private channel and we shouldn't be informing all of our peers of channel parameters.
4624     */
4625    LDKMessageSendEvent_SendChannelUpdate,
4626    /**
4627     * Broadcast an error downstream to be handled
4628     */
4629    LDKMessageSendEvent_HandleError,
4630    /**
4631     * Query a peer for channels with funding transaction UTXOs in a block range.
4632     */
4633    LDKMessageSendEvent_SendChannelRangeQuery,
4634    /**
4635     * Request routing gossip messages from a peer for a list of channels identified by
4636     * their short_channel_ids.
4637     */
4638    LDKMessageSendEvent_SendShortIdsQuery,
4639    /**
4640     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
4641     * emitted during processing of the query.
4642     */
4643    LDKMessageSendEvent_SendReplyChannelRange,
4644    /**
4645     * Sends a timestamp filter for inbound gossip. This should be sent on each new connection to
4646     * enable receiving gossip messages from the peer.
4647     */
4648    LDKMessageSendEvent_SendGossipTimestampFilter,
4649    /**
4650     * Must be last for serialization purposes
4651     */
4652    LDKMessageSendEvent_Sentinel,
4653 } LDKMessageSendEvent_Tag;
4654
4655 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
4656    /**
4657     * The node_id of the node which should receive this message
4658     */
4659    struct LDKPublicKey node_id;
4660    /**
4661     * The message which should be sent.
4662     */
4663    struct LDKAcceptChannel msg;
4664 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
4665
4666 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
4667    /**
4668     * The node_id of the node which should receive this message
4669     */
4670    struct LDKPublicKey node_id;
4671    /**
4672     * The message which should be sent.
4673     */
4674    struct LDKOpenChannel msg;
4675 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
4676
4677 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
4678    /**
4679     * The node_id of the node which should receive this message
4680     */
4681    struct LDKPublicKey node_id;
4682    /**
4683     * The message which should be sent.
4684     */
4685    struct LDKFundingCreated msg;
4686 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
4687
4688 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
4689    /**
4690     * The node_id of the node which should receive this message
4691     */
4692    struct LDKPublicKey node_id;
4693    /**
4694     * The message which should be sent.
4695     */
4696    struct LDKFundingSigned msg;
4697 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
4698
4699 typedef struct LDKMessageSendEvent_LDKSendChannelReady_Body {
4700    /**
4701     * The node_id of the node which should receive these message(s)
4702     */
4703    struct LDKPublicKey node_id;
4704    /**
4705     * The channel_ready message which should be sent.
4706     */
4707    struct LDKChannelReady msg;
4708 } LDKMessageSendEvent_LDKSendChannelReady_Body;
4709
4710 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
4711    /**
4712     * The node_id of the node which should receive these message(s)
4713     */
4714    struct LDKPublicKey node_id;
4715    /**
4716     * The announcement_signatures message which should be sent.
4717     */
4718    struct LDKAnnouncementSignatures msg;
4719 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
4720
4721 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
4722    /**
4723     * The node_id of the node which should receive these message(s)
4724     */
4725    struct LDKPublicKey node_id;
4726    /**
4727     * The update messages which should be sent. ALL messages in the struct should be sent!
4728     */
4729    struct LDKCommitmentUpdate updates;
4730 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
4731
4732 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
4733    /**
4734     * The node_id of the node which should receive this message
4735     */
4736    struct LDKPublicKey node_id;
4737    /**
4738     * The message which should be sent.
4739     */
4740    struct LDKRevokeAndACK msg;
4741 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
4742
4743 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
4744    /**
4745     * The node_id of the node which should receive this message
4746     */
4747    struct LDKPublicKey node_id;
4748    /**
4749     * The message which should be sent.
4750     */
4751    struct LDKClosingSigned msg;
4752 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
4753
4754 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
4755    /**
4756     * The node_id of the node which should receive this message
4757     */
4758    struct LDKPublicKey node_id;
4759    /**
4760     * The message which should be sent.
4761     */
4762    struct LDKShutdown msg;
4763 } LDKMessageSendEvent_LDKSendShutdown_Body;
4764
4765 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
4766    /**
4767     * The node_id of the node which should receive this message
4768     */
4769    struct LDKPublicKey node_id;
4770    /**
4771     * The message which should be sent.
4772     */
4773    struct LDKChannelReestablish msg;
4774 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
4775
4776 typedef struct LDKMessageSendEvent_LDKSendChannelAnnouncement_Body {
4777    /**
4778     * The node_id of the node which should receive this message
4779     */
4780    struct LDKPublicKey node_id;
4781    /**
4782     * The channel_announcement which should be sent.
4783     */
4784    struct LDKChannelAnnouncement msg;
4785    /**
4786     * The followup channel_update which should be sent.
4787     */
4788    struct LDKChannelUpdate update_msg;
4789 } LDKMessageSendEvent_LDKSendChannelAnnouncement_Body;
4790
4791 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
4792    /**
4793     * The channel_announcement which should be sent.
4794     */
4795    struct LDKChannelAnnouncement msg;
4796    /**
4797     * The followup channel_update which should be sent.
4798     */
4799    struct LDKChannelUpdate update_msg;
4800 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
4801
4802 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
4803    /**
4804     * The channel_update which should be sent.
4805     */
4806    struct LDKChannelUpdate msg;
4807 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
4808
4809 typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
4810    /**
4811     * The node_id of the node which should receive this message
4812     */
4813    struct LDKPublicKey node_id;
4814    /**
4815     * The channel_update which should be sent.
4816     */
4817    struct LDKChannelUpdate msg;
4818 } LDKMessageSendEvent_LDKSendChannelUpdate_Body;
4819
4820 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
4821    /**
4822     * The node_id of the node which should receive this message
4823     */
4824    struct LDKPublicKey node_id;
4825    /**
4826     * The action which should be taken.
4827     */
4828    struct LDKErrorAction action;
4829 } LDKMessageSendEvent_LDKHandleError_Body;
4830
4831 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
4832    /**
4833     * The node_id of this message recipient
4834     */
4835    struct LDKPublicKey node_id;
4836    /**
4837     * The query_channel_range which should be sent.
4838     */
4839    struct LDKQueryChannelRange msg;
4840 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
4841
4842 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
4843    /**
4844     * The node_id of this message recipient
4845     */
4846    struct LDKPublicKey node_id;
4847    /**
4848     * The query_short_channel_ids which should be sent.
4849     */
4850    struct LDKQueryShortChannelIds msg;
4851 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
4852
4853 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
4854    /**
4855     * The node_id of this message recipient
4856     */
4857    struct LDKPublicKey node_id;
4858    /**
4859     * The reply_channel_range which should be sent.
4860     */
4861    struct LDKReplyChannelRange msg;
4862 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
4863
4864 typedef struct LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body {
4865    /**
4866     * The node_id of this message recipient
4867     */
4868    struct LDKPublicKey node_id;
4869    /**
4870     * The gossip_timestamp_filter which should be sent.
4871     */
4872    struct LDKGossipTimestampFilter msg;
4873 } LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body;
4874
4875 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
4876    LDKMessageSendEvent_Tag tag;
4877    union {
4878       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
4879       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
4880       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
4881       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
4882       LDKMessageSendEvent_LDKSendChannelReady_Body send_channel_ready;
4883       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
4884       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
4885       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
4886       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
4887       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
4888       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
4889       LDKMessageSendEvent_LDKSendChannelAnnouncement_Body send_channel_announcement;
4890       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
4891       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
4892       LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
4893       LDKMessageSendEvent_LDKHandleError_Body handle_error;
4894       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
4895       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
4896       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
4897       LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body send_gossip_timestamp_filter;
4898    };
4899 } LDKMessageSendEvent;
4900
4901 /**
4902  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
4903  * This corresponds to std::vector in C++
4904  */
4905 typedef struct LDKCVec_MessageSendEventZ {
4906    /**
4907     * The elements in the array.
4908     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4909     */
4910    struct LDKMessageSendEvent *data;
4911    /**
4912     * The number of elements pointed to by `data`.
4913     */
4914    uintptr_t datalen;
4915 } LDKCVec_MessageSendEventZ;
4916
4917 /**
4918  * The contents of CResult_TxOutAccessErrorZ
4919  */
4920 typedef union LDKCResult_TxOutAccessErrorZPtr {
4921    /**
4922     * A pointer to the contents in the success state.
4923     * Reading from this pointer when `result_ok` is not set is undefined.
4924     */
4925    struct LDKTxOut *result;
4926    /**
4927     * A pointer to the contents in the error state.
4928     * Reading from this pointer when `result_ok` is set is undefined.
4929     */
4930    enum LDKAccessError *err;
4931 } LDKCResult_TxOutAccessErrorZPtr;
4932
4933 /**
4934  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
4935  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
4936  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4937  */
4938 typedef struct LDKCResult_TxOutAccessErrorZ {
4939    /**
4940     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
4941     * `err` or `result` depending on the state of `result_ok`.
4942     */
4943    union LDKCResult_TxOutAccessErrorZPtr contents;
4944    /**
4945     * Whether this CResult_TxOutAccessErrorZ represents a success state.
4946     */
4947    bool result_ok;
4948 } LDKCResult_TxOutAccessErrorZ;
4949
4950 /**
4951  * A tuple of 2 elements. See the individual fields for the types contained.
4952  */
4953 typedef struct LDKC2Tuple_usizeTransactionZ {
4954    /**
4955     * The element at position 0
4956     */
4957    uintptr_t a;
4958    /**
4959     * The element at position 1
4960     */
4961    struct LDKTransaction b;
4962 } LDKC2Tuple_usizeTransactionZ;
4963
4964 /**
4965  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
4966  * This corresponds to std::vector in C++
4967  */
4968 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
4969    /**
4970     * The elements in the array.
4971     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4972     */
4973    struct LDKC2Tuple_usizeTransactionZ *data;
4974    /**
4975     * The number of elements pointed to by `data`.
4976     */
4977    uintptr_t datalen;
4978 } LDKCVec_C2Tuple_usizeTransactionZZ;
4979
4980 /**
4981  * A tuple of 2 elements. See the individual fields for the types contained.
4982  */
4983 typedef struct LDKC2Tuple_TxidBlockHashZ {
4984    /**
4985     * The element at position 0
4986     */
4987    struct LDKThirtyTwoBytes a;
4988    /**
4989     * The element at position 1
4990     */
4991    struct LDKThirtyTwoBytes b;
4992 } LDKC2Tuple_TxidBlockHashZ;
4993
4994 /**
4995  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidBlockHashZs of arbitrary size.
4996  * This corresponds to std::vector in C++
4997  */
4998 typedef struct LDKCVec_C2Tuple_TxidBlockHashZZ {
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 LDKC2Tuple_TxidBlockHashZ *data;
5004    /**
5005     * The number of elements pointed to by `data`.
5006     */
5007    uintptr_t datalen;
5008 } LDKCVec_C2Tuple_TxidBlockHashZZ;
5009
5010
5011
5012 /**
5013  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
5014  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
5015  * preimage claim backward will lead to loss of funds.
5016  */
5017 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
5018    /**
5019     * A pointer to the opaque Rust object.
5020     * Nearly everywhere, inner must be non-null, however in places where
5021     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5022     */
5023    LDKnativeHTLCUpdate *inner;
5024    /**
5025     * Indicates that this is the only struct which contains the same pointer.
5026     * Rust functions which take ownership of an object provided via an argument require
5027     * this to be true and invalidate the object pointed to by inner.
5028     */
5029    bool is_owned;
5030 } LDKHTLCUpdate;
5031
5032 /**
5033  * An event to be processed by the ChannelManager.
5034  */
5035 typedef enum LDKMonitorEvent_Tag {
5036    /**
5037     * A monitor event containing an HTLCUpdate.
5038     */
5039    LDKMonitorEvent_HTLCEvent,
5040    /**
5041     * A monitor event that the Channel's commitment transaction was confirmed.
5042     */
5043    LDKMonitorEvent_CommitmentTxConfirmed,
5044    /**
5045     * Indicates a [`ChannelMonitor`] update has completed. See
5046     * [`ChannelMonitorUpdateStatus::InProgress`] for more information on how this is used.
5047     *
5048     * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
5049     */
5050    LDKMonitorEvent_Completed,
5051    /**
5052     * Indicates a [`ChannelMonitor`] update has failed. See
5053     * [`ChannelMonitorUpdateStatus::PermanentFailure`] for more information on how this is used.
5054     *
5055     * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure
5056     */
5057    LDKMonitorEvent_UpdateFailed,
5058    /**
5059     * Must be last for serialization purposes
5060     */
5061    LDKMonitorEvent_Sentinel,
5062 } LDKMonitorEvent_Tag;
5063
5064 typedef struct LDKMonitorEvent_LDKCompleted_Body {
5065    /**
5066     * The funding outpoint of the [`ChannelMonitor`] that was updated
5067     */
5068    struct LDKOutPoint funding_txo;
5069    /**
5070     * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
5071     * [`ChannelMonitor::get_latest_update_id`].
5072     *
5073     * Note that this should only be set to a given update's ID if all previous updates for the
5074     * same [`ChannelMonitor`] have been applied and persisted.
5075     */
5076    uint64_t monitor_update_id;
5077 } LDKMonitorEvent_LDKCompleted_Body;
5078
5079 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
5080    LDKMonitorEvent_Tag tag;
5081    union {
5082       struct {
5083          struct LDKHTLCUpdate htlc_event;
5084       };
5085       struct {
5086          struct LDKOutPoint commitment_tx_confirmed;
5087       };
5088       LDKMonitorEvent_LDKCompleted_Body completed;
5089       struct {
5090          struct LDKOutPoint update_failed;
5091       };
5092    };
5093 } LDKMonitorEvent;
5094
5095 /**
5096  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
5097  * This corresponds to std::vector in C++
5098  */
5099 typedef struct LDKCVec_MonitorEventZ {
5100    /**
5101     * The elements in the array.
5102     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5103     */
5104    struct LDKMonitorEvent *data;
5105    /**
5106     * The number of elements pointed to by `data`.
5107     */
5108    uintptr_t datalen;
5109 } LDKCVec_MonitorEventZ;
5110
5111 /**
5112  * A tuple of 3 elements. See the individual fields for the types contained.
5113  */
5114 typedef struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5115    /**
5116     * The element at position 0
5117     */
5118    struct LDKOutPoint a;
5119    /**
5120     * The element at position 1
5121     */
5122    struct LDKCVec_MonitorEventZ b;
5123    /**
5124     * The element at position 2
5125     */
5126    struct LDKPublicKey c;
5127 } LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ;
5128
5129 /**
5130  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
5131  * This corresponds to std::vector in C++
5132  */
5133 typedef struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5134    /**
5135     * The elements in the array.
5136     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5137     */
5138    struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *data;
5139    /**
5140     * The number of elements pointed to by `data`.
5141     */
5142    uintptr_t datalen;
5143 } LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ;
5144
5145
5146
5147 /**
5148  * [`Score`] implementation that uses a fixed penalty.
5149  */
5150 typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer {
5151    /**
5152     * A pointer to the opaque Rust object.
5153     * Nearly everywhere, inner must be non-null, however in places where
5154     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5155     */
5156    LDKnativeFixedPenaltyScorer *inner;
5157    /**
5158     * Indicates that this is the only struct which contains the same pointer.
5159     * Rust functions which take ownership of an object provided via an argument require
5160     * this to be true and invalidate the object pointed to by inner.
5161     */
5162    bool is_owned;
5163 } LDKFixedPenaltyScorer;
5164
5165 /**
5166  * The contents of CResult_FixedPenaltyScorerDecodeErrorZ
5167  */
5168 typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr {
5169    /**
5170     * A pointer to the contents in the success state.
5171     * Reading from this pointer when `result_ok` is not set is undefined.
5172     */
5173    struct LDKFixedPenaltyScorer *result;
5174    /**
5175     * A pointer to the contents in the error state.
5176     * Reading from this pointer when `result_ok` is set is undefined.
5177     */
5178    struct LDKDecodeError *err;
5179 } LDKCResult_FixedPenaltyScorerDecodeErrorZPtr;
5180
5181 /**
5182  * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
5183  * containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
5184  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5185  */
5186 typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ {
5187    /**
5188     * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
5189     * `err` or `result` depending on the state of `result_ok`.
5190     */
5191    union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents;
5192    /**
5193     * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
5194     */
5195    bool result_ok;
5196 } LDKCResult_FixedPenaltyScorerDecodeErrorZ;
5197
5198 /**
5199  * A tuple of 2 elements. See the individual fields for the types contained.
5200  */
5201 typedef struct LDKC2Tuple_u64u64Z {
5202    /**
5203     * The element at position 0
5204     */
5205    uint64_t a;
5206    /**
5207     * The element at position 1
5208     */
5209    uint64_t b;
5210 } LDKC2Tuple_u64u64Z;
5211
5212 /**
5213  * An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
5214  */
5215 typedef enum LDKCOption_C2Tuple_u64u64ZZ_Tag {
5216    /**
5217     * When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
5218     */
5219    LDKCOption_C2Tuple_u64u64ZZ_Some,
5220    /**
5221     * When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
5222     */
5223    LDKCOption_C2Tuple_u64u64ZZ_None,
5224    /**
5225     * Must be last for serialization purposes
5226     */
5227    LDKCOption_C2Tuple_u64u64ZZ_Sentinel,
5228 } LDKCOption_C2Tuple_u64u64ZZ_Tag;
5229
5230 typedef struct LDKCOption_C2Tuple_u64u64ZZ {
5231    LDKCOption_C2Tuple_u64u64ZZ_Tag tag;
5232    union {
5233       struct {
5234          struct LDKC2Tuple_u64u64Z some;
5235       };
5236    };
5237 } LDKCOption_C2Tuple_u64u64ZZ;
5238
5239 /**
5240  * A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
5241  * This corresponds to std::vector in C++
5242  */
5243 typedef struct LDKCVec_NodeIdZ {
5244    /**
5245     * The elements in the array.
5246     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5247     */
5248    struct LDKNodeId *data;
5249    /**
5250     * The number of elements pointed to by `data`.
5251     */
5252    uintptr_t datalen;
5253 } LDKCVec_NodeIdZ;
5254
5255
5256
5257 /**
5258  * A Record, unit of logging output with Metadata to enable filtering
5259  * Module_path, file, line to inform on log's source
5260  */
5261 typedef struct MUST_USE_STRUCT LDKRecord {
5262    /**
5263     * A pointer to the opaque Rust object.
5264     * Nearly everywhere, inner must be non-null, however in places where
5265     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5266     */
5267    LDKnativeRecord *inner;
5268    /**
5269     * Indicates that this is the only struct which contains the same pointer.
5270     * Rust functions which take ownership of an object provided via an argument require
5271     * this to be true and invalidate the object pointed to by inner.
5272     */
5273    bool is_owned;
5274 } LDKRecord;
5275
5276 /**
5277  * A trait encapsulating the operations required of a logger
5278  */
5279 typedef struct LDKLogger {
5280    /**
5281     * An opaque pointer which is passed to your function implementations as an argument.
5282     * This has no meaning in the LDK, and can be NULL or any other value.
5283     */
5284    void *this_arg;
5285    /**
5286     * Logs the `Record`
5287     */
5288    void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record);
5289    /**
5290     * Frees any resources associated with this object given its this_arg pointer.
5291     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5292     */
5293    void (*free)(void *this_arg);
5294 } LDKLogger;
5295
5296
5297
5298 /**
5299  * Represents the network as nodes and channels between them
5300  */
5301 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
5302    /**
5303     * A pointer to the opaque Rust object.
5304     * Nearly everywhere, inner must be non-null, however in places where
5305     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5306     */
5307    LDKnativeNetworkGraph *inner;
5308    /**
5309     * Indicates that this is the only struct which contains the same pointer.
5310     * Rust functions which take ownership of an object provided via an argument require
5311     * this to be true and invalidate the object pointed to by inner.
5312     */
5313    bool is_owned;
5314 } LDKNetworkGraph;
5315
5316
5317
5318 /**
5319  * [`Score`] implementation using channel success probability distributions.
5320  *
5321  * Channels are tracked with upper and lower liquidity bounds - when an HTLC fails at a channel,
5322  * we learn that the upper-bound on the available liquidity is lower than the amount of the HTLC.
5323  * When a payment is forwarded through a channel (but fails later in the route), we learn the
5324  * lower-bound on the channel's available liquidity must be at least the value of the HTLC.
5325  *
5326  * These bounds are then used to determine a success probability using the formula from
5327  * *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
5328  * and Stefan Richter [[1]] (i.e. `(upper_bound - payment_amount) / (upper_bound - lower_bound)`).
5329  *
5330  * This probability is combined with the [`liquidity_penalty_multiplier_msat`] and
5331  * [`liquidity_penalty_amount_multiplier_msat`] parameters to calculate a concrete penalty in
5332  * milli-satoshis. The penalties, when added across all hops, have the property of being linear in
5333  * terms of the entire path's success probability. This allows the router to directly compare
5334  * penalties for different paths. See the documentation of those parameters for the exact formulas.
5335  *
5336  * The liquidity bounds are decayed by halving them every [`liquidity_offset_half_life`].
5337  *
5338  * Further, we track the history of our upper and lower liquidity bounds for each channel,
5339  * allowing us to assign a second penalty (using [`historical_liquidity_penalty_multiplier_msat`]
5340  * and [`historical_liquidity_penalty_amount_multiplier_msat`]) based on the same probability
5341  * formula, but using the history of a channel rather than our latest estimates for the liquidity
5342  * bounds.
5343  *
5344  * # Note
5345  *
5346  * Mixing the `no-std` feature between serialization and deserialization results in undefined
5347  * behavior.
5348  *
5349  * [1]: https://arxiv.org/abs/2107.05322
5350  * [`liquidity_penalty_multiplier_msat`]: ProbabilisticScoringParameters::liquidity_penalty_multiplier_msat
5351  * [`liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringParameters::liquidity_penalty_amount_multiplier_msat
5352  * [`liquidity_offset_half_life`]: ProbabilisticScoringParameters::liquidity_offset_half_life
5353  * [`historical_liquidity_penalty_multiplier_msat`]: ProbabilisticScoringParameters::historical_liquidity_penalty_multiplier_msat
5354  * [`historical_liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringParameters::historical_liquidity_penalty_amount_multiplier_msat
5355  */
5356 typedef struct MUST_USE_STRUCT LDKProbabilisticScorer {
5357    /**
5358     * A pointer to the opaque Rust object.
5359     * Nearly everywhere, inner must be non-null, however in places where
5360     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5361     */
5362    LDKnativeProbabilisticScorer *inner;
5363    /**
5364     * Indicates that this is the only struct which contains the same pointer.
5365     * Rust functions which take ownership of an object provided via an argument require
5366     * this to be true and invalidate the object pointed to by inner.
5367     */
5368    bool is_owned;
5369 } LDKProbabilisticScorer;
5370
5371 /**
5372  * The contents of CResult_ProbabilisticScorerDecodeErrorZ
5373  */
5374 typedef union LDKCResult_ProbabilisticScorerDecodeErrorZPtr {
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 LDKProbabilisticScorer *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_ProbabilisticScorerDecodeErrorZPtr;
5386
5387 /**
5388  * A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
5389  * containing a crate::lightning::routing::scoring::ProbabilisticScorer 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_ProbabilisticScorerDecodeErrorZ {
5393    /**
5394     * The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
5395     * `err` or `result` depending on the state of `result_ok`.
5396     */
5397    union LDKCResult_ProbabilisticScorerDecodeErrorZPtr contents;
5398    /**
5399     * Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
5400     */
5401    bool result_ok;
5402 } LDKCResult_ProbabilisticScorerDecodeErrorZ;
5403
5404
5405
5406 /**
5407  * Features used within an `init` message.
5408  */
5409 typedef struct MUST_USE_STRUCT LDKInitFeatures {
5410    /**
5411     * A pointer to the opaque Rust object.
5412     * Nearly everywhere, inner must be non-null, however in places where
5413     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5414     */
5415    LDKnativeInitFeatures *inner;
5416    /**
5417     * Indicates that this is the only struct which contains the same pointer.
5418     * Rust functions which take ownership of an object provided via an argument require
5419     * this to be true and invalidate the object pointed to by inner.
5420     */
5421    bool is_owned;
5422 } LDKInitFeatures;
5423
5424 /**
5425  * The contents of CResult_InitFeaturesDecodeErrorZ
5426  */
5427 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
5428    /**
5429     * A pointer to the contents in the success state.
5430     * Reading from this pointer when `result_ok` is not set is undefined.
5431     */
5432    struct LDKInitFeatures *result;
5433    /**
5434     * A pointer to the contents in the error state.
5435     * Reading from this pointer when `result_ok` is set is undefined.
5436     */
5437    struct LDKDecodeError *err;
5438 } LDKCResult_InitFeaturesDecodeErrorZPtr;
5439
5440 /**
5441  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
5442  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5443  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5444  */
5445 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
5446    /**
5447     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
5448     * `err` or `result` depending on the state of `result_ok`.
5449     */
5450    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
5451    /**
5452     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
5453     */
5454    bool result_ok;
5455 } LDKCResult_InitFeaturesDecodeErrorZ;
5456
5457
5458
5459 /**
5460  * Features used within a `channel_announcement` message.
5461  */
5462 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
5463    /**
5464     * A pointer to the opaque Rust object.
5465     * Nearly everywhere, inner must be non-null, however in places where
5466     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5467     */
5468    LDKnativeChannelFeatures *inner;
5469    /**
5470     * Indicates that this is the only struct which contains the same pointer.
5471     * Rust functions which take ownership of an object provided via an argument require
5472     * this to be true and invalidate the object pointed to by inner.
5473     */
5474    bool is_owned;
5475 } LDKChannelFeatures;
5476
5477 /**
5478  * The contents of CResult_ChannelFeaturesDecodeErrorZ
5479  */
5480 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
5481    /**
5482     * A pointer to the contents in the success state.
5483     * Reading from this pointer when `result_ok` is not set is undefined.
5484     */
5485    struct LDKChannelFeatures *result;
5486    /**
5487     * A pointer to the contents in the error state.
5488     * Reading from this pointer when `result_ok` is set is undefined.
5489     */
5490    struct LDKDecodeError *err;
5491 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
5492
5493 /**
5494  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
5495  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5496  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5497  */
5498 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
5499    /**
5500     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
5501     * `err` or `result` depending on the state of `result_ok`.
5502     */
5503    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
5504    /**
5505     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
5506     */
5507    bool result_ok;
5508 } LDKCResult_ChannelFeaturesDecodeErrorZ;
5509
5510
5511
5512 /**
5513  * Features used within a `node_announcement` message.
5514  */
5515 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
5516    /**
5517     * A pointer to the opaque Rust object.
5518     * Nearly everywhere, inner must be non-null, however in places where
5519     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5520     */
5521    LDKnativeNodeFeatures *inner;
5522    /**
5523     * Indicates that this is the only struct which contains the same pointer.
5524     * Rust functions which take ownership of an object provided via an argument require
5525     * this to be true and invalidate the object pointed to by inner.
5526     */
5527    bool is_owned;
5528 } LDKNodeFeatures;
5529
5530 /**
5531  * The contents of CResult_NodeFeaturesDecodeErrorZ
5532  */
5533 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
5534    /**
5535     * A pointer to the contents in the success state.
5536     * Reading from this pointer when `result_ok` is not set is undefined.
5537     */
5538    struct LDKNodeFeatures *result;
5539    /**
5540     * A pointer to the contents in the error state.
5541     * Reading from this pointer when `result_ok` is set is undefined.
5542     */
5543    struct LDKDecodeError *err;
5544 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
5545
5546 /**
5547  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5548  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5549  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5550  */
5551 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
5552    /**
5553     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
5554     * `err` or `result` depending on the state of `result_ok`.
5555     */
5556    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
5557    /**
5558     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
5559     */
5560    bool result_ok;
5561 } LDKCResult_NodeFeaturesDecodeErrorZ;
5562
5563
5564
5565 /**
5566  * Features used within an invoice.
5567  */
5568 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
5569    /**
5570     * A pointer to the opaque Rust object.
5571     * Nearly everywhere, inner must be non-null, however in places where
5572     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5573     */
5574    LDKnativeInvoiceFeatures *inner;
5575    /**
5576     * Indicates that this is the only struct which contains the same pointer.
5577     * Rust functions which take ownership of an object provided via an argument require
5578     * this to be true and invalidate the object pointed to by inner.
5579     */
5580    bool is_owned;
5581 } LDKInvoiceFeatures;
5582
5583 /**
5584  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
5585  */
5586 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
5587    /**
5588     * A pointer to the contents in the success state.
5589     * Reading from this pointer when `result_ok` is not set is undefined.
5590     */
5591    struct LDKInvoiceFeatures *result;
5592    /**
5593     * A pointer to the contents in the error state.
5594     * Reading from this pointer when `result_ok` is set is undefined.
5595     */
5596    struct LDKDecodeError *err;
5597 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
5598
5599 /**
5600  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5601  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5602  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5603  */
5604 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
5605    /**
5606     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
5607     * `err` or `result` depending on the state of `result_ok`.
5608     */
5609    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
5610    /**
5611     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
5612     */
5613    bool result_ok;
5614 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
5615
5616 /**
5617  * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
5618  */
5619 typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr {
5620    /**
5621     * A pointer to the contents in the success state.
5622     * Reading from this pointer when `result_ok` is not set is undefined.
5623     */
5624    struct LDKChannelTypeFeatures *result;
5625    /**
5626     * A pointer to the contents in the error state.
5627     * Reading from this pointer when `result_ok` is set is undefined.
5628     */
5629    struct LDKDecodeError *err;
5630 } LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr;
5631
5632 /**
5633  * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
5634  * containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5635  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5636  */
5637 typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ {
5638    /**
5639     * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
5640     * `err` or `result` depending on the state of `result_ok`.
5641     */
5642    union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents;
5643    /**
5644     * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
5645     */
5646    bool result_ok;
5647 } LDKCResult_ChannelTypeFeaturesDecodeErrorZ;
5648
5649
5650
5651 /**
5652  * Features used within an `offer`.
5653  */
5654 typedef struct MUST_USE_STRUCT LDKOfferFeatures {
5655    /**
5656     * A pointer to the opaque Rust object.
5657     * Nearly everywhere, inner must be non-null, however in places where
5658     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5659     */
5660    LDKnativeOfferFeatures *inner;
5661    /**
5662     * Indicates that this is the only struct which contains the same pointer.
5663     * Rust functions which take ownership of an object provided via an argument require
5664     * this to be true and invalidate the object pointed to by inner.
5665     */
5666    bool is_owned;
5667 } LDKOfferFeatures;
5668
5669 /**
5670  * The contents of CResult_OfferFeaturesDecodeErrorZ
5671  */
5672 typedef union LDKCResult_OfferFeaturesDecodeErrorZPtr {
5673    /**
5674     * A pointer to the contents in the success state.
5675     * Reading from this pointer when `result_ok` is not set is undefined.
5676     */
5677    struct LDKOfferFeatures *result;
5678    /**
5679     * A pointer to the contents in the error state.
5680     * Reading from this pointer when `result_ok` is set is undefined.
5681     */
5682    struct LDKDecodeError *err;
5683 } LDKCResult_OfferFeaturesDecodeErrorZPtr;
5684
5685 /**
5686  * A CResult_OfferFeaturesDecodeErrorZ represents the result of a fallible operation,
5687  * containing a crate::lightning::ln::features::OfferFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5688  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5689  */
5690 typedef struct LDKCResult_OfferFeaturesDecodeErrorZ {
5691    /**
5692     * The contents of this CResult_OfferFeaturesDecodeErrorZ, accessible via either
5693     * `err` or `result` depending on the state of `result_ok`.
5694     */
5695    union LDKCResult_OfferFeaturesDecodeErrorZPtr contents;
5696    /**
5697     * Whether this CResult_OfferFeaturesDecodeErrorZ represents a success state.
5698     */
5699    bool result_ok;
5700 } LDKCResult_OfferFeaturesDecodeErrorZ;
5701
5702
5703
5704 /**
5705  * Features used within an `invoice_request`.
5706  */
5707 typedef struct MUST_USE_STRUCT LDKInvoiceRequestFeatures {
5708    /**
5709     * A pointer to the opaque Rust object.
5710     * Nearly everywhere, inner must be non-null, however in places where
5711     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5712     */
5713    LDKnativeInvoiceRequestFeatures *inner;
5714    /**
5715     * Indicates that this is the only struct which contains the same pointer.
5716     * Rust functions which take ownership of an object provided via an argument require
5717     * this to be true and invalidate the object pointed to by inner.
5718     */
5719    bool is_owned;
5720 } LDKInvoiceRequestFeatures;
5721
5722 /**
5723  * The contents of CResult_InvoiceRequestFeaturesDecodeErrorZ
5724  */
5725 typedef union LDKCResult_InvoiceRequestFeaturesDecodeErrorZPtr {
5726    /**
5727     * A pointer to the contents in the success state.
5728     * Reading from this pointer when `result_ok` is not set is undefined.
5729     */
5730    struct LDKInvoiceRequestFeatures *result;
5731    /**
5732     * A pointer to the contents in the error state.
5733     * Reading from this pointer when `result_ok` is set is undefined.
5734     */
5735    struct LDKDecodeError *err;
5736 } LDKCResult_InvoiceRequestFeaturesDecodeErrorZPtr;
5737
5738 /**
5739  * A CResult_InvoiceRequestFeaturesDecodeErrorZ represents the result of a fallible operation,
5740  * containing a crate::lightning::ln::features::InvoiceRequestFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5741  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5742  */
5743 typedef struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ {
5744    /**
5745     * The contents of this CResult_InvoiceRequestFeaturesDecodeErrorZ, accessible via either
5746     * `err` or `result` depending on the state of `result_ok`.
5747     */
5748    union LDKCResult_InvoiceRequestFeaturesDecodeErrorZPtr contents;
5749    /**
5750     * Whether this CResult_InvoiceRequestFeaturesDecodeErrorZ represents a success state.
5751     */
5752    bool result_ok;
5753 } LDKCResult_InvoiceRequestFeaturesDecodeErrorZ;
5754
5755 /**
5756  * The contents of CResult_NodeIdDecodeErrorZ
5757  */
5758 typedef union LDKCResult_NodeIdDecodeErrorZPtr {
5759    /**
5760     * A pointer to the contents in the success state.
5761     * Reading from this pointer when `result_ok` is not set is undefined.
5762     */
5763    struct LDKNodeId *result;
5764    /**
5765     * A pointer to the contents in the error state.
5766     * Reading from this pointer when `result_ok` is set is undefined.
5767     */
5768    struct LDKDecodeError *err;
5769 } LDKCResult_NodeIdDecodeErrorZPtr;
5770
5771 /**
5772  * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
5773  * containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
5774  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5775  */
5776 typedef struct LDKCResult_NodeIdDecodeErrorZ {
5777    /**
5778     * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
5779     * `err` or `result` depending on the state of `result_ok`.
5780     */
5781    union LDKCResult_NodeIdDecodeErrorZPtr contents;
5782    /**
5783     * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
5784     */
5785    bool result_ok;
5786 } LDKCResult_NodeIdDecodeErrorZ;
5787
5788 /**
5789  * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
5790  */
5791 typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr {
5792    /**
5793     * A pointer to the contents in the success state.
5794     * Reading from this pointer when `result_ok` is not set is undefined.
5795     */
5796    struct LDKCOption_NetworkUpdateZ *result;
5797    /**
5798     * A pointer to the contents in the error state.
5799     * Reading from this pointer when `result_ok` is set is undefined.
5800     */
5801    struct LDKDecodeError *err;
5802 } LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr;
5803
5804 /**
5805  * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
5806  * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5807  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5808  */
5809 typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ {
5810    /**
5811     * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
5812     * `err` or `result` depending on the state of `result_ok`.
5813     */
5814    union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents;
5815    /**
5816     * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
5817     */
5818    bool result_ok;
5819 } LDKCResult_COption_NetworkUpdateZDecodeErrorZ;
5820
5821 /**
5822  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
5823  * UTXOs.
5824  */
5825 typedef struct LDKAccess {
5826    /**
5827     * An opaque pointer which is passed to your function implementations as an argument.
5828     * This has no meaning in the LDK, and can be NULL or any other value.
5829     */
5830    void *this_arg;
5831    /**
5832     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
5833     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
5834     * is unknown.
5835     *
5836     * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id
5837     */
5838    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
5839    /**
5840     * Frees any resources associated with this object given its this_arg pointer.
5841     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5842     */
5843    void (*free)(void *this_arg);
5844 } LDKAccess;
5845
5846 /**
5847  * An enum which can either contain a crate::lightning::chain::Access or not
5848  */
5849 typedef enum LDKCOption_AccessZ_Tag {
5850    /**
5851     * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
5852     */
5853    LDKCOption_AccessZ_Some,
5854    /**
5855     * When we're in this state, this COption_AccessZ contains nothing
5856     */
5857    LDKCOption_AccessZ_None,
5858    /**
5859     * Must be last for serialization purposes
5860     */
5861    LDKCOption_AccessZ_Sentinel,
5862 } LDKCOption_AccessZ_Tag;
5863
5864 typedef struct LDKCOption_AccessZ {
5865    LDKCOption_AccessZ_Tag tag;
5866    union {
5867       struct {
5868          struct LDKAccess some;
5869       };
5870    };
5871 } LDKCOption_AccessZ;
5872
5873 /**
5874  * The contents of CResult_boolLightningErrorZ
5875  */
5876 typedef union LDKCResult_boolLightningErrorZPtr {
5877    /**
5878     * A pointer to the contents in the success state.
5879     * Reading from this pointer when `result_ok` is not set is undefined.
5880     */
5881    bool *result;
5882    /**
5883     * A pointer to the contents in the error state.
5884     * Reading from this pointer when `result_ok` is set is undefined.
5885     */
5886    struct LDKLightningError *err;
5887 } LDKCResult_boolLightningErrorZPtr;
5888
5889 /**
5890  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
5891  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
5892  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5893  */
5894 typedef struct LDKCResult_boolLightningErrorZ {
5895    /**
5896     * The contents of this CResult_boolLightningErrorZ, accessible via either
5897     * `err` or `result` depending on the state of `result_ok`.
5898     */
5899    union LDKCResult_boolLightningErrorZPtr contents;
5900    /**
5901     * Whether this CResult_boolLightningErrorZ represents a success state.
5902     */
5903    bool result_ok;
5904 } LDKCResult_boolLightningErrorZ;
5905
5906 /**
5907  * A tuple of 3 elements. See the individual fields for the types contained.
5908  */
5909 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5910    /**
5911     * The element at position 0
5912     */
5913    struct LDKChannelAnnouncement a;
5914    /**
5915     * The element at position 1
5916     */
5917    struct LDKChannelUpdate b;
5918    /**
5919     * The element at position 2
5920     */
5921    struct LDKChannelUpdate c;
5922 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
5923
5924 /**
5925  * An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
5926  */
5927 typedef enum LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag {
5928    /**
5929     * When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
5930     */
5931    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some,
5932    /**
5933     * When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
5934     */
5935    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None,
5936    /**
5937     * Must be last for serialization purposes
5938     */
5939    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Sentinel,
5940 } LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag;
5941
5942 typedef struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5943    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag tag;
5944    union {
5945       struct {
5946          struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ some;
5947       };
5948    };
5949 } LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
5950
5951 /**
5952  * The contents of CResult_NoneLightningErrorZ
5953  */
5954 typedef union LDKCResult_NoneLightningErrorZPtr {
5955    /**
5956     * Note that this value is always NULL, as there are no contents in the OK variant
5957     */
5958    void *result;
5959    /**
5960     * A pointer to the contents in the error state.
5961     * Reading from this pointer when `result_ok` is set is undefined.
5962     */
5963    struct LDKLightningError *err;
5964 } LDKCResult_NoneLightningErrorZPtr;
5965
5966 /**
5967  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5968  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5969  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5970  */
5971 typedef struct LDKCResult_NoneLightningErrorZ {
5972    /**
5973     * The contents of this CResult_NoneLightningErrorZ, accessible via either
5974     * `err` or `result` depending on the state of `result_ok`.
5975     */
5976    union LDKCResult_NoneLightningErrorZPtr contents;
5977    /**
5978     * Whether this CResult_NoneLightningErrorZ represents a success state.
5979     */
5980    bool result_ok;
5981 } LDKCResult_NoneLightningErrorZ;
5982
5983
5984
5985 /**
5986  * Details about one direction of a channel as received within a [`ChannelUpdate`].
5987  */
5988 typedef struct MUST_USE_STRUCT LDKChannelUpdateInfo {
5989    /**
5990     * A pointer to the opaque Rust object.
5991     * Nearly everywhere, inner must be non-null, however in places where
5992     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5993     */
5994    LDKnativeChannelUpdateInfo *inner;
5995    /**
5996     * Indicates that this is the only struct which contains the same pointer.
5997     * Rust functions which take ownership of an object provided via an argument require
5998     * this to be true and invalidate the object pointed to by inner.
5999     */
6000    bool is_owned;
6001 } LDKChannelUpdateInfo;
6002
6003 /**
6004  * The contents of CResult_ChannelUpdateInfoDecodeErrorZ
6005  */
6006 typedef union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr {
6007    /**
6008     * A pointer to the contents in the success state.
6009     * Reading from this pointer when `result_ok` is not set is undefined.
6010     */
6011    struct LDKChannelUpdateInfo *result;
6012    /**
6013     * A pointer to the contents in the error state.
6014     * Reading from this pointer when `result_ok` is set is undefined.
6015     */
6016    struct LDKDecodeError *err;
6017 } LDKCResult_ChannelUpdateInfoDecodeErrorZPtr;
6018
6019 /**
6020  * A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
6021  * containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6022  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6023  */
6024 typedef struct LDKCResult_ChannelUpdateInfoDecodeErrorZ {
6025    /**
6026     * The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
6027     * `err` or `result` depending on the state of `result_ok`.
6028     */
6029    union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr contents;
6030    /**
6031     * Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
6032     */
6033    bool result_ok;
6034 } LDKCResult_ChannelUpdateInfoDecodeErrorZ;
6035
6036
6037
6038 /**
6039  * Details about a channel (both directions).
6040  * Received within a channel announcement.
6041  */
6042 typedef struct MUST_USE_STRUCT LDKChannelInfo {
6043    /**
6044     * A pointer to the opaque Rust object.
6045     * Nearly everywhere, inner must be non-null, however in places where
6046     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6047     */
6048    LDKnativeChannelInfo *inner;
6049    /**
6050     * Indicates that this is the only struct which contains the same pointer.
6051     * Rust functions which take ownership of an object provided via an argument require
6052     * this to be true and invalidate the object pointed to by inner.
6053     */
6054    bool is_owned;
6055 } LDKChannelInfo;
6056
6057 /**
6058  * The contents of CResult_ChannelInfoDecodeErrorZ
6059  */
6060 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
6061    /**
6062     * A pointer to the contents in the success state.
6063     * Reading from this pointer when `result_ok` is not set is undefined.
6064     */
6065    struct LDKChannelInfo *result;
6066    /**
6067     * A pointer to the contents in the error state.
6068     * Reading from this pointer when `result_ok` is set is undefined.
6069     */
6070    struct LDKDecodeError *err;
6071 } LDKCResult_ChannelInfoDecodeErrorZPtr;
6072
6073 /**
6074  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
6075  * containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6076  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6077  */
6078 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
6079    /**
6080     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
6081     * `err` or `result` depending on the state of `result_ok`.
6082     */
6083    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
6084    /**
6085     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
6086     */
6087    bool result_ok;
6088 } LDKCResult_ChannelInfoDecodeErrorZ;
6089
6090
6091
6092 /**
6093  * Fees for routing via a given channel or a node
6094  */
6095 typedef struct MUST_USE_STRUCT LDKRoutingFees {
6096    /**
6097     * A pointer to the opaque Rust object.
6098     * Nearly everywhere, inner must be non-null, however in places where
6099     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6100     */
6101    LDKnativeRoutingFees *inner;
6102    /**
6103     * Indicates that this is the only struct which contains the same pointer.
6104     * Rust functions which take ownership of an object provided via an argument require
6105     * this to be true and invalidate the object pointed to by inner.
6106     */
6107    bool is_owned;
6108 } LDKRoutingFees;
6109
6110 /**
6111  * The contents of CResult_RoutingFeesDecodeErrorZ
6112  */
6113 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
6114    /**
6115     * A pointer to the contents in the success state.
6116     * Reading from this pointer when `result_ok` is not set is undefined.
6117     */
6118    struct LDKRoutingFees *result;
6119    /**
6120     * A pointer to the contents in the error state.
6121     * Reading from this pointer when `result_ok` is set is undefined.
6122     */
6123    struct LDKDecodeError *err;
6124 } LDKCResult_RoutingFeesDecodeErrorZPtr;
6125
6126 /**
6127  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
6128  * containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
6129  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6130  */
6131 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
6132    /**
6133     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
6134     * `err` or `result` depending on the state of `result_ok`.
6135     */
6136    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
6137    /**
6138     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
6139     */
6140    bool result_ok;
6141 } LDKCResult_RoutingFeesDecodeErrorZ;
6142
6143 /**
6144  * A 4-byte byte array.
6145  */
6146 typedef struct LDKFourBytes {
6147    /**
6148     * The four bytes
6149     */
6150    uint8_t data[4];
6151 } LDKFourBytes;
6152
6153 /**
6154  * A 12-byte byte array.
6155  */
6156 typedef struct LDKTwelveBytes {
6157    /**
6158     * The twelve bytes
6159     */
6160    uint8_t data[12];
6161 } LDKTwelveBytes;
6162
6163
6164
6165 /**
6166  * Represents a hostname for serialization purposes.
6167  * Only the character set and length will be validated.
6168  * The character set consists of ASCII alphanumeric characters, hyphens, and periods.
6169  * Its length is guaranteed to be representable by a single byte.
6170  * This serialization is used by BOLT 7 hostnames.
6171  */
6172 typedef struct MUST_USE_STRUCT LDKHostname {
6173    /**
6174     * A pointer to the opaque Rust object.
6175     * Nearly everywhere, inner must be non-null, however in places where
6176     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6177     */
6178    LDKnativeHostname *inner;
6179    /**
6180     * Indicates that this is the only struct which contains the same pointer.
6181     * Rust functions which take ownership of an object provided via an argument require
6182     * this to be true and invalidate the object pointed to by inner.
6183     */
6184    bool is_owned;
6185 } LDKHostname;
6186
6187 /**
6188  * An address which can be used to connect to a remote peer
6189  */
6190 typedef enum LDKNetAddress_Tag {
6191    /**
6192     * An IPv4 address/port on which the peer is listening.
6193     */
6194    LDKNetAddress_IPv4,
6195    /**
6196     * An IPv6 address/port on which the peer is listening.
6197     */
6198    LDKNetAddress_IPv6,
6199    /**
6200     * An old-style Tor onion address/port on which the peer is listening.
6201     *
6202     * This field is deprecated and the Tor network generally no longer supports V2 Onion
6203     * addresses. Thus, the details are not parsed here.
6204     */
6205    LDKNetAddress_OnionV2,
6206    /**
6207     * A new-style Tor onion address/port on which the peer is listening.
6208     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
6209     * wrap as base32 and append \".onion\".
6210     */
6211    LDKNetAddress_OnionV3,
6212    /**
6213     * A hostname/port on which the peer is listening.
6214     */
6215    LDKNetAddress_Hostname,
6216    /**
6217     * Must be last for serialization purposes
6218     */
6219    LDKNetAddress_Sentinel,
6220 } LDKNetAddress_Tag;
6221
6222 typedef struct LDKNetAddress_LDKIPv4_Body {
6223    /**
6224     * The 4-byte IPv4 address
6225     */
6226    struct LDKFourBytes addr;
6227    /**
6228     * The port on which the node is listening
6229     */
6230    uint16_t port;
6231 } LDKNetAddress_LDKIPv4_Body;
6232
6233 typedef struct LDKNetAddress_LDKIPv6_Body {
6234    /**
6235     * The 16-byte IPv6 address
6236     */
6237    struct LDKSixteenBytes addr;
6238    /**
6239     * The port on which the node is listening
6240     */
6241    uint16_t port;
6242 } LDKNetAddress_LDKIPv6_Body;
6243
6244 typedef struct LDKNetAddress_LDKOnionV3_Body {
6245    /**
6246     * The ed25519 long-term public key of the peer
6247     */
6248    struct LDKThirtyTwoBytes ed25519_pubkey;
6249    /**
6250     * The checksum of the pubkey and version, as included in the onion address
6251     */
6252    uint16_t checksum;
6253    /**
6254     * The version byte, as defined by the Tor Onion v3 spec.
6255     */
6256    uint8_t version;
6257    /**
6258     * The port on which the node is listening
6259     */
6260    uint16_t port;
6261 } LDKNetAddress_LDKOnionV3_Body;
6262
6263 typedef struct LDKNetAddress_LDKHostname_Body {
6264    /**
6265     * The hostname on which the node is listening.
6266     */
6267    struct LDKHostname hostname;
6268    /**
6269     * The port on which the node is listening.
6270     */
6271    uint16_t port;
6272 } LDKNetAddress_LDKHostname_Body;
6273
6274 typedef struct MUST_USE_STRUCT LDKNetAddress {
6275    LDKNetAddress_Tag tag;
6276    union {
6277       LDKNetAddress_LDKIPv4_Body i_pv4;
6278       LDKNetAddress_LDKIPv6_Body i_pv6;
6279       struct {
6280          struct LDKTwelveBytes onion_v2;
6281       };
6282       LDKNetAddress_LDKOnionV3_Body onion_v3;
6283       LDKNetAddress_LDKHostname_Body hostname;
6284    };
6285 } LDKNetAddress;
6286
6287 /**
6288  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6289  * This corresponds to std::vector in C++
6290  */
6291 typedef struct LDKCVec_NetAddressZ {
6292    /**
6293     * The elements in the array.
6294     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6295     */
6296    struct LDKNetAddress *data;
6297    /**
6298     * The number of elements pointed to by `data`.
6299     */
6300    uintptr_t datalen;
6301 } LDKCVec_NetAddressZ;
6302
6303
6304
6305 /**
6306  * Information received in the latest node_announcement from this node.
6307  */
6308 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
6309    /**
6310     * A pointer to the opaque Rust object.
6311     * Nearly everywhere, inner must be non-null, however in places where
6312     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6313     */
6314    LDKnativeNodeAnnouncementInfo *inner;
6315    /**
6316     * Indicates that this is the only struct which contains the same pointer.
6317     * Rust functions which take ownership of an object provided via an argument require
6318     * this to be true and invalidate the object pointed to by inner.
6319     */
6320    bool is_owned;
6321 } LDKNodeAnnouncementInfo;
6322
6323 /**
6324  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
6325  */
6326 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
6327    /**
6328     * A pointer to the contents in the success state.
6329     * Reading from this pointer when `result_ok` is not set is undefined.
6330     */
6331    struct LDKNodeAnnouncementInfo *result;
6332    /**
6333     * A pointer to the contents in the error state.
6334     * Reading from this pointer when `result_ok` is set is undefined.
6335     */
6336    struct LDKDecodeError *err;
6337 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
6338
6339 /**
6340  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
6341  * containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6342  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6343  */
6344 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
6345    /**
6346     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
6347     * `err` or `result` depending on the state of `result_ok`.
6348     */
6349    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
6350    /**
6351     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
6352     */
6353    bool result_ok;
6354 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
6355
6356
6357
6358 /**
6359  * A user-defined name for a node, which may be used when displaying the node in a graph.
6360  *
6361  * Since node aliases are provided by third parties, they are a potential avenue for injection
6362  * attacks. Care must be taken when processing.
6363  */
6364 typedef struct MUST_USE_STRUCT LDKNodeAlias {
6365    /**
6366     * A pointer to the opaque Rust object.
6367     * Nearly everywhere, inner must be non-null, however in places where
6368     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6369     */
6370    LDKnativeNodeAlias *inner;
6371    /**
6372     * Indicates that this is the only struct which contains the same pointer.
6373     * Rust functions which take ownership of an object provided via an argument require
6374     * this to be true and invalidate the object pointed to by inner.
6375     */
6376    bool is_owned;
6377 } LDKNodeAlias;
6378
6379 /**
6380  * The contents of CResult_NodeAliasDecodeErrorZ
6381  */
6382 typedef union LDKCResult_NodeAliasDecodeErrorZPtr {
6383    /**
6384     * A pointer to the contents in the success state.
6385     * Reading from this pointer when `result_ok` is not set is undefined.
6386     */
6387    struct LDKNodeAlias *result;
6388    /**
6389     * A pointer to the contents in the error state.
6390     * Reading from this pointer when `result_ok` is set is undefined.
6391     */
6392    struct LDKDecodeError *err;
6393 } LDKCResult_NodeAliasDecodeErrorZPtr;
6394
6395 /**
6396  * A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
6397  * containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
6398  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6399  */
6400 typedef struct LDKCResult_NodeAliasDecodeErrorZ {
6401    /**
6402     * The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
6403     * `err` or `result` depending on the state of `result_ok`.
6404     */
6405    union LDKCResult_NodeAliasDecodeErrorZPtr contents;
6406    /**
6407     * Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
6408     */
6409    bool result_ok;
6410 } LDKCResult_NodeAliasDecodeErrorZ;
6411
6412
6413
6414 /**
6415  * Details about a node in the network, known from the network announcement.
6416  */
6417 typedef struct MUST_USE_STRUCT LDKNodeInfo {
6418    /**
6419     * A pointer to the opaque Rust object.
6420     * Nearly everywhere, inner must be non-null, however in places where
6421     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6422     */
6423    LDKnativeNodeInfo *inner;
6424    /**
6425     * Indicates that this is the only struct which contains the same pointer.
6426     * Rust functions which take ownership of an object provided via an argument require
6427     * this to be true and invalidate the object pointed to by inner.
6428     */
6429    bool is_owned;
6430 } LDKNodeInfo;
6431
6432 /**
6433  * The contents of CResult_NodeInfoDecodeErrorZ
6434  */
6435 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
6436    /**
6437     * A pointer to the contents in the success state.
6438     * Reading from this pointer when `result_ok` is not set is undefined.
6439     */
6440    struct LDKNodeInfo *result;
6441    /**
6442     * A pointer to the contents in the error state.
6443     * Reading from this pointer when `result_ok` is set is undefined.
6444     */
6445    struct LDKDecodeError *err;
6446 } LDKCResult_NodeInfoDecodeErrorZPtr;
6447
6448 /**
6449  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
6450  * containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6451  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6452  */
6453 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
6454    /**
6455     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
6456     * `err` or `result` depending on the state of `result_ok`.
6457     */
6458    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
6459    /**
6460     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
6461     */
6462    bool result_ok;
6463 } LDKCResult_NodeInfoDecodeErrorZ;
6464
6465 /**
6466  * The contents of CResult_NetworkGraphDecodeErrorZ
6467  */
6468 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
6469    /**
6470     * A pointer to the contents in the success state.
6471     * Reading from this pointer when `result_ok` is not set is undefined.
6472     */
6473    struct LDKNetworkGraph *result;
6474    /**
6475     * A pointer to the contents in the error state.
6476     * Reading from this pointer when `result_ok` is set is undefined.
6477     */
6478    struct LDKDecodeError *err;
6479 } LDKCResult_NetworkGraphDecodeErrorZPtr;
6480
6481 /**
6482  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
6483  * containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
6484  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6485  */
6486 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
6487    /**
6488     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
6489     * `err` or `result` depending on the state of `result_ok`.
6490     */
6491    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
6492    /**
6493     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
6494     */
6495    bool result_ok;
6496 } LDKCResult_NetworkGraphDecodeErrorZ;
6497
6498 /**
6499  * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
6500  */
6501 typedef enum LDKCOption_CVec_NetAddressZZ_Tag {
6502    /**
6503     * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
6504     */
6505    LDKCOption_CVec_NetAddressZZ_Some,
6506    /**
6507     * When we're in this state, this COption_CVec_NetAddressZZ contains nothing
6508     */
6509    LDKCOption_CVec_NetAddressZZ_None,
6510    /**
6511     * Must be last for serialization purposes
6512     */
6513    LDKCOption_CVec_NetAddressZZ_Sentinel,
6514 } LDKCOption_CVec_NetAddressZZ_Tag;
6515
6516 typedef struct LDKCOption_CVec_NetAddressZZ {
6517    LDKCOption_CVec_NetAddressZZ_Tag tag;
6518    union {
6519       struct {
6520          struct LDKCVec_NetAddressZ some;
6521       };
6522    };
6523 } LDKCOption_CVec_NetAddressZZ;
6524
6525 /**
6526  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
6527  */
6528 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6529    /**
6530     * A pointer to the contents in the success state.
6531     * Reading from this pointer when `result_ok` is not set is undefined.
6532     */
6533    struct LDKDelayedPaymentOutputDescriptor *result;
6534    /**
6535     * A pointer to the contents in the error state.
6536     * Reading from this pointer when `result_ok` is set is undefined.
6537     */
6538    struct LDKDecodeError *err;
6539 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
6540
6541 /**
6542  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6543  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6544  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6545  */
6546 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6547    /**
6548     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
6549     * `err` or `result` depending on the state of `result_ok`.
6550     */
6551    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
6552    /**
6553     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
6554     */
6555    bool result_ok;
6556 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
6557
6558 /**
6559  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
6560  */
6561 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6562    /**
6563     * A pointer to the contents in the success state.
6564     * Reading from this pointer when `result_ok` is not set is undefined.
6565     */
6566    struct LDKStaticPaymentOutputDescriptor *result;
6567    /**
6568     * A pointer to the contents in the error state.
6569     * Reading from this pointer when `result_ok` is set is undefined.
6570     */
6571    struct LDKDecodeError *err;
6572 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
6573
6574 /**
6575  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6576  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6577  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6578  */
6579 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6580    /**
6581     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
6582     * `err` or `result` depending on the state of `result_ok`.
6583     */
6584    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
6585    /**
6586     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
6587     */
6588    bool result_ok;
6589 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
6590
6591 /**
6592  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
6593  */
6594 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
6595    /**
6596     * A pointer to the contents in the success state.
6597     * Reading from this pointer when `result_ok` is not set is undefined.
6598     */
6599    struct LDKSpendableOutputDescriptor *result;
6600    /**
6601     * A pointer to the contents in the error state.
6602     * Reading from this pointer when `result_ok` is set is undefined.
6603     */
6604    struct LDKDecodeError *err;
6605 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
6606
6607 /**
6608  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6609  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6610  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6611  */
6612 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
6613    /**
6614     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
6615     * `err` or `result` depending on the state of `result_ok`.
6616     */
6617    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
6618    /**
6619     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
6620     */
6621    bool result_ok;
6622 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
6623
6624 /**
6625  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
6626  * This corresponds to std::vector in C++
6627  */
6628 typedef struct LDKCVec_PaymentPreimageZ {
6629    /**
6630     * The elements in the array.
6631     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6632     */
6633    struct LDKThirtyTwoBytes *data;
6634    /**
6635     * The number of elements pointed to by `data`.
6636     */
6637    uintptr_t datalen;
6638 } LDKCVec_PaymentPreimageZ;
6639
6640 /**
6641  * A tuple of 2 elements. See the individual fields for the types contained.
6642  */
6643 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
6644    /**
6645     * The element at position 0
6646     */
6647    struct LDKSignature a;
6648    /**
6649     * The element at position 1
6650     */
6651    struct LDKCVec_SignatureZ b;
6652 } LDKC2Tuple_SignatureCVec_SignatureZZ;
6653
6654 /**
6655  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
6656  */
6657 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6658    /**
6659     * A pointer to the contents in the success state.
6660     * Reading from this pointer when `result_ok` is not set is undefined.
6661     */
6662    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
6663    /**
6664     * Note that this value is always NULL, as there are no contents in the Err variant
6665     */
6666    void *err;
6667 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
6668
6669 /**
6670  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
6671  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
6672  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6673  */
6674 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6675    /**
6676     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
6677     * `err` or `result` depending on the state of `result_ok`.
6678     */
6679    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
6680    /**
6681     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
6682     */
6683    bool result_ok;
6684 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
6685
6686 /**
6687  * The contents of CResult_SignatureNoneZ
6688  */
6689 typedef union LDKCResult_SignatureNoneZPtr {
6690    /**
6691     * A pointer to the contents in the success state.
6692     * Reading from this pointer when `result_ok` is not set is undefined.
6693     */
6694    struct LDKSignature *result;
6695    /**
6696     * Note that this value is always NULL, as there are no contents in the Err variant
6697     */
6698    void *err;
6699 } LDKCResult_SignatureNoneZPtr;
6700
6701 /**
6702  * A CResult_SignatureNoneZ represents the result of a fallible operation,
6703  * containing a crate::c_types::Signature on success and a () on failure.
6704  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6705  */
6706 typedef struct LDKCResult_SignatureNoneZ {
6707    /**
6708     * The contents of this CResult_SignatureNoneZ, accessible via either
6709     * `err` or `result` depending on the state of `result_ok`.
6710     */
6711    union LDKCResult_SignatureNoneZPtr contents;
6712    /**
6713     * Whether this CResult_SignatureNoneZ represents a success state.
6714     */
6715    bool result_ok;
6716 } LDKCResult_SignatureNoneZ;
6717
6718 /**
6719  * A tuple of 2 elements. See the individual fields for the types contained.
6720  */
6721 typedef struct LDKC2Tuple_SignatureSignatureZ {
6722    /**
6723     * The element at position 0
6724     */
6725    struct LDKSignature a;
6726    /**
6727     * The element at position 1
6728     */
6729    struct LDKSignature b;
6730 } LDKC2Tuple_SignatureSignatureZ;
6731
6732 /**
6733  * The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
6734  */
6735 typedef union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr {
6736    /**
6737     * A pointer to the contents in the success state.
6738     * Reading from this pointer when `result_ok` is not set is undefined.
6739     */
6740    struct LDKC2Tuple_SignatureSignatureZ *result;
6741    /**
6742     * Note that this value is always NULL, as there are no contents in the Err variant
6743     */
6744    void *err;
6745 } LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr;
6746
6747 /**
6748  * A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
6749  * containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
6750  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6751  */
6752 typedef struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ {
6753    /**
6754     * The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
6755     * `err` or `result` depending on the state of `result_ok`.
6756     */
6757    union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr contents;
6758    /**
6759     * Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
6760     */
6761    bool result_ok;
6762 } LDKCResult_C2Tuple_SignatureSignatureZNoneZ;
6763
6764 /**
6765  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
6766  */
6767 typedef struct LDKSecretKey {
6768    /**
6769     * The bytes of the secret key
6770     */
6771    uint8_t bytes[32];
6772 } LDKSecretKey;
6773
6774 /**
6775  * The contents of CResult_SecretKeyNoneZ
6776  */
6777 typedef union LDKCResult_SecretKeyNoneZPtr {
6778    /**
6779     * A pointer to the contents in the success state.
6780     * Reading from this pointer when `result_ok` is not set is undefined.
6781     */
6782    struct LDKSecretKey *result;
6783    /**
6784     * Note that this value is always NULL, as there are no contents in the Err variant
6785     */
6786    void *err;
6787 } LDKCResult_SecretKeyNoneZPtr;
6788
6789 /**
6790  * A CResult_SecretKeyNoneZ represents the result of a fallible operation,
6791  * containing a crate::c_types::SecretKey on success and a () on failure.
6792  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6793  */
6794 typedef struct LDKCResult_SecretKeyNoneZ {
6795    /**
6796     * The contents of this CResult_SecretKeyNoneZ, accessible via either
6797     * `err` or `result` depending on the state of `result_ok`.
6798     */
6799    union LDKCResult_SecretKeyNoneZPtr contents;
6800    /**
6801     * Whether this CResult_SecretKeyNoneZ represents a success state.
6802     */
6803    bool result_ok;
6804 } LDKCResult_SecretKeyNoneZ;
6805
6806 /**
6807  * The contents of CResult_PublicKeyNoneZ
6808  */
6809 typedef union LDKCResult_PublicKeyNoneZPtr {
6810    /**
6811     * A pointer to the contents in the success state.
6812     * Reading from this pointer when `result_ok` is not set is undefined.
6813     */
6814    struct LDKPublicKey *result;
6815    /**
6816     * Note that this value is always NULL, as there are no contents in the Err variant
6817     */
6818    void *err;
6819 } LDKCResult_PublicKeyNoneZPtr;
6820
6821 /**
6822  * A CResult_PublicKeyNoneZ represents the result of a fallible operation,
6823  * containing a crate::c_types::PublicKey on success and a () on failure.
6824  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6825  */
6826 typedef struct LDKCResult_PublicKeyNoneZ {
6827    /**
6828     * The contents of this CResult_PublicKeyNoneZ, accessible via either
6829     * `err` or `result` depending on the state of `result_ok`.
6830     */
6831    union LDKCResult_PublicKeyNoneZPtr contents;
6832    /**
6833     * Whether this CResult_PublicKeyNoneZ represents a success state.
6834     */
6835    bool result_ok;
6836 } LDKCResult_PublicKeyNoneZ;
6837
6838 /**
6839  * An enum which can either contain a crate::c_types::BigEndianScalar or not
6840  */
6841 typedef enum LDKCOption_ScalarZ_Tag {
6842    /**
6843     * When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar
6844     */
6845    LDKCOption_ScalarZ_Some,
6846    /**
6847     * When we're in this state, this COption_ScalarZ contains nothing
6848     */
6849    LDKCOption_ScalarZ_None,
6850    /**
6851     * Must be last for serialization purposes
6852     */
6853    LDKCOption_ScalarZ_Sentinel,
6854 } LDKCOption_ScalarZ_Tag;
6855
6856 typedef struct LDKCOption_ScalarZ {
6857    LDKCOption_ScalarZ_Tag tag;
6858    union {
6859       struct {
6860          struct LDKBigEndianScalar some;
6861       };
6862    };
6863 } LDKCOption_ScalarZ;
6864
6865 /**
6866  * The contents of CResult_SharedSecretNoneZ
6867  */
6868 typedef union LDKCResult_SharedSecretNoneZPtr {
6869    /**
6870     * A pointer to the contents in the success state.
6871     * Reading from this pointer when `result_ok` is not set is undefined.
6872     */
6873    struct LDKThirtyTwoBytes *result;
6874    /**
6875     * Note that this value is always NULL, as there are no contents in the Err variant
6876     */
6877    void *err;
6878 } LDKCResult_SharedSecretNoneZPtr;
6879
6880 /**
6881  * A CResult_SharedSecretNoneZ represents the result of a fallible operation,
6882  * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6883  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6884  */
6885 typedef struct LDKCResult_SharedSecretNoneZ {
6886    /**
6887     * The contents of this CResult_SharedSecretNoneZ, accessible via either
6888     * `err` or `result` depending on the state of `result_ok`.
6889     */
6890    union LDKCResult_SharedSecretNoneZPtr contents;
6891    /**
6892     * Whether this CResult_SharedSecretNoneZ represents a success state.
6893     */
6894    bool result_ok;
6895 } LDKCResult_SharedSecretNoneZ;
6896
6897
6898
6899 /**
6900  * This class tracks the per-transaction information needed to build a closing transaction and will
6901  * actually build it and sign.
6902  *
6903  * This class can be used inside a signer implementation to generate a signature given the relevant
6904  * secret key.
6905  */
6906 typedef struct MUST_USE_STRUCT LDKClosingTransaction {
6907    /**
6908     * A pointer to the opaque Rust object.
6909     * Nearly everywhere, inner must be non-null, however in places where
6910     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6911     */
6912    LDKnativeClosingTransaction *inner;
6913    /**
6914     * Indicates that this is the only struct which contains the same pointer.
6915     * Rust functions which take ownership of an object provided via an argument require
6916     * this to be true and invalidate the object pointed to by inner.
6917     */
6918    bool is_owned;
6919 } LDKClosingTransaction;
6920
6921
6922
6923 /**
6924  * The unsigned part of a channel_announcement
6925  */
6926 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
6927    /**
6928     * A pointer to the opaque Rust object.
6929     * Nearly everywhere, inner must be non-null, however in places where
6930     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6931     */
6932    LDKnativeUnsignedChannelAnnouncement *inner;
6933    /**
6934     * Indicates that this is the only struct which contains the same pointer.
6935     * Rust functions which take ownership of an object provided via an argument require
6936     * this to be true and invalidate the object pointed to by inner.
6937     */
6938    bool is_owned;
6939 } LDKUnsignedChannelAnnouncement;
6940
6941 /**
6942  * A trait to sign Lightning channel transactions as described in
6943  * [BOLT 3](https://github.com/lightning/bolts/blob/master/03-transactions.md).
6944  *
6945  * Signing services could be implemented on a hardware wallet and should implement signing
6946  * policies in order to be secure. Please refer to the [VLS Policy
6947  * Controls](https://gitlab.com/lightning-signer/validating-lightning-signer/-/blob/main/docs/policy-controls.md)
6948  * for an example of such policies.
6949  */
6950 typedef struct LDKBaseSign {
6951    /**
6952     * An opaque pointer which is passed to your function implementations as an argument.
6953     * This has no meaning in the LDK, and can be NULL or any other value.
6954     */
6955    void *this_arg;
6956    /**
6957     * Gets the per-commitment point for a specific commitment number
6958     *
6959     * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards.
6960     */
6961    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
6962    /**
6963     * Gets the commitment secret for a specific commitment number as part of the revocation process
6964     *
6965     * An external signer implementation should error here if the commitment was already signed
6966     * and should refuse to sign it in the future.
6967     *
6968     * May be called more than once for the same index.
6969     *
6970     * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards.
6971     */
6972    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
6973    /**
6974     * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
6975     *
6976     * This is required in order for the signer to make sure that releasing a commitment
6977     * secret won't leave us without a broadcastable holder transaction.
6978     * Policy checks should be implemented in this function, including checking the amount
6979     * sent to us and checking the HTLCs.
6980     *
6981     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
6982     * A validating signer should ensure that an HTLC output is removed only when the matching
6983     * preimage is provided, or when the value to holder is restored.
6984     *
6985     * Note that all the relevant preimages will be provided, but there may also be additional
6986     * irrelevant or duplicate preimages.
6987     */
6988    struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages);
6989    /**
6990     * Returns the holder's channel public keys and basepoints.
6991     */
6992    struct LDKChannelPublicKeys pubkeys;
6993    /**
6994     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
6995     * Note that this takes a pointer to this object, not the this_ptr like other methods do
6996     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
6997     */
6998    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
6999    /**
7000     * Returns an arbitrary identifier describing the set of keys which are provided back to you in
7001     * some [`SpendableOutputDescriptor`] types. This should be sufficient to identify this
7002     * [`BaseSign`] object uniquely and lookup or re-derive its keys.
7003     */
7004    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
7005    /**
7006     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
7007     *
7008     * Note that if signing fails or is rejected, the channel will be force-closed.
7009     *
7010     * Policy checks should be implemented in this function, including checking the amount
7011     * sent to us and checking the HTLCs.
7012     *
7013     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
7014     * A validating signer should ensure that an HTLC output is removed only when the matching
7015     * preimage is provided, or when the value to holder is restored.
7016     *
7017     * Note that all the relevant preimages will be provided, but there may also be additional
7018     * irrelevant or duplicate preimages.
7019     */
7020    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages);
7021    /**
7022     * Validate the counterparty's revocation.
7023     *
7024     * This is required in order for the signer to make sure that the state has moved
7025     * forward and it is safe to sign the next counterparty commitment.
7026     */
7027    struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
7028    /**
7029     * Creates a signature for a holder's commitment transaction and its claiming HTLC transactions.
7030     *
7031     * This will be called
7032     * - with a non-revoked `commitment_tx`.
7033     * - with the latest `commitment_tx` when we initiate a force-close.
7034     * - with the previous `commitment_tx`, just to get claiming HTLC
7035     *   signatures, if we are reacting to a [`ChannelMonitor`]
7036     *   [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas)
7037     *   that decided to broadcast before it had been updated to the latest `commitment_tx`.
7038     *
7039     * This may be called multiple times for the same transaction.
7040     *
7041     * An external signer implementation should check that the commitment has not been revoked.
7042     *
7043     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
7044     */
7045    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
7046    /**
7047     * Create a signature for the given input in a transaction spending an HTLC transaction output
7048     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
7049     *
7050     * A justice transaction may claim multiple outputs at the same time if timelocks are
7051     * similar, but only a signature for the input at index `input` should be signed for here.
7052     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
7053     * to an upcoming timelock expiration.
7054     *
7055     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
7056     *
7057     * `per_commitment_key` is revocation secret which was provided by our counterparty when they
7058     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
7059     * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do
7060     * so).
7061     */
7062    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]);
7063    /**
7064     * Create a signature for the given input in a transaction spending a commitment transaction
7065     * HTLC output when our counterparty broadcasts an old state.
7066     *
7067     * A justice transaction may claim multiple outputs at the same time if timelocks are
7068     * similar, but only a signature for the input at index `input` should be signed for here.
7069     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
7070     * to an upcoming timelock expiration.
7071     *
7072     * `amount` is the value of the output spent by this input, committed to in the BIP 143
7073     * signature.
7074     *
7075     * `per_commitment_key` is revocation secret which was provided by our counterparty when they
7076     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
7077     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
7078     * so).
7079     *
7080     * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script
7081     * (which is committed to in the BIP 143 signatures).
7082     */
7083    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);
7084    /**
7085     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
7086     * transaction, either offered or received.
7087     *
7088     * Such a transaction may claim multiples offered outputs at same time if we know the
7089     * preimage for each when we create it, but only the input at index `input` should be
7090     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
7091     * needed with regards to an upcoming timelock expiration.
7092     *
7093     * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC
7094     * outputs.
7095     *
7096     * `amount` is value of the output spent by this input, committed to in the BIP 143 signature.
7097     *
7098     * `per_commitment_point` is the dynamic point corresponding to the channel state
7099     * detected onchain. It has been generated by our counterparty and is used to derive
7100     * channel state keys, which are then included in the witness script and committed to in the
7101     * BIP 143 signature.
7102     */
7103    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);
7104    /**
7105     * Create a signature for a (proposed) closing transaction.
7106     *
7107     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
7108     * chosen to forgo their output as dust.
7109     */
7110    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
7111    /**
7112     * Computes the signature for a commitment transaction's anchor output used as an
7113     * input within `anchor_tx`, which spends the commitment transaction, at index `input`.
7114     */
7115    struct LDKCResult_SignatureNoneZ (*sign_holder_anchor_input)(const void *this_arg, struct LDKTransaction anchor_tx, uintptr_t input);
7116    /**
7117     * Signs a channel announcement message with our funding key and our node secret key (aka
7118     * node_id or network_key), proving it comes from one of the channel participants.
7119     *
7120     * The first returned signature should be from our node secret key, the second from our
7121     * funding key.
7122     *
7123     * Note that if this fails or is rejected, the channel will not be publicly announced and
7124     * our counterparty may (though likely will not) close the channel on us for violating the
7125     * protocol.
7126     */
7127    struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
7128    /**
7129     * Set the counterparty static channel data, including basepoints,
7130     * `counterparty_selected`/`holder_selected_contest_delay` and funding outpoint. Since these
7131     * are static channel data, they MUST NOT be allowed to change to different values once set,
7132     * as LDK may call this method more than once.
7133     *
7134     * channel_parameters.is_populated() MUST be true.
7135     */
7136    void (*provide_channel_parameters)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
7137    /**
7138     * Frees any resources associated with this object given its this_arg pointer.
7139     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7140     */
7141    void (*free)(void *this_arg);
7142 } LDKBaseSign;
7143
7144 /**
7145  * A writeable signer.
7146  *
7147  * There will always be two instances of a signer per channel, one occupied by the
7148  * [`ChannelManager`] and another by the channel's [`ChannelMonitor`].
7149  *
7150  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
7151  * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
7152  */
7153 typedef struct LDKSign {
7154    /**
7155     * An opaque pointer which is passed to your function implementations as an argument.
7156     * This has no meaning in the LDK, and can be NULL or any other value.
7157     */
7158    void *this_arg;
7159    /**
7160     * Implementation of BaseSign for this object.
7161     */
7162    struct LDKBaseSign BaseSign;
7163    /**
7164     * Serialize the object into a byte array
7165     */
7166    struct LDKCVec_u8Z (*write)(const void *this_arg);
7167    /**
7168     * Frees any resources associated with this object given its this_arg pointer.
7169     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7170     */
7171    void (*free)(void *this_arg);
7172 } LDKSign;
7173
7174 /**
7175  * The contents of CResult_SignDecodeErrorZ
7176  */
7177 typedef union LDKCResult_SignDecodeErrorZPtr {
7178    /**
7179     * A pointer to the contents in the success state.
7180     * Reading from this pointer when `result_ok` is not set is undefined.
7181     */
7182    struct LDKSign *result;
7183    /**
7184     * A pointer to the contents in the error state.
7185     * Reading from this pointer when `result_ok` is set is undefined.
7186     */
7187    struct LDKDecodeError *err;
7188 } LDKCResult_SignDecodeErrorZPtr;
7189
7190 /**
7191  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
7192  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
7193  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7194  */
7195 typedef struct LDKCResult_SignDecodeErrorZ {
7196    /**
7197     * The contents of this CResult_SignDecodeErrorZ, accessible via either
7198     * `err` or `result` depending on the state of `result_ok`.
7199     */
7200    union LDKCResult_SignDecodeErrorZPtr contents;
7201    /**
7202     * Whether this CResult_SignDecodeErrorZ represents a success state.
7203     */
7204    bool result_ok;
7205 } LDKCResult_SignDecodeErrorZ;
7206
7207 /**
7208  * Integer in the range `0..32`
7209  */
7210 typedef struct LDKU5 {
7211    uint8_t _0;
7212 } LDKU5;
7213
7214 /**
7215  * A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
7216  * This corresponds to std::vector in C++
7217  */
7218 typedef struct LDKCVec_U5Z {
7219    /**
7220     * The elements in the array.
7221     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7222     */
7223    struct LDKU5 *data;
7224    /**
7225     * The number of elements pointed to by `data`.
7226     */
7227    uintptr_t datalen;
7228 } LDKCVec_U5Z;
7229
7230 /**
7231  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
7232  * allows recovering the exact public key which created the signature given the message.
7233  */
7234 typedef struct LDKRecoverableSignature {
7235    /**
7236     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
7237     * recovery.
7238     */
7239    uint8_t serialized_form[68];
7240 } LDKRecoverableSignature;
7241
7242 /**
7243  * The contents of CResult_RecoverableSignatureNoneZ
7244  */
7245 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
7246    /**
7247     * A pointer to the contents in the success state.
7248     * Reading from this pointer when `result_ok` is not set is undefined.
7249     */
7250    struct LDKRecoverableSignature *result;
7251    /**
7252     * Note that this value is always NULL, as there are no contents in the Err variant
7253     */
7254    void *err;
7255 } LDKCResult_RecoverableSignatureNoneZPtr;
7256
7257 /**
7258  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
7259  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
7260  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7261  */
7262 typedef struct LDKCResult_RecoverableSignatureNoneZ {
7263    /**
7264     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
7265     * `err` or `result` depending on the state of `result_ok`.
7266     */
7267    union LDKCResult_RecoverableSignatureNoneZPtr contents;
7268    /**
7269     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
7270     */
7271    bool result_ok;
7272 } LDKCResult_RecoverableSignatureNoneZ;
7273
7274 /**
7275  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
7276  * This corresponds to std::vector in C++
7277  */
7278 typedef struct LDKCVec_CVec_u8ZZ {
7279    /**
7280     * The elements in the array.
7281     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7282     */
7283    struct LDKCVec_u8Z *data;
7284    /**
7285     * The number of elements pointed to by `data`.
7286     */
7287    uintptr_t datalen;
7288 } LDKCVec_CVec_u8ZZ;
7289
7290 /**
7291  * The contents of CResult_CVec_CVec_u8ZZNoneZ
7292  */
7293 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
7294    /**
7295     * A pointer to the contents in the success state.
7296     * Reading from this pointer when `result_ok` is not set is undefined.
7297     */
7298    struct LDKCVec_CVec_u8ZZ *result;
7299    /**
7300     * Note that this value is always NULL, as there are no contents in the Err variant
7301     */
7302    void *err;
7303 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
7304
7305 /**
7306  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
7307  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
7308  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7309  */
7310 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
7311    /**
7312     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
7313     * `err` or `result` depending on the state of `result_ok`.
7314     */
7315    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
7316    /**
7317     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
7318     */
7319    bool result_ok;
7320 } LDKCResult_CVec_CVec_u8ZZNoneZ;
7321
7322
7323
7324 /**
7325  * A simple implementation of [`Sign`] that just keeps the private keys in memory.
7326  *
7327  * This implementation performs no policy checks and is insufficient by itself as
7328  * a secure external signer.
7329  */
7330 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
7331    /**
7332     * A pointer to the opaque Rust object.
7333     * Nearly everywhere, inner must be non-null, however in places where
7334     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7335     */
7336    LDKnativeInMemorySigner *inner;
7337    /**
7338     * Indicates that this is the only struct which contains the same pointer.
7339     * Rust functions which take ownership of an object provided via an argument require
7340     * this to be true and invalidate the object pointed to by inner.
7341     */
7342    bool is_owned;
7343 } LDKInMemorySigner;
7344
7345 /**
7346  * The contents of CResult_InMemorySignerDecodeErrorZ
7347  */
7348 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
7349    /**
7350     * A pointer to the contents in the success state.
7351     * Reading from this pointer when `result_ok` is not set is undefined.
7352     */
7353    struct LDKInMemorySigner *result;
7354    /**
7355     * A pointer to the contents in the error state.
7356     * Reading from this pointer when `result_ok` is set is undefined.
7357     */
7358    struct LDKDecodeError *err;
7359 } LDKCResult_InMemorySignerDecodeErrorZPtr;
7360
7361 /**
7362  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
7363  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
7364  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7365  */
7366 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
7367    /**
7368     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
7369     * `err` or `result` depending on the state of `result_ok`.
7370     */
7371    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
7372    /**
7373     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
7374     */
7375    bool result_ok;
7376 } LDKCResult_InMemorySignerDecodeErrorZ;
7377
7378 /**
7379  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
7380  * This corresponds to std::vector in C++
7381  */
7382 typedef struct LDKCVec_TxOutZ {
7383    /**
7384     * The elements in the array.
7385     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7386     */
7387    struct LDKTxOut *data;
7388    /**
7389     * The number of elements pointed to by `data`.
7390     */
7391    uintptr_t datalen;
7392 } LDKCVec_TxOutZ;
7393
7394 /**
7395  * The contents of CResult_TransactionNoneZ
7396  */
7397 typedef union LDKCResult_TransactionNoneZPtr {
7398    /**
7399     * A pointer to the contents in the success state.
7400     * Reading from this pointer when `result_ok` is not set is undefined.
7401     */
7402    struct LDKTransaction *result;
7403    /**
7404     * Note that this value is always NULL, as there are no contents in the Err variant
7405     */
7406    void *err;
7407 } LDKCResult_TransactionNoneZPtr;
7408
7409 /**
7410  * A CResult_TransactionNoneZ represents the result of a fallible operation,
7411  * containing a crate::c_types::Transaction on success and a () on failure.
7412  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7413  */
7414 typedef struct LDKCResult_TransactionNoneZ {
7415    /**
7416     * The contents of this CResult_TransactionNoneZ, accessible via either
7417     * `err` or `result` depending on the state of `result_ok`.
7418     */
7419    union LDKCResult_TransactionNoneZPtr contents;
7420    /**
7421     * Whether this CResult_TransactionNoneZ represents a success state.
7422     */
7423    bool result_ok;
7424 } LDKCResult_TransactionNoneZ;
7425
7426
7427
7428 /**
7429  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
7430  * on-chain transactions to ensure no loss of funds occurs.
7431  *
7432  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
7433  * information and are actively monitoring the chain.
7434  *
7435  * Pending Events or updated HTLCs which have not yet been read out by
7436  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
7437  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
7438  * gotten are fully handled before re-serializing the new state.
7439  *
7440  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
7441  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
7442  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
7443  * returned block hash and the the current chain and then reconnecting blocks to get to the
7444  * best chain) upon deserializing the object!
7445  */
7446 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
7447    /**
7448     * A pointer to the opaque Rust object.
7449     * Nearly everywhere, inner must be non-null, however in places where
7450     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7451     */
7452    LDKnativeChannelMonitor *inner;
7453    /**
7454     * Indicates that this is the only struct which contains the same pointer.
7455     * Rust functions which take ownership of an object provided via an argument require
7456     * this to be true and invalidate the object pointed to by inner.
7457     */
7458    bool is_owned;
7459 } LDKChannelMonitor;
7460
7461 /**
7462  * A tuple of 2 elements. See the individual fields for the types contained.
7463  */
7464 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
7465    /**
7466     * The element at position 0
7467     */
7468    struct LDKThirtyTwoBytes a;
7469    /**
7470     * The element at position 1
7471     */
7472    struct LDKChannelMonitor b;
7473 } LDKC2Tuple_BlockHashChannelMonitorZ;
7474
7475 /**
7476  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
7477  * This corresponds to std::vector in C++
7478  */
7479 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
7480    /**
7481     * The elements in the array.
7482     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7483     */
7484    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
7485    /**
7486     * The number of elements pointed to by `data`.
7487     */
7488    uintptr_t datalen;
7489 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
7490
7491 /**
7492  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
7493  */
7494 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7495    /**
7496     * A pointer to the contents in the success state.
7497     * Reading from this pointer when `result_ok` is not set is undefined.
7498     */
7499    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
7500    /**
7501     * A pointer to the contents in the error state.
7502     * Reading from this pointer when `result_ok` is set is undefined.
7503     */
7504    enum LDKIOError *err;
7505 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
7506
7507 /**
7508  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
7509  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
7510  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7511  */
7512 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7513    /**
7514     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
7515     * `err` or `result` depending on the state of `result_ok`.
7516     */
7517    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
7518    /**
7519     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
7520     */
7521    bool result_ok;
7522 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
7523
7524 /**
7525  * An enum which can either contain a u16 or not
7526  */
7527 typedef enum LDKCOption_u16Z_Tag {
7528    /**
7529     * When we're in this state, this COption_u16Z contains a u16
7530     */
7531    LDKCOption_u16Z_Some,
7532    /**
7533     * When we're in this state, this COption_u16Z contains nothing
7534     */
7535    LDKCOption_u16Z_None,
7536    /**
7537     * Must be last for serialization purposes
7538     */
7539    LDKCOption_u16Z_Sentinel,
7540 } LDKCOption_u16Z_Tag;
7541
7542 typedef struct LDKCOption_u16Z {
7543    LDKCOption_u16Z_Tag tag;
7544    union {
7545       struct {
7546          uint16_t some;
7547       };
7548    };
7549 } LDKCOption_u16Z;
7550
7551 /**
7552  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
7553  * too-high values)
7554  */
7555 typedef enum LDKAPIError_Tag {
7556    /**
7557     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
7558     * are documented, but generally indicates some precondition of a function was violated.
7559     */
7560    LDKAPIError_APIMisuseError,
7561    /**
7562     * Due to a high feerate, we were unable to complete the request.
7563     * For example, this may be returned if the feerate implies we cannot open a channel at the
7564     * requested value, but opening a larger channel would succeed.
7565     */
7566    LDKAPIError_FeeRateTooHigh,
7567    /**
7568     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
7569     * too-many-hops, etc).
7570     */
7571    LDKAPIError_InvalidRoute,
7572    /**
7573     * We were unable to complete the request as the Channel required to do so is unable to
7574     * complete the request (or was not found). This can take many forms, including disconnected
7575     * peer, channel at capacity, channel shutting down, etc.
7576     */
7577    LDKAPIError_ChannelUnavailable,
7578    /**
7579     * An attempt to call [`chain::Watch::watch_channel`]/[`chain::Watch::update_channel`]
7580     * returned a [`ChannelMonitorUpdateStatus::InProgress`] indicating the persistence of a
7581     * monitor update is awaiting async resolution. Once it resolves the attempted action should
7582     * complete automatically.
7583     *
7584     * [`chain::Watch::watch_channel`]: crate::chain::Watch::watch_channel
7585     * [`chain::Watch::update_channel`]: crate::chain::Watch::update_channel
7586     * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress
7587     */
7588    LDKAPIError_MonitorUpdateInProgress,
7589    /**
7590     * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
7591     * with the channel counterparty as negotiated in [`InitFeatures`].
7592     *
7593     * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
7594     * a channel or cooperatively close one with this peer (and will have to force-close instead).
7595     *
7596     * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
7597     * [`InitFeatures`]: crate::ln::features::InitFeatures
7598     */
7599    LDKAPIError_IncompatibleShutdownScript,
7600    /**
7601     * Must be last for serialization purposes
7602     */
7603    LDKAPIError_Sentinel,
7604 } LDKAPIError_Tag;
7605
7606 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
7607    /**
7608     * A human-readable error message
7609     */
7610    struct LDKStr err;
7611 } LDKAPIError_LDKAPIMisuseError_Body;
7612
7613 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
7614    /**
7615     * A human-readable error message
7616     */
7617    struct LDKStr err;
7618    /**
7619     * The feerate which was too high.
7620     */
7621    uint32_t feerate;
7622 } LDKAPIError_LDKFeeRateTooHigh_Body;
7623
7624 typedef struct LDKAPIError_LDKInvalidRoute_Body {
7625    /**
7626     * A human-readable error message
7627     */
7628    struct LDKStr err;
7629 } LDKAPIError_LDKInvalidRoute_Body;
7630
7631 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
7632    /**
7633     * A human-readable error message
7634     */
7635    struct LDKStr err;
7636 } LDKAPIError_LDKChannelUnavailable_Body;
7637
7638 typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
7639    /**
7640     * The incompatible shutdown script.
7641     */
7642    struct LDKShutdownScript script;
7643 } LDKAPIError_LDKIncompatibleShutdownScript_Body;
7644
7645 typedef struct MUST_USE_STRUCT LDKAPIError {
7646    LDKAPIError_Tag tag;
7647    union {
7648       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
7649       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
7650       LDKAPIError_LDKInvalidRoute_Body invalid_route;
7651       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
7652       LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
7653    };
7654 } LDKAPIError;
7655
7656 /**
7657  * The contents of CResult_NoneAPIErrorZ
7658  */
7659 typedef union LDKCResult_NoneAPIErrorZPtr {
7660    /**
7661     * Note that this value is always NULL, as there are no contents in the OK variant
7662     */
7663    void *result;
7664    /**
7665     * A pointer to the contents in the error state.
7666     * Reading from this pointer when `result_ok` is set is undefined.
7667     */
7668    struct LDKAPIError *err;
7669 } LDKCResult_NoneAPIErrorZPtr;
7670
7671 /**
7672  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
7673  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
7674  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7675  */
7676 typedef struct LDKCResult_NoneAPIErrorZ {
7677    /**
7678     * The contents of this CResult_NoneAPIErrorZ, accessible via either
7679     * `err` or `result` depending on the state of `result_ok`.
7680     */
7681    union LDKCResult_NoneAPIErrorZPtr contents;
7682    /**
7683     * Whether this CResult_NoneAPIErrorZ represents a success state.
7684     */
7685    bool result_ok;
7686 } LDKCResult_NoneAPIErrorZ;
7687
7688 /**
7689  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
7690  * This corresponds to std::vector in C++
7691  */
7692 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
7693    /**
7694     * The elements in the array.
7695     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7696     */
7697    struct LDKCResult_NoneAPIErrorZ *data;
7698    /**
7699     * The number of elements pointed to by `data`.
7700     */
7701    uintptr_t datalen;
7702 } LDKCVec_CResult_NoneAPIErrorZZ;
7703
7704 /**
7705  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
7706  * This corresponds to std::vector in C++
7707  */
7708 typedef struct LDKCVec_APIErrorZ {
7709    /**
7710     * The elements in the array.
7711     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7712     */
7713    struct LDKAPIError *data;
7714    /**
7715     * The number of elements pointed to by `data`.
7716     */
7717    uintptr_t datalen;
7718 } LDKCVec_APIErrorZ;
7719
7720 /**
7721  * The contents of CResult__u832APIErrorZ
7722  */
7723 typedef union LDKCResult__u832APIErrorZPtr {
7724    /**
7725     * A pointer to the contents in the success state.
7726     * Reading from this pointer when `result_ok` is not set is undefined.
7727     */
7728    struct LDKThirtyTwoBytes *result;
7729    /**
7730     * A pointer to the contents in the error state.
7731     * Reading from this pointer when `result_ok` is set is undefined.
7732     */
7733    struct LDKAPIError *err;
7734 } LDKCResult__u832APIErrorZPtr;
7735
7736 /**
7737  * A CResult__u832APIErrorZ represents the result of a fallible operation,
7738  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7739  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7740  */
7741 typedef struct LDKCResult__u832APIErrorZ {
7742    /**
7743     * The contents of this CResult__u832APIErrorZ, accessible via either
7744     * `err` or `result` depending on the state of `result_ok`.
7745     */
7746    union LDKCResult__u832APIErrorZPtr contents;
7747    /**
7748     * Whether this CResult__u832APIErrorZ represents a success state.
7749     */
7750    bool result_ok;
7751 } LDKCResult__u832APIErrorZ;
7752
7753 /**
7754  * If a payment fails to send, it can be in one of several states. This enum is returned as the
7755  * Err() type describing which state the payment is in, see the description of individual enum
7756  * states for more.
7757  */
7758 typedef enum LDKPaymentSendFailure_Tag {
7759    /**
7760     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
7761     * send the payment at all.
7762     *
7763     * You can freely resend the payment in full (with the parameter error fixed).
7764     *
7765     * Because the payment failed outright, no payment tracking is done, you do not need to call
7766     * [`ChannelManager::abandon_payment`] and [`ChannelManager::retry_payment`] will *not* work
7767     * for this payment.
7768     */
7769    LDKPaymentSendFailure_ParameterError,
7770    /**
7771     * A parameter in a single path which was passed to send_payment was invalid, preventing us
7772     * from attempting to send the payment at all.
7773     *
7774     * You can freely resend the payment in full (with the parameter error fixed).
7775     *
7776     * The results here are ordered the same as the paths in the route object which was passed to
7777     * send_payment.
7778     *
7779     * Because the payment failed outright, no payment tracking is done, you do not need to call
7780     * [`ChannelManager::abandon_payment`] and [`ChannelManager::retry_payment`] will *not* work
7781     * for this payment.
7782     */
7783    LDKPaymentSendFailure_PathParameterError,
7784    /**
7785     * All paths which were attempted failed to send, with no channel state change taking place.
7786     * You can freely resend the payment in full (though you probably want to do so over different
7787     * paths than the ones selected).
7788     *
7789     * Because the payment failed outright, no payment tracking is done, you do not need to call
7790     * [`ChannelManager::abandon_payment`] and [`ChannelManager::retry_payment`] will *not* work
7791     * for this payment.
7792     */
7793    LDKPaymentSendFailure_AllFailedResendSafe,
7794    /**
7795     * Indicates that a payment for the provided [`PaymentId`] is already in-flight and has not
7796     * yet completed (i.e. generated an [`Event::PaymentSent`]) or been abandoned (via
7797     * [`ChannelManager::abandon_payment`]).
7798     *
7799     * [`Event::PaymentSent`]: events::Event::PaymentSent
7800     */
7801    LDKPaymentSendFailure_DuplicatePayment,
7802    /**
7803     * Some paths which were attempted failed to send, though possibly not all. At least some
7804     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
7805     * in over-/re-payment.
7806     *
7807     * The results here are ordered the same as the paths in the route object which was passed to
7808     * send_payment, and any `Err`s which are not [`APIError::MonitorUpdateInProgress`] can be
7809     * safely retried via [`ChannelManager::retry_payment`].
7810     *
7811     * Any entries which contain `Err(APIError::MonitorUpdateInprogress)` or `Ok(())` MUST NOT be
7812     * retried as they will result in over-/re-payment. These HTLCs all either successfully sent
7813     * (in the case of `Ok(())`) or will send once a [`MonitorEvent::Completed`] is provided for
7814     * the next-hop channel with the latest update_id.
7815     */
7816    LDKPaymentSendFailure_PartialFailure,
7817    /**
7818     * Must be last for serialization purposes
7819     */
7820    LDKPaymentSendFailure_Sentinel,
7821 } LDKPaymentSendFailure_Tag;
7822
7823 typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
7824    /**
7825     * The errors themselves, in the same order as the route hops.
7826     */
7827    struct LDKCVec_CResult_NoneAPIErrorZZ results;
7828    /**
7829     * If some paths failed without irrevocably committing to the new HTLC(s), this will
7830     * contain a [`RouteParameters`] object which can be used to calculate a new route that
7831     * will pay all remaining unpaid balance.
7832     *
7833     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
7834     */
7835    struct LDKRouteParameters failed_paths_retry;
7836    /**
7837     * The payment id for the payment, which is now at least partially pending.
7838     */
7839    struct LDKThirtyTwoBytes payment_id;
7840 } LDKPaymentSendFailure_LDKPartialFailure_Body;
7841
7842 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
7843    LDKPaymentSendFailure_Tag tag;
7844    union {
7845       struct {
7846          struct LDKAPIError parameter_error;
7847       };
7848       struct {
7849          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
7850       };
7851       struct {
7852          struct LDKCVec_APIErrorZ all_failed_resend_safe;
7853       };
7854       LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
7855    };
7856 } LDKPaymentSendFailure;
7857
7858 /**
7859  * The contents of CResult_NonePaymentSendFailureZ
7860  */
7861 typedef union LDKCResult_NonePaymentSendFailureZPtr {
7862    /**
7863     * Note that this value is always NULL, as there are no contents in the OK variant
7864     */
7865    void *result;
7866    /**
7867     * A pointer to the contents in the error state.
7868     * Reading from this pointer when `result_ok` is set is undefined.
7869     */
7870    struct LDKPaymentSendFailure *err;
7871 } LDKCResult_NonePaymentSendFailureZPtr;
7872
7873 /**
7874  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
7875  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7876  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7877  */
7878 typedef struct LDKCResult_NonePaymentSendFailureZ {
7879    /**
7880     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
7881     * `err` or `result` depending on the state of `result_ok`.
7882     */
7883    union LDKCResult_NonePaymentSendFailureZPtr contents;
7884    /**
7885     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
7886     */
7887    bool result_ok;
7888 } LDKCResult_NonePaymentSendFailureZ;
7889
7890 /**
7891  * The contents of CResult_PaymentHashPaymentSendFailureZ
7892  */
7893 typedef union LDKCResult_PaymentHashPaymentSendFailureZPtr {
7894    /**
7895     * A pointer to the contents in the success state.
7896     * Reading from this pointer when `result_ok` is not set is undefined.
7897     */
7898    struct LDKThirtyTwoBytes *result;
7899    /**
7900     * A pointer to the contents in the error state.
7901     * Reading from this pointer when `result_ok` is set is undefined.
7902     */
7903    struct LDKPaymentSendFailure *err;
7904 } LDKCResult_PaymentHashPaymentSendFailureZPtr;
7905
7906 /**
7907  * A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation,
7908  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7909  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7910  */
7911 typedef struct LDKCResult_PaymentHashPaymentSendFailureZ {
7912    /**
7913     * The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either
7914     * `err` or `result` depending on the state of `result_ok`.
7915     */
7916    union LDKCResult_PaymentHashPaymentSendFailureZPtr contents;
7917    /**
7918     * Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state.
7919     */
7920    bool result_ok;
7921 } LDKCResult_PaymentHashPaymentSendFailureZ;
7922
7923 /**
7924  * A tuple of 2 elements. See the individual fields for the types contained.
7925  */
7926 typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
7927    /**
7928     * The element at position 0
7929     */
7930    struct LDKThirtyTwoBytes a;
7931    /**
7932     * The element at position 1
7933     */
7934    struct LDKThirtyTwoBytes b;
7935 } LDKC2Tuple_PaymentHashPaymentIdZ;
7936
7937 /**
7938  * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
7939  */
7940 typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7941    /**
7942     * A pointer to the contents in the success state.
7943     * Reading from this pointer when `result_ok` is not set is undefined.
7944     */
7945    struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
7946    /**
7947     * A pointer to the contents in the error state.
7948     * Reading from this pointer when `result_ok` is set is undefined.
7949     */
7950    struct LDKPaymentSendFailure *err;
7951 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
7952
7953 /**
7954  * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
7955  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7956  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7957  */
7958 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7959    /**
7960     * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
7961     * `err` or `result` depending on the state of `result_ok`.
7962     */
7963    union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
7964    /**
7965     * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
7966     */
7967    bool result_ok;
7968 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
7969
7970 /**
7971  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
7972  * This corresponds to std::vector in C++
7973  */
7974 typedef struct LDKCVec_ThirtyTwoBytesZ {
7975    /**
7976     * The elements in the array.
7977     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7978     */
7979    struct LDKThirtyTwoBytes *data;
7980    /**
7981     * The number of elements pointed to by `data`.
7982     */
7983    uintptr_t datalen;
7984 } LDKCVec_ThirtyTwoBytesZ;
7985
7986 /**
7987  * A tuple of 2 elements. See the individual fields for the types contained.
7988  */
7989 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
7990    /**
7991     * The element at position 0
7992     */
7993    struct LDKThirtyTwoBytes a;
7994    /**
7995     * The element at position 1
7996     */
7997    struct LDKThirtyTwoBytes b;
7998 } LDKC2Tuple_PaymentHashPaymentSecretZ;
7999
8000 /**
8001  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
8002  */
8003 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8004    /**
8005     * A pointer to the contents in the success state.
8006     * Reading from this pointer when `result_ok` is not set is undefined.
8007     */
8008    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
8009    /**
8010     * Note that this value is always NULL, as there are no contents in the Err variant
8011     */
8012    void *err;
8013 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr;
8014
8015 /**
8016  * A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
8017  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
8018  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8019  */
8020 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8021    /**
8022     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
8023     * `err` or `result` depending on the state of `result_ok`.
8024     */
8025    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents;
8026    /**
8027     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
8028     */
8029    bool result_ok;
8030 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ;
8031
8032 /**
8033  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
8034  */
8035 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8036    /**
8037     * A pointer to the contents in the success state.
8038     * Reading from this pointer when `result_ok` is not set is undefined.
8039     */
8040    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
8041    /**
8042     * A pointer to the contents in the error state.
8043     * Reading from this pointer when `result_ok` is set is undefined.
8044     */
8045    struct LDKAPIError *err;
8046 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr;
8047
8048 /**
8049  * A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
8050  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
8051  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8052  */
8053 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8054    /**
8055     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
8056     * `err` or `result` depending on the state of `result_ok`.
8057     */
8058    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr contents;
8059    /**
8060     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
8061     */
8062    bool result_ok;
8063 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ;
8064
8065 /**
8066  * The contents of CResult_PaymentSecretNoneZ
8067  */
8068 typedef union LDKCResult_PaymentSecretNoneZPtr {
8069    /**
8070     * A pointer to the contents in the success state.
8071     * Reading from this pointer when `result_ok` is not set is undefined.
8072     */
8073    struct LDKThirtyTwoBytes *result;
8074    /**
8075     * Note that this value is always NULL, as there are no contents in the Err variant
8076     */
8077    void *err;
8078 } LDKCResult_PaymentSecretNoneZPtr;
8079
8080 /**
8081  * A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
8082  * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
8083  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8084  */
8085 typedef struct LDKCResult_PaymentSecretNoneZ {
8086    /**
8087     * The contents of this CResult_PaymentSecretNoneZ, accessible via either
8088     * `err` or `result` depending on the state of `result_ok`.
8089     */
8090    union LDKCResult_PaymentSecretNoneZPtr contents;
8091    /**
8092     * Whether this CResult_PaymentSecretNoneZ represents a success state.
8093     */
8094    bool result_ok;
8095 } LDKCResult_PaymentSecretNoneZ;
8096
8097 /**
8098  * The contents of CResult_PaymentSecretAPIErrorZ
8099  */
8100 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
8101    /**
8102     * A pointer to the contents in the success state.
8103     * Reading from this pointer when `result_ok` is not set is undefined.
8104     */
8105    struct LDKThirtyTwoBytes *result;
8106    /**
8107     * A pointer to the contents in the error state.
8108     * Reading from this pointer when `result_ok` is set is undefined.
8109     */
8110    struct LDKAPIError *err;
8111 } LDKCResult_PaymentSecretAPIErrorZPtr;
8112
8113 /**
8114  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
8115  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8116  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8117  */
8118 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
8119    /**
8120     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
8121     * `err` or `result` depending on the state of `result_ok`.
8122     */
8123    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
8124    /**
8125     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
8126     */
8127    bool result_ok;
8128 } LDKCResult_PaymentSecretAPIErrorZ;
8129
8130 /**
8131  * The contents of CResult_PaymentPreimageAPIErrorZ
8132  */
8133 typedef union LDKCResult_PaymentPreimageAPIErrorZPtr {
8134    /**
8135     * A pointer to the contents in the success state.
8136     * Reading from this pointer when `result_ok` is not set is undefined.
8137     */
8138    struct LDKThirtyTwoBytes *result;
8139    /**
8140     * A pointer to the contents in the error state.
8141     * Reading from this pointer when `result_ok` is set is undefined.
8142     */
8143    struct LDKAPIError *err;
8144 } LDKCResult_PaymentPreimageAPIErrorZPtr;
8145
8146 /**
8147  * A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
8148  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8149  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8150  */
8151 typedef struct LDKCResult_PaymentPreimageAPIErrorZ {
8152    /**
8153     * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
8154     * `err` or `result` depending on the state of `result_ok`.
8155     */
8156    union LDKCResult_PaymentPreimageAPIErrorZPtr contents;
8157    /**
8158     * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
8159     */
8160    bool result_ok;
8161 } LDKCResult_PaymentPreimageAPIErrorZ;
8162
8163
8164
8165 /**
8166  * Information needed for constructing an invoice route hint for this channel.
8167  */
8168 typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
8169    /**
8170     * A pointer to the opaque Rust object.
8171     * Nearly everywhere, inner must be non-null, however in places where
8172     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8173     */
8174    LDKnativeCounterpartyForwardingInfo *inner;
8175    /**
8176     * Indicates that this is the only struct which contains the same pointer.
8177     * Rust functions which take ownership of an object provided via an argument require
8178     * this to be true and invalidate the object pointed to by inner.
8179     */
8180    bool is_owned;
8181 } LDKCounterpartyForwardingInfo;
8182
8183 /**
8184  * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
8185  */
8186 typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8187    /**
8188     * A pointer to the contents in the success state.
8189     * Reading from this pointer when `result_ok` is not set is undefined.
8190     */
8191    struct LDKCounterpartyForwardingInfo *result;
8192    /**
8193     * A pointer to the contents in the error state.
8194     * Reading from this pointer when `result_ok` is set is undefined.
8195     */
8196    struct LDKDecodeError *err;
8197 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr;
8198
8199 /**
8200  * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
8201  * containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8202  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8203  */
8204 typedef struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ {
8205    /**
8206     * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
8207     * `err` or `result` depending on the state of `result_ok`.
8208     */
8209    union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents;
8210    /**
8211     * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
8212     */
8213    bool result_ok;
8214 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZ;
8215
8216
8217
8218 /**
8219  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
8220  * to better separate parameters.
8221  */
8222 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
8223    /**
8224     * A pointer to the opaque Rust object.
8225     * Nearly everywhere, inner must be non-null, however in places where
8226     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8227     */
8228    LDKnativeChannelCounterparty *inner;
8229    /**
8230     * Indicates that this is the only struct which contains the same pointer.
8231     * Rust functions which take ownership of an object provided via an argument require
8232     * this to be true and invalidate the object pointed to by inner.
8233     */
8234    bool is_owned;
8235 } LDKChannelCounterparty;
8236
8237 /**
8238  * The contents of CResult_ChannelCounterpartyDecodeErrorZ
8239  */
8240 typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr {
8241    /**
8242     * A pointer to the contents in the success state.
8243     * Reading from this pointer when `result_ok` is not set is undefined.
8244     */
8245    struct LDKChannelCounterparty *result;
8246    /**
8247     * A pointer to the contents in the error state.
8248     * Reading from this pointer when `result_ok` is set is undefined.
8249     */
8250    struct LDKDecodeError *err;
8251 } LDKCResult_ChannelCounterpartyDecodeErrorZPtr;
8252
8253 /**
8254  * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
8255  * containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
8256  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8257  */
8258 typedef struct LDKCResult_ChannelCounterpartyDecodeErrorZ {
8259    /**
8260     * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
8261     * `err` or `result` depending on the state of `result_ok`.
8262     */
8263    union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents;
8264    /**
8265     * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
8266     */
8267    bool result_ok;
8268 } LDKCResult_ChannelCounterpartyDecodeErrorZ;
8269
8270 /**
8271  * The contents of CResult_ChannelDetailsDecodeErrorZ
8272  */
8273 typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr {
8274    /**
8275     * A pointer to the contents in the success state.
8276     * Reading from this pointer when `result_ok` is not set is undefined.
8277     */
8278    struct LDKChannelDetails *result;
8279    /**
8280     * A pointer to the contents in the error state.
8281     * Reading from this pointer when `result_ok` is set is undefined.
8282     */
8283    struct LDKDecodeError *err;
8284 } LDKCResult_ChannelDetailsDecodeErrorZPtr;
8285
8286 /**
8287  * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
8288  * containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
8289  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8290  */
8291 typedef struct LDKCResult_ChannelDetailsDecodeErrorZ {
8292    /**
8293     * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
8294     * `err` or `result` depending on the state of `result_ok`.
8295     */
8296    union LDKCResult_ChannelDetailsDecodeErrorZPtr contents;
8297    /**
8298     * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
8299     */
8300    bool result_ok;
8301 } LDKCResult_ChannelDetailsDecodeErrorZ;
8302
8303
8304
8305 /**
8306  * Route hints used in constructing invoices for [phantom node payents].
8307  *
8308  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
8309  */
8310 typedef struct MUST_USE_STRUCT LDKPhantomRouteHints {
8311    /**
8312     * A pointer to the opaque Rust object.
8313     * Nearly everywhere, inner must be non-null, however in places where
8314     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8315     */
8316    LDKnativePhantomRouteHints *inner;
8317    /**
8318     * Indicates that this is the only struct which contains the same pointer.
8319     * Rust functions which take ownership of an object provided via an argument require
8320     * this to be true and invalidate the object pointed to by inner.
8321     */
8322    bool is_owned;
8323 } LDKPhantomRouteHints;
8324
8325 /**
8326  * The contents of CResult_PhantomRouteHintsDecodeErrorZ
8327  */
8328 typedef union LDKCResult_PhantomRouteHintsDecodeErrorZPtr {
8329    /**
8330     * A pointer to the contents in the success state.
8331     * Reading from this pointer when `result_ok` is not set is undefined.
8332     */
8333    struct LDKPhantomRouteHints *result;
8334    /**
8335     * A pointer to the contents in the error state.
8336     * Reading from this pointer when `result_ok` is set is undefined.
8337     */
8338    struct LDKDecodeError *err;
8339 } LDKCResult_PhantomRouteHintsDecodeErrorZPtr;
8340
8341 /**
8342  * A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
8343  * containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
8344  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8345  */
8346 typedef struct LDKCResult_PhantomRouteHintsDecodeErrorZ {
8347    /**
8348     * The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
8349     * `err` or `result` depending on the state of `result_ok`.
8350     */
8351    union LDKCResult_PhantomRouteHintsDecodeErrorZPtr contents;
8352    /**
8353     * Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
8354     */
8355    bool result_ok;
8356 } LDKCResult_PhantomRouteHintsDecodeErrorZ;
8357
8358 /**
8359  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
8360  * This corresponds to std::vector in C++
8361  */
8362 typedef struct LDKCVec_ChannelMonitorZ {
8363    /**
8364     * The elements in the array.
8365     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8366     */
8367    struct LDKChannelMonitor *data;
8368    /**
8369     * The number of elements pointed to by `data`.
8370     */
8371    uintptr_t datalen;
8372 } LDKCVec_ChannelMonitorZ;
8373
8374
8375
8376 /**
8377  * An update generated by the underlying channel itself which contains some new information the
8378  * [`ChannelMonitor`] should be made aware of.
8379  *
8380  * Because this represents only a small number of updates to the underlying state, it is generally
8381  * much smaller than a full [`ChannelMonitor`]. However, for large single commitment transaction
8382  * updates (e.g. ones during which there are hundreds of HTLCs pending on the commitment
8383  * transaction), a single update may reach upwards of 1 MiB in serialized size.
8384  */
8385 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
8386    /**
8387     * A pointer to the opaque Rust object.
8388     * Nearly everywhere, inner must be non-null, however in places where
8389     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8390     */
8391    LDKnativeChannelMonitorUpdate *inner;
8392    /**
8393     * Indicates that this is the only struct which contains the same pointer.
8394     * Rust functions which take ownership of an object provided via an argument require
8395     * this to be true and invalidate the object pointed to by inner.
8396     */
8397    bool is_owned;
8398 } LDKChannelMonitorUpdate;
8399
8400 /**
8401  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
8402  * blocks are connected and disconnected.
8403  *
8404  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
8405  * responsible for maintaining a set of monitors such that they can be updated accordingly as
8406  * channel state changes and HTLCs are resolved. See method documentation for specific
8407  * requirements.
8408  *
8409  * Implementations **must** ensure that updates are successfully applied and persisted upon method
8410  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
8411  * without taking any further action such as persisting the current state.
8412  *
8413  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
8414  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
8415  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
8416  * funds in the channel. See [`ChannelMonitorUpdateStatus`] for more details about how to handle
8417  * multiple instances.
8418  *
8419  * [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure
8420  */
8421 typedef struct LDKWatch {
8422    /**
8423     * An opaque pointer which is passed to your function implementations as an argument.
8424     * This has no meaning in the LDK, and can be NULL or any other value.
8425     */
8426    void *this_arg;
8427    /**
8428     * Watches a channel identified by `funding_txo` using `monitor`.
8429     *
8430     * Implementations are responsible for watching the chain for the funding transaction along
8431     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
8432     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
8433     *
8434     * Note: this interface MUST error with [`ChannelMonitorUpdateStatus::PermanentFailure`] if
8435     * the given `funding_txo` has previously been registered via `watch_channel`.
8436     *
8437     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
8438     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
8439     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
8440     */
8441    enum LDKChannelMonitorUpdateStatus (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
8442    /**
8443     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
8444     *
8445     * Implementations must call [`update_monitor`] with the given update. See
8446     * [`ChannelMonitorUpdateStatus`] for invariants around returning an error.
8447     *
8448     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
8449     */
8450    enum LDKChannelMonitorUpdateStatus (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
8451    /**
8452     * Returns any monitor events since the last call. Subsequent calls must only return new
8453     * events.
8454     *
8455     * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
8456     * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
8457     * to disk.
8458     *
8459     * For details on asynchronous [`ChannelMonitor`] updating and returning
8460     * [`MonitorEvent::Completed`] here, see [`ChannelMonitorUpdateStatus::InProgress`].
8461     */
8462    struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ (*release_pending_monitor_events)(const void *this_arg);
8463    /**
8464     * Frees any resources associated with this object given its this_arg pointer.
8465     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8466     */
8467    void (*free)(void *this_arg);
8468 } LDKWatch;
8469
8470 /**
8471  * An interface to send a transaction to the Bitcoin network.
8472  */
8473 typedef struct LDKBroadcasterInterface {
8474    /**
8475     * An opaque pointer which is passed to your function implementations as an argument.
8476     * This has no meaning in the LDK, and can be NULL or any other value.
8477     */
8478    void *this_arg;
8479    /**
8480     * Sends a transaction out to (hopefully) be mined.
8481     */
8482    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
8483    /**
8484     * Frees any resources associated with this object given its this_arg pointer.
8485     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8486     */
8487    void (*free)(void *this_arg);
8488 } LDKBroadcasterInterface;
8489
8490 /**
8491  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
8492  * own the memory pointed to by data.
8493  */
8494 typedef struct LDKu8slice {
8495    /**
8496     * A pointer to the byte buffer
8497     */
8498    const uint8_t *data;
8499    /**
8500     * The number of bytes pointed to by `data`.
8501     */
8502    uintptr_t datalen;
8503 } LDKu8slice;
8504
8505 /**
8506  * A trait to describe an object which can get user secrets and key material.
8507  */
8508 typedef struct LDKKeysInterface {
8509    /**
8510     * An opaque pointer which is passed to your function implementations as an argument.
8511     * This has no meaning in the LDK, and can be NULL or any other value.
8512     */
8513    void *this_arg;
8514    /**
8515     * Get node secret key based on the provided [`Recipient`].
8516     *
8517     * The `node_id`/`network_key` is the public key that corresponds to this secret key.
8518     *
8519     * This method must return the same value each time it is called with a given [`Recipient`]
8520     * parameter.
8521     *
8522     * Errors if the [`Recipient`] variant is not supported by the implementation.
8523     */
8524    struct LDKCResult_SecretKeyNoneZ (*get_node_secret)(const void *this_arg, enum LDKRecipient recipient);
8525    /**
8526     * Get node id based on the provided [`Recipient`]. This public key corresponds to the secret in
8527     * [`get_node_secret`].
8528     *
8529     * This method must return the same value each time it is called with a given [`Recipient`]
8530     * parameter.
8531     *
8532     * Errors if the [`Recipient`] variant is not supported by the implementation.
8533     *
8534     * [`get_node_secret`]: Self::get_node_secret
8535     */
8536    struct LDKCResult_PublicKeyNoneZ (*get_node_id)(const void *this_arg, enum LDKRecipient recipient);
8537    /**
8538     * Gets the ECDH shared secret of our [`node secret`] and `other_key`, multiplying by `tweak` if
8539     * one is provided. Note that this tweak can be applied to `other_key` instead of our node
8540     * secret, though this is less efficient.
8541     *
8542     * Errors if the [`Recipient`] variant is not supported by the implementation.
8543     *
8544     * [`node secret`]: Self::get_node_secret
8545     */
8546    struct LDKCResult_SharedSecretNoneZ (*ecdh)(const void *this_arg, enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_ScalarZ tweak);
8547    /**
8548     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
8549     *
8550     * This method should return a different value each time it is called, to avoid linking
8551     * on-chain funds across channels as controlled to the same user.
8552     */
8553    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
8554    /**
8555     * Get a script pubkey which we will send funds to when closing a channel.
8556     *
8557     * This method should return a different value each time it is called, to avoid linking
8558     * on-chain funds across channels as controlled to the same user.
8559     */
8560    struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
8561    /**
8562     * Get a new set of [`Sign`] for per-channel secrets. These MUST be unique even if you
8563     * restarted with some stale data!
8564     *
8565     * This method must return a different value each time it is called.
8566     */
8567    struct LDKThirtyTwoBytes (*generate_channel_keys_id)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis, struct LDKU128 user_channel_id);
8568    /**
8569     * Derives the private key material backing a `Signer`.
8570     *
8571     * To derive a new `Signer`, a fresh `channel_keys_id` should be obtained through
8572     * [`KeysInterface::generate_channel_keys_id`]. Otherwise, an existing `Signer` can be
8573     * re-derived from its `channel_keys_id`, which can be obtained through its trait method
8574     * [`BaseSign::channel_keys_id`].
8575     */
8576    struct LDKSign (*derive_channel_signer)(const void *this_arg, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id);
8577    /**
8578     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
8579     * onion packets and for temporary channel IDs. There is no requirement that these be
8580     * persisted anywhere, though they must be unique across restarts.
8581     *
8582     * This method must return a different value each time it is called.
8583     */
8584    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
8585    /**
8586     * Reads a [`Signer`] for this [`KeysInterface`] from the given input stream.
8587     * This is only called during deserialization of other objects which contain
8588     * [`Sign`]-implementing objects (i.e., [`ChannelMonitor`]s and [`ChannelManager`]s).
8589     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
8590     * contain no versioning scheme. You may wish to include your own version prefix and ensure
8591     * you've read all of the provided bytes to ensure no corruption occurred.
8592     *
8593     * This method is slowly being phased out -- it will only be called when reading objects
8594     * written by LDK versions prior to 0.0.113.
8595     *
8596     * [`Signer`]: Self::Signer
8597     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
8598     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
8599     */
8600    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
8601    /**
8602     * Sign an invoice.
8603     * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of
8604     * this trait to parse the invoice and make sure they're signing what they expect, rather than
8605     * blindly signing the hash.
8606     * The `hrp` is ASCII bytes, while the invoice data is base32-encoded.
8607     *
8608     * The secret key used to sign the invoice is dependent on the [`Recipient`].
8609     *
8610     * Errors if the [`Recipient`] variant is not supported by the implementation.
8611     */
8612    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z invoice_data, enum LDKRecipient receipient);
8613    /**
8614     * Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
8615     *
8616     * If the implementor of this trait supports [phantom node payments], then every node that is
8617     * intended to be included in the phantom invoice route hints must return the same value from
8618     * this method.
8619     *
8620     * This method must return the same value each time it is called.
8621     *
8622     * [phantom node payments]: PhantomKeysManager
8623     */
8624    struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg);
8625    /**
8626     * Frees any resources associated with this object given its this_arg pointer.
8627     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8628     */
8629    void (*free)(void *this_arg);
8630 } LDKKeysInterface;
8631
8632 /**
8633  * A trait which should be implemented to provide feerate information on a number of time
8634  * horizons.
8635  *
8636  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
8637  * called from inside the library in response to chain events, P2P events, or timer events).
8638  */
8639 typedef struct LDKFeeEstimator {
8640    /**
8641     * An opaque pointer which is passed to your function implementations as an argument.
8642     * This has no meaning in the LDK, and can be NULL or any other value.
8643     */
8644    void *this_arg;
8645    /**
8646     * Gets estimated satoshis of fee required per 1000 Weight-Units.
8647     *
8648     * LDK will wrap this method and ensure that the value returned is no smaller than 253
8649     * (ie 1 satoshi-per-byte rounded up to ensure later round-downs don't put us below 1 satoshi-per-byte).
8650     *
8651     * The following unit conversions can be used to convert to sats/KW:
8652     *  * satoshis-per-byte * 250
8653     *  * satoshis-per-kbyte / 4
8654     */
8655    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
8656    /**
8657     * Frees any resources associated with this object given its this_arg pointer.
8658     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8659     */
8660    void (*free)(void *this_arg);
8661 } LDKFeeEstimator;
8662
8663
8664
8665 /**
8666  * Manager which keeps track of a number of channels and sends messages to the appropriate
8667  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
8668  *
8669  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
8670  * to individual Channels.
8671  *
8672  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
8673  * all peers during write/read (though does not modify this instance, only the instance being
8674  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
8675  * called funding_transaction_generated for outbound channels).
8676  *
8677  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
8678  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
8679  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
8680  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
8681  * the serialization process). If the deserialized version is out-of-date compared to the
8682  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
8683  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
8684  *
8685  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
8686  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
8687  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
8688  * block_connected() to step towards your best block) upon deserialization before using the
8689  * object!
8690  *
8691  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
8692  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
8693  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
8694  * offline for a full minute. In order to track this, you must call
8695  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
8696  *
8697  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
8698  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
8699  * essentially you should default to using a SimpleRefChannelManager, and use a
8700  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
8701  * you're using lightning-net-tokio.
8702  */
8703 typedef struct MUST_USE_STRUCT LDKChannelManager {
8704    /**
8705     * A pointer to the opaque Rust object.
8706     * Nearly everywhere, inner must be non-null, however in places where
8707     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8708     */
8709    LDKnativeChannelManager *inner;
8710    /**
8711     * Indicates that this is the only struct which contains the same pointer.
8712     * Rust functions which take ownership of an object provided via an argument require
8713     * this to be true and invalidate the object pointed to by inner.
8714     */
8715    bool is_owned;
8716 } LDKChannelManager;
8717
8718 /**
8719  * A tuple of 2 elements. See the individual fields for the types contained.
8720  */
8721 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
8722    /**
8723     * The element at position 0
8724     */
8725    struct LDKThirtyTwoBytes a;
8726    /**
8727     * The element at position 1
8728     */
8729    struct LDKChannelManager b;
8730 } LDKC2Tuple_BlockHashChannelManagerZ;
8731
8732 /**
8733  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
8734  */
8735 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
8736    /**
8737     * A pointer to the contents in the success state.
8738     * Reading from this pointer when `result_ok` is not set is undefined.
8739     */
8740    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
8741    /**
8742     * A pointer to the contents in the error state.
8743     * Reading from this pointer when `result_ok` is set is undefined.
8744     */
8745    struct LDKDecodeError *err;
8746 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
8747
8748 /**
8749  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
8750  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8751  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8752  */
8753 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8754    /**
8755     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
8756     * `err` or `result` depending on the state of `result_ok`.
8757     */
8758    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
8759    /**
8760     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
8761     */
8762    bool result_ok;
8763 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
8764
8765
8766
8767 /**
8768  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
8769  * with our counterparty.
8770  */
8771 typedef struct MUST_USE_STRUCT LDKChannelConfig {
8772    /**
8773     * A pointer to the opaque Rust object.
8774     * Nearly everywhere, inner must be non-null, however in places where
8775     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8776     */
8777    LDKnativeChannelConfig *inner;
8778    /**
8779     * Indicates that this is the only struct which contains the same pointer.
8780     * Rust functions which take ownership of an object provided via an argument require
8781     * this to be true and invalidate the object pointed to by inner.
8782     */
8783    bool is_owned;
8784 } LDKChannelConfig;
8785
8786 /**
8787  * The contents of CResult_ChannelConfigDecodeErrorZ
8788  */
8789 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
8790    /**
8791     * A pointer to the contents in the success state.
8792     * Reading from this pointer when `result_ok` is not set is undefined.
8793     */
8794    struct LDKChannelConfig *result;
8795    /**
8796     * A pointer to the contents in the error state.
8797     * Reading from this pointer when `result_ok` is set is undefined.
8798     */
8799    struct LDKDecodeError *err;
8800 } LDKCResult_ChannelConfigDecodeErrorZPtr;
8801
8802 /**
8803  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
8804  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
8805  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8806  */
8807 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
8808    /**
8809     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
8810     * `err` or `result` depending on the state of `result_ok`.
8811     */
8812    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
8813    /**
8814     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
8815     */
8816    bool result_ok;
8817 } LDKCResult_ChannelConfigDecodeErrorZ;
8818
8819 /**
8820  * The contents of CResult_OutPointDecodeErrorZ
8821  */
8822 typedef union LDKCResult_OutPointDecodeErrorZPtr {
8823    /**
8824     * A pointer to the contents in the success state.
8825     * Reading from this pointer when `result_ok` is not set is undefined.
8826     */
8827    struct LDKOutPoint *result;
8828    /**
8829     * A pointer to the contents in the error state.
8830     * Reading from this pointer when `result_ok` is set is undefined.
8831     */
8832    struct LDKDecodeError *err;
8833 } LDKCResult_OutPointDecodeErrorZPtr;
8834
8835 /**
8836  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
8837  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
8838  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8839  */
8840 typedef struct LDKCResult_OutPointDecodeErrorZ {
8841    /**
8842     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
8843     * `err` or `result` depending on the state of `result_ok`.
8844     */
8845    union LDKCResult_OutPointDecodeErrorZPtr contents;
8846    /**
8847     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
8848     */
8849    bool result_ok;
8850 } LDKCResult_OutPointDecodeErrorZ;
8851
8852 /**
8853  * Defines a type identifier for sending messages over the wire.
8854  *
8855  * Messages implementing this trait specify a type and must be [`Writeable`].
8856  */
8857 typedef struct LDKType {
8858    /**
8859     * An opaque pointer which is passed to your function implementations as an argument.
8860     * This has no meaning in the LDK, and can be NULL or any other value.
8861     */
8862    void *this_arg;
8863    /**
8864     * Returns the type identifying the message payload.
8865     */
8866    uint16_t (*type_id)(const void *this_arg);
8867    /**
8868     * Return a human-readable "debug" string describing this object
8869     */
8870    struct LDKStr (*debug_str)(const void *this_arg);
8871    /**
8872     * Serialize the object into a byte array
8873     */
8874    struct LDKCVec_u8Z (*write)(const void *this_arg);
8875    /**
8876     * Frees any resources associated with this object given its this_arg pointer.
8877     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8878     */
8879    void (*free)(void *this_arg);
8880 } LDKType;
8881
8882 /**
8883  * An enum which can either contain a crate::lightning::ln::wire::Type or not
8884  */
8885 typedef enum LDKCOption_TypeZ_Tag {
8886    /**
8887     * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
8888     */
8889    LDKCOption_TypeZ_Some,
8890    /**
8891     * When we're in this state, this COption_TypeZ contains nothing
8892     */
8893    LDKCOption_TypeZ_None,
8894    /**
8895     * Must be last for serialization purposes
8896     */
8897    LDKCOption_TypeZ_Sentinel,
8898 } LDKCOption_TypeZ_Tag;
8899
8900 typedef struct LDKCOption_TypeZ {
8901    LDKCOption_TypeZ_Tag tag;
8902    union {
8903       struct {
8904          struct LDKType some;
8905       };
8906    };
8907 } LDKCOption_TypeZ;
8908
8909 /**
8910  * The contents of CResult_COption_TypeZDecodeErrorZ
8911  */
8912 typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
8913    /**
8914     * A pointer to the contents in the success state.
8915     * Reading from this pointer when `result_ok` is not set is undefined.
8916     */
8917    struct LDKCOption_TypeZ *result;
8918    /**
8919     * A pointer to the contents in the error state.
8920     * Reading from this pointer when `result_ok` is set is undefined.
8921     */
8922    struct LDKDecodeError *err;
8923 } LDKCResult_COption_TypeZDecodeErrorZPtr;
8924
8925 /**
8926  * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
8927  * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8928  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8929  */
8930 typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
8931    /**
8932     * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
8933     * `err` or `result` depending on the state of `result_ok`.
8934     */
8935    union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
8936    /**
8937     * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
8938     */
8939    bool result_ok;
8940 } LDKCResult_COption_TypeZDecodeErrorZ;
8941
8942 /**
8943  * An error that may occur when making a payment.
8944  */
8945 typedef enum LDKPaymentError_Tag {
8946    /**
8947     * An error resulting from the provided [`Invoice`] or payment hash.
8948     */
8949    LDKPaymentError_Invoice,
8950    /**
8951     * An error occurring when finding a route.
8952     */
8953    LDKPaymentError_Routing,
8954    /**
8955     * An error occurring when sending a payment.
8956     */
8957    LDKPaymentError_Sending,
8958    /**
8959     * Must be last for serialization purposes
8960     */
8961    LDKPaymentError_Sentinel,
8962 } LDKPaymentError_Tag;
8963
8964 typedef struct MUST_USE_STRUCT LDKPaymentError {
8965    LDKPaymentError_Tag tag;
8966    union {
8967       struct {
8968          struct LDKStr invoice;
8969       };
8970       struct {
8971          struct LDKLightningError routing;
8972       };
8973       struct {
8974          struct LDKPaymentSendFailure sending;
8975       };
8976    };
8977 } LDKPaymentError;
8978
8979 /**
8980  * The contents of CResult_PaymentIdPaymentErrorZ
8981  */
8982 typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
8983    /**
8984     * A pointer to the contents in the success state.
8985     * Reading from this pointer when `result_ok` is not set is undefined.
8986     */
8987    struct LDKThirtyTwoBytes *result;
8988    /**
8989     * A pointer to the contents in the error state.
8990     * Reading from this pointer when `result_ok` is set is undefined.
8991     */
8992    struct LDKPaymentError *err;
8993 } LDKCResult_PaymentIdPaymentErrorZPtr;
8994
8995 /**
8996  * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
8997  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
8998  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8999  */
9000 typedef struct LDKCResult_PaymentIdPaymentErrorZ {
9001    /**
9002     * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
9003     * `err` or `result` depending on the state of `result_ok`.
9004     */
9005    union LDKCResult_PaymentIdPaymentErrorZPtr contents;
9006    /**
9007     * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
9008     */
9009    bool result_ok;
9010 } LDKCResult_PaymentIdPaymentErrorZ;
9011
9012 /**
9013  * The contents of CResult_NonePaymentErrorZ
9014  */
9015 typedef union LDKCResult_NonePaymentErrorZPtr {
9016    /**
9017     * Note that this value is always NULL, as there are no contents in the OK variant
9018     */
9019    void *result;
9020    /**
9021     * A pointer to the contents in the error state.
9022     * Reading from this pointer when `result_ok` is set is undefined.
9023     */
9024    struct LDKPaymentError *err;
9025 } LDKCResult_NonePaymentErrorZPtr;
9026
9027 /**
9028  * A CResult_NonePaymentErrorZ represents the result of a fallible operation,
9029  * containing a () on success and a crate::lightning_invoice::payment::PaymentError on failure.
9030  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9031  */
9032 typedef struct LDKCResult_NonePaymentErrorZ {
9033    /**
9034     * The contents of this CResult_NonePaymentErrorZ, accessible via either
9035     * `err` or `result` depending on the state of `result_ok`.
9036     */
9037    union LDKCResult_NonePaymentErrorZPtr contents;
9038    /**
9039     * Whether this CResult_NonePaymentErrorZ represents a success state.
9040     */
9041    bool result_ok;
9042 } LDKCResult_NonePaymentErrorZ;
9043
9044 /**
9045  * The contents of CResult_StringErrorZ
9046  */
9047 typedef union LDKCResult_StringErrorZPtr {
9048    /**
9049     * A pointer to the contents in the success state.
9050     * Reading from this pointer when `result_ok` is not set is undefined.
9051     */
9052    struct LDKStr *result;
9053    /**
9054     * A pointer to the contents in the error state.
9055     * Reading from this pointer when `result_ok` is set is undefined.
9056     */
9057    enum LDKSecp256k1Error *err;
9058 } LDKCResult_StringErrorZPtr;
9059
9060 /**
9061  * A CResult_StringErrorZ represents the result of a fallible operation,
9062  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
9063  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9064  */
9065 typedef struct LDKCResult_StringErrorZ {
9066    /**
9067     * The contents of this CResult_StringErrorZ, accessible via either
9068     * `err` or `result` depending on the state of `result_ok`.
9069     */
9070    union LDKCResult_StringErrorZPtr contents;
9071    /**
9072     * Whether this CResult_StringErrorZ represents a success state.
9073     */
9074    bool result_ok;
9075 } LDKCResult_StringErrorZ;
9076
9077 /**
9078  * The contents of CResult_PublicKeyErrorZ
9079  */
9080 typedef union LDKCResult_PublicKeyErrorZPtr {
9081    /**
9082     * A pointer to the contents in the success state.
9083     * Reading from this pointer when `result_ok` is not set is undefined.
9084     */
9085    struct LDKPublicKey *result;
9086    /**
9087     * A pointer to the contents in the error state.
9088     * Reading from this pointer when `result_ok` is set is undefined.
9089     */
9090    enum LDKSecp256k1Error *err;
9091 } LDKCResult_PublicKeyErrorZPtr;
9092
9093 /**
9094  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
9095  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
9096  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9097  */
9098 typedef struct LDKCResult_PublicKeyErrorZ {
9099    /**
9100     * The contents of this CResult_PublicKeyErrorZ, accessible via either
9101     * `err` or `result` depending on the state of `result_ok`.
9102     */
9103    union LDKCResult_PublicKeyErrorZPtr contents;
9104    /**
9105     * Whether this CResult_PublicKeyErrorZ represents a success state.
9106     */
9107    bool result_ok;
9108 } LDKCResult_PublicKeyErrorZ;
9109
9110 /**
9111  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
9112  */
9113 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
9114    /**
9115     * A pointer to the contents in the success state.
9116     * Reading from this pointer when `result_ok` is not set is undefined.
9117     */
9118    struct LDKChannelMonitorUpdate *result;
9119    /**
9120     * A pointer to the contents in the error state.
9121     * Reading from this pointer when `result_ok` is set is undefined.
9122     */
9123    struct LDKDecodeError *err;
9124 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
9125
9126 /**
9127  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
9128  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9129  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9130  */
9131 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
9132    /**
9133     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
9134     * `err` or `result` depending on the state of `result_ok`.
9135     */
9136    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
9137    /**
9138     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
9139     */
9140    bool result_ok;
9141 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
9142
9143 /**
9144  * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
9145  */
9146 typedef enum LDKCOption_MonitorEventZ_Tag {
9147    /**
9148     * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
9149     */
9150    LDKCOption_MonitorEventZ_Some,
9151    /**
9152     * When we're in this state, this COption_MonitorEventZ contains nothing
9153     */
9154    LDKCOption_MonitorEventZ_None,
9155    /**
9156     * Must be last for serialization purposes
9157     */
9158    LDKCOption_MonitorEventZ_Sentinel,
9159 } LDKCOption_MonitorEventZ_Tag;
9160
9161 typedef struct LDKCOption_MonitorEventZ {
9162    LDKCOption_MonitorEventZ_Tag tag;
9163    union {
9164       struct {
9165          struct LDKMonitorEvent some;
9166       };
9167    };
9168 } LDKCOption_MonitorEventZ;
9169
9170 /**
9171  * The contents of CResult_COption_MonitorEventZDecodeErrorZ
9172  */
9173 typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr {
9174    /**
9175     * A pointer to the contents in the success state.
9176     * Reading from this pointer when `result_ok` is not set is undefined.
9177     */
9178    struct LDKCOption_MonitorEventZ *result;
9179    /**
9180     * A pointer to the contents in the error state.
9181     * Reading from this pointer when `result_ok` is set is undefined.
9182     */
9183    struct LDKDecodeError *err;
9184 } LDKCResult_COption_MonitorEventZDecodeErrorZPtr;
9185
9186 /**
9187  * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
9188  * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9189  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9190  */
9191 typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ {
9192    /**
9193     * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
9194     * `err` or `result` depending on the state of `result_ok`.
9195     */
9196    union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents;
9197    /**
9198     * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
9199     */
9200    bool result_ok;
9201 } LDKCResult_COption_MonitorEventZDecodeErrorZ;
9202
9203 /**
9204  * The contents of CResult_HTLCUpdateDecodeErrorZ
9205  */
9206 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
9207    /**
9208     * A pointer to the contents in the success state.
9209     * Reading from this pointer when `result_ok` is not set is undefined.
9210     */
9211    struct LDKHTLCUpdate *result;
9212    /**
9213     * A pointer to the contents in the error state.
9214     * Reading from this pointer when `result_ok` is set is undefined.
9215     */
9216    struct LDKDecodeError *err;
9217 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
9218
9219 /**
9220  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
9221  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9222  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9223  */
9224 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
9225    /**
9226     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
9227     * `err` or `result` depending on the state of `result_ok`.
9228     */
9229    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
9230    /**
9231     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
9232     */
9233    bool result_ok;
9234 } LDKCResult_HTLCUpdateDecodeErrorZ;
9235
9236 /**
9237  * A tuple of 2 elements. See the individual fields for the types contained.
9238  */
9239 typedef struct LDKC2Tuple_OutPointScriptZ {
9240    /**
9241     * The element at position 0
9242     */
9243    struct LDKOutPoint a;
9244    /**
9245     * The element at position 1
9246     */
9247    struct LDKCVec_u8Z b;
9248 } LDKC2Tuple_OutPointScriptZ;
9249
9250 /**
9251  * A tuple of 2 elements. See the individual fields for the types contained.
9252  */
9253 typedef struct LDKC2Tuple_u32ScriptZ {
9254    /**
9255     * The element at position 0
9256     */
9257    uint32_t a;
9258    /**
9259     * The element at position 1
9260     */
9261    struct LDKCVec_u8Z b;
9262 } LDKC2Tuple_u32ScriptZ;
9263
9264 /**
9265  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
9266  * This corresponds to std::vector in C++
9267  */
9268 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
9269    /**
9270     * The elements in the array.
9271     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9272     */
9273    struct LDKC2Tuple_u32ScriptZ *data;
9274    /**
9275     * The number of elements pointed to by `data`.
9276     */
9277    uintptr_t datalen;
9278 } LDKCVec_C2Tuple_u32ScriptZZ;
9279
9280 /**
9281  * A tuple of 2 elements. See the individual fields for the types contained.
9282  */
9283 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9284    /**
9285     * The element at position 0
9286     */
9287    struct LDKThirtyTwoBytes a;
9288    /**
9289     * The element at position 1
9290     */
9291    struct LDKCVec_C2Tuple_u32ScriptZZ b;
9292 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
9293
9294 /**
9295  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
9296  * This corresponds to std::vector in C++
9297  */
9298 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9299    /**
9300     * The elements in the array.
9301     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9302     */
9303    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
9304    /**
9305     * The number of elements pointed to by `data`.
9306     */
9307    uintptr_t datalen;
9308 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
9309
9310 /**
9311  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
9312  * This corresponds to std::vector in C++
9313  */
9314 typedef struct LDKCVec_EventZ {
9315    /**
9316     * The elements in the array.
9317     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9318     */
9319    struct LDKEvent *data;
9320    /**
9321     * The number of elements pointed to by `data`.
9322     */
9323    uintptr_t datalen;
9324 } LDKCVec_EventZ;
9325
9326 /**
9327  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
9328  * This corresponds to std::vector in C++
9329  */
9330 typedef struct LDKCVec_TransactionZ {
9331    /**
9332     * The elements in the array.
9333     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9334     */
9335    struct LDKTransaction *data;
9336    /**
9337     * The number of elements pointed to by `data`.
9338     */
9339    uintptr_t datalen;
9340 } LDKCVec_TransactionZ;
9341
9342 /**
9343  * A tuple of 2 elements. See the individual fields for the types contained.
9344  */
9345 typedef struct LDKC2Tuple_u32TxOutZ {
9346    /**
9347     * The element at position 0
9348     */
9349    uint32_t a;
9350    /**
9351     * The element at position 1
9352     */
9353    struct LDKTxOut b;
9354 } LDKC2Tuple_u32TxOutZ;
9355
9356 /**
9357  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
9358  * This corresponds to std::vector in C++
9359  */
9360 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
9361    /**
9362     * The elements in the array.
9363     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9364     */
9365    struct LDKC2Tuple_u32TxOutZ *data;
9366    /**
9367     * The number of elements pointed to by `data`.
9368     */
9369    uintptr_t datalen;
9370 } LDKCVec_C2Tuple_u32TxOutZZ;
9371
9372 /**
9373  * A tuple of 2 elements. See the individual fields for the types contained.
9374  */
9375 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9376    /**
9377     * The element at position 0
9378     */
9379    struct LDKThirtyTwoBytes a;
9380    /**
9381     * The element at position 1
9382     */
9383    struct LDKCVec_C2Tuple_u32TxOutZZ b;
9384 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
9385
9386 /**
9387  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
9388  * This corresponds to std::vector in C++
9389  */
9390 typedef struct LDKCVec_TransactionOutputsZ {
9391    /**
9392     * The elements in the array.
9393     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9394     */
9395    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
9396    /**
9397     * The number of elements pointed to by `data`.
9398     */
9399    uintptr_t datalen;
9400 } LDKCVec_TransactionOutputsZ;
9401
9402 /**
9403  * Details about the balance(s) available for spending once the channel appears on chain.
9404  *
9405  * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
9406  * be provided.
9407  */
9408 typedef enum LDKBalance_Tag {
9409    /**
9410     * The channel is not yet closed (or the commitment or closing transaction has not yet
9411     * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
9412     * force-closed now.
9413     */
9414    LDKBalance_ClaimableOnChannelClose,
9415    /**
9416     * The channel has been closed, and the given balance is ours but awaiting confirmations until
9417     * we consider it spendable.
9418     */
9419    LDKBalance_ClaimableAwaitingConfirmations,
9420    /**
9421     * The channel has been closed, and the given balance should be ours but awaiting spending
9422     * transaction confirmation. If the spending transaction does not confirm in time, it is
9423     * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
9424     *
9425     * Once the spending transaction confirms, before it has reached enough confirmations to be
9426     * considered safe from chain reorganizations, the balance will instead be provided via
9427     * [`Balance::ClaimableAwaitingConfirmations`].
9428     */
9429    LDKBalance_ContentiousClaimable,
9430    /**
9431     * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
9432     * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
9433     * likely to be claimed by our counterparty before we do.
9434     */
9435    LDKBalance_MaybeTimeoutClaimableHTLC,
9436    /**
9437     * HTLCs which we received from our counterparty which are claimable with a preimage which we
9438     * do not currently have. This will only be claimable if we receive the preimage from the node
9439     * to which we forwarded this HTLC before the timeout.
9440     */
9441    LDKBalance_MaybePreimageClaimableHTLC,
9442    /**
9443     * The channel has been closed, and our counterparty broadcasted a revoked commitment
9444     * transaction.
9445     *
9446     * Thus, we're able to claim all outputs in the commitment transaction, one of which has the
9447     * following amount.
9448     */
9449    LDKBalance_CounterpartyRevokedOutputClaimable,
9450    /**
9451     * Must be last for serialization purposes
9452     */
9453    LDKBalance_Sentinel,
9454 } LDKBalance_Tag;
9455
9456 typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
9457    /**
9458     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
9459     * required to do so.
9460     */
9461    uint64_t claimable_amount_satoshis;
9462 } LDKBalance_LDKClaimableOnChannelClose_Body;
9463
9464 typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
9465    /**
9466     * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
9467     * were spent in broadcasting the transaction.
9468     */
9469    uint64_t claimable_amount_satoshis;
9470    /**
9471     * The height at which an [`Event::SpendableOutputs`] event will be generated for this
9472     * amount.
9473     */
9474    uint32_t confirmation_height;
9475 } LDKBalance_LDKClaimableAwaitingConfirmations_Body;
9476
9477 typedef struct LDKBalance_LDKContentiousClaimable_Body {
9478    /**
9479     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
9480     * required to do so.
9481     */
9482    uint64_t claimable_amount_satoshis;
9483    /**
9484     * The height at which the counterparty may be able to claim the balance if we have not
9485     * done so.
9486     */
9487    uint32_t timeout_height;
9488 } LDKBalance_LDKContentiousClaimable_Body;
9489
9490 typedef struct LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body {
9491    /**
9492     * The amount potentially available to claim, in satoshis, excluding the on-chain fees
9493     * which will be required to do so.
9494     */
9495    uint64_t claimable_amount_satoshis;
9496    /**
9497     * The height at which we will be able to claim the balance if our counterparty has not
9498     * done so.
9499     */
9500    uint32_t claimable_height;
9501 } LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body;
9502
9503 typedef struct LDKBalance_LDKMaybePreimageClaimableHTLC_Body {
9504    /**
9505     * The amount potentially available to claim, in satoshis, excluding the on-chain fees
9506     * which will be required to do so.
9507     */
9508    uint64_t claimable_amount_satoshis;
9509    /**
9510     * The height at which our counterparty will be able to claim the balance if we have not
9511     * yet received the preimage and claimed it ourselves.
9512     */
9513    uint32_t expiry_height;
9514 } LDKBalance_LDKMaybePreimageClaimableHTLC_Body;
9515
9516 typedef struct LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body {
9517    /**
9518     * The amount, in satoshis, of the output which we can claim.
9519     *
9520     * Note that for outputs from HTLC balances this may be excluding some on-chain fees that
9521     * were already spent.
9522     */
9523    uint64_t claimable_amount_satoshis;
9524 } LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body;
9525
9526 typedef struct MUST_USE_STRUCT LDKBalance {
9527    LDKBalance_Tag tag;
9528    union {
9529       LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
9530       LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
9531       LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
9532       LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body maybe_timeout_claimable_htlc;
9533       LDKBalance_LDKMaybePreimageClaimableHTLC_Body maybe_preimage_claimable_htlc;
9534       LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body counterparty_revoked_output_claimable;
9535    };
9536 } LDKBalance;
9537
9538 /**
9539  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
9540  * This corresponds to std::vector in C++
9541  */
9542 typedef struct LDKCVec_BalanceZ {
9543    /**
9544     * The elements in the array.
9545     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9546     */
9547    struct LDKBalance *data;
9548    /**
9549     * The number of elements pointed to by `data`.
9550     */
9551    uintptr_t datalen;
9552 } LDKCVec_BalanceZ;
9553
9554 /**
9555  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
9556  */
9557 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9558    /**
9559     * A pointer to the contents in the success state.
9560     * Reading from this pointer when `result_ok` is not set is undefined.
9561     */
9562    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
9563    /**
9564     * A pointer to the contents in the error state.
9565     * Reading from this pointer when `result_ok` is set is undefined.
9566     */
9567    struct LDKDecodeError *err;
9568 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
9569
9570 /**
9571  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
9572  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9573  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9574  */
9575 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9576    /**
9577     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
9578     * `err` or `result` depending on the state of `result_ok`.
9579     */
9580    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
9581    /**
9582     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
9583     */
9584    bool result_ok;
9585 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
9586
9587 /**
9588  * A tuple of 2 elements. See the individual fields for the types contained.
9589  */
9590 typedef struct LDKC2Tuple_PublicKeyTypeZ {
9591    /**
9592     * The element at position 0
9593     */
9594    struct LDKPublicKey a;
9595    /**
9596     * The element at position 1
9597     */
9598    struct LDKType b;
9599 } LDKC2Tuple_PublicKeyTypeZ;
9600
9601 /**
9602  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
9603  * This corresponds to std::vector in C++
9604  */
9605 typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
9606    /**
9607     * The elements in the array.
9608     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9609     */
9610    struct LDKC2Tuple_PublicKeyTypeZ *data;
9611    /**
9612     * The number of elements pointed to by `data`.
9613     */
9614    uintptr_t datalen;
9615 } LDKCVec_C2Tuple_PublicKeyTypeZZ;
9616
9617 /**
9618  * The contents of a custom onion message.
9619  */
9620 typedef struct LDKCustomOnionMessageContents {
9621    /**
9622     * An opaque pointer which is passed to your function implementations as an argument.
9623     * This has no meaning in the LDK, and can be NULL or any other value.
9624     */
9625    void *this_arg;
9626    /**
9627     * Returns the TLV type identifying the message contents. MUST be >= 64.
9628     */
9629    uint64_t (*tlv_type)(const void *this_arg);
9630    /**
9631     * Serialize the object into a byte array
9632     */
9633    struct LDKCVec_u8Z (*write)(const void *this_arg);
9634    /**
9635     * Frees any resources associated with this object given its this_arg pointer.
9636     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9637     */
9638    void (*free)(void *this_arg);
9639 } LDKCustomOnionMessageContents;
9640
9641 /**
9642  * An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
9643  */
9644 typedef enum LDKCOption_CustomOnionMessageContentsZ_Tag {
9645    /**
9646     * When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
9647     */
9648    LDKCOption_CustomOnionMessageContentsZ_Some,
9649    /**
9650     * When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
9651     */
9652    LDKCOption_CustomOnionMessageContentsZ_None,
9653    /**
9654     * Must be last for serialization purposes
9655     */
9656    LDKCOption_CustomOnionMessageContentsZ_Sentinel,
9657 } LDKCOption_CustomOnionMessageContentsZ_Tag;
9658
9659 typedef struct LDKCOption_CustomOnionMessageContentsZ {
9660    LDKCOption_CustomOnionMessageContentsZ_Tag tag;
9661    union {
9662       struct {
9663          struct LDKCustomOnionMessageContents some;
9664       };
9665    };
9666 } LDKCOption_CustomOnionMessageContentsZ;
9667
9668 /**
9669  * The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
9670  */
9671 typedef union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
9672    /**
9673     * A pointer to the contents in the success state.
9674     * Reading from this pointer when `result_ok` is not set is undefined.
9675     */
9676    struct LDKCOption_CustomOnionMessageContentsZ *result;
9677    /**
9678     * A pointer to the contents in the error state.
9679     * Reading from this pointer when `result_ok` is set is undefined.
9680     */
9681    struct LDKDecodeError *err;
9682 } LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr;
9683
9684 /**
9685  * A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
9686  * containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9687  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9688  */
9689 typedef struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
9690    /**
9691     * The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
9692     * `err` or `result` depending on the state of `result_ok`.
9693     */
9694    union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr contents;
9695    /**
9696     * Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
9697     */
9698    bool result_ok;
9699 } LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ;
9700
9701 /**
9702  * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
9703  */
9704 typedef enum LDKCOption_NetAddressZ_Tag {
9705    /**
9706     * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
9707     */
9708    LDKCOption_NetAddressZ_Some,
9709    /**
9710     * When we're in this state, this COption_NetAddressZ contains nothing
9711     */
9712    LDKCOption_NetAddressZ_None,
9713    /**
9714     * Must be last for serialization purposes
9715     */
9716    LDKCOption_NetAddressZ_Sentinel,
9717 } LDKCOption_NetAddressZ_Tag;
9718
9719 typedef struct LDKCOption_NetAddressZ {
9720    LDKCOption_NetAddressZ_Tag tag;
9721    union {
9722       struct {
9723          struct LDKNetAddress some;
9724       };
9725    };
9726 } LDKCOption_NetAddressZ;
9727
9728
9729
9730 /**
9731  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
9732  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
9733  * descriptor.
9734  */
9735 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
9736    /**
9737     * A pointer to the opaque Rust object.
9738     * Nearly everywhere, inner must be non-null, however in places where
9739     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9740     */
9741    LDKnativePeerHandleError *inner;
9742    /**
9743     * Indicates that this is the only struct which contains the same pointer.
9744     * Rust functions which take ownership of an object provided via an argument require
9745     * this to be true and invalidate the object pointed to by inner.
9746     */
9747    bool is_owned;
9748 } LDKPeerHandleError;
9749
9750 /**
9751  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
9752  */
9753 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
9754    /**
9755     * A pointer to the contents in the success state.
9756     * Reading from this pointer when `result_ok` is not set is undefined.
9757     */
9758    struct LDKCVec_u8Z *result;
9759    /**
9760     * A pointer to the contents in the error state.
9761     * Reading from this pointer when `result_ok` is set is undefined.
9762     */
9763    struct LDKPeerHandleError *err;
9764 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
9765
9766 /**
9767  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
9768  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9769  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9770  */
9771 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
9772    /**
9773     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
9774     * `err` or `result` depending on the state of `result_ok`.
9775     */
9776    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
9777    /**
9778     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
9779     */
9780    bool result_ok;
9781 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
9782
9783 /**
9784  * The contents of CResult_NonePeerHandleErrorZ
9785  */
9786 typedef union LDKCResult_NonePeerHandleErrorZPtr {
9787    /**
9788     * Note that this value is always NULL, as there are no contents in the OK variant
9789     */
9790    void *result;
9791    /**
9792     * A pointer to the contents in the error state.
9793     * Reading from this pointer when `result_ok` is set is undefined.
9794     */
9795    struct LDKPeerHandleError *err;
9796 } LDKCResult_NonePeerHandleErrorZPtr;
9797
9798 /**
9799  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
9800  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9801  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9802  */
9803 typedef struct LDKCResult_NonePeerHandleErrorZ {
9804    /**
9805     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
9806     * `err` or `result` depending on the state of `result_ok`.
9807     */
9808    union LDKCResult_NonePeerHandleErrorZPtr contents;
9809    /**
9810     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
9811     */
9812    bool result_ok;
9813 } LDKCResult_NonePeerHandleErrorZ;
9814
9815 /**
9816  * The contents of CResult_boolPeerHandleErrorZ
9817  */
9818 typedef union LDKCResult_boolPeerHandleErrorZPtr {
9819    /**
9820     * A pointer to the contents in the success state.
9821     * Reading from this pointer when `result_ok` is not set is undefined.
9822     */
9823    bool *result;
9824    /**
9825     * A pointer to the contents in the error state.
9826     * Reading from this pointer when `result_ok` is set is undefined.
9827     */
9828    struct LDKPeerHandleError *err;
9829 } LDKCResult_boolPeerHandleErrorZPtr;
9830
9831 /**
9832  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
9833  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9834  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9835  */
9836 typedef struct LDKCResult_boolPeerHandleErrorZ {
9837    /**
9838     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
9839     * `err` or `result` depending on the state of `result_ok`.
9840     */
9841    union LDKCResult_boolPeerHandleErrorZPtr contents;
9842    /**
9843     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
9844     */
9845    bool result_ok;
9846 } LDKCResult_boolPeerHandleErrorZ;
9847
9848 /**
9849  * Errors that may occur when [sending an onion message].
9850  *
9851  * [sending an onion message]: OnionMessenger::send_onion_message
9852  */
9853 typedef enum LDKSendError_Tag {
9854    /**
9855     * Errored computing onion message packet keys.
9856     */
9857    LDKSendError_Secp256k1,
9858    /**
9859     * Because implementations such as Eclair will drop onion messages where the message packet
9860     * exceeds 32834 bytes, we refuse to send messages where the packet exceeds this size.
9861     */
9862    LDKSendError_TooBigPacket,
9863    /**
9864     * The provided [`Destination`] was an invalid [`BlindedPath`], due to having fewer than two
9865     * blinded hops.
9866     */
9867    LDKSendError_TooFewBlindedHops,
9868    /**
9869     * Our next-hop peer was offline or does not support onion message forwarding.
9870     */
9871    LDKSendError_InvalidFirstHop,
9872    /**
9873     * Onion message contents must have a TLV type >= 64.
9874     */
9875    LDKSendError_InvalidMessage,
9876    /**
9877     * Our next-hop peer's buffer was full or our total outbound buffer was full.
9878     */
9879    LDKSendError_BufferFull,
9880    /**
9881     * Failed to retrieve our node id from the provided [`KeysInterface`].
9882     *
9883     * [`KeysInterface`]: crate::chain::keysinterface::KeysInterface
9884     */
9885    LDKSendError_GetNodeIdFailed,
9886    /**
9887     * We attempted to send to a blinded path where we are the introduction node, and failed to
9888     * advance the blinded path to make the second hop the new introduction node. Either
9889     * [`KeysInterface::ecdh`] failed, we failed to tweak the current blinding point to get the
9890     * new blinding point, or we were attempting to send to ourselves.
9891     */
9892    LDKSendError_BlindedPathAdvanceFailed,
9893    /**
9894     * Must be last for serialization purposes
9895     */
9896    LDKSendError_Sentinel,
9897 } LDKSendError_Tag;
9898
9899 typedef struct MUST_USE_STRUCT LDKSendError {
9900    LDKSendError_Tag tag;
9901    union {
9902       struct {
9903          enum LDKSecp256k1Error secp256k1;
9904       };
9905    };
9906 } LDKSendError;
9907
9908 /**
9909  * The contents of CResult_NoneSendErrorZ
9910  */
9911 typedef union LDKCResult_NoneSendErrorZPtr {
9912    /**
9913     * Note that this value is always NULL, as there are no contents in the OK variant
9914     */
9915    void *result;
9916    /**
9917     * A pointer to the contents in the error state.
9918     * Reading from this pointer when `result_ok` is set is undefined.
9919     */
9920    struct LDKSendError *err;
9921 } LDKCResult_NoneSendErrorZPtr;
9922
9923 /**
9924  * A CResult_NoneSendErrorZ represents the result of a fallible operation,
9925  * containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
9926  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9927  */
9928 typedef struct LDKCResult_NoneSendErrorZ {
9929    /**
9930     * The contents of this CResult_NoneSendErrorZ, accessible via either
9931     * `err` or `result` depending on the state of `result_ok`.
9932     */
9933    union LDKCResult_NoneSendErrorZPtr contents;
9934    /**
9935     * Whether this CResult_NoneSendErrorZ represents a success state.
9936     */
9937    bool result_ok;
9938 } LDKCResult_NoneSendErrorZ;
9939
9940 /**
9941  * Sub-errors which don't have specific information in them use this type.
9942  */
9943 typedef struct LDKError {
9944    /**
9945     * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here
9946     */
9947    uint8_t _dummy;
9948 } LDKError;
9949
9950 /**
9951  * Errors that indicate what is wrong with the invoice. They have some granularity for debug
9952  * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user.
9953  */
9954 typedef enum LDKParseError_Tag {
9955    LDKParseError_Bech32Error,
9956    LDKParseError_ParseAmountError,
9957    LDKParseError_MalformedSignature,
9958    LDKParseError_BadPrefix,
9959    LDKParseError_UnknownCurrency,
9960    LDKParseError_UnknownSiPrefix,
9961    LDKParseError_MalformedHRP,
9962    LDKParseError_TooShortDataPart,
9963    LDKParseError_UnexpectedEndOfTaggedFields,
9964    LDKParseError_DescriptionDecodeError,
9965    LDKParseError_PaddingError,
9966    LDKParseError_IntegerOverflowError,
9967    LDKParseError_InvalidSegWitProgramLength,
9968    LDKParseError_InvalidPubKeyHashLength,
9969    LDKParseError_InvalidScriptHashLength,
9970    LDKParseError_InvalidRecoveryId,
9971    LDKParseError_InvalidSliceLength,
9972    /**
9973     * Not an error, but used internally to signal that a part of the invoice should be ignored
9974     * according to BOLT11
9975     */
9976    LDKParseError_Skip,
9977    /**
9978     * Must be last for serialization purposes
9979     */
9980    LDKParseError_Sentinel,
9981 } LDKParseError_Tag;
9982
9983 typedef struct MUST_USE_STRUCT LDKParseError {
9984    LDKParseError_Tag tag;
9985    union {
9986       struct {
9987          struct LDKBech32Error bech32_error;
9988       };
9989       struct {
9990          struct LDKError parse_amount_error;
9991       };
9992       struct {
9993          enum LDKSecp256k1Error malformed_signature;
9994       };
9995       struct {
9996          struct LDKError description_decode_error;
9997       };
9998       struct {
9999          struct LDKStr invalid_slice_length;
10000       };
10001    };
10002 } LDKParseError;
10003
10004 /**
10005  * The contents of CResult_SiPrefixParseErrorZ
10006  */
10007 typedef union LDKCResult_SiPrefixParseErrorZPtr {
10008    /**
10009     * A pointer to the contents in the success state.
10010     * Reading from this pointer when `result_ok` is not set is undefined.
10011     */
10012    enum LDKSiPrefix *result;
10013    /**
10014     * A pointer to the contents in the error state.
10015     * Reading from this pointer when `result_ok` is set is undefined.
10016     */
10017    struct LDKParseError *err;
10018 } LDKCResult_SiPrefixParseErrorZPtr;
10019
10020 /**
10021  * A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
10022  * containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
10023  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10024  */
10025 typedef struct LDKCResult_SiPrefixParseErrorZ {
10026    /**
10027     * The contents of this CResult_SiPrefixParseErrorZ, accessible via either
10028     * `err` or `result` depending on the state of `result_ok`.
10029     */
10030    union LDKCResult_SiPrefixParseErrorZPtr contents;
10031    /**
10032     * Whether this CResult_SiPrefixParseErrorZ represents a success state.
10033     */
10034    bool result_ok;
10035 } LDKCResult_SiPrefixParseErrorZ;
10036
10037
10038
10039 /**
10040  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
10041  *
10042  * There are three ways to construct an `Invoice`:
10043  *  1. using `InvoiceBuilder`
10044  *  2. using `Invoice::from_signed(SignedRawInvoice)`
10045  *  3. using `str::parse::<Invoice>(&str)`
10046  */
10047 typedef struct MUST_USE_STRUCT LDKInvoice {
10048    /**
10049     * A pointer to the opaque Rust object.
10050     * Nearly everywhere, inner must be non-null, however in places where
10051     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10052     */
10053    LDKnativeInvoice *inner;
10054    /**
10055     * Indicates that this is the only struct which contains the same pointer.
10056     * Rust functions which take ownership of an object provided via an argument require
10057     * this to be true and invalidate the object pointed to by inner.
10058     */
10059    bool is_owned;
10060 } LDKInvoice;
10061
10062 /**
10063  * Indicates that something went wrong while parsing or validating the invoice. Parsing errors
10064  * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors
10065  * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
10066  */
10067 typedef enum LDKParseOrSemanticError_Tag {
10068    /**
10069     * The invoice couldn't be decoded
10070     */
10071    LDKParseOrSemanticError_ParseError,
10072    /**
10073     * The invoice could be decoded but violates the BOLT11 standard
10074     */
10075    LDKParseOrSemanticError_SemanticError,
10076    /**
10077     * Must be last for serialization purposes
10078     */
10079    LDKParseOrSemanticError_Sentinel,
10080 } LDKParseOrSemanticError_Tag;
10081
10082 typedef struct MUST_USE_STRUCT LDKParseOrSemanticError {
10083    LDKParseOrSemanticError_Tag tag;
10084    union {
10085       struct {
10086          struct LDKParseError parse_error;
10087       };
10088       struct {
10089          enum LDKSemanticError semantic_error;
10090       };
10091    };
10092 } LDKParseOrSemanticError;
10093
10094 /**
10095  * The contents of CResult_InvoiceParseOrSemanticErrorZ
10096  */
10097 typedef union LDKCResult_InvoiceParseOrSemanticErrorZPtr {
10098    /**
10099     * A pointer to the contents in the success state.
10100     * Reading from this pointer when `result_ok` is not set is undefined.
10101     */
10102    struct LDKInvoice *result;
10103    /**
10104     * A pointer to the contents in the error state.
10105     * Reading from this pointer when `result_ok` is set is undefined.
10106     */
10107    struct LDKParseOrSemanticError *err;
10108 } LDKCResult_InvoiceParseOrSemanticErrorZPtr;
10109
10110 /**
10111  * A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
10112  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
10113  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10114  */
10115 typedef struct LDKCResult_InvoiceParseOrSemanticErrorZ {
10116    /**
10117     * The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
10118     * `err` or `result` depending on the state of `result_ok`.
10119     */
10120    union LDKCResult_InvoiceParseOrSemanticErrorZPtr contents;
10121    /**
10122     * Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
10123     */
10124    bool result_ok;
10125 } LDKCResult_InvoiceParseOrSemanticErrorZ;
10126
10127
10128
10129 /**
10130  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
10131  * invalid.
10132  *
10133  * # Invariants
10134  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
10135  */
10136 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
10137    /**
10138     * A pointer to the opaque Rust object.
10139     * Nearly everywhere, inner must be non-null, however in places where
10140     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10141     */
10142    LDKnativeSignedRawInvoice *inner;
10143    /**
10144     * Indicates that this is the only struct which contains the same pointer.
10145     * Rust functions which take ownership of an object provided via an argument require
10146     * this to be true and invalidate the object pointed to by inner.
10147     */
10148    bool is_owned;
10149 } LDKSignedRawInvoice;
10150
10151 /**
10152  * The contents of CResult_SignedRawInvoiceParseErrorZ
10153  */
10154 typedef union LDKCResult_SignedRawInvoiceParseErrorZPtr {
10155    /**
10156     * A pointer to the contents in the success state.
10157     * Reading from this pointer when `result_ok` is not set is undefined.
10158     */
10159    struct LDKSignedRawInvoice *result;
10160    /**
10161     * A pointer to the contents in the error state.
10162     * Reading from this pointer when `result_ok` is set is undefined.
10163     */
10164    struct LDKParseError *err;
10165 } LDKCResult_SignedRawInvoiceParseErrorZPtr;
10166
10167 /**
10168  * A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
10169  * containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
10170  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10171  */
10172 typedef struct LDKCResult_SignedRawInvoiceParseErrorZ {
10173    /**
10174     * The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
10175     * `err` or `result` depending on the state of `result_ok`.
10176     */
10177    union LDKCResult_SignedRawInvoiceParseErrorZPtr contents;
10178    /**
10179     * Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
10180     */
10181    bool result_ok;
10182 } LDKCResult_SignedRawInvoiceParseErrorZ;
10183
10184
10185
10186 /**
10187  * Represents an syntactically correct Invoice for a payment on the lightning network,
10188  * but without the signature information.
10189  * De- and encoding should not lead to information loss but may lead to different hashes.
10190  *
10191  * For methods without docs see the corresponding methods in `Invoice`.
10192  */
10193 typedef struct MUST_USE_STRUCT LDKRawInvoice {
10194    /**
10195     * A pointer to the opaque Rust object.
10196     * Nearly everywhere, inner must be non-null, however in places where
10197     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10198     */
10199    LDKnativeRawInvoice *inner;
10200    /**
10201     * Indicates that this is the only struct which contains the same pointer.
10202     * Rust functions which take ownership of an object provided via an argument require
10203     * this to be true and invalidate the object pointed to by inner.
10204     */
10205    bool is_owned;
10206 } LDKRawInvoice;
10207
10208
10209
10210 /**
10211  * Recoverable signature
10212  */
10213 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
10214    /**
10215     * A pointer to the opaque Rust object.
10216     * Nearly everywhere, inner must be non-null, however in places where
10217     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10218     */
10219    LDKnativeInvoiceSignature *inner;
10220    /**
10221     * Indicates that this is the only struct which contains the same pointer.
10222     * Rust functions which take ownership of an object provided via an argument require
10223     * this to be true and invalidate the object pointed to by inner.
10224     */
10225    bool is_owned;
10226 } LDKInvoiceSignature;
10227
10228 /**
10229  * A tuple of 3 elements. See the individual fields for the types contained.
10230  */
10231 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
10232    /**
10233     * The element at position 0
10234     */
10235    struct LDKRawInvoice a;
10236    /**
10237     * The element at position 1
10238     */
10239    struct LDKThirtyTwoBytes b;
10240    /**
10241     * The element at position 2
10242     */
10243    struct LDKInvoiceSignature c;
10244 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
10245
10246
10247
10248 /**
10249  * Payee public key
10250  */
10251 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
10252    /**
10253     * A pointer to the opaque Rust object.
10254     * Nearly everywhere, inner must be non-null, however in places where
10255     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10256     */
10257    LDKnativePayeePubKey *inner;
10258    /**
10259     * Indicates that this is the only struct which contains the same pointer.
10260     * Rust functions which take ownership of an object provided via an argument require
10261     * this to be true and invalidate the object pointed to by inner.
10262     */
10263    bool is_owned;
10264 } LDKPayeePubKey;
10265
10266 /**
10267  * The contents of CResult_PayeePubKeyErrorZ
10268  */
10269 typedef union LDKCResult_PayeePubKeyErrorZPtr {
10270    /**
10271     * A pointer to the contents in the success state.
10272     * Reading from this pointer when `result_ok` is not set is undefined.
10273     */
10274    struct LDKPayeePubKey *result;
10275    /**
10276     * A pointer to the contents in the error state.
10277     * Reading from this pointer when `result_ok` is set is undefined.
10278     */
10279    enum LDKSecp256k1Error *err;
10280 } LDKCResult_PayeePubKeyErrorZPtr;
10281
10282 /**
10283  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
10284  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
10285  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10286  */
10287 typedef struct LDKCResult_PayeePubKeyErrorZ {
10288    /**
10289     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
10290     * `err` or `result` depending on the state of `result_ok`.
10291     */
10292    union LDKCResult_PayeePubKeyErrorZPtr contents;
10293    /**
10294     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
10295     */
10296    bool result_ok;
10297 } LDKCResult_PayeePubKeyErrorZ;
10298
10299
10300
10301 /**
10302  * Private routing information
10303  *
10304  * # Invariants
10305  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
10306  *
10307  */
10308 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
10309    /**
10310     * A pointer to the opaque Rust object.
10311     * Nearly everywhere, inner must be non-null, however in places where
10312     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10313     */
10314    LDKnativePrivateRoute *inner;
10315    /**
10316     * Indicates that this is the only struct which contains the same pointer.
10317     * Rust functions which take ownership of an object provided via an argument require
10318     * this to be true and invalidate the object pointed to by inner.
10319     */
10320    bool is_owned;
10321 } LDKPrivateRoute;
10322
10323 /**
10324  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
10325  * This corresponds to std::vector in C++
10326  */
10327 typedef struct LDKCVec_PrivateRouteZ {
10328    /**
10329     * The elements in the array.
10330     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10331     */
10332    struct LDKPrivateRoute *data;
10333    /**
10334     * The number of elements pointed to by `data`.
10335     */
10336    uintptr_t datalen;
10337 } LDKCVec_PrivateRouteZ;
10338
10339
10340
10341 /**
10342  * A timestamp that refers to a date after 1 January 1970.
10343  *
10344  * # Invariants
10345  *
10346  * The Unix timestamp representing the stored time has to be positive and no greater than
10347  * [`MAX_TIMESTAMP`].
10348  */
10349 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
10350    /**
10351     * A pointer to the opaque Rust object.
10352     * Nearly everywhere, inner must be non-null, however in places where
10353     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10354     */
10355    LDKnativePositiveTimestamp *inner;
10356    /**
10357     * Indicates that this is the only struct which contains the same pointer.
10358     * Rust functions which take ownership of an object provided via an argument require
10359     * this to be true and invalidate the object pointed to by inner.
10360     */
10361    bool is_owned;
10362 } LDKPositiveTimestamp;
10363
10364 /**
10365  * The contents of CResult_PositiveTimestampCreationErrorZ
10366  */
10367 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
10368    /**
10369     * A pointer to the contents in the success state.
10370     * Reading from this pointer when `result_ok` is not set is undefined.
10371     */
10372    struct LDKPositiveTimestamp *result;
10373    /**
10374     * A pointer to the contents in the error state.
10375     * Reading from this pointer when `result_ok` is set is undefined.
10376     */
10377    enum LDKCreationError *err;
10378 } LDKCResult_PositiveTimestampCreationErrorZPtr;
10379
10380 /**
10381  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
10382  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
10383  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10384  */
10385 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
10386    /**
10387     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
10388     * `err` or `result` depending on the state of `result_ok`.
10389     */
10390    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
10391    /**
10392     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
10393     */
10394    bool result_ok;
10395 } LDKCResult_PositiveTimestampCreationErrorZ;
10396
10397 /**
10398  * The contents of CResult_NoneSemanticErrorZ
10399  */
10400 typedef union LDKCResult_NoneSemanticErrorZPtr {
10401    /**
10402     * Note that this value is always NULL, as there are no contents in the OK variant
10403     */
10404    void *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    enum LDKSemanticError *err;
10410 } LDKCResult_NoneSemanticErrorZPtr;
10411
10412 /**
10413  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
10414  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
10415  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10416  */
10417 typedef struct LDKCResult_NoneSemanticErrorZ {
10418    /**
10419     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
10420     * `err` or `result` depending on the state of `result_ok`.
10421     */
10422    union LDKCResult_NoneSemanticErrorZPtr contents;
10423    /**
10424     * Whether this CResult_NoneSemanticErrorZ represents a success state.
10425     */
10426    bool result_ok;
10427 } LDKCResult_NoneSemanticErrorZ;
10428
10429 /**
10430  * The contents of CResult_InvoiceSemanticErrorZ
10431  */
10432 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
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 LDKInvoice *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    enum LDKSemanticError *err;
10443 } LDKCResult_InvoiceSemanticErrorZPtr;
10444
10445 /**
10446  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
10447  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
10448  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10449  */
10450 typedef struct LDKCResult_InvoiceSemanticErrorZ {
10451    /**
10452     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
10453     * `err` or `result` depending on the state of `result_ok`.
10454     */
10455    union LDKCResult_InvoiceSemanticErrorZPtr contents;
10456    /**
10457     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
10458     */
10459    bool result_ok;
10460 } LDKCResult_InvoiceSemanticErrorZ;
10461
10462
10463
10464 /**
10465  * Description string
10466  *
10467  * # Invariants
10468  * The description can be at most 639 __bytes__ long
10469  */
10470 typedef struct MUST_USE_STRUCT LDKDescription {
10471    /**
10472     * A pointer to the opaque Rust object.
10473     * Nearly everywhere, inner must be non-null, however in places where
10474     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10475     */
10476    LDKnativeDescription *inner;
10477    /**
10478     * Indicates that this is the only struct which contains the same pointer.
10479     * Rust functions which take ownership of an object provided via an argument require
10480     * this to be true and invalidate the object pointed to by inner.
10481     */
10482    bool is_owned;
10483 } LDKDescription;
10484
10485 /**
10486  * The contents of CResult_DescriptionCreationErrorZ
10487  */
10488 typedef union LDKCResult_DescriptionCreationErrorZPtr {
10489    /**
10490     * A pointer to the contents in the success state.
10491     * Reading from this pointer when `result_ok` is not set is undefined.
10492     */
10493    struct LDKDescription *result;
10494    /**
10495     * A pointer to the contents in the error state.
10496     * Reading from this pointer when `result_ok` is set is undefined.
10497     */
10498    enum LDKCreationError *err;
10499 } LDKCResult_DescriptionCreationErrorZPtr;
10500
10501 /**
10502  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
10503  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
10504  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10505  */
10506 typedef struct LDKCResult_DescriptionCreationErrorZ {
10507    /**
10508     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
10509     * `err` or `result` depending on the state of `result_ok`.
10510     */
10511    union LDKCResult_DescriptionCreationErrorZPtr contents;
10512    /**
10513     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
10514     */
10515    bool result_ok;
10516 } LDKCResult_DescriptionCreationErrorZ;
10517
10518 /**
10519  * The contents of CResult_PrivateRouteCreationErrorZ
10520  */
10521 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
10522    /**
10523     * A pointer to the contents in the success state.
10524     * Reading from this pointer when `result_ok` is not set is undefined.
10525     */
10526    struct LDKPrivateRoute *result;
10527    /**
10528     * A pointer to the contents in the error state.
10529     * Reading from this pointer when `result_ok` is set is undefined.
10530     */
10531    enum LDKCreationError *err;
10532 } LDKCResult_PrivateRouteCreationErrorZPtr;
10533
10534 /**
10535  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
10536  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
10537  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10538  */
10539 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
10540    /**
10541     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
10542     * `err` or `result` depending on the state of `result_ok`.
10543     */
10544    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
10545    /**
10546     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
10547     */
10548    bool result_ok;
10549 } LDKCResult_PrivateRouteCreationErrorZ;
10550
10551 /**
10552  * All-encompassing standard error type that processing can return
10553  */
10554 typedef enum LDKGraphSyncError_Tag {
10555    /**
10556     * Error trying to read the update data, typically due to an erroneous data length indication
10557     * that is greater than the actual amount of data provided
10558     */
10559    LDKGraphSyncError_DecodeError,
10560    /**
10561     * Error applying the patch to the network graph, usually the result of updates that are too
10562     * old or missing prerequisite data to the application of updates out of order
10563     */
10564    LDKGraphSyncError_LightningError,
10565    /**
10566     * Must be last for serialization purposes
10567     */
10568    LDKGraphSyncError_Sentinel,
10569 } LDKGraphSyncError_Tag;
10570
10571 typedef struct MUST_USE_STRUCT LDKGraphSyncError {
10572    LDKGraphSyncError_Tag tag;
10573    union {
10574       struct {
10575          struct LDKDecodeError decode_error;
10576       };
10577       struct {
10578          struct LDKLightningError lightning_error;
10579       };
10580    };
10581 } LDKGraphSyncError;
10582
10583 /**
10584  * The contents of CResult_u32GraphSyncErrorZ
10585  */
10586 typedef union LDKCResult_u32GraphSyncErrorZPtr {
10587    /**
10588     * A pointer to the contents in the success state.
10589     * Reading from this pointer when `result_ok` is not set is undefined.
10590     */
10591    uint32_t *result;
10592    /**
10593     * A pointer to the contents in the error state.
10594     * Reading from this pointer when `result_ok` is set is undefined.
10595     */
10596    struct LDKGraphSyncError *err;
10597 } LDKCResult_u32GraphSyncErrorZPtr;
10598
10599 /**
10600  * A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
10601  * containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
10602  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10603  */
10604 typedef struct LDKCResult_u32GraphSyncErrorZ {
10605    /**
10606     * The contents of this CResult_u32GraphSyncErrorZ, accessible via either
10607     * `err` or `result` depending on the state of `result_ok`.
10608     */
10609    union LDKCResult_u32GraphSyncErrorZPtr contents;
10610    /**
10611     * Whether this CResult_u32GraphSyncErrorZ represents a success state.
10612     */
10613    bool result_ok;
10614 } LDKCResult_u32GraphSyncErrorZ;
10615
10616 /**
10617  * The contents of CResult_NetAddressDecodeErrorZ
10618  */
10619 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
10620    /**
10621     * A pointer to the contents in the success state.
10622     * Reading from this pointer when `result_ok` is not set is undefined.
10623     */
10624    struct LDKNetAddress *result;
10625    /**
10626     * A pointer to the contents in the error state.
10627     * Reading from this pointer when `result_ok` is set is undefined.
10628     */
10629    struct LDKDecodeError *err;
10630 } LDKCResult_NetAddressDecodeErrorZPtr;
10631
10632 /**
10633  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
10634  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
10635  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10636  */
10637 typedef struct LDKCResult_NetAddressDecodeErrorZ {
10638    /**
10639     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
10640     * `err` or `result` depending on the state of `result_ok`.
10641     */
10642    union LDKCResult_NetAddressDecodeErrorZPtr contents;
10643    /**
10644     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
10645     */
10646    bool result_ok;
10647 } LDKCResult_NetAddressDecodeErrorZ;
10648
10649
10650
10651 /**
10652  * An update_add_htlc message to be sent or received from a peer
10653  */
10654 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
10655    /**
10656     * A pointer to the opaque Rust object.
10657     * Nearly everywhere, inner must be non-null, however in places where
10658     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10659     */
10660    LDKnativeUpdateAddHTLC *inner;
10661    /**
10662     * Indicates that this is the only struct which contains the same pointer.
10663     * Rust functions which take ownership of an object provided via an argument require
10664     * this to be true and invalidate the object pointed to by inner.
10665     */
10666    bool is_owned;
10667 } LDKUpdateAddHTLC;
10668
10669 /**
10670  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
10671  * This corresponds to std::vector in C++
10672  */
10673 typedef struct LDKCVec_UpdateAddHTLCZ {
10674    /**
10675     * The elements in the array.
10676     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10677     */
10678    struct LDKUpdateAddHTLC *data;
10679    /**
10680     * The number of elements pointed to by `data`.
10681     */
10682    uintptr_t datalen;
10683 } LDKCVec_UpdateAddHTLCZ;
10684
10685
10686
10687 /**
10688  * An update_fulfill_htlc message to be sent or received from a peer
10689  */
10690 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
10691    /**
10692     * A pointer to the opaque Rust object.
10693     * Nearly everywhere, inner must be non-null, however in places where
10694     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10695     */
10696    LDKnativeUpdateFulfillHTLC *inner;
10697    /**
10698     * Indicates that this is the only struct which contains the same pointer.
10699     * Rust functions which take ownership of an object provided via an argument require
10700     * this to be true and invalidate the object pointed to by inner.
10701     */
10702    bool is_owned;
10703 } LDKUpdateFulfillHTLC;
10704
10705 /**
10706  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
10707  * This corresponds to std::vector in C++
10708  */
10709 typedef struct LDKCVec_UpdateFulfillHTLCZ {
10710    /**
10711     * The elements in the array.
10712     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10713     */
10714    struct LDKUpdateFulfillHTLC *data;
10715    /**
10716     * The number of elements pointed to by `data`.
10717     */
10718    uintptr_t datalen;
10719 } LDKCVec_UpdateFulfillHTLCZ;
10720
10721
10722
10723 /**
10724  * An update_fail_htlc message to be sent or received from a peer
10725  */
10726 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
10727    /**
10728     * A pointer to the opaque Rust object.
10729     * Nearly everywhere, inner must be non-null, however in places where
10730     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10731     */
10732    LDKnativeUpdateFailHTLC *inner;
10733    /**
10734     * Indicates that this is the only struct which contains the same pointer.
10735     * Rust functions which take ownership of an object provided via an argument require
10736     * this to be true and invalidate the object pointed to by inner.
10737     */
10738    bool is_owned;
10739 } LDKUpdateFailHTLC;
10740
10741 /**
10742  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
10743  * This corresponds to std::vector in C++
10744  */
10745 typedef struct LDKCVec_UpdateFailHTLCZ {
10746    /**
10747     * The elements in the array.
10748     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10749     */
10750    struct LDKUpdateFailHTLC *data;
10751    /**
10752     * The number of elements pointed to by `data`.
10753     */
10754    uintptr_t datalen;
10755 } LDKCVec_UpdateFailHTLCZ;
10756
10757
10758
10759 /**
10760  * An update_fail_malformed_htlc message to be sent or received from a peer
10761  */
10762 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
10763    /**
10764     * A pointer to the opaque Rust object.
10765     * Nearly everywhere, inner must be non-null, however in places where
10766     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10767     */
10768    LDKnativeUpdateFailMalformedHTLC *inner;
10769    /**
10770     * Indicates that this is the only struct which contains the same pointer.
10771     * Rust functions which take ownership of an object provided via an argument require
10772     * this to be true and invalidate the object pointed to by inner.
10773     */
10774    bool is_owned;
10775 } LDKUpdateFailMalformedHTLC;
10776
10777 /**
10778  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
10779  * This corresponds to std::vector in C++
10780  */
10781 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
10782    /**
10783     * The elements in the array.
10784     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10785     */
10786    struct LDKUpdateFailMalformedHTLC *data;
10787    /**
10788     * The number of elements pointed to by `data`.
10789     */
10790    uintptr_t datalen;
10791 } LDKCVec_UpdateFailMalformedHTLCZ;
10792
10793 /**
10794  * The contents of CResult_AcceptChannelDecodeErrorZ
10795  */
10796 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
10797    /**
10798     * A pointer to the contents in the success state.
10799     * Reading from this pointer when `result_ok` is not set is undefined.
10800     */
10801    struct LDKAcceptChannel *result;
10802    /**
10803     * A pointer to the contents in the error state.
10804     * Reading from this pointer when `result_ok` is set is undefined.
10805     */
10806    struct LDKDecodeError *err;
10807 } LDKCResult_AcceptChannelDecodeErrorZPtr;
10808
10809 /**
10810  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
10811  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
10812  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10813  */
10814 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
10815    /**
10816     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
10817     * `err` or `result` depending on the state of `result_ok`.
10818     */
10819    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
10820    /**
10821     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
10822     */
10823    bool result_ok;
10824 } LDKCResult_AcceptChannelDecodeErrorZ;
10825
10826 /**
10827  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
10828  */
10829 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
10830    /**
10831     * A pointer to the contents in the success state.
10832     * Reading from this pointer when `result_ok` is not set is undefined.
10833     */
10834    struct LDKAnnouncementSignatures *result;
10835    /**
10836     * A pointer to the contents in the error state.
10837     * Reading from this pointer when `result_ok` is set is undefined.
10838     */
10839    struct LDKDecodeError *err;
10840 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
10841
10842 /**
10843  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
10844  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
10845  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10846  */
10847 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
10848    /**
10849     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
10850     * `err` or `result` depending on the state of `result_ok`.
10851     */
10852    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
10853    /**
10854     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
10855     */
10856    bool result_ok;
10857 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
10858
10859 /**
10860  * The contents of CResult_ChannelReestablishDecodeErrorZ
10861  */
10862 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
10863    /**
10864     * A pointer to the contents in the success state.
10865     * Reading from this pointer when `result_ok` is not set is undefined.
10866     */
10867    struct LDKChannelReestablish *result;
10868    /**
10869     * A pointer to the contents in the error state.
10870     * Reading from this pointer when `result_ok` is set is undefined.
10871     */
10872    struct LDKDecodeError *err;
10873 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
10874
10875 /**
10876  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
10877  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
10878  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10879  */
10880 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
10881    /**
10882     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
10883     * `err` or `result` depending on the state of `result_ok`.
10884     */
10885    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
10886    /**
10887     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
10888     */
10889    bool result_ok;
10890 } LDKCResult_ChannelReestablishDecodeErrorZ;
10891
10892 /**
10893  * The contents of CResult_ClosingSignedDecodeErrorZ
10894  */
10895 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
10896    /**
10897     * A pointer to the contents in the success state.
10898     * Reading from this pointer when `result_ok` is not set is undefined.
10899     */
10900    struct LDKClosingSigned *result;
10901    /**
10902     * A pointer to the contents in the error state.
10903     * Reading from this pointer when `result_ok` is set is undefined.
10904     */
10905    struct LDKDecodeError *err;
10906 } LDKCResult_ClosingSignedDecodeErrorZPtr;
10907
10908 /**
10909  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
10910  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
10911  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10912  */
10913 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
10914    /**
10915     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
10916     * `err` or `result` depending on the state of `result_ok`.
10917     */
10918    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
10919    /**
10920     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
10921     */
10922    bool result_ok;
10923 } LDKCResult_ClosingSignedDecodeErrorZ;
10924
10925
10926
10927 /**
10928  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
10929  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
10930  * to use.
10931  */
10932 typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
10933    /**
10934     * A pointer to the opaque Rust object.
10935     * Nearly everywhere, inner must be non-null, however in places where
10936     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10937     */
10938    LDKnativeClosingSignedFeeRange *inner;
10939    /**
10940     * Indicates that this is the only struct which contains the same pointer.
10941     * Rust functions which take ownership of an object provided via an argument require
10942     * this to be true and invalidate the object pointed to by inner.
10943     */
10944    bool is_owned;
10945 } LDKClosingSignedFeeRange;
10946
10947 /**
10948  * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
10949  */
10950 typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
10951    /**
10952     * A pointer to the contents in the success state.
10953     * Reading from this pointer when `result_ok` is not set is undefined.
10954     */
10955    struct LDKClosingSignedFeeRange *result;
10956    /**
10957     * A pointer to the contents in the error state.
10958     * Reading from this pointer when `result_ok` is set is undefined.
10959     */
10960    struct LDKDecodeError *err;
10961 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr;
10962
10963 /**
10964  * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
10965  * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10966  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10967  */
10968 typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ {
10969    /**
10970     * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
10971     * `err` or `result` depending on the state of `result_ok`.
10972     */
10973    union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
10974    /**
10975     * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
10976     */
10977    bool result_ok;
10978 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
10979
10980
10981
10982 /**
10983  * A commitment_signed message to be sent or received from a peer
10984  */
10985 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
10986    /**
10987     * A pointer to the opaque Rust object.
10988     * Nearly everywhere, inner must be non-null, however in places where
10989     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10990     */
10991    LDKnativeCommitmentSigned *inner;
10992    /**
10993     * Indicates that this is the only struct which contains the same pointer.
10994     * Rust functions which take ownership of an object provided via an argument require
10995     * this to be true and invalidate the object pointed to by inner.
10996     */
10997    bool is_owned;
10998 } LDKCommitmentSigned;
10999
11000 /**
11001  * The contents of CResult_CommitmentSignedDecodeErrorZ
11002  */
11003 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
11004    /**
11005     * A pointer to the contents in the success state.
11006     * Reading from this pointer when `result_ok` is not set is undefined.
11007     */
11008    struct LDKCommitmentSigned *result;
11009    /**
11010     * A pointer to the contents in the error state.
11011     * Reading from this pointer when `result_ok` is set is undefined.
11012     */
11013    struct LDKDecodeError *err;
11014 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
11015
11016 /**
11017  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
11018  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11019  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11020  */
11021 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
11022    /**
11023     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
11024     * `err` or `result` depending on the state of `result_ok`.
11025     */
11026    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
11027    /**
11028     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
11029     */
11030    bool result_ok;
11031 } LDKCResult_CommitmentSignedDecodeErrorZ;
11032
11033 /**
11034  * The contents of CResult_FundingCreatedDecodeErrorZ
11035  */
11036 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
11037    /**
11038     * A pointer to the contents in the success state.
11039     * Reading from this pointer when `result_ok` is not set is undefined.
11040     */
11041    struct LDKFundingCreated *result;
11042    /**
11043     * A pointer to the contents in the error state.
11044     * Reading from this pointer when `result_ok` is set is undefined.
11045     */
11046    struct LDKDecodeError *err;
11047 } LDKCResult_FundingCreatedDecodeErrorZPtr;
11048
11049 /**
11050  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
11051  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
11052  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11053  */
11054 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
11055    /**
11056     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
11057     * `err` or `result` depending on the state of `result_ok`.
11058     */
11059    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
11060    /**
11061     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
11062     */
11063    bool result_ok;
11064 } LDKCResult_FundingCreatedDecodeErrorZ;
11065
11066 /**
11067  * The contents of CResult_FundingSignedDecodeErrorZ
11068  */
11069 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
11070    /**
11071     * A pointer to the contents in the success state.
11072     * Reading from this pointer when `result_ok` is not set is undefined.
11073     */
11074    struct LDKFundingSigned *result;
11075    /**
11076     * A pointer to the contents in the error state.
11077     * Reading from this pointer when `result_ok` is set is undefined.
11078     */
11079    struct LDKDecodeError *err;
11080 } LDKCResult_FundingSignedDecodeErrorZPtr;
11081
11082 /**
11083  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
11084  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11085  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11086  */
11087 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
11088    /**
11089     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
11090     * `err` or `result` depending on the state of `result_ok`.
11091     */
11092    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
11093    /**
11094     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
11095     */
11096    bool result_ok;
11097 } LDKCResult_FundingSignedDecodeErrorZ;
11098
11099 /**
11100  * The contents of CResult_ChannelReadyDecodeErrorZ
11101  */
11102 typedef union LDKCResult_ChannelReadyDecodeErrorZPtr {
11103    /**
11104     * A pointer to the contents in the success state.
11105     * Reading from this pointer when `result_ok` is not set is undefined.
11106     */
11107    struct LDKChannelReady *result;
11108    /**
11109     * A pointer to the contents in the error state.
11110     * Reading from this pointer when `result_ok` is set is undefined.
11111     */
11112    struct LDKDecodeError *err;
11113 } LDKCResult_ChannelReadyDecodeErrorZPtr;
11114
11115 /**
11116  * A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
11117  * containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
11118  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11119  */
11120 typedef struct LDKCResult_ChannelReadyDecodeErrorZ {
11121    /**
11122     * The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
11123     * `err` or `result` depending on the state of `result_ok`.
11124     */
11125    union LDKCResult_ChannelReadyDecodeErrorZPtr contents;
11126    /**
11127     * Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
11128     */
11129    bool result_ok;
11130 } LDKCResult_ChannelReadyDecodeErrorZ;
11131
11132
11133
11134 /**
11135  * An init message to be sent or received from a peer
11136  */
11137 typedef struct MUST_USE_STRUCT LDKInit {
11138    /**
11139     * A pointer to the opaque Rust object.
11140     * Nearly everywhere, inner must be non-null, however in places where
11141     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11142     */
11143    LDKnativeInit *inner;
11144    /**
11145     * Indicates that this is the only struct which contains the same pointer.
11146     * Rust functions which take ownership of an object provided via an argument require
11147     * this to be true and invalidate the object pointed to by inner.
11148     */
11149    bool is_owned;
11150 } LDKInit;
11151
11152 /**
11153  * The contents of CResult_InitDecodeErrorZ
11154  */
11155 typedef union LDKCResult_InitDecodeErrorZPtr {
11156    /**
11157     * A pointer to the contents in the success state.
11158     * Reading from this pointer when `result_ok` is not set is undefined.
11159     */
11160    struct LDKInit *result;
11161    /**
11162     * A pointer to the contents in the error state.
11163     * Reading from this pointer when `result_ok` is set is undefined.
11164     */
11165    struct LDKDecodeError *err;
11166 } LDKCResult_InitDecodeErrorZPtr;
11167
11168 /**
11169  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
11170  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
11171  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11172  */
11173 typedef struct LDKCResult_InitDecodeErrorZ {
11174    /**
11175     * The contents of this CResult_InitDecodeErrorZ, accessible via either
11176     * `err` or `result` depending on the state of `result_ok`.
11177     */
11178    union LDKCResult_InitDecodeErrorZPtr contents;
11179    /**
11180     * Whether this CResult_InitDecodeErrorZ represents a success state.
11181     */
11182    bool result_ok;
11183 } LDKCResult_InitDecodeErrorZ;
11184
11185 /**
11186  * The contents of CResult_OpenChannelDecodeErrorZ
11187  */
11188 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
11189    /**
11190     * A pointer to the contents in the success state.
11191     * Reading from this pointer when `result_ok` is not set is undefined.
11192     */
11193    struct LDKOpenChannel *result;
11194    /**
11195     * A pointer to the contents in the error state.
11196     * Reading from this pointer when `result_ok` is set is undefined.
11197     */
11198    struct LDKDecodeError *err;
11199 } LDKCResult_OpenChannelDecodeErrorZPtr;
11200
11201 /**
11202  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
11203  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
11204  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11205  */
11206 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
11207    /**
11208     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
11209     * `err` or `result` depending on the state of `result_ok`.
11210     */
11211    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
11212    /**
11213     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
11214     */
11215    bool result_ok;
11216 } LDKCResult_OpenChannelDecodeErrorZ;
11217
11218 /**
11219  * The contents of CResult_RevokeAndACKDecodeErrorZ
11220  */
11221 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
11222    /**
11223     * A pointer to the contents in the success state.
11224     * Reading from this pointer when `result_ok` is not set is undefined.
11225     */
11226    struct LDKRevokeAndACK *result;
11227    /**
11228     * A pointer to the contents in the error state.
11229     * Reading from this pointer when `result_ok` is set is undefined.
11230     */
11231    struct LDKDecodeError *err;
11232 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
11233
11234 /**
11235  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
11236  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
11237  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11238  */
11239 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
11240    /**
11241     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
11242     * `err` or `result` depending on the state of `result_ok`.
11243     */
11244    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
11245    /**
11246     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
11247     */
11248    bool result_ok;
11249 } LDKCResult_RevokeAndACKDecodeErrorZ;
11250
11251 /**
11252  * The contents of CResult_ShutdownDecodeErrorZ
11253  */
11254 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
11255    /**
11256     * A pointer to the contents in the success state.
11257     * Reading from this pointer when `result_ok` is not set is undefined.
11258     */
11259    struct LDKShutdown *result;
11260    /**
11261     * A pointer to the contents in the error state.
11262     * Reading from this pointer when `result_ok` is set is undefined.
11263     */
11264    struct LDKDecodeError *err;
11265 } LDKCResult_ShutdownDecodeErrorZPtr;
11266
11267 /**
11268  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
11269  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
11270  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11271  */
11272 typedef struct LDKCResult_ShutdownDecodeErrorZ {
11273    /**
11274     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
11275     * `err` or `result` depending on the state of `result_ok`.
11276     */
11277    union LDKCResult_ShutdownDecodeErrorZPtr contents;
11278    /**
11279     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
11280     */
11281    bool result_ok;
11282 } LDKCResult_ShutdownDecodeErrorZ;
11283
11284 /**
11285  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
11286  */
11287 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
11288    /**
11289     * A pointer to the contents in the success state.
11290     * Reading from this pointer when `result_ok` is not set is undefined.
11291     */
11292    struct LDKUpdateFailHTLC *result;
11293    /**
11294     * A pointer to the contents in the error state.
11295     * Reading from this pointer when `result_ok` is set is undefined.
11296     */
11297    struct LDKDecodeError *err;
11298 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
11299
11300 /**
11301  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
11302  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
11303  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11304  */
11305 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
11306    /**
11307     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
11308     * `err` or `result` depending on the state of `result_ok`.
11309     */
11310    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
11311    /**
11312     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
11313     */
11314    bool result_ok;
11315 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
11316
11317 /**
11318  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
11319  */
11320 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
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 LDKUpdateFailMalformedHTLC *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_UpdateFailMalformedHTLCDecodeErrorZPtr;
11332
11333 /**
11334  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
11335  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC 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_UpdateFailMalformedHTLCDecodeErrorZ {
11339    /**
11340     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
11341     * `err` or `result` depending on the state of `result_ok`.
11342     */
11343    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
11344    /**
11345     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
11346     */
11347    bool result_ok;
11348 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
11349
11350
11351
11352 /**
11353  * An update_fee message to be sent or received from a peer
11354  */
11355 typedef struct MUST_USE_STRUCT LDKUpdateFee {
11356    /**
11357     * A pointer to the opaque Rust object.
11358     * Nearly everywhere, inner must be non-null, however in places where
11359     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11360     */
11361    LDKnativeUpdateFee *inner;
11362    /**
11363     * Indicates that this is the only struct which contains the same pointer.
11364     * Rust functions which take ownership of an object provided via an argument require
11365     * this to be true and invalidate the object pointed to by inner.
11366     */
11367    bool is_owned;
11368 } LDKUpdateFee;
11369
11370 /**
11371  * The contents of CResult_UpdateFeeDecodeErrorZ
11372  */
11373 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
11374    /**
11375     * A pointer to the contents in the success state.
11376     * Reading from this pointer when `result_ok` is not set is undefined.
11377     */
11378    struct LDKUpdateFee *result;
11379    /**
11380     * A pointer to the contents in the error state.
11381     * Reading from this pointer when `result_ok` is set is undefined.
11382     */
11383    struct LDKDecodeError *err;
11384 } LDKCResult_UpdateFeeDecodeErrorZPtr;
11385
11386 /**
11387  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
11388  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
11389  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11390  */
11391 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
11392    /**
11393     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
11394     * `err` or `result` depending on the state of `result_ok`.
11395     */
11396    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
11397    /**
11398     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
11399     */
11400    bool result_ok;
11401 } LDKCResult_UpdateFeeDecodeErrorZ;
11402
11403 /**
11404  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
11405  */
11406 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
11407    /**
11408     * A pointer to the contents in the success state.
11409     * Reading from this pointer when `result_ok` is not set is undefined.
11410     */
11411    struct LDKUpdateFulfillHTLC *result;
11412    /**
11413     * A pointer to the contents in the error state.
11414     * Reading from this pointer when `result_ok` is set is undefined.
11415     */
11416    struct LDKDecodeError *err;
11417 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
11418
11419 /**
11420  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
11421  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
11422  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11423  */
11424 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
11425    /**
11426     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
11427     * `err` or `result` depending on the state of `result_ok`.
11428     */
11429    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
11430    /**
11431     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
11432     */
11433    bool result_ok;
11434 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
11435
11436 /**
11437  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
11438  */
11439 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
11440    /**
11441     * A pointer to the contents in the success state.
11442     * Reading from this pointer when `result_ok` is not set is undefined.
11443     */
11444    struct LDKUpdateAddHTLC *result;
11445    /**
11446     * A pointer to the contents in the error state.
11447     * Reading from this pointer when `result_ok` is set is undefined.
11448     */
11449    struct LDKDecodeError *err;
11450 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
11451
11452 /**
11453  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
11454  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
11455  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11456  */
11457 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
11458    /**
11459     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
11460     * `err` or `result` depending on the state of `result_ok`.
11461     */
11462    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
11463    /**
11464     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
11465     */
11466    bool result_ok;
11467 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
11468
11469
11470
11471 /**
11472  * An onion message to be sent or received from a peer
11473  */
11474 typedef struct MUST_USE_STRUCT LDKOnionMessage {
11475    /**
11476     * A pointer to the opaque Rust object.
11477     * Nearly everywhere, inner must be non-null, however in places where
11478     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11479     */
11480    LDKnativeOnionMessage *inner;
11481    /**
11482     * Indicates that this is the only struct which contains the same pointer.
11483     * Rust functions which take ownership of an object provided via an argument require
11484     * this to be true and invalidate the object pointed to by inner.
11485     */
11486    bool is_owned;
11487 } LDKOnionMessage;
11488
11489 /**
11490  * The contents of CResult_OnionMessageDecodeErrorZ
11491  */
11492 typedef union LDKCResult_OnionMessageDecodeErrorZPtr {
11493    /**
11494     * A pointer to the contents in the success state.
11495     * Reading from this pointer when `result_ok` is not set is undefined.
11496     */
11497    struct LDKOnionMessage *result;
11498    /**
11499     * A pointer to the contents in the error state.
11500     * Reading from this pointer when `result_ok` is set is undefined.
11501     */
11502    struct LDKDecodeError *err;
11503 } LDKCResult_OnionMessageDecodeErrorZPtr;
11504
11505 /**
11506  * A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
11507  * containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
11508  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11509  */
11510 typedef struct LDKCResult_OnionMessageDecodeErrorZ {
11511    /**
11512     * The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
11513     * `err` or `result` depending on the state of `result_ok`.
11514     */
11515    union LDKCResult_OnionMessageDecodeErrorZPtr contents;
11516    /**
11517     * Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
11518     */
11519    bool result_ok;
11520 } LDKCResult_OnionMessageDecodeErrorZ;
11521
11522
11523
11524 /**
11525  * A ping message to be sent or received from a peer
11526  */
11527 typedef struct MUST_USE_STRUCT LDKPing {
11528    /**
11529     * A pointer to the opaque Rust object.
11530     * Nearly everywhere, inner must be non-null, however in places where
11531     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11532     */
11533    LDKnativePing *inner;
11534    /**
11535     * Indicates that this is the only struct which contains the same pointer.
11536     * Rust functions which take ownership of an object provided via an argument require
11537     * this to be true and invalidate the object pointed to by inner.
11538     */
11539    bool is_owned;
11540 } LDKPing;
11541
11542 /**
11543  * The contents of CResult_PingDecodeErrorZ
11544  */
11545 typedef union LDKCResult_PingDecodeErrorZPtr {
11546    /**
11547     * A pointer to the contents in the success state.
11548     * Reading from this pointer when `result_ok` is not set is undefined.
11549     */
11550    struct LDKPing *result;
11551    /**
11552     * A pointer to the contents in the error state.
11553     * Reading from this pointer when `result_ok` is set is undefined.
11554     */
11555    struct LDKDecodeError *err;
11556 } LDKCResult_PingDecodeErrorZPtr;
11557
11558 /**
11559  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
11560  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
11561  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11562  */
11563 typedef struct LDKCResult_PingDecodeErrorZ {
11564    /**
11565     * The contents of this CResult_PingDecodeErrorZ, accessible via either
11566     * `err` or `result` depending on the state of `result_ok`.
11567     */
11568    union LDKCResult_PingDecodeErrorZPtr contents;
11569    /**
11570     * Whether this CResult_PingDecodeErrorZ represents a success state.
11571     */
11572    bool result_ok;
11573 } LDKCResult_PingDecodeErrorZ;
11574
11575
11576
11577 /**
11578  * A pong message to be sent or received from a peer
11579  */
11580 typedef struct MUST_USE_STRUCT LDKPong {
11581    /**
11582     * A pointer to the opaque Rust object.
11583     * Nearly everywhere, inner must be non-null, however in places where
11584     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11585     */
11586    LDKnativePong *inner;
11587    /**
11588     * Indicates that this is the only struct which contains the same pointer.
11589     * Rust functions which take ownership of an object provided via an argument require
11590     * this to be true and invalidate the object pointed to by inner.
11591     */
11592    bool is_owned;
11593 } LDKPong;
11594
11595 /**
11596  * The contents of CResult_PongDecodeErrorZ
11597  */
11598 typedef union LDKCResult_PongDecodeErrorZPtr {
11599    /**
11600     * A pointer to the contents in the success state.
11601     * Reading from this pointer when `result_ok` is not set is undefined.
11602     */
11603    struct LDKPong *result;
11604    /**
11605     * A pointer to the contents in the error state.
11606     * Reading from this pointer when `result_ok` is set is undefined.
11607     */
11608    struct LDKDecodeError *err;
11609 } LDKCResult_PongDecodeErrorZPtr;
11610
11611 /**
11612  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
11613  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
11614  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11615  */
11616 typedef struct LDKCResult_PongDecodeErrorZ {
11617    /**
11618     * The contents of this CResult_PongDecodeErrorZ, accessible via either
11619     * `err` or `result` depending on the state of `result_ok`.
11620     */
11621    union LDKCResult_PongDecodeErrorZPtr contents;
11622    /**
11623     * Whether this CResult_PongDecodeErrorZ represents a success state.
11624     */
11625    bool result_ok;
11626 } LDKCResult_PongDecodeErrorZ;
11627
11628 /**
11629  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
11630  */
11631 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
11632    /**
11633     * A pointer to the contents in the success state.
11634     * Reading from this pointer when `result_ok` is not set is undefined.
11635     */
11636    struct LDKUnsignedChannelAnnouncement *result;
11637    /**
11638     * A pointer to the contents in the error state.
11639     * Reading from this pointer when `result_ok` is set is undefined.
11640     */
11641    struct LDKDecodeError *err;
11642 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
11643
11644 /**
11645  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
11646  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11647  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11648  */
11649 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
11650    /**
11651     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
11652     * `err` or `result` depending on the state of `result_ok`.
11653     */
11654    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
11655    /**
11656     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
11657     */
11658    bool result_ok;
11659 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
11660
11661 /**
11662  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
11663  */
11664 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
11665    /**
11666     * A pointer to the contents in the success state.
11667     * Reading from this pointer when `result_ok` is not set is undefined.
11668     */
11669    struct LDKChannelAnnouncement *result;
11670    /**
11671     * A pointer to the contents in the error state.
11672     * Reading from this pointer when `result_ok` is set is undefined.
11673     */
11674    struct LDKDecodeError *err;
11675 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
11676
11677 /**
11678  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
11679  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11680  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11681  */
11682 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
11683    /**
11684     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
11685     * `err` or `result` depending on the state of `result_ok`.
11686     */
11687    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
11688    /**
11689     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
11690     */
11691    bool result_ok;
11692 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
11693
11694
11695
11696 /**
11697  * The unsigned part of a channel_update
11698  */
11699 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
11700    /**
11701     * A pointer to the opaque Rust object.
11702     * Nearly everywhere, inner must be non-null, however in places where
11703     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11704     */
11705    LDKnativeUnsignedChannelUpdate *inner;
11706    /**
11707     * Indicates that this is the only struct which contains the same pointer.
11708     * Rust functions which take ownership of an object provided via an argument require
11709     * this to be true and invalidate the object pointed to by inner.
11710     */
11711    bool is_owned;
11712 } LDKUnsignedChannelUpdate;
11713
11714 /**
11715  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
11716  */
11717 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
11718    /**
11719     * A pointer to the contents in the success state.
11720     * Reading from this pointer when `result_ok` is not set is undefined.
11721     */
11722    struct LDKUnsignedChannelUpdate *result;
11723    /**
11724     * A pointer to the contents in the error state.
11725     * Reading from this pointer when `result_ok` is set is undefined.
11726     */
11727    struct LDKDecodeError *err;
11728 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
11729
11730 /**
11731  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
11732  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11733  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11734  */
11735 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
11736    /**
11737     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
11738     * `err` or `result` depending on the state of `result_ok`.
11739     */
11740    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
11741    /**
11742     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
11743     */
11744    bool result_ok;
11745 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
11746
11747 /**
11748  * The contents of CResult_ChannelUpdateDecodeErrorZ
11749  */
11750 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
11751    /**
11752     * A pointer to the contents in the success state.
11753     * Reading from this pointer when `result_ok` is not set is undefined.
11754     */
11755    struct LDKChannelUpdate *result;
11756    /**
11757     * A pointer to the contents in the error state.
11758     * Reading from this pointer when `result_ok` is set is undefined.
11759     */
11760    struct LDKDecodeError *err;
11761 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
11762
11763 /**
11764  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
11765  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11766  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11767  */
11768 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
11769    /**
11770     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
11771     * `err` or `result` depending on the state of `result_ok`.
11772     */
11773    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
11774    /**
11775     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
11776     */
11777    bool result_ok;
11778 } LDKCResult_ChannelUpdateDecodeErrorZ;
11779
11780 /**
11781  * The contents of CResult_ErrorMessageDecodeErrorZ
11782  */
11783 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
11784    /**
11785     * A pointer to the contents in the success state.
11786     * Reading from this pointer when `result_ok` is not set is undefined.
11787     */
11788    struct LDKErrorMessage *result;
11789    /**
11790     * A pointer to the contents in the error state.
11791     * Reading from this pointer when `result_ok` is set is undefined.
11792     */
11793    struct LDKDecodeError *err;
11794 } LDKCResult_ErrorMessageDecodeErrorZPtr;
11795
11796 /**
11797  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
11798  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
11799  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11800  */
11801 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
11802    /**
11803     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
11804     * `err` or `result` depending on the state of `result_ok`.
11805     */
11806    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
11807    /**
11808     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
11809     */
11810    bool result_ok;
11811 } LDKCResult_ErrorMessageDecodeErrorZ;
11812
11813 /**
11814  * The contents of CResult_WarningMessageDecodeErrorZ
11815  */
11816 typedef union LDKCResult_WarningMessageDecodeErrorZPtr {
11817    /**
11818     * A pointer to the contents in the success state.
11819     * Reading from this pointer when `result_ok` is not set is undefined.
11820     */
11821    struct LDKWarningMessage *result;
11822    /**
11823     * A pointer to the contents in the error state.
11824     * Reading from this pointer when `result_ok` is set is undefined.
11825     */
11826    struct LDKDecodeError *err;
11827 } LDKCResult_WarningMessageDecodeErrorZPtr;
11828
11829 /**
11830  * A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
11831  * containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
11832  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11833  */
11834 typedef struct LDKCResult_WarningMessageDecodeErrorZ {
11835    /**
11836     * The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
11837     * `err` or `result` depending on the state of `result_ok`.
11838     */
11839    union LDKCResult_WarningMessageDecodeErrorZPtr contents;
11840    /**
11841     * Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
11842     */
11843    bool result_ok;
11844 } LDKCResult_WarningMessageDecodeErrorZ;
11845
11846
11847
11848 /**
11849  * The unsigned part of a node_announcement
11850  */
11851 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
11852    /**
11853     * A pointer to the opaque Rust object.
11854     * Nearly everywhere, inner must be non-null, however in places where
11855     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11856     */
11857    LDKnativeUnsignedNodeAnnouncement *inner;
11858    /**
11859     * Indicates that this is the only struct which contains the same pointer.
11860     * Rust functions which take ownership of an object provided via an argument require
11861     * this to be true and invalidate the object pointed to by inner.
11862     */
11863    bool is_owned;
11864 } LDKUnsignedNodeAnnouncement;
11865
11866 /**
11867  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
11868  */
11869 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
11870    /**
11871     * A pointer to the contents in the success state.
11872     * Reading from this pointer when `result_ok` is not set is undefined.
11873     */
11874    struct LDKUnsignedNodeAnnouncement *result;
11875    /**
11876     * A pointer to the contents in the error state.
11877     * Reading from this pointer when `result_ok` is set is undefined.
11878     */
11879    struct LDKDecodeError *err;
11880 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
11881
11882 /**
11883  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
11884  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11885  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11886  */
11887 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
11888    /**
11889     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
11890     * `err` or `result` depending on the state of `result_ok`.
11891     */
11892    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
11893    /**
11894     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
11895     */
11896    bool result_ok;
11897 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
11898
11899
11900
11901 /**
11902  * A node_announcement message to be sent or received from a peer
11903  */
11904 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
11905    /**
11906     * A pointer to the opaque Rust object.
11907     * Nearly everywhere, inner must be non-null, however in places where
11908     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11909     */
11910    LDKnativeNodeAnnouncement *inner;
11911    /**
11912     * Indicates that this is the only struct which contains the same pointer.
11913     * Rust functions which take ownership of an object provided via an argument require
11914     * this to be true and invalidate the object pointed to by inner.
11915     */
11916    bool is_owned;
11917 } LDKNodeAnnouncement;
11918
11919 /**
11920  * The contents of CResult_NodeAnnouncementDecodeErrorZ
11921  */
11922 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
11923    /**
11924     * A pointer to the contents in the success state.
11925     * Reading from this pointer when `result_ok` is not set is undefined.
11926     */
11927    struct LDKNodeAnnouncement *result;
11928    /**
11929     * A pointer to the contents in the error state.
11930     * Reading from this pointer when `result_ok` is set is undefined.
11931     */
11932    struct LDKDecodeError *err;
11933 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
11934
11935 /**
11936  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
11937  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
11938  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11939  */
11940 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
11941    /**
11942     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
11943     * `err` or `result` depending on the state of `result_ok`.
11944     */
11945    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
11946    /**
11947     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
11948     */
11949    bool result_ok;
11950 } LDKCResult_NodeAnnouncementDecodeErrorZ;
11951
11952 /**
11953  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
11954  */
11955 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
11956    /**
11957     * A pointer to the contents in the success state.
11958     * Reading from this pointer when `result_ok` is not set is undefined.
11959     */
11960    struct LDKQueryShortChannelIds *result;
11961    /**
11962     * A pointer to the contents in the error state.
11963     * Reading from this pointer when `result_ok` is set is undefined.
11964     */
11965    struct LDKDecodeError *err;
11966 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
11967
11968 /**
11969  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
11970  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
11971  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11972  */
11973 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
11974    /**
11975     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
11976     * `err` or `result` depending on the state of `result_ok`.
11977     */
11978    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
11979    /**
11980     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
11981     */
11982    bool result_ok;
11983 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
11984
11985
11986
11987 /**
11988  * A reply_short_channel_ids_end message is sent as a reply to a
11989  * query_short_channel_ids message. The query recipient makes a best
11990  * effort to respond based on their local network view which may not be
11991  * a perfect view of the network.
11992  */
11993 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
11994    /**
11995     * A pointer to the opaque Rust object.
11996     * Nearly everywhere, inner must be non-null, however in places where
11997     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11998     */
11999    LDKnativeReplyShortChannelIdsEnd *inner;
12000    /**
12001     * Indicates that this is the only struct which contains the same pointer.
12002     * Rust functions which take ownership of an object provided via an argument require
12003     * this to be true and invalidate the object pointed to by inner.
12004     */
12005    bool is_owned;
12006 } LDKReplyShortChannelIdsEnd;
12007
12008 /**
12009  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
12010  */
12011 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12012    /**
12013     * A pointer to the contents in the success state.
12014     * Reading from this pointer when `result_ok` is not set is undefined.
12015     */
12016    struct LDKReplyShortChannelIdsEnd *result;
12017    /**
12018     * A pointer to the contents in the error state.
12019     * Reading from this pointer when `result_ok` is set is undefined.
12020     */
12021    struct LDKDecodeError *err;
12022 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
12023
12024 /**
12025  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
12026  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
12027  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12028  */
12029 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
12030    /**
12031     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
12032     * `err` or `result` depending on the state of `result_ok`.
12033     */
12034    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
12035    /**
12036     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
12037     */
12038    bool result_ok;
12039 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
12040
12041 /**
12042  * The contents of CResult_QueryChannelRangeDecodeErrorZ
12043  */
12044 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
12045    /**
12046     * A pointer to the contents in the success state.
12047     * Reading from this pointer when `result_ok` is not set is undefined.
12048     */
12049    struct LDKQueryChannelRange *result;
12050    /**
12051     * A pointer to the contents in the error state.
12052     * Reading from this pointer when `result_ok` is set is undefined.
12053     */
12054    struct LDKDecodeError *err;
12055 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
12056
12057 /**
12058  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
12059  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12060  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12061  */
12062 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
12063    /**
12064     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
12065     * `err` or `result` depending on the state of `result_ok`.
12066     */
12067    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
12068    /**
12069     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
12070     */
12071    bool result_ok;
12072 } LDKCResult_QueryChannelRangeDecodeErrorZ;
12073
12074 /**
12075  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
12076  */
12077 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
12078    /**
12079     * A pointer to the contents in the success state.
12080     * Reading from this pointer when `result_ok` is not set is undefined.
12081     */
12082    struct LDKReplyChannelRange *result;
12083    /**
12084     * A pointer to the contents in the error state.
12085     * Reading from this pointer when `result_ok` is set is undefined.
12086     */
12087    struct LDKDecodeError *err;
12088 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
12089
12090 /**
12091  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
12092  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12093  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12094  */
12095 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
12096    /**
12097     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
12098     * `err` or `result` depending on the state of `result_ok`.
12099     */
12100    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
12101    /**
12102     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
12103     */
12104    bool result_ok;
12105 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
12106
12107 /**
12108  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
12109  */
12110 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
12111    /**
12112     * A pointer to the contents in the success state.
12113     * Reading from this pointer when `result_ok` is not set is undefined.
12114     */
12115    struct LDKGossipTimestampFilter *result;
12116    /**
12117     * A pointer to the contents in the error state.
12118     * Reading from this pointer when `result_ok` is set is undefined.
12119     */
12120    struct LDKDecodeError *err;
12121 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
12122
12123 /**
12124  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
12125  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
12126  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12127  */
12128 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
12129    /**
12130     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
12131     * `err` or `result` depending on the state of `result_ok`.
12132     */
12133    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
12134    /**
12135     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
12136     */
12137    bool result_ok;
12138 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
12139
12140 /**
12141  * A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
12142  * This corresponds to std::vector in C++
12143  */
12144 typedef struct LDKCVec_PhantomRouteHintsZ {
12145    /**
12146     * The elements in the array.
12147     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12148     */
12149    struct LDKPhantomRouteHints *data;
12150    /**
12151     * The number of elements pointed to by `data`.
12152     */
12153    uintptr_t datalen;
12154 } LDKCVec_PhantomRouteHintsZ;
12155
12156 /**
12157  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
12158  * may occur.
12159  */
12160 typedef enum LDKSignOrCreationError_Tag {
12161    /**
12162     * An error occurred during signing
12163     */
12164    LDKSignOrCreationError_SignError,
12165    /**
12166     * An error occurred while building the transaction
12167     */
12168    LDKSignOrCreationError_CreationError,
12169    /**
12170     * Must be last for serialization purposes
12171     */
12172    LDKSignOrCreationError_Sentinel,
12173 } LDKSignOrCreationError_Tag;
12174
12175 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
12176    LDKSignOrCreationError_Tag tag;
12177    union {
12178       struct {
12179          enum LDKCreationError creation_error;
12180       };
12181    };
12182 } LDKSignOrCreationError;
12183
12184 /**
12185  * The contents of CResult_InvoiceSignOrCreationErrorZ
12186  */
12187 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
12188    /**
12189     * A pointer to the contents in the success state.
12190     * Reading from this pointer when `result_ok` is not set is undefined.
12191     */
12192    struct LDKInvoice *result;
12193    /**
12194     * A pointer to the contents in the error state.
12195     * Reading from this pointer when `result_ok` is set is undefined.
12196     */
12197    struct LDKSignOrCreationError *err;
12198 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
12199
12200 /**
12201  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
12202  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
12203  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12204  */
12205 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
12206    /**
12207     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
12208     * `err` or `result` depending on the state of `result_ok`.
12209     */
12210    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
12211    /**
12212     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
12213     */
12214    bool result_ok;
12215 } LDKCResult_InvoiceSignOrCreationErrorZ;
12216
12217
12218
12219 /**
12220  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
12221  *
12222  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
12223  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
12224  * [`Confirm::transactions_confirmed`].
12225  *
12226  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
12227  * may have been spent there. See [`Filter::register_output`] for details.
12228  *
12229  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
12230  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
12231  */
12232 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
12233    /**
12234     * A pointer to the opaque Rust object.
12235     * Nearly everywhere, inner must be non-null, however in places where
12236     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12237     */
12238    LDKnativeWatchedOutput *inner;
12239    /**
12240     * Indicates that this is the only struct which contains the same pointer.
12241     * Rust functions which take ownership of an object provided via an argument require
12242     * this to be true and invalidate the object pointed to by inner.
12243     */
12244    bool is_owned;
12245 } LDKWatchedOutput;
12246
12247 /**
12248  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
12249  * channels.
12250  *
12251  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
12252  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
12253  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
12254  * receiving full blocks from a chain source, any further filtering is unnecessary.
12255  *
12256  * After an output has been registered, subsequent block retrievals from the chain source must not
12257  * exclude any transactions matching the new criteria nor any in-block descendants of such
12258  * transactions.
12259  *
12260  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
12261  * should not block on I/O. Implementations should instead queue the newly monitored data to be
12262  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
12263  * invocation that has called the `Filter` must return [`InProgress`].
12264  *
12265  * [`InProgress`]: ChannelMonitorUpdateStatus::InProgress
12266  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
12267  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
12268  */
12269 typedef struct LDKFilter {
12270    /**
12271     * An opaque pointer which is passed to your function implementations as an argument.
12272     * This has no meaning in the LDK, and can be NULL or any other value.
12273     */
12274    void *this_arg;
12275    /**
12276     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
12277     * a spending condition.
12278     */
12279    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
12280    /**
12281     * Registers interest in spends of a transaction output.
12282     *
12283     * Note that this method might be called during processing of a new block. You therefore need
12284     * to ensure that also dependent output spents within an already connected block are correctly
12285     * handled, e.g., by re-scanning the block in question whenever new outputs have been
12286     * registered mid-processing.
12287     */
12288    void (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
12289    /**
12290     * Frees any resources associated with this object given its this_arg pointer.
12291     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12292     */
12293    void (*free)(void *this_arg);
12294 } LDKFilter;
12295
12296 /**
12297  * An enum which can either contain a crate::lightning::chain::Filter or not
12298  */
12299 typedef enum LDKCOption_FilterZ_Tag {
12300    /**
12301     * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
12302     */
12303    LDKCOption_FilterZ_Some,
12304    /**
12305     * When we're in this state, this COption_FilterZ contains nothing
12306     */
12307    LDKCOption_FilterZ_None,
12308    /**
12309     * Must be last for serialization purposes
12310     */
12311    LDKCOption_FilterZ_Sentinel,
12312 } LDKCOption_FilterZ_Tag;
12313
12314 typedef struct LDKCOption_FilterZ {
12315    LDKCOption_FilterZ_Tag tag;
12316    union {
12317       struct {
12318          struct LDKFilter some;
12319       };
12320    };
12321 } LDKCOption_FilterZ;
12322
12323
12324
12325 /**
12326  * A read-only reference to a current ChannelMonitor.
12327  *
12328  * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is
12329  * released.
12330  */
12331 typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor {
12332    /**
12333     * A pointer to the opaque Rust object.
12334     * Nearly everywhere, inner must be non-null, however in places where
12335     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12336     */
12337    LDKnativeLockedChannelMonitor *inner;
12338    /**
12339     * Indicates that this is the only struct which contains the same pointer.
12340     * Rust functions which take ownership of an object provided via an argument require
12341     * this to be true and invalidate the object pointed to by inner.
12342     */
12343    bool is_owned;
12344 } LDKLockedChannelMonitor;
12345
12346 /**
12347  * The contents of CResult_LockedChannelMonitorNoneZ
12348  */
12349 typedef union LDKCResult_LockedChannelMonitorNoneZPtr {
12350    /**
12351     * A pointer to the contents in the success state.
12352     * Reading from this pointer when `result_ok` is not set is undefined.
12353     */
12354    struct LDKLockedChannelMonitor *result;
12355    /**
12356     * Note that this value is always NULL, as there are no contents in the Err variant
12357     */
12358    void *err;
12359 } LDKCResult_LockedChannelMonitorNoneZPtr;
12360
12361 /**
12362  * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
12363  * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
12364  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12365  */
12366 typedef struct LDKCResult_LockedChannelMonitorNoneZ {
12367    /**
12368     * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
12369     * `err` or `result` depending on the state of `result_ok`.
12370     */
12371    union LDKCResult_LockedChannelMonitorNoneZPtr contents;
12372    /**
12373     * Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
12374     */
12375    bool result_ok;
12376 } LDKCResult_LockedChannelMonitorNoneZ;
12377
12378 /**
12379  * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
12380  * This corresponds to std::vector in C++
12381  */
12382 typedef struct LDKCVec_OutPointZ {
12383    /**
12384     * The elements in the array.
12385     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12386     */
12387    struct LDKOutPoint *data;
12388    /**
12389     * The number of elements pointed to by `data`.
12390     */
12391    uintptr_t datalen;
12392 } LDKCVec_OutPointZ;
12393
12394
12395
12396 /**
12397  * An opaque identifier describing a specific [`Persist`] method call.
12398  */
12399 typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
12400    /**
12401     * A pointer to the opaque Rust object.
12402     * Nearly everywhere, inner must be non-null, however in places where
12403     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12404     */
12405    LDKnativeMonitorUpdateId *inner;
12406    /**
12407     * Indicates that this is the only struct which contains the same pointer.
12408     * Rust functions which take ownership of an object provided via an argument require
12409     * this to be true and invalidate the object pointed to by inner.
12410     */
12411    bool is_owned;
12412 } LDKMonitorUpdateId;
12413
12414 /**
12415  * A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
12416  * This corresponds to std::vector in C++
12417  */
12418 typedef struct LDKCVec_MonitorUpdateIdZ {
12419    /**
12420     * The elements in the array.
12421     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12422     */
12423    struct LDKMonitorUpdateId *data;
12424    /**
12425     * The number of elements pointed to by `data`.
12426     */
12427    uintptr_t datalen;
12428 } LDKCVec_MonitorUpdateIdZ;
12429
12430 /**
12431  * A tuple of 2 elements. See the individual fields for the types contained.
12432  */
12433 typedef struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ {
12434    /**
12435     * The element at position 0
12436     */
12437    struct LDKOutPoint a;
12438    /**
12439     * The element at position 1
12440     */
12441    struct LDKCVec_MonitorUpdateIdZ b;
12442 } LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ;
12443
12444 /**
12445  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
12446  * This corresponds to std::vector in C++
12447  */
12448 typedef struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
12449    /**
12450     * The elements in the array.
12451     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12452     */
12453    struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *data;
12454    /**
12455     * The number of elements pointed to by `data`.
12456     */
12457    uintptr_t datalen;
12458 } LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ;
12459
12460 /**
12461  * A trait indicating an object may generate message send events
12462  */
12463 typedef struct LDKMessageSendEventsProvider {
12464    /**
12465     * An opaque pointer which is passed to your function implementations as an argument.
12466     * This has no meaning in the LDK, and can be NULL or any other value.
12467     */
12468    void *this_arg;
12469    /**
12470     * Gets the list of pending events which were generated by previous actions, clearing the list
12471     * in the process.
12472     */
12473    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
12474    /**
12475     * Frees any resources associated with this object given its this_arg pointer.
12476     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12477     */
12478    void (*free)(void *this_arg);
12479 } LDKMessageSendEventsProvider;
12480
12481 /**
12482  * A trait indicating an object may generate onion messages to send
12483  */
12484 typedef struct LDKOnionMessageProvider {
12485    /**
12486     * An opaque pointer which is passed to your function implementations as an argument.
12487     * This has no meaning in the LDK, and can be NULL or any other value.
12488     */
12489    void *this_arg;
12490    /**
12491     * Gets the next pending onion message for the peer with the given node id.
12492     *
12493     * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
12494     */
12495    struct LDKOnionMessage (*next_onion_message_for_peer)(const void *this_arg, struct LDKPublicKey peer_node_id);
12496    /**
12497     * Frees any resources associated with this object given its this_arg pointer.
12498     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12499     */
12500    void (*free)(void *this_arg);
12501 } LDKOnionMessageProvider;
12502
12503 /**
12504  * A trait implemented for objects handling events from [`EventsProvider`].
12505  *
12506  * An async variation also exists for implementations of [`EventsProvider`] that support async
12507  * event handling. The async event handler should satisfy the generic bounds: `F:
12508  * core::future::Future, H: Fn(Event) -> F`.
12509  */
12510 typedef struct LDKEventHandler {
12511    /**
12512     * An opaque pointer which is passed to your function implementations as an argument.
12513     * This has no meaning in the LDK, and can be NULL or any other value.
12514     */
12515    void *this_arg;
12516    /**
12517     * Handles the given [`Event`].
12518     *
12519     * See [`EventsProvider`] for details that must be considered when implementing this method.
12520     */
12521    void (*handle_event)(const void *this_arg, struct LDKEvent event);
12522    /**
12523     * Frees any resources associated with this object given its this_arg pointer.
12524     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12525     */
12526    void (*free)(void *this_arg);
12527 } LDKEventHandler;
12528
12529 /**
12530  * A trait indicating an object may generate events.
12531  *
12532  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
12533  *
12534  * Implementations of this trait may also feature an async version of event handling, as shown with
12535  * [`ChannelManager::process_pending_events_async`] and
12536  * [`ChainMonitor::process_pending_events_async`].
12537  *
12538  * # Requirements
12539  *
12540  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
12541  * event since the last invocation.
12542  *
12543  * In order to ensure no [`Event`]s are lost, implementors of this trait will persist [`Event`]s
12544  * and replay any unhandled events on startup. An [`Event`] is considered handled when
12545  * [`process_pending_events`] returns, thus handlers MUST fully handle [`Event`]s and persist any
12546  * relevant changes to disk *before* returning.
12547  *
12548  * Further, because an application may crash between an [`Event`] being handled and the
12549  * implementor of this trait being re-serialized, [`Event`] handling must be idempotent - in
12550  * effect, [`Event`]s may be replayed.
12551  *
12552  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
12553  * consult the provider's documentation on the implication of processing events and how a handler
12554  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
12555  * [`ChainMonitor::process_pending_events`]).
12556  *
12557  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
12558  * own type(s).
12559  *
12560  * [`process_pending_events`]: Self::process_pending_events
12561  * [`handle_event`]: EventHandler::handle_event
12562  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
12563  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
12564  * [`ChannelManager::process_pending_events_async`]: crate::ln::channelmanager::ChannelManager::process_pending_events_async
12565  * [`ChainMonitor::process_pending_events_async`]: crate::chain::chainmonitor::ChainMonitor::process_pending_events_async
12566  */
12567 typedef struct LDKEventsProvider {
12568    /**
12569     * An opaque pointer which is passed to your function implementations as an argument.
12570     * This has no meaning in the LDK, and can be NULL or any other value.
12571     */
12572    void *this_arg;
12573    /**
12574     * Processes any events generated since the last call using the given event handler.
12575     *
12576     * See the trait-level documentation for requirements.
12577     */
12578    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
12579    /**
12580     * Frees any resources associated with this object given its this_arg pointer.
12581     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12582     */
12583    void (*free)(void *this_arg);
12584 } LDKEventsProvider;
12585
12586
12587
12588 /**
12589  * Lightning TLV uses a custom variable-length integer called BigSize. It is similar to Bitcoin's
12590  * variable-length integers except that it is serialized in big-endian instead of little-endian.
12591  *
12592  * Like Bitcoin's variable-length integer, it exhibits ambiguity in that certain values can be
12593  * encoded in several different ways, which we must check for at deserialization-time. Thus, if
12594  * you're looking for an example of a variable-length integer to use for your own project, move
12595  * along, this is a rather poor design.
12596  */
12597 typedef struct MUST_USE_STRUCT LDKBigSize {
12598    /**
12599     * A pointer to the opaque Rust object.
12600     * Nearly everywhere, inner must be non-null, however in places where
12601     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12602     */
12603    LDKnativeBigSize *inner;
12604    /**
12605     * Indicates that this is the only struct which contains the same pointer.
12606     * Rust functions which take ownership of an object provided via an argument require
12607     * this to be true and invalidate the object pointed to by inner.
12608     */
12609    bool is_owned;
12610 } LDKBigSize;
12611
12612 /**
12613  * Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk.
12614  */
12615 typedef struct LDKPersister {
12616    /**
12617     * An opaque pointer which is passed to your function implementations as an argument.
12618     * This has no meaning in the LDK, and can be NULL or any other value.
12619     */
12620    void *this_arg;
12621    /**
12622     * Persist the given ['ChannelManager'] to disk, returning an error if persistence failed.
12623     */
12624    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
12625    /**
12626     * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed.
12627     */
12628    struct LDKCResult_NoneErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
12629    /**
12630     * Persist the given [`WriteableScore`] to disk, returning an error if persistence failed.
12631     */
12632    struct LDKCResult_NoneErrorZ (*persist_scorer)(const void *this_arg, const struct LDKWriteableScore *NONNULL_PTR scorer);
12633    /**
12634     * Frees any resources associated with this object given its this_arg pointer.
12635     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12636     */
12637    void (*free)(void *this_arg);
12638 } LDKPersister;
12639
12640
12641
12642 /**
12643  * A string that displays only printable characters, replacing control characters with
12644  * [`core::char::REPLACEMENT_CHARACTER`].
12645  */
12646 typedef struct MUST_USE_STRUCT LDKPrintableString {
12647    /**
12648     * A pointer to the opaque Rust object.
12649     * Nearly everywhere, inner must be non-null, however in places where
12650     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12651     */
12652    LDKnativePrintableString *inner;
12653    /**
12654     * Indicates that this is the only struct which contains the same pointer.
12655     * Rust functions which take ownership of an object provided via an argument require
12656     * this to be true and invalidate the object pointed to by inner.
12657     */
12658    bool is_owned;
12659 } LDKPrintableString;
12660
12661 /**
12662  * A callback which is called when a [`Future`] completes.
12663  *
12664  * Note that this MUST NOT call back into LDK directly, it must instead schedule actions to be
12665  * taken later. Rust users should use the [`std::future::Future`] implementation for [`Future`]
12666  * instead.
12667  *
12668  * Note that the [`std::future::Future`] implementation may only work for runtimes which schedule
12669  * futures when they receive a wake, rather than immediately executing them.
12670  */
12671 typedef struct LDKFutureCallback {
12672    /**
12673     * An opaque pointer which is passed to your function implementations as an argument.
12674     * This has no meaning in the LDK, and can be NULL or any other value.
12675     */
12676    void *this_arg;
12677    /**
12678     * The method which is called.
12679     */
12680    void (*call)(const void *this_arg);
12681    /**
12682     * Frees any resources associated with this object given its this_arg pointer.
12683     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12684     */
12685    void (*free)(void *this_arg);
12686 } LDKFutureCallback;
12687
12688
12689
12690 /**
12691  * A simple future which can complete once, and calls some callback(s) when it does so.
12692  */
12693 typedef struct MUST_USE_STRUCT LDKFuture {
12694    /**
12695     * A pointer to the opaque Rust object.
12696     * Nearly everywhere, inner must be non-null, however in places where
12697     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12698     */
12699    LDKnativeFuture *inner;
12700    /**
12701     * Indicates that this is the only struct which contains the same pointer.
12702     * Rust functions which take ownership of an object provided via an argument require
12703     * this to be true and invalidate the object pointed to by inner.
12704     */
12705    bool is_owned;
12706 } LDKFuture;
12707
12708
12709
12710 /**
12711  * Configuration we set when applicable.
12712  *
12713  * Default::default() provides sane defaults.
12714  */
12715 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
12716    /**
12717     * A pointer to the opaque Rust object.
12718     * Nearly everywhere, inner must be non-null, however in places where
12719     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12720     */
12721    LDKnativeChannelHandshakeConfig *inner;
12722    /**
12723     * Indicates that this is the only struct which contains the same pointer.
12724     * Rust functions which take ownership of an object provided via an argument require
12725     * this to be true and invalidate the object pointed to by inner.
12726     */
12727    bool is_owned;
12728 } LDKChannelHandshakeConfig;
12729
12730
12731
12732 /**
12733  * Optional channel limits which are applied during channel creation.
12734  *
12735  * These limits are only applied to our counterparty's limits, not our own.
12736  *
12737  * Use 0/<type>::max_value() as appropriate to skip checking.
12738  *
12739  * Provides sane defaults for most configurations.
12740  *
12741  * Most additional limits are disabled except those with which specify a default in individual
12742  * field documentation. Note that this may result in barely-usable channels, but since they
12743  * are applied mostly only to incoming channels that's not much of a problem.
12744  */
12745 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
12746    /**
12747     * A pointer to the opaque Rust object.
12748     * Nearly everywhere, inner must be non-null, however in places where
12749     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12750     */
12751    LDKnativeChannelHandshakeLimits *inner;
12752    /**
12753     * Indicates that this is the only struct which contains the same pointer.
12754     * Rust functions which take ownership of an object provided via an argument require
12755     * this to be true and invalidate the object pointed to by inner.
12756     */
12757    bool is_owned;
12758 } LDKChannelHandshakeLimits;
12759
12760
12761
12762 /**
12763  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
12764  *
12765  * Default::default() provides sane defaults for most configurations
12766  * (but currently with 0 relay fees!)
12767  */
12768 typedef struct MUST_USE_STRUCT LDKUserConfig {
12769    /**
12770     * A pointer to the opaque Rust object.
12771     * Nearly everywhere, inner must be non-null, however in places where
12772     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12773     */
12774    LDKnativeUserConfig *inner;
12775    /**
12776     * Indicates that this is the only struct which contains the same pointer.
12777     * Rust functions which take ownership of an object provided via an argument require
12778     * this to be true and invalidate the object pointed to by inner.
12779     */
12780    bool is_owned;
12781 } LDKUserConfig;
12782
12783
12784
12785 /**
12786  * The best known block as identified by its hash and height.
12787  */
12788 typedef struct MUST_USE_STRUCT LDKBestBlock {
12789    /**
12790     * A pointer to the opaque Rust object.
12791     * Nearly everywhere, inner must be non-null, however in places where
12792     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12793     */
12794    LDKnativeBestBlock *inner;
12795    /**
12796     * Indicates that this is the only struct which contains the same pointer.
12797     * Rust functions which take ownership of an object provided via an argument require
12798     * this to be true and invalidate the object pointed to by inner.
12799     */
12800    bool is_owned;
12801 } LDKBestBlock;
12802
12803 /**
12804  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
12805  * chain.
12806  *
12807  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
12808  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
12809  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
12810  * when needed.
12811  *
12812  * By using [`Listen::filtered_block_connected`] this interface supports clients fetching the
12813  * entire header chain and only blocks with matching transaction data using BIP 157 filters or
12814  * other similar filtering.
12815  */
12816 typedef struct LDKListen {
12817    /**
12818     * An opaque pointer which is passed to your function implementations as an argument.
12819     * This has no meaning in the LDK, and can be NULL or any other value.
12820     */
12821    void *this_arg;
12822    /**
12823     * Notifies the listener that a block was added at the given height, with the transaction data
12824     * possibly filtered.
12825     */
12826    void (*filtered_block_connected)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
12827    /**
12828     * Notifies the listener that a block was added at the given height.
12829     */
12830    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
12831    /**
12832     * Notifies the listener that a block was removed at the given height.
12833     */
12834    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
12835    /**
12836     * Frees any resources associated with this object given its this_arg pointer.
12837     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12838     */
12839    void (*free)(void *this_arg);
12840 } LDKListen;
12841
12842 /**
12843  * The `Confirm` trait is used to notify LDK when relevant transactions have been confirmed on
12844  * chain or unconfirmed during a chain reorganization.
12845  *
12846  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
12847  * [`Listen`]. For instance, an Electrum-based transaction sync implementation may implement
12848  * [`Filter`] to subscribe to relevant transactions and unspent outputs it should monitor for
12849  * on-chain activity. Then, it needs to notify LDK via this interface upon observing any changes
12850  * with reference to the confirmation status of the monitored objects.
12851  *
12852  * # Use
12853  * The intended use is as follows:
12854  * - Call [`transactions_confirmed`] to notify LDK whenever any of the registered transactions or
12855  *   outputs are, respectively, confirmed or spent on chain.
12856  * - Call [`transaction_unconfirmed`] to notify LDK whenever any transaction returned by
12857  *   [`get_relevant_txids`] is no longer confirmed in the block with the given block hash.
12858  * - Call [`best_block_updated`] to notify LDK whenever a new chain tip becomes available.
12859  *
12860  * # Order
12861  *
12862  * Clients must call these methods in chain order. Specifically:
12863  * - Transactions which are confirmed in a particular block must be given before transactions
12864  *   confirmed in a later block.
12865  * - Dependent transactions within the same block must be given in topological order, possibly in
12866  *   separate calls.
12867  * - All unconfirmed transactions must be given after the original confirmations and before *any*
12868  *   reconfirmations, i.e., [`transactions_confirmed`] and [`transaction_unconfirmed`] calls should
12869  *   never be interleaved, but always conduced *en bloc*.
12870  * - Any reconfirmed transactions need to be explicitly unconfirmed before they are reconfirmed
12871  *   in regard to the new block.
12872  *
12873  * See individual method documentation for further details.
12874  *
12875  * [`transactions_confirmed`]: Self::transactions_confirmed
12876  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
12877  * [`best_block_updated`]: Self::best_block_updated
12878  * [`get_relevant_txids`]: Self::get_relevant_txids
12879  */
12880 typedef struct LDKConfirm {
12881    /**
12882     * An opaque pointer which is passed to your function implementations as an argument.
12883     * This has no meaning in the LDK, and can be NULL or any other value.
12884     */
12885    void *this_arg;
12886    /**
12887     * Notifies LDK of transactions confirmed in a block with a given header and height.
12888     *
12889     * Must be called for any transactions registered by [`Filter::register_tx`] or any
12890     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
12891     * appearing in the same block do not need to be included in the same call; instead, multiple
12892     * calls with additional transactions may be made so long as they are made in [chain order].
12893     *
12894     * May be called before or after [`best_block_updated`] for the corresponding block. However,
12895     * in the event of a chain reorganization, it must not be called with a `header` that is no
12896     * longer in the chain as of the last call to [`best_block_updated`].
12897     *
12898     * [chain order]: Confirm#order
12899     * [`best_block_updated`]: Self::best_block_updated
12900     */
12901    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
12902    /**
12903     * Notifies LDK of a transaction that is no longer confirmed as result of a chain reorganization.
12904     *
12905     * Must be called for any transaction returned by [`get_relevant_txids`] if it has been
12906     * reorganized out of the best chain or if it is no longer confirmed in the block with the
12907     * given block hash. Once called, the given transaction will not be returned
12908     * by [`get_relevant_txids`], unless it has been reconfirmed via [`transactions_confirmed`].
12909     *
12910     * [`get_relevant_txids`]: Self::get_relevant_txids
12911     * [`transactions_confirmed`]: Self::transactions_confirmed
12912     */
12913    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
12914    /**
12915     * Notifies LDK of an update to the best header connected at the given height.
12916     *
12917     * Must be called whenever a new chain tip becomes available. May be skipped for intermediary
12918     * blocks.
12919     */
12920    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
12921    /**
12922     * Returns transactions that must be monitored for reorganization out of the chain along
12923     * with the hash of the block as part of which it had been previously confirmed.
12924     *
12925     * Will include any transactions passed to [`transactions_confirmed`] that have insufficient
12926     * confirmations to be safe from a chain reorganization. Will not include any transactions
12927     * passed to [`transaction_unconfirmed`], unless later reconfirmed.
12928     *
12929     * Must be called to determine the subset of transactions that must be monitored for
12930     * reorganization. Will be idempotent between calls but may change as a result of calls to the
12931     * other interface methods. Thus, this is useful to determine which transactions must be
12932     * given to [`transaction_unconfirmed`].
12933     *
12934     * If any of the returned transactions are confirmed in a block other than the one with the
12935     * given hash, they need to be unconfirmed and reconfirmed via [`transaction_unconfirmed`] and
12936     * [`transactions_confirmed`], respectively.
12937     *
12938     * [`transactions_confirmed`]: Self::transactions_confirmed
12939     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
12940     */
12941    struct LDKCVec_C2Tuple_TxidBlockHashZZ (*get_relevant_txids)(const void *this_arg);
12942    /**
12943     * Frees any resources associated with this object given its this_arg pointer.
12944     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12945     */
12946    void (*free)(void *this_arg);
12947 } LDKConfirm;
12948
12949 /**
12950  * `Persist` defines behavior for persisting channel monitors: this could mean
12951  * writing once to disk, and/or uploading to one or more backup services.
12952  *
12953  * Each method can return three possible values:
12954  *  * If persistence (including any relevant `fsync()` calls) happens immediately, the
12955  *    implementation should return [`ChannelMonitorUpdateStatus::Completed`], indicating normal
12956  *    channel operation should continue.
12957  *  * If persistence happens asynchronously, implementations should first ensure the
12958  *    [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return
12959  *    [`ChannelMonitorUpdateStatus::InProgress`] while the update continues in the background.
12960  *    Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be called with
12961  *    the corresponding [`MonitorUpdateId`].
12962  *
12963  *    Note that unlike the direct [`chain::Watch`] interface,
12964  *    [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
12965  *
12966  *  * If persistence fails for some reason, implementations should return
12967  *    [`ChannelMonitorUpdateStatus::PermanentFailure`], in which case the channel will likely be
12968  *    closed without broadcasting the latest state. See
12969  *    [`ChannelMonitorUpdateStatus::PermanentFailure`] for more details.
12970  */
12971 typedef struct LDKPersist {
12972    /**
12973     * An opaque pointer which is passed to your function implementations as an argument.
12974     * This has no meaning in the LDK, and can be NULL or any other value.
12975     */
12976    void *this_arg;
12977    /**
12978     * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
12979     * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
12980     *
12981     * The data can be stored any way you want, but the identifier provided by LDK is the
12982     * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
12983     * and the stored channel data). Note that you **must** persist every new monitor to disk.
12984     *
12985     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
12986     * if you return [`ChannelMonitorUpdateStatus::InProgress`].
12987     *
12988     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
12989     * and [`ChannelMonitorUpdateStatus`] for requirements when returning errors.
12990     *
12991     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
12992     * [`Writeable::write`]: crate::util::ser::Writeable::write
12993     */
12994    enum LDKChannelMonitorUpdateStatus (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
12995    /**
12996     * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
12997     * update.
12998     *
12999     * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
13000     * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
13001     * details.
13002     *
13003     * During blockchain synchronization operations, this may be called with no
13004     * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
13005     * Note that after the full [`ChannelMonitor`] is persisted any previous
13006     * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
13007     * applied to the persisted [`ChannelMonitor`] as they were already applied.
13008     *
13009     * If an implementer chooses to persist the updates only, they need to make
13010     * sure that all the updates are applied to the `ChannelMonitors` *before*
13011     * the set of channel monitors is given to the `ChannelManager`
13012     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
13013     * applying a monitor update to a monitor. If full `ChannelMonitors` are
13014     * persisted, then there is no need to persist individual updates.
13015     *
13016     * Note that there could be a performance tradeoff between persisting complete
13017     * channel monitors on every update vs. persisting only updates and applying
13018     * them in batches. The size of each monitor grows `O(number of state updates)`
13019     * whereas updates are small and `O(1)`.
13020     *
13021     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
13022     * if you return [`ChannelMonitorUpdateStatus::InProgress`].
13023     *
13024     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
13025     * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
13026     * [`ChannelMonitorUpdateStatus`] for requirements when returning errors.
13027     *
13028     * [`Writeable::write`]: crate::util::ser::Writeable::write
13029     *
13030     * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
13031     */
13032    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);
13033    /**
13034     * Frees any resources associated with this object given its this_arg pointer.
13035     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13036     */
13037    void (*free)(void *this_arg);
13038 } LDKPersist;
13039
13040
13041
13042 /**
13043  * An implementation of [`chain::Watch`] for monitoring channels.
13044  *
13045  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
13046  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
13047  * or used independently to monitor channels remotely. See the [module-level documentation] for
13048  * details.
13049  *
13050  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
13051  * [module-level documentation]: crate::chain::chainmonitor
13052  */
13053 typedef struct MUST_USE_STRUCT LDKChainMonitor {
13054    /**
13055     * A pointer to the opaque Rust object.
13056     * Nearly everywhere, inner must be non-null, however in places where
13057     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13058     */
13059    LDKnativeChainMonitor *inner;
13060    /**
13061     * Indicates that this is the only struct which contains the same pointer.
13062     * Rust functions which take ownership of an object provided via an argument require
13063     * this to be true and invalidate the object pointed to by inner.
13064     */
13065    bool is_owned;
13066 } LDKChainMonitor;
13067
13068
13069
13070 /**
13071  * Simple [`KeysInterface`] implementation that takes a 32-byte seed for use as a BIP 32 extended
13072  * key and derives keys from that.
13073  *
13074  * Your `node_id` is seed/0'.
13075  * Unilateral closes may use seed/1'.
13076  * Cooperative closes may use seed/2'.
13077  * The two close keys may be needed to claim on-chain funds!
13078  *
13079  * This struct cannot be used for nodes that wish to support receiving phantom payments;
13080  * [`PhantomKeysManager`] must be used instead.
13081  *
13082  * Note that switching between this struct and [`PhantomKeysManager`] will invalidate any
13083  * previously issued invoices and attempts to pay previous invoices will fail.
13084  */
13085 typedef struct MUST_USE_STRUCT LDKKeysManager {
13086    /**
13087     * A pointer to the opaque Rust object.
13088     * Nearly everywhere, inner must be non-null, however in places where
13089     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13090     */
13091    LDKnativeKeysManager *inner;
13092    /**
13093     * Indicates that this is the only struct which contains the same pointer.
13094     * Rust functions which take ownership of an object provided via an argument require
13095     * this to be true and invalidate the object pointed to by inner.
13096     */
13097    bool is_owned;
13098 } LDKKeysManager;
13099
13100
13101
13102 /**
13103  * Similar to [`KeysManager`], but allows the node using this struct to receive phantom node
13104  * payments.
13105  *
13106  * A phantom node payment is a payment made to a phantom invoice, which is an invoice that can be
13107  * paid to one of multiple nodes. This works because we encode the invoice route hints such that
13108  * LDK will recognize an incoming payment as destined for a phantom node, and collect the payment
13109  * itself without ever needing to forward to this fake node.
13110  *
13111  * Phantom node payments are useful for load balancing between multiple LDK nodes. They also
13112  * provide some fault tolerance, because payers will automatically retry paying other provided
13113  * nodes in the case that one node goes down.
13114  *
13115  * Note that multi-path payments are not supported in phantom invoices for security reasons.
13116  * Switching between this struct and [`KeysManager`] will invalidate any previously issued
13117  * invoices and attempts to pay previous invoices will fail.
13118  */
13119 typedef struct MUST_USE_STRUCT LDKPhantomKeysManager {
13120    /**
13121     * A pointer to the opaque Rust object.
13122     * Nearly everywhere, inner must be non-null, however in places where
13123     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13124     */
13125    LDKnativePhantomKeysManager *inner;
13126    /**
13127     * Indicates that this is the only struct which contains the same pointer.
13128     * Rust functions which take ownership of an object provided via an argument require
13129     * this to be true and invalidate the object pointed to by inner.
13130     */
13131    bool is_owned;
13132 } LDKPhantomKeysManager;
13133
13134
13135
13136 /**
13137  * Chain-related parameters used to construct a new `ChannelManager`.
13138  *
13139  * Typically, the block-specific parameters are derived from the best block hash for the network,
13140  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
13141  * are not needed when deserializing a previously constructed `ChannelManager`.
13142  */
13143 typedef struct MUST_USE_STRUCT LDKChainParameters {
13144    /**
13145     * A pointer to the opaque Rust object.
13146     * Nearly everywhere, inner must be non-null, however in places where
13147     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13148     */
13149    LDKnativeChainParameters *inner;
13150    /**
13151     * Indicates that this is the only struct which contains the same pointer.
13152     * Rust functions which take ownership of an object provided via an argument require
13153     * this to be true and invalidate the object pointed to by inner.
13154     */
13155    bool is_owned;
13156 } LDKChainParameters;
13157
13158 /**
13159  * A trait to describe an object which can receive channel messages.
13160  *
13161  * Messages MAY be called in parallel when they originate from different their_node_ids, however
13162  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
13163  */
13164 typedef struct LDKChannelMessageHandler {
13165    /**
13166     * An opaque pointer which is passed to your function implementations as an argument.
13167     * This has no meaning in the LDK, and can be NULL or any other value.
13168     */
13169    void *this_arg;
13170    /**
13171     * Handle an incoming open_channel message from the given peer.
13172     */
13173    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
13174    /**
13175     * Handle an incoming accept_channel message from the given peer.
13176     */
13177    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
13178    /**
13179     * Handle an incoming funding_created message from the given peer.
13180     */
13181    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
13182    /**
13183     * Handle an incoming funding_signed message from the given peer.
13184     */
13185    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
13186    /**
13187     * Handle an incoming channel_ready message from the given peer.
13188     */
13189    void (*handle_channel_ready)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReady *NONNULL_PTR msg);
13190    /**
13191     * Handle an incoming shutdown message from the given peer.
13192     */
13193    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);
13194    /**
13195     * Handle an incoming closing_signed message from the given peer.
13196     */
13197    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
13198    /**
13199     * Handle an incoming update_add_htlc message from the given peer.
13200     */
13201    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
13202    /**
13203     * Handle an incoming update_fulfill_htlc message from the given peer.
13204     */
13205    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
13206    /**
13207     * Handle an incoming update_fail_htlc message from the given peer.
13208     */
13209    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
13210    /**
13211     * Handle an incoming update_fail_malformed_htlc message from the given peer.
13212     */
13213    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
13214    /**
13215     * Handle an incoming commitment_signed message from the given peer.
13216     */
13217    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
13218    /**
13219     * Handle an incoming revoke_and_ack message from the given peer.
13220     */
13221    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
13222    /**
13223     * Handle an incoming update_fee message from the given peer.
13224     */
13225    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
13226    /**
13227     * Handle an incoming announcement_signatures message from the given peer.
13228     */
13229    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
13230    /**
13231     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
13232     * is believed to be possible in the future (eg they're sending us messages we don't
13233     * understand or indicate they require unknown feature bits), no_connection_possible is set
13234     * and any outstanding channels should be failed.
13235     *
13236     * Note that in some rare cases this may be called without a corresponding
13237     * [`Self::peer_connected`].
13238     */
13239    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
13240    /**
13241     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
13242     *
13243     * May return an `Err(())` if the features the peer supports are not sufficient to communicate
13244     * with us. Implementors should be somewhat conservative about doing so, however, as other
13245     * message handlers may still wish to communicate with this peer.
13246     */
13247    struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
13248    /**
13249     * Handle an incoming channel_reestablish message from the given peer.
13250     */
13251    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
13252    /**
13253     * Handle an incoming channel update from the given peer.
13254     */
13255    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
13256    /**
13257     * Handle an incoming error message from the given peer.
13258     */
13259    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
13260    /**
13261     * Gets the node feature flags which this handler itself supports. All available handlers are
13262     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
13263     * which are broadcasted in our [`NodeAnnouncement`] message.
13264     */
13265    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
13266    /**
13267     * Gets the init feature flags which should be sent to the given peer. All available handlers
13268     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
13269     * which are sent in our [`Init`] message.
13270     *
13271     * Note that this method is called before [`Self::peer_connected`].
13272     */
13273    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
13274    /**
13275     * Implementation of MessageSendEventsProvider for this object.
13276     */
13277    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
13278    /**
13279     * Frees any resources associated with this object given its this_arg pointer.
13280     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13281     */
13282    void (*free)(void *this_arg);
13283 } LDKChannelMessageHandler;
13284
13285
13286
13287 /**
13288  * Arguments for the creation of a ChannelManager that are not deserialized.
13289  *
13290  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
13291  * is:
13292  * 1) Deserialize all stored [`ChannelMonitor`]s.
13293  * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
13294  *    `<(BlockHash, ChannelManager)>::read(reader, args)`
13295  *    This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
13296  *    [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
13297  * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
13298  *    same way you would handle a [`chain::Filter`] call using
13299  *    [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
13300  * 4) Reconnect blocks on your [`ChannelMonitor`]s.
13301  * 5) Disconnect/connect blocks on the [`ChannelManager`].
13302  * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
13303  *    Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
13304  *    will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
13305  *    the next step.
13306  * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
13307  *    [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
13308  *
13309  * Note that the ordering of #4-7 is not of importance, however all four must occur before you
13310  * call any other methods on the newly-deserialized [`ChannelManager`].
13311  *
13312  * Note that because some channels may be closed during deserialization, it is critical that you
13313  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
13314  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
13315  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
13316  * not force-close the same channels but consider them live), you may end up revoking a state for
13317  * which you've already broadcasted the transaction.
13318  *
13319  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
13320  */
13321 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
13322    /**
13323     * A pointer to the opaque Rust object.
13324     * Nearly everywhere, inner must be non-null, however in places where
13325     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13326     */
13327    LDKnativeChannelManagerReadArgs *inner;
13328    /**
13329     * Indicates that this is the only struct which contains the same pointer.
13330     * Rust functions which take ownership of an object provided via an argument require
13331     * this to be true and invalidate the object pointed to by inner.
13332     */
13333    bool is_owned;
13334 } LDKChannelManagerReadArgs;
13335
13336
13337
13338 /**
13339  * A set of keys that were HKDF-expanded from an initial call to
13340  * [`KeysInterface::get_inbound_payment_key_material`].
13341  *
13342  * [`KeysInterface::get_inbound_payment_key_material`]: crate::chain::keysinterface::KeysInterface::get_inbound_payment_key_material
13343  */
13344 typedef struct MUST_USE_STRUCT LDKExpandedKey {
13345    /**
13346     * A pointer to the opaque Rust object.
13347     * Nearly everywhere, inner must be non-null, however in places where
13348     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13349     */
13350    LDKnativeExpandedKey *inner;
13351    /**
13352     * Indicates that this is the only struct which contains the same pointer.
13353     * Rust functions which take ownership of an object provided via an argument require
13354     * this to be true and invalidate the object pointed to by inner.
13355     */
13356    bool is_owned;
13357 } LDKExpandedKey;
13358
13359
13360
13361 /**
13362  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
13363  * This is used to convince the recipient that the channel is at a certain commitment
13364  * number even if they lost that data due to a local failure.  Of course, the peer may lie
13365  * and even later commitments may have been revoked.
13366  */
13367 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
13368    /**
13369     * A pointer to the opaque Rust object.
13370     * Nearly everywhere, inner must be non-null, however in places where
13371     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13372     */
13373    LDKnativeDataLossProtect *inner;
13374    /**
13375     * Indicates that this is the only struct which contains the same pointer.
13376     * Rust functions which take ownership of an object provided via an argument require
13377     * this to be true and invalidate the object pointed to by inner.
13378     */
13379    bool is_owned;
13380 } LDKDataLossProtect;
13381
13382 /**
13383  * A 3-byte byte array.
13384  */
13385 typedef struct LDKThreeBytes {
13386    /**
13387     * The three bytes
13388     */
13389    uint8_t data[3];
13390 } LDKThreeBytes;
13391
13392 /**
13393  * A trait to describe an object which can receive routing messages.
13394  *
13395  * # Implementor DoS Warnings
13396  *
13397  * For `gossip_queries` messages there are potential DoS vectors when handling
13398  * inbound queries. Implementors using an on-disk network graph should be aware of
13399  * repeated disk I/O for queries accessing different parts of the network graph.
13400  */
13401 typedef struct LDKRoutingMessageHandler {
13402    /**
13403     * An opaque pointer which is passed to your function implementations as an argument.
13404     * This has no meaning in the LDK, and can be NULL or any other value.
13405     */
13406    void *this_arg;
13407    /**
13408     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
13409     * false or returning an Err otherwise.
13410     */
13411    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
13412    /**
13413     * Handle a channel_announcement message, returning true if it should be forwarded on, false
13414     * or returning an Err otherwise.
13415     */
13416    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
13417    /**
13418     * Handle an incoming channel_update message, returning true if it should be forwarded on,
13419     * false or returning an Err otherwise.
13420     */
13421    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
13422    /**
13423     * Gets channel announcements and updates required to dump our routing table to a remote node,
13424     * starting at the short_channel_id indicated by starting_point and including announcements
13425     * for a single channel.
13426     */
13427    struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcement)(const void *this_arg, uint64_t starting_point);
13428    /**
13429     * Gets a node announcement required to dump our routing table to a remote node, starting at
13430     * the node *after* the provided pubkey and including up to one announcement immediately
13431     * higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
13432     * If None is provided for starting_point, we start at the first node.
13433     *
13434     * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
13435     * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
13436     */
13437    struct LDKNodeAnnouncement (*get_next_node_announcement)(const void *this_arg, struct LDKPublicKey starting_point);
13438    /**
13439     * Called when a connection is established with a peer. This can be used to
13440     * perform routing table synchronization using a strategy defined by the
13441     * implementor.
13442     *
13443     * May return an `Err(())` if the features the peer supports are not sufficient to communicate
13444     * with us. Implementors should be somewhat conservative about doing so, however, as other
13445     * message handlers may still wish to communicate with this peer.
13446     */
13447    struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
13448    /**
13449     * Handles the reply of a query we initiated to learn about channels
13450     * for a given range of blocks. We can expect to receive one or more
13451     * replies to a single query.
13452     */
13453    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
13454    /**
13455     * Handles the reply of a query we initiated asking for routing gossip
13456     * messages for a list of channels. We should receive this message when
13457     * a node has completed its best effort to send us the pertaining routing
13458     * gossip messages.
13459     */
13460    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
13461    /**
13462     * Handles when a peer asks us to send a list of short_channel_ids
13463     * for the requested range of blocks.
13464     */
13465    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
13466    /**
13467     * Handles when a peer asks us to send routing gossip messages for a
13468     * list of short_channel_ids.
13469     */
13470    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
13471    /**
13472     * Gets the node feature flags which this handler itself supports. All available handlers are
13473     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
13474     * which are broadcasted in our [`NodeAnnouncement`] message.
13475     */
13476    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
13477    /**
13478     * Gets the init feature flags which should be sent to the given peer. All available handlers
13479     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
13480     * which are sent in our [`Init`] message.
13481     *
13482     * Note that this method is called before [`Self::peer_connected`].
13483     */
13484    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
13485    /**
13486     * Implementation of MessageSendEventsProvider for this object.
13487     */
13488    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
13489    /**
13490     * Frees any resources associated with this object given its this_arg pointer.
13491     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13492     */
13493    void (*free)(void *this_arg);
13494 } LDKRoutingMessageHandler;
13495
13496 /**
13497  * A trait to describe an object that can receive onion messages.
13498  */
13499 typedef struct LDKOnionMessageHandler {
13500    /**
13501     * An opaque pointer which is passed to your function implementations as an argument.
13502     * This has no meaning in the LDK, and can be NULL or any other value.
13503     */
13504    void *this_arg;
13505    /**
13506     * Handle an incoming onion_message message from the given peer.
13507     */
13508    void (*handle_onion_message)(const void *this_arg, struct LDKPublicKey peer_node_id, const struct LDKOnionMessage *NONNULL_PTR msg);
13509    /**
13510     * Called when a connection is established with a peer. Can be used to track which peers
13511     * advertise onion message support and are online.
13512     *
13513     * May return an `Err(())` if the features the peer supports are not sufficient to communicate
13514     * with us. Implementors should be somewhat conservative about doing so, however, as other
13515     * message handlers may still wish to communicate with this peer.
13516     */
13517    struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
13518    /**
13519     * Indicates a connection to the peer failed/an existing connection was lost. Allows handlers to
13520     * drop and refuse to forward onion messages to this peer.
13521     *
13522     * Note that in some rare cases this may be called without a corresponding
13523     * [`Self::peer_connected`].
13524     */
13525    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
13526    /**
13527     * Gets the node feature flags which this handler itself supports. All available handlers are
13528     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
13529     * which are broadcasted in our [`NodeAnnouncement`] message.
13530     */
13531    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
13532    /**
13533     * Gets the init feature flags which should be sent to the given peer. All available handlers
13534     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
13535     * which are sent in our [`Init`] message.
13536     *
13537     * Note that this method is called before [`Self::peer_connected`].
13538     */
13539    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
13540    /**
13541     * Implementation of OnionMessageProvider for this object.
13542     */
13543    struct LDKOnionMessageProvider OnionMessageProvider;
13544    /**
13545     * Frees any resources associated with this object given its this_arg pointer.
13546     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13547     */
13548    void (*free)(void *this_arg);
13549 } LDKOnionMessageHandler;
13550
13551 /**
13552  * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
13553  * decoders.
13554  */
13555 typedef struct LDKCustomMessageReader {
13556    /**
13557     * An opaque pointer which is passed to your function implementations as an argument.
13558     * This has no meaning in the LDK, and can be NULL or any other value.
13559     */
13560    void *this_arg;
13561    /**
13562     * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
13563     * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
13564     * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
13565     * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
13566     */
13567    struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer);
13568    /**
13569     * Frees any resources associated with this object given its this_arg pointer.
13570     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13571     */
13572    void (*free)(void *this_arg);
13573 } LDKCustomMessageReader;
13574
13575 /**
13576  * Handler for BOLT1-compliant messages.
13577  */
13578 typedef struct LDKCustomMessageHandler {
13579    /**
13580     * An opaque pointer which is passed to your function implementations as an argument.
13581     * This has no meaning in the LDK, and can be NULL or any other value.
13582     */
13583    void *this_arg;
13584    /**
13585     * Called with the message type that was received and the buffer to be read.
13586     * Can return a `MessageHandlingError` if the message could not be handled.
13587     */
13588    struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id);
13589    /**
13590     * Gets the list of pending messages which were generated by the custom message
13591     * handler, clearing the list in the process. The first tuple element must
13592     * correspond to the intended recipients node ids. If no connection to one of the
13593     * specified node does not exist, the message is simply not sent to it.
13594     */
13595    struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg);
13596    /**
13597     * Implementation of CustomMessageReader for this object.
13598     */
13599    struct LDKCustomMessageReader CustomMessageReader;
13600    /**
13601     * Frees any resources associated with this object given its this_arg pointer.
13602     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13603     */
13604    void (*free)(void *this_arg);
13605 } LDKCustomMessageHandler;
13606
13607
13608
13609 /**
13610  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
13611  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
13612  */
13613 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
13614    /**
13615     * A pointer to the opaque Rust object.
13616     * Nearly everywhere, inner must be non-null, however in places where
13617     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13618     */
13619    LDKnativeIgnoringMessageHandler *inner;
13620    /**
13621     * Indicates that this is the only struct which contains the same pointer.
13622     * Rust functions which take ownership of an object provided via an argument require
13623     * this to be true and invalidate the object pointed to by inner.
13624     */
13625    bool is_owned;
13626 } LDKIgnoringMessageHandler;
13627
13628 /**
13629  * Handler for custom onion messages. If you are using [`SimpleArcOnionMessenger`],
13630  * [`SimpleRefOnionMessenger`], or prefer to ignore inbound custom onion messages,
13631  * [`IgnoringMessageHandler`] must be provided to [`OnionMessenger::new`]. Otherwise, a custom
13632  * implementation of this trait must be provided, with [`CustomMessage`] specifying the supported
13633  * message types.
13634  *
13635  * See [`OnionMessenger`] for example usage.
13636  *
13637  * [`IgnoringMessageHandler`]: crate::ln::peer_handler::IgnoringMessageHandler
13638  * [`CustomMessage`]: Self::CustomMessage
13639  */
13640 typedef struct LDKCustomOnionMessageHandler {
13641    /**
13642     * An opaque pointer which is passed to your function implementations as an argument.
13643     * This has no meaning in the LDK, and can be NULL or any other value.
13644     */
13645    void *this_arg;
13646    /**
13647     * Called with the custom message that was received.
13648     */
13649    void (*handle_custom_message)(const void *this_arg, struct LDKCustomOnionMessageContents msg);
13650    /**
13651     * Read a custom message of type `message_type` from `buffer`, returning `Ok(None)` if the
13652     * message type is unknown.
13653     */
13654    struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ (*read_custom_message)(const void *this_arg, uint64_t message_type, struct LDKu8slice buffer);
13655    /**
13656     * Frees any resources associated with this object given its this_arg pointer.
13657     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13658     */
13659    void (*free)(void *this_arg);
13660 } LDKCustomOnionMessageHandler;
13661
13662
13663
13664 /**
13665  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
13666  * You can provide one of these as the route_handler in a MessageHandler.
13667  */
13668 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
13669    /**
13670     * A pointer to the opaque Rust object.
13671     * Nearly everywhere, inner must be non-null, however in places where
13672     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13673     */
13674    LDKnativeErroringMessageHandler *inner;
13675    /**
13676     * Indicates that this is the only struct which contains the same pointer.
13677     * Rust functions which take ownership of an object provided via an argument require
13678     * this to be true and invalidate the object pointed to by inner.
13679     */
13680    bool is_owned;
13681 } LDKErroringMessageHandler;
13682
13683
13684
13685 /**
13686  * Provides references to trait impls which handle different types of messages.
13687  */
13688 typedef struct MUST_USE_STRUCT LDKMessageHandler {
13689    /**
13690     * A pointer to the opaque Rust object.
13691     * Nearly everywhere, inner must be non-null, however in places where
13692     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13693     */
13694    LDKnativeMessageHandler *inner;
13695    /**
13696     * Indicates that this is the only struct which contains the same pointer.
13697     * Rust functions which take ownership of an object provided via an argument require
13698     * this to be true and invalidate the object pointed to by inner.
13699     */
13700    bool is_owned;
13701 } LDKMessageHandler;
13702
13703 /**
13704  * Provides an object which can be used to send data to and which uniquely identifies a connection
13705  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
13706  * implement Hash to meet the PeerManager API.
13707  *
13708  * For efficiency, Clone should be relatively cheap for this type.
13709  *
13710  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
13711  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
13712  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
13713  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
13714  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
13715  * to simply use another value which is guaranteed to be globally unique instead.
13716  */
13717 typedef struct LDKSocketDescriptor {
13718    /**
13719     * An opaque pointer which is passed to your function implementations as an argument.
13720     * This has no meaning in the LDK, and can be NULL or any other value.
13721     */
13722    void *this_arg;
13723    /**
13724     * Attempts to send some data from the given slice to the peer.
13725     *
13726     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
13727     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
13728     * called and further write attempts may occur until that time.
13729     *
13730     * If the returned size is smaller than `data.len()`, a
13731     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
13732     * written. Additionally, until a `send_data` event completes fully, no further
13733     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
13734     * prevent denial-of-service issues, you should not read or buffer any data from the socket
13735     * until then.
13736     *
13737     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
13738     * (indicating that read events should be paused to prevent DoS in the send buffer),
13739     * `resume_read` may be set indicating that read events on this descriptor should resume. A
13740     * `resume_read` of false carries no meaning, and should not cause any action.
13741     */
13742    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
13743    /**
13744     * Disconnect the socket pointed to by this SocketDescriptor.
13745     *
13746     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
13747     * call (doing so is a noop).
13748     */
13749    void (*disconnect_socket)(void *this_arg);
13750    /**
13751     * Checks if two objects are equal given this object's this_arg pointer and another object.
13752     */
13753    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
13754    /**
13755     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
13756     * This is used, for example, for inclusion of this object in a hash map.
13757     */
13758    uint64_t (*hash)(const void *this_arg);
13759    /**
13760     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
13761     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
13762     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
13763     */
13764    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
13765    /**
13766     * Frees any resources associated with this object given its this_arg pointer.
13767     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13768     */
13769    void (*free)(void *this_arg);
13770 } LDKSocketDescriptor;
13771
13772
13773
13774 /**
13775  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
13776  * socket events into messages which it passes on to its [`MessageHandler`].
13777  *
13778  * Locks are taken internally, so you must never assume that reentrancy from a
13779  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
13780  *
13781  * Calls to [`read_event`] will decode relevant messages and pass them to the
13782  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
13783  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
13784  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
13785  * calls only after previous ones have returned.
13786  *
13787  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
13788  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
13789  * essentially you should default to using a SimpleRefPeerManager, and use a
13790  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
13791  * you're using lightning-net-tokio.
13792  *
13793  * [`read_event`]: PeerManager::read_event
13794  */
13795 typedef struct MUST_USE_STRUCT LDKPeerManager {
13796    /**
13797     * A pointer to the opaque Rust object.
13798     * Nearly everywhere, inner must be non-null, however in places where
13799     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13800     */
13801    LDKnativePeerManager *inner;
13802    /**
13803     * Indicates that this is the only struct which contains the same pointer.
13804     * Rust functions which take ownership of an object provided via an argument require
13805     * this to be true and invalidate the object pointed to by inner.
13806     */
13807    bool is_owned;
13808 } LDKPeerManager;
13809
13810
13811
13812 /**
13813  * Static channel fields used to build transactions given per-commitment fields, organized by
13814  * broadcaster/countersignatory.
13815  *
13816  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
13817  * as_holder_broadcastable and as_counterparty_broadcastable functions.
13818  */
13819 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
13820    /**
13821     * A pointer to the opaque Rust object.
13822     * Nearly everywhere, inner must be non-null, however in places where
13823     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13824     */
13825    LDKnativeDirectedChannelTransactionParameters *inner;
13826    /**
13827     * Indicates that this is the only struct which contains the same pointer.
13828     * Rust functions which take ownership of an object provided via an argument require
13829     * this to be true and invalidate the object pointed to by inner.
13830     */
13831    bool is_owned;
13832 } LDKDirectedChannelTransactionParameters;
13833
13834 /**
13835  * Integer in the range `0..=16`
13836  */
13837 typedef struct LDKWitnessVersion {
13838    uint8_t _0;
13839 } LDKWitnessVersion;
13840
13841
13842
13843 /**
13844  * A read-only view of [`NetworkGraph`].
13845  */
13846 typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
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    LDKnativeReadOnlyNetworkGraph *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 } LDKReadOnlyNetworkGraph;
13860
13861
13862
13863 /**
13864  * Receives and validates network updates from peers,
13865  * stores authentic and relevant data as a network graph.
13866  * This network graph is then used for routing payments.
13867  * Provides interface to help with initial routing sync by
13868  * serving historical announcements.
13869  */
13870 typedef struct MUST_USE_STRUCT LDKP2PGossipSync {
13871    /**
13872     * A pointer to the opaque Rust object.
13873     * Nearly everywhere, inner must be non-null, however in places where
13874     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13875     */
13876    LDKnativeP2PGossipSync *inner;
13877    /**
13878     * Indicates that this is the only struct which contains the same pointer.
13879     * Rust functions which take ownership of an object provided via an argument require
13880     * this to be true and invalidate the object pointed to by inner.
13881     */
13882    bool is_owned;
13883 } LDKP2PGossipSync;
13884
13885
13886
13887 /**
13888  * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a
13889  * source node to a target node.
13890  */
13891 typedef struct MUST_USE_STRUCT LDKDirectedChannelInfo {
13892    /**
13893     * A pointer to the opaque Rust object.
13894     * Nearly everywhere, inner must be non-null, however in places where
13895     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13896     */
13897    LDKnativeDirectedChannelInfo *inner;
13898    /**
13899     * Indicates that this is the only struct which contains the same pointer.
13900     * Rust functions which take ownership of an object provided via an argument require
13901     * this to be true and invalidate the object pointed to by inner.
13902     */
13903    bool is_owned;
13904 } LDKDirectedChannelInfo;
13905
13906 /**
13907  * The effective capacity of a channel for routing purposes.
13908  *
13909  * While this may be smaller than the actual channel capacity, amounts greater than
13910  * [`Self::as_msat`] should not be routed through the channel.
13911  */
13912 typedef enum LDKEffectiveCapacity_Tag {
13913    /**
13914     * The available liquidity in the channel known from being a channel counterparty, and thus a
13915     * direct hop.
13916     */
13917    LDKEffectiveCapacity_ExactLiquidity,
13918    /**
13919     * The maximum HTLC amount in one direction as advertised on the gossip network.
13920     */
13921    LDKEffectiveCapacity_MaximumHTLC,
13922    /**
13923     * The total capacity of the channel as determined by the funding transaction.
13924     */
13925    LDKEffectiveCapacity_Total,
13926    /**
13927     * A capacity sufficient to route any payment, typically used for private channels provided by
13928     * an invoice.
13929     */
13930    LDKEffectiveCapacity_Infinite,
13931    /**
13932     * A capacity that is unknown possibly because either the chain state is unavailable to know
13933     * the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network.
13934     */
13935    LDKEffectiveCapacity_Unknown,
13936    /**
13937     * Must be last for serialization purposes
13938     */
13939    LDKEffectiveCapacity_Sentinel,
13940 } LDKEffectiveCapacity_Tag;
13941
13942 typedef struct LDKEffectiveCapacity_LDKExactLiquidity_Body {
13943    /**
13944     * Either the inbound or outbound liquidity depending on the direction, denominated in
13945     * millisatoshi.
13946     */
13947    uint64_t liquidity_msat;
13948 } LDKEffectiveCapacity_LDKExactLiquidity_Body;
13949
13950 typedef struct LDKEffectiveCapacity_LDKMaximumHTLC_Body {
13951    /**
13952     * The maximum HTLC amount denominated in millisatoshi.
13953     */
13954    uint64_t amount_msat;
13955 } LDKEffectiveCapacity_LDKMaximumHTLC_Body;
13956
13957 typedef struct LDKEffectiveCapacity_LDKTotal_Body {
13958    /**
13959     * The funding amount denominated in millisatoshi.
13960     */
13961    uint64_t capacity_msat;
13962    /**
13963     * The maximum HTLC amount denominated in millisatoshi.
13964     */
13965    uint64_t htlc_maximum_msat;
13966 } LDKEffectiveCapacity_LDKTotal_Body;
13967
13968 typedef struct MUST_USE_STRUCT LDKEffectiveCapacity {
13969    LDKEffectiveCapacity_Tag tag;
13970    union {
13971       LDKEffectiveCapacity_LDKExactLiquidity_Body exact_liquidity;
13972       LDKEffectiveCapacity_LDKMaximumHTLC_Body maximum_htlc;
13973       LDKEffectiveCapacity_LDKTotal_Body total;
13974    };
13975 } LDKEffectiveCapacity;
13976
13977
13978
13979 /**
13980  * A [`Router`] implemented using [`find_route`].
13981  */
13982 typedef struct MUST_USE_STRUCT LDKDefaultRouter {
13983    /**
13984     * A pointer to the opaque Rust object.
13985     * Nearly everywhere, inner must be non-null, however in places where
13986     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13987     */
13988    LDKnativeDefaultRouter *inner;
13989    /**
13990     * Indicates that this is the only struct which contains the same pointer.
13991     * Rust functions which take ownership of an object provided via an argument require
13992     * this to be true and invalidate the object pointed to by inner.
13993     */
13994    bool is_owned;
13995 } LDKDefaultRouter;
13996
13997 /**
13998  * A trait defining behavior for routing a payment.
13999  */
14000 typedef struct LDKRouter {
14001    /**
14002     * An opaque pointer which is passed to your function implementations as an argument.
14003     * This has no meaning in the LDK, and can be NULL or any other value.
14004     */
14005    void *this_arg;
14006    /**
14007     * Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
14008     *
14009     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
14010     */
14011    struct LDKCResult_RouteLightningErrorZ (*find_route)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs);
14012    /**
14013     * Finds a [`Route`] between `payer` and `payee` for a payment with the given values. Includes
14014     * `PaymentHash` and `PaymentId` to be able to correlate the request with a specific payment.
14015     *
14016     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
14017     */
14018    struct LDKCResult_RouteLightningErrorZ (*find_route_with_id)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs, struct LDKThirtyTwoBytes _payment_hash, struct LDKThirtyTwoBytes _payment_id);
14019    /**
14020     * Lets the router know that payment through a specific path has failed.
14021     */
14022    void (*notify_payment_path_failed)(const void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
14023    /**
14024     * Lets the router know that payment through a specific path was successful.
14025     */
14026    void (*notify_payment_path_successful)(const void *this_arg, struct LDKCVec_RouteHopZ path);
14027    /**
14028     * Lets the router know that a payment probe was successful.
14029     */
14030    void (*notify_payment_probe_successful)(const void *this_arg, struct LDKCVec_RouteHopZ path);
14031    /**
14032     * Lets the router know that a payment probe failed.
14033     */
14034    void (*notify_payment_probe_failed)(const void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
14035    /**
14036     * Frees any resources associated with this object given its this_arg pointer.
14037     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
14038     */
14039    void (*free)(void *this_arg);
14040 } LDKRouter;
14041
14042
14043
14044 /**
14045  * [`Score`] implementation that factors in in-flight HTLC liquidity.
14046  *
14047  * Useful for custom [`Router`] implementations to wrap their [`Score`] on-the-fly when calling
14048  * [`find_route`].
14049  *
14050  * [`Score`]: crate::routing::scoring::Score
14051  */
14052 typedef struct MUST_USE_STRUCT LDKScorerAccountingForInFlightHtlcs {
14053    /**
14054     * A pointer to the opaque Rust object.
14055     * Nearly everywhere, inner must be non-null, however in places where
14056     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14057     */
14058    LDKnativeScorerAccountingForInFlightHtlcs *inner;
14059    /**
14060     * Indicates that this is the only struct which contains the same pointer.
14061     * Rust functions which take ownership of an object provided via an argument require
14062     * this to be true and invalidate the object pointed to by inner.
14063     */
14064    bool is_owned;
14065 } LDKScorerAccountingForInFlightHtlcs;
14066
14067
14068
14069 /**
14070  * A concrete implementation of [`LockableScore`] which supports multi-threading.
14071  */
14072 typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore {
14073    /**
14074     * A pointer to the opaque Rust object.
14075     * Nearly everywhere, inner must be non-null, however in places where
14076     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14077     */
14078    LDKnativeMultiThreadedLockableScore *inner;
14079    /**
14080     * Indicates that this is the only struct which contains the same pointer.
14081     * Rust functions which take ownership of an object provided via an argument require
14082     * this to be true and invalidate the object pointed to by inner.
14083     */
14084    bool is_owned;
14085 } LDKMultiThreadedLockableScore;
14086
14087
14088
14089 /**
14090  * A locked `MultiThreadedLockableScore`.
14091  */
14092 typedef struct MUST_USE_STRUCT LDKMultiThreadedScoreLock {
14093    /**
14094     * A pointer to the opaque Rust object.
14095     * Nearly everywhere, inner must be non-null, however in places where
14096     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14097     */
14098    LDKnativeMultiThreadedScoreLock *inner;
14099    /**
14100     * Indicates that this is the only struct which contains the same pointer.
14101     * Rust functions which take ownership of an object provided via an argument require
14102     * this to be true and invalidate the object pointed to by inner.
14103     */
14104    bool is_owned;
14105 } LDKMultiThreadedScoreLock;
14106
14107
14108
14109 /**
14110  * Parameters for configuring [`ProbabilisticScorer`].
14111  *
14112  * Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel
14113  * penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel).
14114  *
14115  * The penalty applied to any channel by the [`ProbabilisticScorer`] is the sum of each of the
14116  * parameters here.
14117  */
14118 typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters {
14119    /**
14120     * A pointer to the opaque Rust object.
14121     * Nearly everywhere, inner must be non-null, however in places where
14122     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14123     */
14124    LDKnativeProbabilisticScoringParameters *inner;
14125    /**
14126     * Indicates that this is the only struct which contains the same pointer.
14127     * Rust functions which take ownership of an object provided via an argument require
14128     * this to be true and invalidate the object pointed to by inner.
14129     */
14130    bool is_owned;
14131 } LDKProbabilisticScoringParameters;
14132
14133
14134
14135 /**
14136  * A sender, receiver and forwarder of onion messages. In upcoming releases, this object will be
14137  * used to retrieve invoices and fulfill invoice requests from [offers]. Currently, only sending
14138  * and receiving custom onion messages is supported.
14139  *
14140  * # Example
14141  *
14142  * ```
14143  * # extern crate bitcoin;
14144  * # use bitcoin::hashes::_export::_core::time::Duration;
14145  * # use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};
14146  * # use lightning::chain::keysinterface::{InMemorySigner, KeysManager, KeysInterface};
14147  * # use lightning::ln::msgs::DecodeError;
14148  * # use lightning::ln::peer_handler::IgnoringMessageHandler;
14149  * # use lightning::onion_message::blinded_path::BlindedPath;
14150  * # use lightning::onion_message::messenger::{CustomOnionMessageContents, Destination, OnionMessageContents, OnionMessenger};
14151  * # use lightning::util::logger::{Logger, Record};
14152  * # use lightning::util::ser::{Writeable, Writer};
14153  * # use lightning::io;
14154  * # use std::sync::Arc;
14155  * # struct FakeLogger {};
14156  * # impl Logger for FakeLogger {
14157  * #     fn log(&self, record: &Record) { unimplemented!() }
14158  * # }
14159  * # let seed = [42u8; 32];
14160  * # let time = Duration::from_secs(123456);
14161  * # let keys_manager = KeysManager::new(&seed, time.as_secs(), time.subsec_nanos());
14162  * # let logger = Arc::new(FakeLogger {});
14163  * # let node_secret = SecretKey::from_slice(&hex::decode(\"0101010101010101010101010101010101010101010101010101010101010101\").unwrap()[..]).unwrap();
14164  * # let secp_ctx = Secp256k1::new();
14165  * # let hop_node_id1 = PublicKey::from_secret_key(&secp_ctx, &node_secret);
14166  * # let (hop_node_id2, hop_node_id3, hop_node_id4) = (hop_node_id1, hop_node_id1, hop_node_id1);
14167  * # let destination_node_id = hop_node_id1;
14168  * # let your_custom_message_handler = IgnoringMessageHandler {};
14169  * // Create the onion messenger. This must use the same `keys_manager` as is passed to your
14170  * // ChannelManager.
14171  * let onion_messenger = OnionMessenger::new(&keys_manager, logger, your_custom_message_handler);
14172  *
14173  * # struct YourCustomMessage {}
14174  * impl Writeable for YourCustomMessage {
14175  * \tfn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
14176  * \t\t# Ok(())
14177  * \t\t// Write your custom onion message to `w`
14178  * \t}
14179  * }
14180  * impl CustomOnionMessageContents for YourCustomMessage {
14181  * \tfn tlv_type(&self) -> u64 {
14182  * \t\t# let your_custom_message_type = 42;
14183  * \t\tyour_custom_message_type
14184  * \t}
14185  * }
14186  * // Send a custom onion message to a node id.
14187  * let intermediate_hops = [hop_node_id1, hop_node_id2];
14188  * let reply_path = None;
14189  * # let your_custom_message = YourCustomMessage {};
14190  * let message = OnionMessageContents::Custom(your_custom_message);
14191  * onion_messenger.send_onion_message(&intermediate_hops, Destination::Node(destination_node_id), message, reply_path);
14192  *
14193  * // Create a blinded path to yourself, for someone to send an onion message to.
14194  * # let your_node_id = hop_node_id1;
14195  * let hops = [hop_node_id3, hop_node_id4, your_node_id];
14196  * let blinded_path = BlindedPath::new(&hops, &keys_manager, &secp_ctx).unwrap();
14197  *
14198  * // Send a custom onion message to a blinded path.
14199  * # let intermediate_hops = [hop_node_id1, hop_node_id2];
14200  * let reply_path = None;
14201  * # let your_custom_message = YourCustomMessage {};
14202  * let message = OnionMessageContents::Custom(your_custom_message);
14203  * onion_messenger.send_onion_message(&intermediate_hops, Destination::BlindedPath(blinded_path), message, reply_path);
14204  * ```
14205  *
14206  * [offers]: <https://github.com/lightning/bolts/pull/798>
14207  * [`OnionMessenger`]: crate::onion_message::OnionMessenger
14208  */
14209 typedef struct MUST_USE_STRUCT LDKOnionMessenger {
14210    /**
14211     * A pointer to the opaque Rust object.
14212     * Nearly everywhere, inner must be non-null, however in places where
14213     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14214     */
14215    LDKnativeOnionMessenger *inner;
14216    /**
14217     * Indicates that this is the only struct which contains the same pointer.
14218     * Rust functions which take ownership of an object provided via an argument require
14219     * this to be true and invalidate the object pointed to by inner.
14220     */
14221    bool is_owned;
14222 } LDKOnionMessenger;
14223
14224 /**
14225  * The destination of an onion message.
14226  */
14227 typedef enum LDKDestination_Tag {
14228    /**
14229     * We're sending this onion message to a node.
14230     */
14231    LDKDestination_Node,
14232    /**
14233     * We're sending this onion message to a blinded path.
14234     */
14235    LDKDestination_BlindedPath,
14236    /**
14237     * Must be last for serialization purposes
14238     */
14239    LDKDestination_Sentinel,
14240 } LDKDestination_Tag;
14241
14242 typedef struct MUST_USE_STRUCT LDKDestination {
14243    LDKDestination_Tag tag;
14244    union {
14245       struct {
14246          struct LDKPublicKey node;
14247       };
14248       struct {
14249          struct LDKBlindedPath blinded_path;
14250       };
14251    };
14252 } LDKDestination;
14253
14254 /**
14255  * The contents of an onion message. In the context of offers, this would be the invoice, invoice
14256  * request, or invoice error.
14257  */
14258 typedef enum LDKOnionMessageContents_Tag {
14259    /**
14260     * A custom onion message specified by the user.
14261     */
14262    LDKOnionMessageContents_Custom,
14263    /**
14264     * Must be last for serialization purposes
14265     */
14266    LDKOnionMessageContents_Sentinel,
14267 } LDKOnionMessageContents_Tag;
14268
14269 typedef struct MUST_USE_STRUCT LDKOnionMessageContents {
14270    LDKOnionMessageContents_Tag tag;
14271    union {
14272       struct {
14273          struct LDKCustomOnionMessageContents custom;
14274       };
14275    };
14276 } LDKOnionMessageContents;
14277
14278
14279
14280 /**
14281  * FilesystemPersister persists channel data on disk, where each channel's
14282  * data is stored in a file named after its funding outpoint.
14283  *
14284  * Warning: this module does the best it can with calls to persist data, but it
14285  * can only guarantee that the data is passed to the drive. It is up to the
14286  * drive manufacturers to do the actual persistence properly, which they often
14287  * don't (especially on consumer-grade hardware). Therefore, it is up to the
14288  * user to validate their entire storage stack, to ensure the writes are
14289  * persistent.
14290  * Corollary: especially when dealing with larger amounts of money, it is best
14291  * practice to have multiple channel data backups and not rely only on one
14292  * FilesystemPersister.
14293  */
14294 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
14295    /**
14296     * A pointer to the opaque Rust object.
14297     * Nearly everywhere, inner must be non-null, however in places where
14298     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14299     */
14300    LDKnativeFilesystemPersister *inner;
14301    /**
14302     * Indicates that this is the only struct which contains the same pointer.
14303     * Rust functions which take ownership of an object provided via an argument require
14304     * this to be true and invalidate the object pointed to by inner.
14305     */
14306    bool is_owned;
14307 } LDKFilesystemPersister;
14308
14309
14310
14311 /**
14312  * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
14313  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
14314  * responsibilities are:
14315  * * Processing [`Event`]s with a user-provided [`EventHandler`].
14316  * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
14317  *   writing it to disk/backups by invoking the callback given to it at startup.
14318  *   [`ChannelManager`] persistence should be done in the background.
14319  * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
14320  *   at the appropriate intervals.
14321  * * Calling [`NetworkGraph::remove_stale_channels_and_tracking`] (if a [`GossipSync`] with a
14322  *   [`NetworkGraph`] is provided to [`BackgroundProcessor::start`]).
14323  *
14324  * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
14325  * upon as doing so may result in high latency.
14326  *
14327  * # Note
14328  *
14329  * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
14330  * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
14331  * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
14332  * unilateral chain closure fees are at risk.
14333  *
14334  * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
14335  * [`Event`]: lightning::util::events::Event
14336  *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
14337  */
14338 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
14339    /**
14340     * A pointer to the opaque Rust object.
14341     * Nearly everywhere, inner must be non-null, however in places where
14342     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14343     */
14344    LDKnativeBackgroundProcessor *inner;
14345    /**
14346     * Indicates that this is the only struct which contains the same pointer.
14347     * Rust functions which take ownership of an object provided via an argument require
14348     * this to be true and invalidate the object pointed to by inner.
14349     */
14350    bool is_owned;
14351 } LDKBackgroundProcessor;
14352
14353
14354
14355 /**
14356  * The main Rapid Gossip Sync object.
14357  *
14358  * See [crate-level documentation] for usage.
14359  *
14360  * [crate-level documentation]: crate
14361  */
14362 typedef struct MUST_USE_STRUCT LDKRapidGossipSync {
14363    /**
14364     * A pointer to the opaque Rust object.
14365     * Nearly everywhere, inner must be non-null, however in places where
14366     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14367     */
14368    LDKnativeRapidGossipSync *inner;
14369    /**
14370     * Indicates that this is the only struct which contains the same pointer.
14371     * Rust functions which take ownership of an object provided via an argument require
14372     * this to be true and invalidate the object pointed to by inner.
14373     */
14374    bool is_owned;
14375 } LDKRapidGossipSync;
14376
14377 /**
14378  * Either [`P2PGossipSync`] or [`RapidGossipSync`].
14379  */
14380 typedef enum LDKGossipSync_Tag {
14381    /**
14382     * Gossip sync via the lightning peer-to-peer network as defined by BOLT 7.
14383     */
14384    LDKGossipSync_P2P,
14385    /**
14386     * Rapid gossip sync from a trusted server.
14387     */
14388    LDKGossipSync_Rapid,
14389    /**
14390     * No gossip sync.
14391     */
14392    LDKGossipSync_None,
14393    /**
14394     * Must be last for serialization purposes
14395     */
14396    LDKGossipSync_Sentinel,
14397 } LDKGossipSync_Tag;
14398
14399 typedef struct MUST_USE_STRUCT LDKGossipSync {
14400    LDKGossipSync_Tag tag;
14401    union {
14402       struct {
14403          /**
14404           * Note that this field is expected to be a reference.
14405           */
14406          struct LDKP2PGossipSync p2p;
14407       };
14408       struct {
14409          /**
14410           * Note that this field is expected to be a reference.
14411           */
14412          struct LDKRapidGossipSync rapid;
14413       };
14414    };
14415 } LDKGossipSync;
14416
14417
14418
14419 /**
14420  * Data of the `RawInvoice` that is encoded in the data part
14421  */
14422 typedef struct MUST_USE_STRUCT LDKRawDataPart {
14423    /**
14424     * A pointer to the opaque Rust object.
14425     * Nearly everywhere, inner must be non-null, however in places where
14426     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14427     */
14428    LDKnativeRawDataPart *inner;
14429    /**
14430     * Indicates that this is the only struct which contains the same pointer.
14431     * Rust functions which take ownership of an object provided via an argument require
14432     * this to be true and invalidate the object pointed to by inner.
14433     */
14434    bool is_owned;
14435 } LDKRawDataPart;
14436
14437
14438
14439 /**
14440  * SHA-256 hash
14441  */
14442 typedef struct MUST_USE_STRUCT LDKSha256 {
14443    /**
14444     * A pointer to the opaque Rust object.
14445     * Nearly everywhere, inner must be non-null, however in places where
14446     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14447     */
14448    LDKnativeSha256 *inner;
14449    /**
14450     * Indicates that this is the only struct which contains the same pointer.
14451     * Rust functions which take ownership of an object provided via an argument require
14452     * this to be true and invalidate the object pointed to by inner.
14453     */
14454    bool is_owned;
14455 } LDKSha256;
14456
14457
14458
14459 /**
14460  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
14461  * expires
14462  */
14463 typedef struct MUST_USE_STRUCT LDKExpiryTime {
14464    /**
14465     * A pointer to the opaque Rust object.
14466     * Nearly everywhere, inner must be non-null, however in places where
14467     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14468     */
14469    LDKnativeExpiryTime *inner;
14470    /**
14471     * Indicates that this is the only struct which contains the same pointer.
14472     * Rust functions which take ownership of an object provided via an argument require
14473     * this to be true and invalidate the object pointed to by inner.
14474     */
14475    bool is_owned;
14476 } LDKExpiryTime;
14477
14478
14479
14480 /**
14481  * `min_final_cltv_expiry` to use for the last HTLC in the route
14482  */
14483 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
14484    /**
14485     * A pointer to the opaque Rust object.
14486     * Nearly everywhere, inner must be non-null, however in places where
14487     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14488     */
14489    LDKnativeMinFinalCltvExpiry *inner;
14490    /**
14491     * Indicates that this is the only struct which contains the same pointer.
14492     * Rust functions which take ownership of an object provided via an argument require
14493     * this to be true and invalidate the object pointed to by inner.
14494     */
14495    bool is_owned;
14496 } LDKMinFinalCltvExpiry;
14497
14498 /**
14499  * A 20-byte byte array.
14500  */
14501 typedef struct LDKTwentyBytes {
14502    /**
14503     * The twenty bytes
14504     */
14505    uint8_t data[20];
14506 } LDKTwentyBytes;
14507
14508 /**
14509  * Fallback address in case no LN payment is possible
14510  */
14511 typedef enum LDKFallback_Tag {
14512    LDKFallback_SegWitProgram,
14513    LDKFallback_PubKeyHash,
14514    LDKFallback_ScriptHash,
14515    /**
14516     * Must be last for serialization purposes
14517     */
14518    LDKFallback_Sentinel,
14519 } LDKFallback_Tag;
14520
14521 typedef struct LDKFallback_LDKSegWitProgram_Body {
14522    struct LDKU5 version;
14523    struct LDKCVec_u8Z program;
14524 } LDKFallback_LDKSegWitProgram_Body;
14525
14526 typedef struct MUST_USE_STRUCT LDKFallback {
14527    LDKFallback_Tag tag;
14528    union {
14529       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
14530       struct {
14531          struct LDKTwentyBytes pub_key_hash;
14532       };
14533       struct {
14534          struct LDKTwentyBytes script_hash;
14535       };
14536    };
14537 } LDKFallback;
14538
14539 /**
14540  * A trait defining behavior of an [`Invoice`] payer.
14541  *
14542  * While the behavior of [`InvoicePayer`] provides idempotency of duplicate `send_*payment` calls
14543  * with the same [`PaymentHash`], it is up to the `Payer` to provide idempotency across restarts.
14544  *
14545  * [`ChannelManager`] provides idempotency for duplicate payments with the same [`PaymentId`].
14546  *
14547  * In order to trivially ensure idempotency for payments, the default `Payer` implementation
14548  * reuses the [`PaymentHash`] bytes as the [`PaymentId`]. Custom implementations wishing to
14549  * provide payment idempotency with a different idempotency key (i.e. [`PaymentId`]) should map
14550  * the [`Invoice`] or spontaneous payment target pubkey to their own idempotency key.
14551  *
14552  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
14553  */
14554 typedef struct LDKPayer {
14555    /**
14556     * An opaque pointer which is passed to your function implementations as an argument.
14557     * This has no meaning in the LDK, and can be NULL or any other value.
14558     */
14559    void *this_arg;
14560    /**
14561     * Returns the payer's node id.
14562     */
14563    struct LDKPublicKey (*node_id)(const void *this_arg);
14564    /**
14565     * Returns the payer's channels.
14566     */
14567    struct LDKCVec_ChannelDetailsZ (*first_hops)(const void *this_arg);
14568    /**
14569     * Sends a payment over the Lightning Network using the given [`Route`].
14570     *
14571     * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
14572     */
14573    struct LDKCResult_NonePaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKThirtyTwoBytes payment_id);
14574    /**
14575     * Sends a spontaneous payment over the Lightning Network using the given [`Route`].
14576     */
14577    struct LDKCResult_NonePaymentSendFailureZ (*send_spontaneous_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_id);
14578    /**
14579     * Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
14580     */
14581    struct LDKCResult_NonePaymentSendFailureZ (*retry_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
14582    /**
14583     * Signals that no further retries for the given payment will occur.
14584     */
14585    void (*abandon_payment)(const void *this_arg, struct LDKThirtyTwoBytes payment_id);
14586    /**
14587     * Construct an [`InFlightHtlcs`] containing information about currently used up liquidity
14588     * across payments.
14589     */
14590    struct LDKInFlightHtlcs (*inflight_htlcs)(const void *this_arg);
14591    /**
14592     * Frees any resources associated with this object given its this_arg pointer.
14593     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
14594     */
14595    void (*free)(void *this_arg);
14596 } LDKPayer;
14597
14598
14599
14600 /**
14601  * A utility for paying [`Invoice`]s and sending spontaneous payments.
14602  *
14603  * See [module-level documentation] for details.
14604  *
14605  * [module-level documentation]: crate::payment
14606  */
14607 typedef struct MUST_USE_STRUCT LDKInvoicePayer {
14608    /**
14609     * A pointer to the opaque Rust object.
14610     * Nearly everywhere, inner must be non-null, however in places where
14611     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14612     */
14613    LDKnativeInvoicePayer *inner;
14614    /**
14615     * Indicates that this is the only struct which contains the same pointer.
14616     * Rust functions which take ownership of an object provided via an argument require
14617     * this to be true and invalidate the object pointed to by inner.
14618     */
14619    bool is_owned;
14620 } LDKInvoicePayer;
14621
14622 /**
14623  * Strategies available to retry payment path failures for an [`Invoice`].
14624  *
14625  */
14626 typedef enum LDKRetry_Tag {
14627    /**
14628     * Max number of attempts to retry payment.
14629     *
14630     * Note that this is the number of *path* failures, not full payment retries. For multi-path
14631     * payments, if this is less than the total number of paths, we will never even retry all of the
14632     * payment's paths.
14633     */
14634    LDKRetry_Attempts,
14635    /**
14636     * Time elapsed before abandoning retries for a payment.
14637     */
14638    LDKRetry_Timeout,
14639    /**
14640     * Must be last for serialization purposes
14641     */
14642    LDKRetry_Sentinel,
14643 } LDKRetry_Tag;
14644
14645 typedef struct MUST_USE_STRUCT LDKRetry {
14646    LDKRetry_Tag tag;
14647    union {
14648       struct {
14649          uintptr_t attempts;
14650       };
14651       struct {
14652          uint64_t timeout;
14653       };
14654    };
14655 } LDKRetry;
14656
14657 extern const uintptr_t MAX_BUF_SIZE;
14658
14659 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
14660
14661 extern const uint32_t FEERATE_FLOOR_SATS_PER_KW;
14662
14663 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
14664
14665 extern const uint32_t ANTI_REORG_DELAY;
14666
14667 extern const uint16_t BREAKDOWN_TIMEOUT;
14668
14669 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
14670
14671 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
14672
14673 extern const uint16_t MAX_HTLCS;
14674
14675 extern const uintptr_t OFFERED_HTLC_SCRIPT_WEIGHT;
14676
14677 extern const uintptr_t OFFERED_HTLC_SCRIPT_WEIGHT_ANCHORS;
14678
14679 extern const uintptr_t MAX_ACCEPTED_HTLC_SCRIPT_WEIGHT;
14680
14681 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
14682
14683 extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT;
14684
14685 extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA;
14686
14687 extern const uint8_t DEFAULT_MAX_PATH_COUNT;
14688
14689 extern const uint64_t MAX_TIMESTAMP;
14690
14691 extern const uint64_t DEFAULT_EXPIRY_TIME;
14692
14693 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY;
14694
14695 extern const uint8_t TAG_PAYMENT_HASH;
14696
14697 extern const uint8_t TAG_DESCRIPTION;
14698
14699 extern const uint8_t TAG_PAYEE_PUB_KEY;
14700
14701 extern const uint8_t TAG_DESCRIPTION_HASH;
14702
14703 extern const uint8_t TAG_EXPIRY_TIME;
14704
14705 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
14706
14707 extern const uint8_t TAG_FALLBACK;
14708
14709 extern const uint8_t TAG_PRIVATE_ROUTE;
14710
14711 extern const uint8_t TAG_PAYMENT_SECRET;
14712
14713 extern const uint8_t TAG_FEATURES;
14714
14715 struct LDKStr _ldk_get_compiled_version(void);
14716
14717 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
14718
14719 /**
14720  * Gets the 128-bit integer, as 16 little-endian bytes
14721  */
14722 struct LDKSixteenBytes U128_le_bytes(struct LDKU128 val);
14723
14724 /**
14725  * Constructs a new U128 from 16 little-endian bytes
14726  */
14727 struct LDKU128 U128_new(struct LDKSixteenBytes le_bytes);
14728
14729 /**
14730  * Convenience function for constructing a new BigEndianScalar
14731  */
14732 struct LDKBigEndianScalar BigEndianScalar_new(struct LDKThirtyTwoBytes big_endian_bytes);
14733
14734 /**
14735  * Creates a new Bech32Error which has the same data as `orig`
14736  */
14737 struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig);
14738
14739 /**
14740  * Releases any memory held by the given `Bech32Error` (which is currently none)
14741  */
14742 void Bech32Error_free(struct LDKBech32Error o);
14743
14744 /**
14745  * Frees the data buffer, if data_is_owned is set and datalen > 0.
14746  */
14747 void Transaction_free(struct LDKTransaction _res);
14748
14749 /**
14750  * Frees the data pointed to by data
14751  */
14752 void Witness_free(struct LDKWitness _res);
14753
14754 /**
14755  * Convenience function for constructing a new TxOut
14756  */
14757 struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
14758
14759 /**
14760  * Frees the data pointed to by script_pubkey.
14761  */
14762 void TxOut_free(struct LDKTxOut _res);
14763
14764 /**
14765  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
14766  */
14767 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
14768
14769 /**
14770  * Frees the data buffer, if chars_is_owned is set and len > 0.
14771  */
14772 void Str_free(struct LDKStr _res);
14773
14774 #if defined(LDK_DEBUG_BUILD)
14775 /**
14776  * This function exists for memory safety testing purposes. It should never be used in production
14777  * code
14778  */
14779 const void *__unmangle_inner_ptr(const void *ptr);
14780 #endif
14781
14782 /**
14783  * Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
14784  */
14785 struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_some(enum LDKHTLCClaim o);
14786
14787 /**
14788  * Constructs a new COption_HTLCClaimZ containing nothing
14789  */
14790 struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_none(void);
14791
14792 /**
14793  * Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
14794  */
14795 void COption_HTLCClaimZ_free(struct LDKCOption_HTLCClaimZ _res);
14796
14797 /**
14798  * Creates a new CResult_NoneNoneZ in the success state.
14799  */
14800 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
14801
14802 /**
14803  * Creates a new CResult_NoneNoneZ in the error state.
14804  */
14805 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
14806
14807 /**
14808  * Checks if the given object is currently in the success state
14809  */
14810 bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o);
14811
14812 /**
14813  * Frees any resources used by the CResult_NoneNoneZ.
14814  */
14815 void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
14816
14817 /**
14818  * Creates a new CResult_NoneNoneZ which has the same data as `orig`
14819  * but with all dynamically-allocated buffers duplicated in new buffers.
14820  */
14821 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
14822
14823 /**
14824  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
14825  */
14826 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o);
14827
14828 /**
14829  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
14830  */
14831 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e);
14832
14833 /**
14834  * Checks if the given object is currently in the success state
14835  */
14836 bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o);
14837
14838 /**
14839  * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
14840  */
14841 void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res);
14842
14843 /**
14844  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
14845  * but with all dynamically-allocated buffers duplicated in new buffers.
14846  */
14847 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig);
14848
14849 /**
14850  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
14851  */
14852 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
14853
14854 /**
14855  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
14856  */
14857 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
14858
14859 /**
14860  * Checks if the given object is currently in the success state
14861  */
14862 bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o);
14863
14864 /**
14865  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
14866  */
14867 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
14868
14869 /**
14870  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
14871  * but with all dynamically-allocated buffers duplicated in new buffers.
14872  */
14873 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
14874
14875 /**
14876  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
14877  */
14878 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
14879
14880 /**
14881  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
14882  */
14883 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
14884
14885 /**
14886  * Checks if the given object is currently in the success state
14887  */
14888 bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o);
14889
14890 /**
14891  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
14892  */
14893 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
14894
14895 /**
14896  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
14897  * but with all dynamically-allocated buffers duplicated in new buffers.
14898  */
14899 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
14900
14901 /**
14902  * Constructs a new COption_u32Z containing a u32
14903  */
14904 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
14905
14906 /**
14907  * Constructs a new COption_u32Z containing nothing
14908  */
14909 struct LDKCOption_u32Z COption_u32Z_none(void);
14910
14911 /**
14912  * Frees any resources associated with the u32, if we are in the Some state
14913  */
14914 void COption_u32Z_free(struct LDKCOption_u32Z _res);
14915
14916 /**
14917  * Creates a new COption_u32Z which has the same data as `orig`
14918  * but with all dynamically-allocated buffers duplicated in new buffers.
14919  */
14920 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
14921
14922 /**
14923  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
14924  */
14925 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
14926
14927 /**
14928  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
14929  */
14930 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
14931
14932 /**
14933  * Checks if the given object is currently in the success state
14934  */
14935 bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o);
14936
14937 /**
14938  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
14939  */
14940 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
14941
14942 /**
14943  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
14944  * but with all dynamically-allocated buffers duplicated in new buffers.
14945  */
14946 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
14947
14948 /**
14949  * Constructs a new COption_NoneZ containing a
14950  */
14951 enum LDKCOption_NoneZ COption_NoneZ_some(void);
14952
14953 /**
14954  * Constructs a new COption_NoneZ containing nothing
14955  */
14956 enum LDKCOption_NoneZ COption_NoneZ_none(void);
14957
14958 /**
14959  * Frees any resources associated with the , if we are in the Some state
14960  */
14961 void COption_NoneZ_free(enum LDKCOption_NoneZ _res);
14962
14963 /**
14964  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
14965  */
14966 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
14967
14968 /**
14969  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
14970  */
14971 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
14972
14973 /**
14974  * Checks if the given object is currently in the success state
14975  */
14976 bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
14977
14978 /**
14979  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
14980  */
14981 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
14982
14983 /**
14984  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
14985  * but with all dynamically-allocated buffers duplicated in new buffers.
14986  */
14987 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
14988
14989 /**
14990  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
14991  */
14992 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
14993
14994 /**
14995  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
14996  */
14997 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
14998
14999 /**
15000  * Checks if the given object is currently in the success state
15001  */
15002 bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
15003
15004 /**
15005  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
15006  */
15007 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
15008
15009 /**
15010  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
15011  * but with all dynamically-allocated buffers duplicated in new buffers.
15012  */
15013 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
15014
15015 /**
15016  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15017  */
15018 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
15019
15020 /**
15021  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
15022  */
15023 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
15024
15025 /**
15026  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
15027  */
15028 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
15029
15030 /**
15031  * Checks if the given object is currently in the success state
15032  */
15033 bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
15034
15035 /**
15036  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
15037  */
15038 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
15039
15040 /**
15041  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
15042  * but with all dynamically-allocated buffers duplicated in new buffers.
15043  */
15044 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
15045
15046 /**
15047  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
15048  */
15049 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
15050
15051 /**
15052  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
15053  */
15054 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
15055
15056 /**
15057  * Checks if the given object is currently in the success state
15058  */
15059 bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
15060
15061 /**
15062  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
15063  */
15064 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
15065
15066 /**
15067  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
15068  * but with all dynamically-allocated buffers duplicated in new buffers.
15069  */
15070 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
15071
15072 /**
15073  * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
15074  */
15075 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
15076
15077 /**
15078  * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
15079  */
15080 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
15081
15082 /**
15083  * Checks if the given object is currently in the success state
15084  */
15085 bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o);
15086
15087 /**
15088  * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
15089  */
15090 void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
15091
15092 /**
15093  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
15094  */
15095 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
15096
15097 /**
15098  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
15099  */
15100 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
15101
15102 /**
15103  * Checks if the given object is currently in the success state
15104  */
15105 bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
15106
15107 /**
15108  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
15109  */
15110 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
15111
15112 /**
15113  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
15114  * but with all dynamically-allocated buffers duplicated in new buffers.
15115  */
15116 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
15117
15118 /**
15119  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
15120  */
15121 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
15122
15123 /**
15124  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
15125  */
15126 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
15127
15128 /**
15129  * Checks if the given object is currently in the success state
15130  */
15131 bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o);
15132
15133 /**
15134  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
15135  */
15136 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
15137
15138 /**
15139  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
15140  */
15141 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
15142
15143 /**
15144  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
15145  */
15146 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
15147
15148 /**
15149  * Checks if the given object is currently in the success state
15150  */
15151 bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o);
15152
15153 /**
15154  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
15155  */
15156 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
15157
15158 /**
15159  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
15160  * but with all dynamically-allocated buffers duplicated in new buffers.
15161  */
15162 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
15163
15164 /**
15165  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
15166  */
15167 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
15168
15169 /**
15170  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
15171  */
15172 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
15173
15174 /**
15175  * Checks if the given object is currently in the success state
15176  */
15177 bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o);
15178
15179 /**
15180  * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
15181  */
15182 void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
15183
15184 /**
15185  * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
15186  * but with all dynamically-allocated buffers duplicated in new buffers.
15187  */
15188 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
15189
15190 /**
15191  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
15192  */
15193 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
15194
15195 /**
15196  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
15197  */
15198 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
15199
15200 /**
15201  * Checks if the given object is currently in the success state
15202  */
15203 bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o);
15204
15205 /**
15206  * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
15207  */
15208 void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
15209
15210 /**
15211  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
15212  * but with all dynamically-allocated buffers duplicated in new buffers.
15213  */
15214 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig);
15215
15216 /**
15217  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15218  */
15219 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
15220
15221 /**
15222  * Creates a new CResult_BlindedPathNoneZ in the success state.
15223  */
15224 struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_ok(struct LDKBlindedPath o);
15225
15226 /**
15227  * Creates a new CResult_BlindedPathNoneZ in the error state.
15228  */
15229 struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_err(void);
15230
15231 /**
15232  * Checks if the given object is currently in the success state
15233  */
15234 bool CResult_BlindedPathNoneZ_is_ok(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR o);
15235
15236 /**
15237  * Frees any resources used by the CResult_BlindedPathNoneZ.
15238  */
15239 void CResult_BlindedPathNoneZ_free(struct LDKCResult_BlindedPathNoneZ _res);
15240
15241 /**
15242  * Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
15243  * but with all dynamically-allocated buffers duplicated in new buffers.
15244  */
15245 struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_clone(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR orig);
15246
15247 /**
15248  * Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
15249  */
15250 struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_ok(struct LDKBlindedPath o);
15251
15252 /**
15253  * Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
15254  */
15255 struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_err(struct LDKDecodeError e);
15256
15257 /**
15258  * Checks if the given object is currently in the success state
15259  */
15260 bool CResult_BlindedPathDecodeErrorZ_is_ok(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR o);
15261
15262 /**
15263  * Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
15264  */
15265 void CResult_BlindedPathDecodeErrorZ_free(struct LDKCResult_BlindedPathDecodeErrorZ _res);
15266
15267 /**
15268  * Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
15269  * but with all dynamically-allocated buffers duplicated in new buffers.
15270  */
15271 struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_clone(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR orig);
15272
15273 /**
15274  * Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
15275  */
15276 struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_ok(struct LDKBlindedHop o);
15277
15278 /**
15279  * Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
15280  */
15281 struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_err(struct LDKDecodeError e);
15282
15283 /**
15284  * Checks if the given object is currently in the success state
15285  */
15286 bool CResult_BlindedHopDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR o);
15287
15288 /**
15289  * Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
15290  */
15291 void CResult_BlindedHopDecodeErrorZ_free(struct LDKCResult_BlindedHopDecodeErrorZ _res);
15292
15293 /**
15294  * Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
15295  * but with all dynamically-allocated buffers duplicated in new buffers.
15296  */
15297 struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_clone(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR orig);
15298
15299 /**
15300  * Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
15301  */
15302 struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_some(struct LDKWriteableScore o);
15303
15304 /**
15305  * Constructs a new COption_WriteableScoreZ containing nothing
15306  */
15307 struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_none(void);
15308
15309 /**
15310  * Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
15311  */
15312 void COption_WriteableScoreZ_free(struct LDKCOption_WriteableScoreZ _res);
15313
15314 /**
15315  * Creates a new CResult_NoneErrorZ in the success state.
15316  */
15317 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
15318
15319 /**
15320  * Creates a new CResult_NoneErrorZ in the error state.
15321  */
15322 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
15323
15324 /**
15325  * Checks if the given object is currently in the success state
15326  */
15327 bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o);
15328
15329 /**
15330  * Frees any resources used by the CResult_NoneErrorZ.
15331  */
15332 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
15333
15334 /**
15335  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
15336  * but with all dynamically-allocated buffers duplicated in new buffers.
15337  */
15338 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
15339
15340 /**
15341  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15342  */
15343 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
15344
15345 /**
15346  * Creates a new CResult_RouteLightningErrorZ in the success state.
15347  */
15348 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
15349
15350 /**
15351  * Creates a new CResult_RouteLightningErrorZ in the error state.
15352  */
15353 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
15354
15355 /**
15356  * Checks if the given object is currently in the success state
15357  */
15358 bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o);
15359
15360 /**
15361  * Frees any resources used by the CResult_RouteLightningErrorZ.
15362  */
15363 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
15364
15365 /**
15366  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
15367  * but with all dynamically-allocated buffers duplicated in new buffers.
15368  */
15369 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
15370
15371 /**
15372  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15373  */
15374 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
15375
15376 /**
15377  * Constructs a new COption_u64Z containing a u64
15378  */
15379 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
15380
15381 /**
15382  * Constructs a new COption_u64Z containing nothing
15383  */
15384 struct LDKCOption_u64Z COption_u64Z_none(void);
15385
15386 /**
15387  * Frees any resources associated with the u64, if we are in the Some state
15388  */
15389 void COption_u64Z_free(struct LDKCOption_u64Z _res);
15390
15391 /**
15392  * Creates a new COption_u64Z which has the same data as `orig`
15393  * but with all dynamically-allocated buffers duplicated in new buffers.
15394  */
15395 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
15396
15397 /**
15398  * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
15399  */
15400 struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_ok(struct LDKInFlightHtlcs o);
15401
15402 /**
15403  * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
15404  */
15405 struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_err(struct LDKDecodeError e);
15406
15407 /**
15408  * Checks if the given object is currently in the success state
15409  */
15410 bool CResult_InFlightHtlcsDecodeErrorZ_is_ok(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR o);
15411
15412 /**
15413  * Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
15414  */
15415 void CResult_InFlightHtlcsDecodeErrorZ_free(struct LDKCResult_InFlightHtlcsDecodeErrorZ _res);
15416
15417 /**
15418  * Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
15419  * but with all dynamically-allocated buffers duplicated in new buffers.
15420  */
15421 struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_clone(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR orig);
15422
15423 /**
15424  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
15425  */
15426 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
15427
15428 /**
15429  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
15430  */
15431 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
15432
15433 /**
15434  * Checks if the given object is currently in the success state
15435  */
15436 bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o);
15437
15438 /**
15439  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
15440  */
15441 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
15442
15443 /**
15444  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
15445  * but with all dynamically-allocated buffers duplicated in new buffers.
15446  */
15447 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
15448
15449 /**
15450  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15451  */
15452 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
15453
15454 /**
15455  * Creates a new CResult_RouteDecodeErrorZ in the success state.
15456  */
15457 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
15458
15459 /**
15460  * Creates a new CResult_RouteDecodeErrorZ in the error state.
15461  */
15462 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
15463
15464 /**
15465  * Checks if the given object is currently in the success state
15466  */
15467 bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o);
15468
15469 /**
15470  * Frees any resources used by the CResult_RouteDecodeErrorZ.
15471  */
15472 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
15473
15474 /**
15475  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
15476  * but with all dynamically-allocated buffers duplicated in new buffers.
15477  */
15478 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
15479
15480 /**
15481  * Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
15482  */
15483 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o);
15484
15485 /**
15486  * Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
15487  */
15488 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e);
15489
15490 /**
15491  * Checks if the given object is currently in the success state
15492  */
15493 bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o);
15494
15495 /**
15496  * Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
15497  */
15498 void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res);
15499
15500 /**
15501  * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
15502  * but with all dynamically-allocated buffers duplicated in new buffers.
15503  */
15504 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig);
15505
15506 /**
15507  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15508  */
15509 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
15510
15511 /**
15512  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15513  */
15514 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
15515
15516 /**
15517  * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
15518  */
15519 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o);
15520
15521 /**
15522  * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
15523  */
15524 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e);
15525
15526 /**
15527  * Checks if the given object is currently in the success state
15528  */
15529 bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o);
15530
15531 /**
15532  * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
15533  */
15534 void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res);
15535
15536 /**
15537  * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
15538  * but with all dynamically-allocated buffers duplicated in new buffers.
15539  */
15540 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig);
15541
15542 /**
15543  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15544  */
15545 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
15546
15547 /**
15548  * Creates a new CResult_RouteHintDecodeErrorZ in the success state.
15549  */
15550 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o);
15551
15552 /**
15553  * Creates a new CResult_RouteHintDecodeErrorZ in the error state.
15554  */
15555 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e);
15556
15557 /**
15558  * Checks if the given object is currently in the success state
15559  */
15560 bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o);
15561
15562 /**
15563  * Frees any resources used by the CResult_RouteHintDecodeErrorZ.
15564  */
15565 void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res);
15566
15567 /**
15568  * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
15569  * but with all dynamically-allocated buffers duplicated in new buffers.
15570  */
15571 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig);
15572
15573 /**
15574  * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
15575  */
15576 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o);
15577
15578 /**
15579  * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
15580  */
15581 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e);
15582
15583 /**
15584  * Checks if the given object is currently in the success state
15585  */
15586 bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o);
15587
15588 /**
15589  * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
15590  */
15591 void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res);
15592
15593 /**
15594  * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
15595  * but with all dynamically-allocated buffers duplicated in new buffers.
15596  */
15597 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
15598
15599 /**
15600  * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
15601  */
15602 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o);
15603
15604 /**
15605  * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
15606  */
15607 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_err(struct LDKDecodeError e);
15608
15609 /**
15610  * Checks if the given object is currently in the success state
15611  */
15612 bool CResult_PaymentPurposeDecodeErrorZ_is_ok(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR o);
15613
15614 /**
15615  * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
15616  */
15617 void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res);
15618
15619 /**
15620  * Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
15621  * but with all dynamically-allocated buffers duplicated in new buffers.
15622  */
15623 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig);
15624
15625 /**
15626  * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
15627  */
15628 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o);
15629
15630 /**
15631  * Constructs a new COption_ClosureReasonZ containing nothing
15632  */
15633 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void);
15634
15635 /**
15636  * Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
15637  */
15638 void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res);
15639
15640 /**
15641  * Creates a new COption_ClosureReasonZ which has the same data as `orig`
15642  * but with all dynamically-allocated buffers duplicated in new buffers.
15643  */
15644 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig);
15645
15646 /**
15647  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
15648  */
15649 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o);
15650
15651 /**
15652  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
15653  */
15654 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e);
15655
15656 /**
15657  * Checks if the given object is currently in the success state
15658  */
15659 bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o);
15660
15661 /**
15662  * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
15663  */
15664 void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res);
15665
15666 /**
15667  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
15668  * but with all dynamically-allocated buffers duplicated in new buffers.
15669  */
15670 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig);
15671
15672 /**
15673  * Constructs a new COption_HTLCDestinationZ containing a crate::lightning::util::events::HTLCDestination
15674  */
15675 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_some(struct LDKHTLCDestination o);
15676
15677 /**
15678  * Constructs a new COption_HTLCDestinationZ containing nothing
15679  */
15680 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_none(void);
15681
15682 /**
15683  * Frees any resources associated with the crate::lightning::util::events::HTLCDestination, if we are in the Some state
15684  */
15685 void COption_HTLCDestinationZ_free(struct LDKCOption_HTLCDestinationZ _res);
15686
15687 /**
15688  * Creates a new COption_HTLCDestinationZ which has the same data as `orig`
15689  * but with all dynamically-allocated buffers duplicated in new buffers.
15690  */
15691 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_clone(const struct LDKCOption_HTLCDestinationZ *NONNULL_PTR orig);
15692
15693 /**
15694  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
15695  */
15696 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_ok(struct LDKCOption_HTLCDestinationZ o);
15697
15698 /**
15699  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
15700  */
15701 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_err(struct LDKDecodeError e);
15702
15703 /**
15704  * Checks if the given object is currently in the success state
15705  */
15706 bool CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR o);
15707
15708 /**
15709  * Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
15710  */
15711 void CResult_COption_HTLCDestinationZDecodeErrorZ_free(struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res);
15712
15713 /**
15714  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
15715  * but with all dynamically-allocated buffers duplicated in new buffers.
15716  */
15717 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_clone(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR orig);
15718
15719 /**
15720  * Constructs a new COption_u128Z containing a crate::c_types::U128
15721  */
15722 struct LDKCOption_u128Z COption_u128Z_some(struct LDKU128 o);
15723
15724 /**
15725  * Constructs a new COption_u128Z containing nothing
15726  */
15727 struct LDKCOption_u128Z COption_u128Z_none(void);
15728
15729 /**
15730  * Frees any resources associated with the crate::c_types::U128, if we are in the Some state
15731  */
15732 void COption_u128Z_free(struct LDKCOption_u128Z _res);
15733
15734 /**
15735  * Creates a new COption_u128Z which has the same data as `orig`
15736  * but with all dynamically-allocated buffers duplicated in new buffers.
15737  */
15738 struct LDKCOption_u128Z COption_u128Z_clone(const struct LDKCOption_u128Z *NONNULL_PTR orig);
15739
15740 /**
15741  * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
15742  */
15743 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
15744
15745 /**
15746  * Constructs a new COption_NetworkUpdateZ containing nothing
15747  */
15748 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
15749
15750 /**
15751  * Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
15752  */
15753 void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
15754
15755 /**
15756  * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
15757  * but with all dynamically-allocated buffers duplicated in new buffers.
15758  */
15759 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
15760
15761 /**
15762  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15763  */
15764 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
15765
15766 /**
15767  * Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
15768  */
15769 struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o);
15770
15771 /**
15772  * Constructs a new COption_EventZ containing nothing
15773  */
15774 struct LDKCOption_EventZ COption_EventZ_none(void);
15775
15776 /**
15777  * Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
15778  */
15779 void COption_EventZ_free(struct LDKCOption_EventZ _res);
15780
15781 /**
15782  * Creates a new COption_EventZ which has the same data as `orig`
15783  * but with all dynamically-allocated buffers duplicated in new buffers.
15784  */
15785 struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig);
15786
15787 /**
15788  * Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
15789  */
15790 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o);
15791
15792 /**
15793  * Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
15794  */
15795 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e);
15796
15797 /**
15798  * Checks if the given object is currently in the success state
15799  */
15800 bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o);
15801
15802 /**
15803  * Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
15804  */
15805 void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res);
15806
15807 /**
15808  * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
15809  * but with all dynamically-allocated buffers duplicated in new buffers.
15810  */
15811 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig);
15812
15813 /**
15814  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15815  */
15816 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
15817
15818 /**
15819  * Creates a new CResult_TxOutAccessErrorZ in the success state.
15820  */
15821 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
15822
15823 /**
15824  * Creates a new CResult_TxOutAccessErrorZ in the error state.
15825  */
15826 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
15827
15828 /**
15829  * Checks if the given object is currently in the success state
15830  */
15831 bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o);
15832
15833 /**
15834  * Frees any resources used by the CResult_TxOutAccessErrorZ.
15835  */
15836 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
15837
15838 /**
15839  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
15840  * but with all dynamically-allocated buffers duplicated in new buffers.
15841  */
15842 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
15843
15844 /**
15845  * Creates a new tuple which has the same data as `orig`
15846  * but with all dynamically-allocated buffers duplicated in new buffers.
15847  */
15848 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
15849
15850 /**
15851  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
15852  */
15853 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
15854
15855 /**
15856  * Frees any resources used by the C2Tuple_usizeTransactionZ.
15857  */
15858 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
15859
15860 /**
15861  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15862  */
15863 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
15864
15865 /**
15866  * Creates a new tuple which has the same data as `orig`
15867  * but with all dynamically-allocated buffers duplicated in new buffers.
15868  */
15869 struct LDKC2Tuple_TxidBlockHashZ C2Tuple_TxidBlockHashZ_clone(const struct LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR orig);
15870
15871 /**
15872  * Creates a new C2Tuple_TxidBlockHashZ from the contained elements.
15873  */
15874 struct LDKC2Tuple_TxidBlockHashZ C2Tuple_TxidBlockHashZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
15875
15876 /**
15877  * Frees any resources used by the C2Tuple_TxidBlockHashZ.
15878  */
15879 void C2Tuple_TxidBlockHashZ_free(struct LDKC2Tuple_TxidBlockHashZ _res);
15880
15881 /**
15882  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15883  */
15884 void CVec_C2Tuple_TxidBlockHashZZ_free(struct LDKCVec_C2Tuple_TxidBlockHashZZ _res);
15885
15886 /**
15887  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15888  */
15889 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
15890
15891 /**
15892  * Creates a new tuple which has the same data as `orig`
15893  * but with all dynamically-allocated buffers duplicated in new buffers.
15894  */
15895 struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(const struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR orig);
15896
15897 /**
15898  * Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
15899  */
15900 struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorEventZ b, struct LDKPublicKey c);
15901
15902 /**
15903  * Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
15904  */
15905 void C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res);
15906
15907 /**
15908  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15909  */
15910 void CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res);
15911
15912 /**
15913  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
15914  */
15915 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o);
15916
15917 /**
15918  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
15919  */
15920 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e);
15921
15922 /**
15923  * Checks if the given object is currently in the success state
15924  */
15925 bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o);
15926
15927 /**
15928  * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
15929  */
15930 void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res);
15931
15932 /**
15933  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
15934  * but with all dynamically-allocated buffers duplicated in new buffers.
15935  */
15936 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig);
15937
15938 /**
15939  * Creates a new tuple which has the same data as `orig`
15940  * but with all dynamically-allocated buffers duplicated in new buffers.
15941  */
15942 struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const struct LDKC2Tuple_u64u64Z *NONNULL_PTR orig);
15943
15944 /**
15945  * Creates a new C2Tuple_u64u64Z from the contained elements.
15946  */
15947 struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
15948
15949 /**
15950  * Frees any resources used by the C2Tuple_u64u64Z.
15951  */
15952 void C2Tuple_u64u64Z_free(struct LDKC2Tuple_u64u64Z _res);
15953
15954 /**
15955  * Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
15956  */
15957 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_some(struct LDKC2Tuple_u64u64Z o);
15958
15959 /**
15960  * Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
15961  */
15962 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_none(void);
15963
15964 /**
15965  * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
15966  */
15967 void COption_C2Tuple_u64u64ZZ_free(struct LDKCOption_C2Tuple_u64u64ZZ _res);
15968
15969 /**
15970  * Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
15971  * but with all dynamically-allocated buffers duplicated in new buffers.
15972  */
15973 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_clone(const struct LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR orig);
15974
15975 /**
15976  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15977  */
15978 void CVec_NodeIdZ_free(struct LDKCVec_NodeIdZ _res);
15979
15980 /**
15981  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
15982  */
15983 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o);
15984
15985 /**
15986  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
15987  */
15988 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e);
15989
15990 /**
15991  * Checks if the given object is currently in the success state
15992  */
15993 bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o);
15994
15995 /**
15996  * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
15997  */
15998 void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res);
15999
16000 /**
16001  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
16002  */
16003 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
16004
16005 /**
16006  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
16007  */
16008 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
16009
16010 /**
16011  * Checks if the given object is currently in the success state
16012  */
16013 bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o);
16014
16015 /**
16016  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
16017  */
16018 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
16019
16020 /**
16021  * Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
16022  * but with all dynamically-allocated buffers duplicated in new buffers.
16023  */
16024 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_clone(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR orig);
16025
16026 /**
16027  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
16028  */
16029 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
16030
16031 /**
16032  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
16033  */
16034 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
16035
16036 /**
16037  * Checks if the given object is currently in the success state
16038  */
16039 bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o);
16040
16041 /**
16042  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
16043  */
16044 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
16045
16046 /**
16047  * Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
16048  * but with all dynamically-allocated buffers duplicated in new buffers.
16049  */
16050 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR orig);
16051
16052 /**
16053  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
16054  */
16055 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
16056
16057 /**
16058  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
16059  */
16060 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
16061
16062 /**
16063  * Checks if the given object is currently in the success state
16064  */
16065 bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o);
16066
16067 /**
16068  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
16069  */
16070 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
16071
16072 /**
16073  * Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
16074  * but with all dynamically-allocated buffers duplicated in new buffers.
16075  */
16076 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_clone(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR orig);
16077
16078 /**
16079  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
16080  */
16081 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
16082
16083 /**
16084  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
16085  */
16086 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
16087
16088 /**
16089  * Checks if the given object is currently in the success state
16090  */
16091 bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o);
16092
16093 /**
16094  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
16095  */
16096 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
16097
16098 /**
16099  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
16100  * but with all dynamically-allocated buffers duplicated in new buffers.
16101  */
16102 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig);
16103
16104 /**
16105  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
16106  */
16107 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o);
16108
16109 /**
16110  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
16111  */
16112 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
16113
16114 /**
16115  * Checks if the given object is currently in the success state
16116  */
16117 bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o);
16118
16119 /**
16120  * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
16121  */
16122 void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res);
16123
16124 /**
16125  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
16126  * but with all dynamically-allocated buffers duplicated in new buffers.
16127  */
16128 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig);
16129
16130 /**
16131  * Creates a new CResult_OfferFeaturesDecodeErrorZ in the success state.
16132  */
16133 struct LDKCResult_OfferFeaturesDecodeErrorZ CResult_OfferFeaturesDecodeErrorZ_ok(struct LDKOfferFeatures o);
16134
16135 /**
16136  * Creates a new CResult_OfferFeaturesDecodeErrorZ in the error state.
16137  */
16138 struct LDKCResult_OfferFeaturesDecodeErrorZ CResult_OfferFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
16139
16140 /**
16141  * Checks if the given object is currently in the success state
16142  */
16143 bool CResult_OfferFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR o);
16144
16145 /**
16146  * Frees any resources used by the CResult_OfferFeaturesDecodeErrorZ.
16147  */
16148 void CResult_OfferFeaturesDecodeErrorZ_free(struct LDKCResult_OfferFeaturesDecodeErrorZ _res);
16149
16150 /**
16151  * Creates a new CResult_OfferFeaturesDecodeErrorZ which has the same data as `orig`
16152  * but with all dynamically-allocated buffers duplicated in new buffers.
16153  */
16154 struct LDKCResult_OfferFeaturesDecodeErrorZ CResult_OfferFeaturesDecodeErrorZ_clone(const struct LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR orig);
16155
16156 /**
16157  * Creates a new CResult_InvoiceRequestFeaturesDecodeErrorZ in the success state.
16158  */
16159 struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ CResult_InvoiceRequestFeaturesDecodeErrorZ_ok(struct LDKInvoiceRequestFeatures o);
16160
16161 /**
16162  * Creates a new CResult_InvoiceRequestFeaturesDecodeErrorZ in the error state.
16163  */
16164 struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ CResult_InvoiceRequestFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
16165
16166 /**
16167  * Checks if the given object is currently in the success state
16168  */
16169 bool CResult_InvoiceRequestFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR o);
16170
16171 /**
16172  * Frees any resources used by the CResult_InvoiceRequestFeaturesDecodeErrorZ.
16173  */
16174 void CResult_InvoiceRequestFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ _res);
16175
16176 /**
16177  * Creates a new CResult_InvoiceRequestFeaturesDecodeErrorZ which has the same data as `orig`
16178  * but with all dynamically-allocated buffers duplicated in new buffers.
16179  */
16180 struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ CResult_InvoiceRequestFeaturesDecodeErrorZ_clone(const struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR orig);
16181
16182 /**
16183  * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
16184  */
16185 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
16186
16187 /**
16188  * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
16189  */
16190 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
16191
16192 /**
16193  * Checks if the given object is currently in the success state
16194  */
16195 bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o);
16196
16197 /**
16198  * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
16199  */
16200 void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
16201
16202 /**
16203  * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
16204  * but with all dynamically-allocated buffers duplicated in new buffers.
16205  */
16206 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
16207
16208 /**
16209  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
16210  */
16211 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o);
16212
16213 /**
16214  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
16215  */
16216 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e);
16217
16218 /**
16219  * Checks if the given object is currently in the success state
16220  */
16221 bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o);
16222
16223 /**
16224  * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
16225  */
16226 void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res);
16227
16228 /**
16229  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
16230  * but with all dynamically-allocated buffers duplicated in new buffers.
16231  */
16232 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig);
16233
16234 /**
16235  * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
16236  */
16237 struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o);
16238
16239 /**
16240  * Constructs a new COption_AccessZ containing nothing
16241  */
16242 struct LDKCOption_AccessZ COption_AccessZ_none(void);
16243
16244 /**
16245  * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
16246  */
16247 void COption_AccessZ_free(struct LDKCOption_AccessZ _res);
16248
16249 /**
16250  * Creates a new CResult_boolLightningErrorZ in the success state.
16251  */
16252 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
16253
16254 /**
16255  * Creates a new CResult_boolLightningErrorZ in the error state.
16256  */
16257 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
16258
16259 /**
16260  * Checks if the given object is currently in the success state
16261  */
16262 bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o);
16263
16264 /**
16265  * Frees any resources used by the CResult_boolLightningErrorZ.
16266  */
16267 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
16268
16269 /**
16270  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
16271  * but with all dynamically-allocated buffers duplicated in new buffers.
16272  */
16273 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
16274
16275 /**
16276  * Creates a new tuple which has the same data as `orig`
16277  * but with all dynamically-allocated buffers duplicated in new buffers.
16278  */
16279 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
16280
16281 /**
16282  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
16283  */
16284 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
16285
16286 /**
16287  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
16288  */
16289 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
16290
16291 /**
16292  * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
16293  */
16294 struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o);
16295
16296 /**
16297  * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
16298  */
16299 struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none(void);
16300
16301 /**
16302  * Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
16303  */
16304 void COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
16305
16306 /**
16307  * Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
16308  * but with all dynamically-allocated buffers duplicated in new buffers.
16309  */
16310 struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR orig);
16311
16312 /**
16313  * Creates a new CResult_NoneLightningErrorZ in the success state.
16314  */
16315 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
16316
16317 /**
16318  * Creates a new CResult_NoneLightningErrorZ in the error state.
16319  */
16320 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
16321
16322 /**
16323  * Checks if the given object is currently in the success state
16324  */
16325 bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o);
16326
16327 /**
16328  * Frees any resources used by the CResult_NoneLightningErrorZ.
16329  */
16330 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
16331
16332 /**
16333  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
16334  * but with all dynamically-allocated buffers duplicated in new buffers.
16335  */
16336 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
16337
16338 /**
16339  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
16340  */
16341 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o);
16342
16343 /**
16344  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
16345  */
16346 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e);
16347
16348 /**
16349  * Checks if the given object is currently in the success state
16350  */
16351 bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o);
16352
16353 /**
16354  * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
16355  */
16356 void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res);
16357
16358 /**
16359  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
16360  * but with all dynamically-allocated buffers duplicated in new buffers.
16361  */
16362 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig);
16363
16364 /**
16365  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
16366  */
16367 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
16368
16369 /**
16370  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
16371  */
16372 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
16373
16374 /**
16375  * Checks if the given object is currently in the success state
16376  */
16377 bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o);
16378
16379 /**
16380  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
16381  */
16382 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
16383
16384 /**
16385  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
16386  * but with all dynamically-allocated buffers duplicated in new buffers.
16387  */
16388 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
16389
16390 /**
16391  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
16392  */
16393 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
16394
16395 /**
16396  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
16397  */
16398 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
16399
16400 /**
16401  * Checks if the given object is currently in the success state
16402  */
16403 bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o);
16404
16405 /**
16406  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
16407  */
16408 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
16409
16410 /**
16411  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
16412  * but with all dynamically-allocated buffers duplicated in new buffers.
16413  */
16414 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
16415
16416 /**
16417  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16418  */
16419 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
16420
16421 /**
16422  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
16423  */
16424 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
16425
16426 /**
16427  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
16428  */
16429 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
16430
16431 /**
16432  * Checks if the given object is currently in the success state
16433  */
16434 bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o);
16435
16436 /**
16437  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
16438  */
16439 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
16440
16441 /**
16442  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
16443  * but with all dynamically-allocated buffers duplicated in new buffers.
16444  */
16445 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
16446
16447 /**
16448  * Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
16449  */
16450 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_ok(struct LDKNodeAlias o);
16451
16452 /**
16453  * Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
16454  */
16455 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_err(struct LDKDecodeError e);
16456
16457 /**
16458  * Checks if the given object is currently in the success state
16459  */
16460 bool CResult_NodeAliasDecodeErrorZ_is_ok(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR o);
16461
16462 /**
16463  * Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
16464  */
16465 void CResult_NodeAliasDecodeErrorZ_free(struct LDKCResult_NodeAliasDecodeErrorZ _res);
16466
16467 /**
16468  * Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
16469  * but with all dynamically-allocated buffers duplicated in new buffers.
16470  */
16471 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_clone(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR orig);
16472
16473 /**
16474  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
16475  */
16476 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
16477
16478 /**
16479  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
16480  */
16481 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
16482
16483 /**
16484  * Checks if the given object is currently in the success state
16485  */
16486 bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o);
16487
16488 /**
16489  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
16490  */
16491 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
16492
16493 /**
16494  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
16495  * but with all dynamically-allocated buffers duplicated in new buffers.
16496  */
16497 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
16498
16499 /**
16500  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
16501  */
16502 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
16503
16504 /**
16505  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
16506  */
16507 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
16508
16509 /**
16510  * Checks if the given object is currently in the success state
16511  */
16512 bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o);
16513
16514 /**
16515  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
16516  */
16517 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
16518
16519 /**
16520  * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
16521  */
16522 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o);
16523
16524 /**
16525  * Constructs a new COption_CVec_NetAddressZZ containing nothing
16526  */
16527 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void);
16528
16529 /**
16530  * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
16531  */
16532 void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
16533
16534 /**
16535  * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
16536  * but with all dynamically-allocated buffers duplicated in new buffers.
16537  */
16538 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
16539
16540 /**
16541  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
16542  */
16543 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
16544
16545 /**
16546  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
16547  */
16548 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
16549
16550 /**
16551  * Checks if the given object is currently in the success state
16552  */
16553 bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
16554
16555 /**
16556  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
16557  */
16558 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
16559
16560 /**
16561  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
16562  * but with all dynamically-allocated buffers duplicated in new buffers.
16563  */
16564 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
16565
16566 /**
16567  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
16568  */
16569 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
16570
16571 /**
16572  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
16573  */
16574 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
16575
16576 /**
16577  * Checks if the given object is currently in the success state
16578  */
16579 bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
16580
16581 /**
16582  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
16583  */
16584 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
16585
16586 /**
16587  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
16588  * but with all dynamically-allocated buffers duplicated in new buffers.
16589  */
16590 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
16591
16592 /**
16593  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
16594  */
16595 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
16596
16597 /**
16598  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
16599  */
16600 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
16601
16602 /**
16603  * Checks if the given object is currently in the success state
16604  */
16605 bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
16606
16607 /**
16608  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
16609  */
16610 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
16611
16612 /**
16613  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
16614  * but with all dynamically-allocated buffers duplicated in new buffers.
16615  */
16616 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
16617
16618 /**
16619  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16620  */
16621 void CVec_PaymentPreimageZ_free(struct LDKCVec_PaymentPreimageZ _res);
16622
16623 /**
16624  * Creates a new tuple which has the same data as `orig`
16625  * but with all dynamically-allocated buffers duplicated in new buffers.
16626  */
16627 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
16628
16629 /**
16630  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
16631  */
16632 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
16633
16634 /**
16635  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
16636  */
16637 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
16638
16639 /**
16640  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
16641  */
16642 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
16643
16644 /**
16645  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
16646  */
16647 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
16648
16649 /**
16650  * Checks if the given object is currently in the success state
16651  */
16652 bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o);
16653
16654 /**
16655  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
16656  */
16657 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
16658
16659 /**
16660  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
16661  * but with all dynamically-allocated buffers duplicated in new buffers.
16662  */
16663 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
16664
16665 /**
16666  * Creates a new CResult_SignatureNoneZ in the success state.
16667  */
16668 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
16669
16670 /**
16671  * Creates a new CResult_SignatureNoneZ in the error state.
16672  */
16673 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
16674
16675 /**
16676  * Checks if the given object is currently in the success state
16677  */
16678 bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o);
16679
16680 /**
16681  * Frees any resources used by the CResult_SignatureNoneZ.
16682  */
16683 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
16684
16685 /**
16686  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
16687  * but with all dynamically-allocated buffers duplicated in new buffers.
16688  */
16689 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
16690
16691 /**
16692  * Creates a new tuple which has the same data as `orig`
16693  * but with all dynamically-allocated buffers duplicated in new buffers.
16694  */
16695 struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_clone(const struct LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR orig);
16696
16697 /**
16698  * Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
16699  */
16700 struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_new(struct LDKSignature a, struct LDKSignature b);
16701
16702 /**
16703  * Frees any resources used by the C2Tuple_SignatureSignatureZ.
16704  */
16705 void C2Tuple_SignatureSignatureZ_free(struct LDKC2Tuple_SignatureSignatureZ _res);
16706
16707 /**
16708  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
16709  */
16710 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_ok(struct LDKC2Tuple_SignatureSignatureZ o);
16711
16712 /**
16713  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
16714  */
16715 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_err(void);
16716
16717 /**
16718  * Checks if the given object is currently in the success state
16719  */
16720 bool CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR o);
16721
16722 /**
16723  * Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
16724  */
16725 void CResult_C2Tuple_SignatureSignatureZNoneZ_free(struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res);
16726
16727 /**
16728  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
16729  * but with all dynamically-allocated buffers duplicated in new buffers.
16730  */
16731 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR orig);
16732
16733 /**
16734  * Creates a new CResult_SecretKeyNoneZ in the success state.
16735  */
16736 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_ok(struct LDKSecretKey o);
16737
16738 /**
16739  * Creates a new CResult_SecretKeyNoneZ in the error state.
16740  */
16741 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_err(void);
16742
16743 /**
16744  * Checks if the given object is currently in the success state
16745  */
16746 bool CResult_SecretKeyNoneZ_is_ok(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR o);
16747
16748 /**
16749  * Frees any resources used by the CResult_SecretKeyNoneZ.
16750  */
16751 void CResult_SecretKeyNoneZ_free(struct LDKCResult_SecretKeyNoneZ _res);
16752
16753 /**
16754  * Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
16755  * but with all dynamically-allocated buffers duplicated in new buffers.
16756  */
16757 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_clone(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR orig);
16758
16759 /**
16760  * Creates a new CResult_PublicKeyNoneZ in the success state.
16761  */
16762 struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_ok(struct LDKPublicKey o);
16763
16764 /**
16765  * Creates a new CResult_PublicKeyNoneZ in the error state.
16766  */
16767 struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_err(void);
16768
16769 /**
16770  * Checks if the given object is currently in the success state
16771  */
16772 bool CResult_PublicKeyNoneZ_is_ok(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR o);
16773
16774 /**
16775  * Frees any resources used by the CResult_PublicKeyNoneZ.
16776  */
16777 void CResult_PublicKeyNoneZ_free(struct LDKCResult_PublicKeyNoneZ _res);
16778
16779 /**
16780  * Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
16781  * but with all dynamically-allocated buffers duplicated in new buffers.
16782  */
16783 struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_clone(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR orig);
16784
16785 /**
16786  * Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar
16787  */
16788 struct LDKCOption_ScalarZ COption_ScalarZ_some(struct LDKBigEndianScalar o);
16789
16790 /**
16791  * Constructs a new COption_ScalarZ containing nothing
16792  */
16793 struct LDKCOption_ScalarZ COption_ScalarZ_none(void);
16794
16795 /**
16796  * Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
16797  */
16798 void COption_ScalarZ_free(struct LDKCOption_ScalarZ _res);
16799
16800 /**
16801  * Creates a new CResult_SharedSecretNoneZ in the success state.
16802  */
16803 struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
16804
16805 /**
16806  * Creates a new CResult_SharedSecretNoneZ in the error state.
16807  */
16808 struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_err(void);
16809
16810 /**
16811  * Checks if the given object is currently in the success state
16812  */
16813 bool CResult_SharedSecretNoneZ_is_ok(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR o);
16814
16815 /**
16816  * Frees any resources used by the CResult_SharedSecretNoneZ.
16817  */
16818 void CResult_SharedSecretNoneZ_free(struct LDKCResult_SharedSecretNoneZ _res);
16819
16820 /**
16821  * Creates a new CResult_SharedSecretNoneZ which has the same data as `orig`
16822  * but with all dynamically-allocated buffers duplicated in new buffers.
16823  */
16824 struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_clone(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR orig);
16825
16826 /**
16827  * Creates a new CResult_SignDecodeErrorZ in the success state.
16828  */
16829 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
16830
16831 /**
16832  * Creates a new CResult_SignDecodeErrorZ in the error state.
16833  */
16834 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
16835
16836 /**
16837  * Checks if the given object is currently in the success state
16838  */
16839 bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o);
16840
16841 /**
16842  * Frees any resources used by the CResult_SignDecodeErrorZ.
16843  */
16844 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
16845
16846 /**
16847  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16848  */
16849 void CVec_U5Z_free(struct LDKCVec_U5Z _res);
16850
16851 /**
16852  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
16853  */
16854 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
16855
16856 /**
16857  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
16858  */
16859 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
16860
16861 /**
16862  * Checks if the given object is currently in the success state
16863  */
16864 bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o);
16865
16866 /**
16867  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
16868  */
16869 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
16870
16871 /**
16872  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
16873  * but with all dynamically-allocated buffers duplicated in new buffers.
16874  */
16875 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
16876
16877 /**
16878  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16879  */
16880 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
16881
16882 /**
16883  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16884  */
16885 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
16886
16887 /**
16888  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
16889  */
16890 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
16891
16892 /**
16893  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
16894  */
16895 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
16896
16897 /**
16898  * Checks if the given object is currently in the success state
16899  */
16900 bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o);
16901
16902 /**
16903  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
16904  */
16905 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
16906
16907 /**
16908  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
16909  * but with all dynamically-allocated buffers duplicated in new buffers.
16910  */
16911 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
16912
16913 /**
16914  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
16915  */
16916 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
16917
16918 /**
16919  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
16920  */
16921 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
16922
16923 /**
16924  * Checks if the given object is currently in the success state
16925  */
16926 bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o);
16927
16928 /**
16929  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
16930  */
16931 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
16932
16933 /**
16934  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
16935  * but with all dynamically-allocated buffers duplicated in new buffers.
16936  */
16937 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
16938
16939 /**
16940  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16941  */
16942 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
16943
16944 /**
16945  * Creates a new CResult_TransactionNoneZ in the success state.
16946  */
16947 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
16948
16949 /**
16950  * Creates a new CResult_TransactionNoneZ in the error state.
16951  */
16952 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
16953
16954 /**
16955  * Checks if the given object is currently in the success state
16956  */
16957 bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o);
16958
16959 /**
16960  * Frees any resources used by the CResult_TransactionNoneZ.
16961  */
16962 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
16963
16964 /**
16965  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
16966  * but with all dynamically-allocated buffers duplicated in new buffers.
16967  */
16968 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
16969
16970 /**
16971  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
16972  */
16973 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
16974
16975 /**
16976  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
16977  */
16978 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
16979
16980 /**
16981  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16982  */
16983 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
16984
16985 /**
16986  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
16987  */
16988 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
16989
16990 /**
16991  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
16992  */
16993 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
16994
16995 /**
16996  * Checks if the given object is currently in the success state
16997  */
16998 bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o);
16999
17000 /**
17001  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
17002  */
17003 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
17004
17005 /**
17006  * Constructs a new COption_u16Z containing a u16
17007  */
17008 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
17009
17010 /**
17011  * Constructs a new COption_u16Z containing nothing
17012  */
17013 struct LDKCOption_u16Z COption_u16Z_none(void);
17014
17015 /**
17016  * Frees any resources associated with the u16, if we are in the Some state
17017  */
17018 void COption_u16Z_free(struct LDKCOption_u16Z _res);
17019
17020 /**
17021  * Creates a new COption_u16Z which has the same data as `orig`
17022  * but with all dynamically-allocated buffers duplicated in new buffers.
17023  */
17024 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
17025
17026 /**
17027  * Creates a new CResult_NoneAPIErrorZ in the success state.
17028  */
17029 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
17030
17031 /**
17032  * Creates a new CResult_NoneAPIErrorZ in the error state.
17033  */
17034 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
17035
17036 /**
17037  * Checks if the given object is currently in the success state
17038  */
17039 bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o);
17040
17041 /**
17042  * Frees any resources used by the CResult_NoneAPIErrorZ.
17043  */
17044 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
17045
17046 /**
17047  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
17048  * but with all dynamically-allocated buffers duplicated in new buffers.
17049  */
17050 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
17051
17052 /**
17053  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17054  */
17055 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
17056
17057 /**
17058  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17059  */
17060 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
17061
17062 /**
17063  * Creates a new CResult__u832APIErrorZ in the success state.
17064  */
17065 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o);
17066
17067 /**
17068  * Creates a new CResult__u832APIErrorZ in the error state.
17069  */
17070 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
17071
17072 /**
17073  * Checks if the given object is currently in the success state
17074  */
17075 bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o);
17076
17077 /**
17078  * Frees any resources used by the CResult__u832APIErrorZ.
17079  */
17080 void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res);
17081
17082 /**
17083  * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
17084  * but with all dynamically-allocated buffers duplicated in new buffers.
17085  */
17086 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig);
17087
17088 /**
17089  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
17090  */
17091 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
17092
17093 /**
17094  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
17095  */
17096 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
17097
17098 /**
17099  * Checks if the given object is currently in the success state
17100  */
17101 bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o);
17102
17103 /**
17104  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
17105  */
17106 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
17107
17108 /**
17109  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
17110  * but with all dynamically-allocated buffers duplicated in new buffers.
17111  */
17112 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
17113
17114 /**
17115  * Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
17116  */
17117 struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
17118
17119 /**
17120  * Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
17121  */
17122 struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
17123
17124 /**
17125  * Checks if the given object is currently in the success state
17126  */
17127 bool CResult_PaymentHashPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR o);
17128
17129 /**
17130  * Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ.
17131  */
17132 void CResult_PaymentHashPaymentSendFailureZ_free(struct LDKCResult_PaymentHashPaymentSendFailureZ _res);
17133
17134 /**
17135  * Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
17136  * but with all dynamically-allocated buffers duplicated in new buffers.
17137  */
17138 struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_clone(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR orig);
17139
17140 /**
17141  * Creates a new tuple which has the same data as `orig`
17142  * but with all dynamically-allocated buffers duplicated in new buffers.
17143  */
17144 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig);
17145
17146 /**
17147  * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
17148  */
17149 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
17150
17151 /**
17152  * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
17153  */
17154 void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res);
17155
17156 /**
17157  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
17158  */
17159 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o);
17160
17161 /**
17162  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
17163  */
17164 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
17165
17166 /**
17167  * Checks if the given object is currently in the success state
17168  */
17169 bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o);
17170
17171 /**
17172  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
17173  */
17174 void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res);
17175
17176 /**
17177  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
17178  * but with all dynamically-allocated buffers duplicated in new buffers.
17179  */
17180 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig);
17181
17182 /**
17183  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17184  */
17185 void CVec_ThirtyTwoBytesZ_free(struct LDKCVec_ThirtyTwoBytesZ _res);
17186
17187 /**
17188  * Creates a new tuple which has the same data as `orig`
17189  * but with all dynamically-allocated buffers duplicated in new buffers.
17190  */
17191 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
17192
17193 /**
17194  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
17195  */
17196 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
17197
17198 /**
17199  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
17200  */
17201 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
17202
17203 /**
17204  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
17205  */
17206 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
17207
17208 /**
17209  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
17210  */
17211 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void);
17212
17213 /**
17214  * Checks if the given object is currently in the success state
17215  */
17216 bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o);
17217
17218 /**
17219  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
17220  */
17221 void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res);
17222
17223 /**
17224  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
17225  * but with all dynamically-allocated buffers duplicated in new buffers.
17226  */
17227 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig);
17228
17229 /**
17230  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
17231  */
17232 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
17233
17234 /**
17235  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
17236  */
17237 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e);
17238
17239 /**
17240  * Checks if the given object is currently in the success state
17241  */
17242 bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o);
17243
17244 /**
17245  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
17246  */
17247 void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res);
17248
17249 /**
17250  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
17251  * but with all dynamically-allocated buffers duplicated in new buffers.
17252  */
17253 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig);
17254
17255 /**
17256  * Creates a new CResult_PaymentSecretNoneZ in the success state.
17257  */
17258 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
17259
17260 /**
17261  * Creates a new CResult_PaymentSecretNoneZ in the error state.
17262  */
17263 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void);
17264
17265 /**
17266  * Checks if the given object is currently in the success state
17267  */
17268 bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o);
17269
17270 /**
17271  * Frees any resources used by the CResult_PaymentSecretNoneZ.
17272  */
17273 void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res);
17274
17275 /**
17276  * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
17277  * but with all dynamically-allocated buffers duplicated in new buffers.
17278  */
17279 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig);
17280
17281 /**
17282  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
17283  */
17284 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
17285
17286 /**
17287  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
17288  */
17289 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
17290
17291 /**
17292  * Checks if the given object is currently in the success state
17293  */
17294 bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o);
17295
17296 /**
17297  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
17298  */
17299 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
17300
17301 /**
17302  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
17303  * but with all dynamically-allocated buffers duplicated in new buffers.
17304  */
17305 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
17306
17307 /**
17308  * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
17309  */
17310 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
17311
17312 /**
17313  * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
17314  */
17315 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e);
17316
17317 /**
17318  * Checks if the given object is currently in the success state
17319  */
17320 bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o);
17321
17322 /**
17323  * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
17324  */
17325 void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res);
17326
17327 /**
17328  * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
17329  * but with all dynamically-allocated buffers duplicated in new buffers.
17330  */
17331 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig);
17332
17333 /**
17334  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
17335  */
17336 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o);
17337
17338 /**
17339  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
17340  */
17341 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e);
17342
17343 /**
17344  * Checks if the given object is currently in the success state
17345  */
17346 bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o);
17347
17348 /**
17349  * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
17350  */
17351 void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res);
17352
17353 /**
17354  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
17355  * but with all dynamically-allocated buffers duplicated in new buffers.
17356  */
17357 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig);
17358
17359 /**
17360  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
17361  */
17362 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o);
17363
17364 /**
17365  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
17366  */
17367 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e);
17368
17369 /**
17370  * Checks if the given object is currently in the success state
17371  */
17372 bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o);
17373
17374 /**
17375  * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
17376  */
17377 void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res);
17378
17379 /**
17380  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
17381  * but with all dynamically-allocated buffers duplicated in new buffers.
17382  */
17383 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig);
17384
17385 /**
17386  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
17387  */
17388 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o);
17389
17390 /**
17391  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
17392  */
17393 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e);
17394
17395 /**
17396  * Checks if the given object is currently in the success state
17397  */
17398 bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o);
17399
17400 /**
17401  * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
17402  */
17403 void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res);
17404
17405 /**
17406  * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
17407  * but with all dynamically-allocated buffers duplicated in new buffers.
17408  */
17409 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig);
17410
17411 /**
17412  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
17413  */
17414 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o);
17415
17416 /**
17417  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
17418  */
17419 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e);
17420
17421 /**
17422  * Checks if the given object is currently in the success state
17423  */
17424 bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o);
17425
17426 /**
17427  * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
17428  */
17429 void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res);
17430
17431 /**
17432  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
17433  * but with all dynamically-allocated buffers duplicated in new buffers.
17434  */
17435 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig);
17436
17437 /**
17438  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17439  */
17440 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
17441
17442 /**
17443  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
17444  */
17445 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
17446
17447 /**
17448  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
17449  */
17450 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
17451
17452 /**
17453  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
17454  */
17455 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
17456
17457 /**
17458  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
17459  */
17460 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
17461
17462 /**
17463  * Checks if the given object is currently in the success state
17464  */
17465 bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o);
17466
17467 /**
17468  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
17469  */
17470 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
17471
17472 /**
17473  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
17474  */
17475 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
17476
17477 /**
17478  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
17479  */
17480 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
17481
17482 /**
17483  * Checks if the given object is currently in the success state
17484  */
17485 bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o);
17486
17487 /**
17488  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
17489  */
17490 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
17491
17492 /**
17493  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
17494  * but with all dynamically-allocated buffers duplicated in new buffers.
17495  */
17496 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
17497
17498 /**
17499  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
17500  */
17501 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
17502
17503 /**
17504  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
17505  */
17506 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
17507
17508 /**
17509  * Checks if the given object is currently in the success state
17510  */
17511 bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o);
17512
17513 /**
17514  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
17515  */
17516 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
17517
17518 /**
17519  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
17520  * but with all dynamically-allocated buffers duplicated in new buffers.
17521  */
17522 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
17523
17524 /**
17525  * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
17526  */
17527 struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
17528
17529 /**
17530  * Constructs a new COption_TypeZ containing nothing
17531  */
17532 struct LDKCOption_TypeZ COption_TypeZ_none(void);
17533
17534 /**
17535  * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
17536  */
17537 void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
17538
17539 /**
17540  * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
17541  */
17542 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
17543
17544 /**
17545  * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
17546  */
17547 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
17548
17549 /**
17550  * Checks if the given object is currently in the success state
17551  */
17552 bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o);
17553
17554 /**
17555  * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
17556  */
17557 void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
17558
17559 /**
17560  * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
17561  */
17562 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
17563
17564 /**
17565  * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
17566  */
17567 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
17568
17569 /**
17570  * Checks if the given object is currently in the success state
17571  */
17572 bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o);
17573
17574 /**
17575  * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
17576  */
17577 void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
17578
17579 /**
17580  * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
17581  * but with all dynamically-allocated buffers duplicated in new buffers.
17582  */
17583 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
17584
17585 /**
17586  * Creates a new CResult_NonePaymentErrorZ in the success state.
17587  */
17588 struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_ok(void);
17589
17590 /**
17591  * Creates a new CResult_NonePaymentErrorZ in the error state.
17592  */
17593 struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_err(struct LDKPaymentError e);
17594
17595 /**
17596  * Checks if the given object is currently in the success state
17597  */
17598 bool CResult_NonePaymentErrorZ_is_ok(const struct LDKCResult_NonePaymentErrorZ *NONNULL_PTR o);
17599
17600 /**
17601  * Frees any resources used by the CResult_NonePaymentErrorZ.
17602  */
17603 void CResult_NonePaymentErrorZ_free(struct LDKCResult_NonePaymentErrorZ _res);
17604
17605 /**
17606  * Creates a new CResult_NonePaymentErrorZ which has the same data as `orig`
17607  * but with all dynamically-allocated buffers duplicated in new buffers.
17608  */
17609 struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_clone(const struct LDKCResult_NonePaymentErrorZ *NONNULL_PTR orig);
17610
17611 /**
17612  * Creates a new CResult_StringErrorZ in the success state.
17613  */
17614 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
17615
17616 /**
17617  * Creates a new CResult_StringErrorZ in the error state.
17618  */
17619 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
17620
17621 /**
17622  * Checks if the given object is currently in the success state
17623  */
17624 bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o);
17625
17626 /**
17627  * Frees any resources used by the CResult_StringErrorZ.
17628  */
17629 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
17630
17631 /**
17632  * Creates a new CResult_StringErrorZ which has the same data as `orig`
17633  * but with all dynamically-allocated buffers duplicated in new buffers.
17634  */
17635 struct LDKCResult_StringErrorZ CResult_StringErrorZ_clone(const struct LDKCResult_StringErrorZ *NONNULL_PTR orig);
17636
17637 /**
17638  * Creates a new CResult_PublicKeyErrorZ in the success state.
17639  */
17640 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
17641
17642 /**
17643  * Creates a new CResult_PublicKeyErrorZ in the error state.
17644  */
17645 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
17646
17647 /**
17648  * Checks if the given object is currently in the success state
17649  */
17650 bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o);
17651
17652 /**
17653  * Frees any resources used by the CResult_PublicKeyErrorZ.
17654  */
17655 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
17656
17657 /**
17658  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
17659  * but with all dynamically-allocated buffers duplicated in new buffers.
17660  */
17661 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
17662
17663 /**
17664  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
17665  */
17666 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
17667
17668 /**
17669  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
17670  */
17671 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
17672
17673 /**
17674  * Checks if the given object is currently in the success state
17675  */
17676 bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o);
17677
17678 /**
17679  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
17680  */
17681 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
17682
17683 /**
17684  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
17685  * but with all dynamically-allocated buffers duplicated in new buffers.
17686  */
17687 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
17688
17689 /**
17690  * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
17691  */
17692 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o);
17693
17694 /**
17695  * Constructs a new COption_MonitorEventZ containing nothing
17696  */
17697 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void);
17698
17699 /**
17700  * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
17701  */
17702 void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res);
17703
17704 /**
17705  * Creates a new COption_MonitorEventZ which has the same data as `orig`
17706  * but with all dynamically-allocated buffers duplicated in new buffers.
17707  */
17708 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig);
17709
17710 /**
17711  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
17712  */
17713 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o);
17714
17715 /**
17716  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
17717  */
17718 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e);
17719
17720 /**
17721  * Checks if the given object is currently in the success state
17722  */
17723 bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o);
17724
17725 /**
17726  * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
17727  */
17728 void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res);
17729
17730 /**
17731  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
17732  * but with all dynamically-allocated buffers duplicated in new buffers.
17733  */
17734 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig);
17735
17736 /**
17737  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
17738  */
17739 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
17740
17741 /**
17742  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
17743  */
17744 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
17745
17746 /**
17747  * Checks if the given object is currently in the success state
17748  */
17749 bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o);
17750
17751 /**
17752  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
17753  */
17754 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
17755
17756 /**
17757  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
17758  * but with all dynamically-allocated buffers duplicated in new buffers.
17759  */
17760 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
17761
17762 /**
17763  * Creates a new tuple which has the same data as `orig`
17764  * but with all dynamically-allocated buffers duplicated in new buffers.
17765  */
17766 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
17767
17768 /**
17769  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
17770  */
17771 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
17772
17773 /**
17774  * Frees any resources used by the C2Tuple_OutPointScriptZ.
17775  */
17776 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
17777
17778 /**
17779  * Creates a new tuple which has the same data as `orig`
17780  * but with all dynamically-allocated buffers duplicated in new buffers.
17781  */
17782 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
17783
17784 /**
17785  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
17786  */
17787 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
17788
17789 /**
17790  * Frees any resources used by the C2Tuple_u32ScriptZ.
17791  */
17792 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
17793
17794 /**
17795  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17796  */
17797 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
17798
17799 /**
17800  * Creates a new tuple which has the same data as `orig`
17801  * but with all dynamically-allocated buffers duplicated in new buffers.
17802  */
17803 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
17804
17805 /**
17806  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
17807  */
17808 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
17809
17810 /**
17811  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
17812  */
17813 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
17814
17815 /**
17816  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17817  */
17818 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
17819
17820 /**
17821  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17822  */
17823 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
17824
17825 /**
17826  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17827  */
17828 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
17829
17830 /**
17831  * Creates a new tuple which has the same data as `orig`
17832  * but with all dynamically-allocated buffers duplicated in new buffers.
17833  */
17834 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
17835
17836 /**
17837  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
17838  */
17839 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
17840
17841 /**
17842  * Frees any resources used by the C2Tuple_u32TxOutZ.
17843  */
17844 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
17845
17846 /**
17847  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17848  */
17849 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
17850
17851 /**
17852  * Creates a new tuple which has the same data as `orig`
17853  * but with all dynamically-allocated buffers duplicated in new buffers.
17854  */
17855 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
17856
17857 /**
17858  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
17859  */
17860 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
17861
17862 /**
17863  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
17864  */
17865 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
17866
17867 /**
17868  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17869  */
17870 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
17871
17872 /**
17873  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17874  */
17875 void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
17876
17877 /**
17878  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
17879  */
17880 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
17881
17882 /**
17883  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
17884  */
17885 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
17886
17887 /**
17888  * Checks if the given object is currently in the success state
17889  */
17890 bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o);
17891
17892 /**
17893  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
17894  */
17895 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
17896
17897 /**
17898  * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
17899  */
17900 struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
17901
17902 /**
17903  * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
17904  */
17905 void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
17906
17907 /**
17908  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17909  */
17910 void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
17911
17912 /**
17913  * Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
17914  */
17915 struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_some(struct LDKCustomOnionMessageContents o);
17916
17917 /**
17918  * Constructs a new COption_CustomOnionMessageContentsZ containing nothing
17919  */
17920 struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_none(void);
17921
17922 /**
17923  * Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
17924  */
17925 void COption_CustomOnionMessageContentsZ_free(struct LDKCOption_CustomOnionMessageContentsZ _res);
17926
17927 /**
17928  * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
17929  */
17930 struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_CustomOnionMessageContentsZ o);
17931
17932 /**
17933  * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
17934  */
17935 struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(struct LDKDecodeError e);
17936
17937 /**
17938  * Checks if the given object is currently in the success state
17939  */
17940 bool CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR o);
17941
17942 /**
17943  * Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
17944  */
17945 void CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res);
17946
17947 /**
17948  * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
17949  */
17950 struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o);
17951
17952 /**
17953  * Constructs a new COption_NetAddressZ containing nothing
17954  */
17955 struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void);
17956
17957 /**
17958  * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
17959  */
17960 void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res);
17961
17962 /**
17963  * Creates a new COption_NetAddressZ which has the same data as `orig`
17964  * but with all dynamically-allocated buffers duplicated in new buffers.
17965  */
17966 struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig);
17967
17968 /**
17969  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
17970  */
17971 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
17972
17973 /**
17974  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
17975  */
17976 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
17977
17978 /**
17979  * Checks if the given object is currently in the success state
17980  */
17981 bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o);
17982
17983 /**
17984  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
17985  */
17986 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
17987
17988 /**
17989  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
17990  * but with all dynamically-allocated buffers duplicated in new buffers.
17991  */
17992 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
17993
17994 /**
17995  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
17996  */
17997 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
17998
17999 /**
18000  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
18001  */
18002 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
18003
18004 /**
18005  * Checks if the given object is currently in the success state
18006  */
18007 bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o);
18008
18009 /**
18010  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
18011  */
18012 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
18013
18014 /**
18015  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
18016  * but with all dynamically-allocated buffers duplicated in new buffers.
18017  */
18018 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
18019
18020 /**
18021  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
18022  */
18023 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
18024
18025 /**
18026  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
18027  */
18028 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
18029
18030 /**
18031  * Checks if the given object is currently in the success state
18032  */
18033 bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o);
18034
18035 /**
18036  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
18037  */
18038 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
18039
18040 /**
18041  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
18042  * but with all dynamically-allocated buffers duplicated in new buffers.
18043  */
18044 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
18045
18046 /**
18047  * Creates a new CResult_NoneSendErrorZ in the success state.
18048  */
18049 struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_ok(void);
18050
18051 /**
18052  * Creates a new CResult_NoneSendErrorZ in the error state.
18053  */
18054 struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_err(struct LDKSendError e);
18055
18056 /**
18057  * Checks if the given object is currently in the success state
18058  */
18059 bool CResult_NoneSendErrorZ_is_ok(const struct LDKCResult_NoneSendErrorZ *NONNULL_PTR o);
18060
18061 /**
18062  * Frees any resources used by the CResult_NoneSendErrorZ.
18063  */
18064 void CResult_NoneSendErrorZ_free(struct LDKCResult_NoneSendErrorZ _res);
18065
18066 /**
18067  * Creates a new CResult_SiPrefixParseErrorZ in the success state.
18068  */
18069 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o);
18070
18071 /**
18072  * Creates a new CResult_SiPrefixParseErrorZ in the error state.
18073  */
18074 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e);
18075
18076 /**
18077  * Checks if the given object is currently in the success state
18078  */
18079 bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o);
18080
18081 /**
18082  * Frees any resources used by the CResult_SiPrefixParseErrorZ.
18083  */
18084 void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res);
18085
18086 /**
18087  * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
18088  * but with all dynamically-allocated buffers duplicated in new buffers.
18089  */
18090 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_clone(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR orig);
18091
18092 /**
18093  * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
18094  */
18095 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o);
18096
18097 /**
18098  * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
18099  */
18100 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e);
18101
18102 /**
18103  * Checks if the given object is currently in the success state
18104  */
18105 bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o);
18106
18107 /**
18108  * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
18109  */
18110 void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res);
18111
18112 /**
18113  * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
18114  * but with all dynamically-allocated buffers duplicated in new buffers.
18115  */
18116 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig);
18117
18118 /**
18119  * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
18120  */
18121 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o);
18122
18123 /**
18124  * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
18125  */
18126 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e);
18127
18128 /**
18129  * Checks if the given object is currently in the success state
18130  */
18131 bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o);
18132
18133 /**
18134  * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
18135  */
18136 void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res);
18137
18138 /**
18139  * Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
18140  * but with all dynamically-allocated buffers duplicated in new buffers.
18141  */
18142 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig);
18143
18144 /**
18145  * Creates a new tuple which has the same data as `orig`
18146  * but with all dynamically-allocated buffers duplicated in new buffers.
18147  */
18148 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
18149
18150 /**
18151  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
18152  */
18153 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
18154
18155 /**
18156  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
18157  */
18158 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
18159
18160 /**
18161  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
18162  */
18163 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
18164
18165 /**
18166  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
18167  */
18168 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
18169
18170 /**
18171  * Checks if the given object is currently in the success state
18172  */
18173 bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o);
18174
18175 /**
18176  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
18177  */
18178 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
18179
18180 /**
18181  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
18182  * but with all dynamically-allocated buffers duplicated in new buffers.
18183  */
18184 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
18185
18186 /**
18187  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18188  */
18189 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
18190
18191 /**
18192  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
18193  */
18194 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
18195
18196 /**
18197  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
18198  */
18199 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
18200
18201 /**
18202  * Checks if the given object is currently in the success state
18203  */
18204 bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o);
18205
18206 /**
18207  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
18208  */
18209 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
18210
18211 /**
18212  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
18213  * but with all dynamically-allocated buffers duplicated in new buffers.
18214  */
18215 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
18216
18217 /**
18218  * Creates a new CResult_NoneSemanticErrorZ in the success state.
18219  */
18220 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
18221
18222 /**
18223  * Creates a new CResult_NoneSemanticErrorZ in the error state.
18224  */
18225 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
18226
18227 /**
18228  * Checks if the given object is currently in the success state
18229  */
18230 bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o);
18231
18232 /**
18233  * Frees any resources used by the CResult_NoneSemanticErrorZ.
18234  */
18235 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
18236
18237 /**
18238  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
18239  * but with all dynamically-allocated buffers duplicated in new buffers.
18240  */
18241 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
18242
18243 /**
18244  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
18245  */
18246 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
18247
18248 /**
18249  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
18250  */
18251 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
18252
18253 /**
18254  * Checks if the given object is currently in the success state
18255  */
18256 bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o);
18257
18258 /**
18259  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
18260  */
18261 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
18262
18263 /**
18264  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
18265  * but with all dynamically-allocated buffers duplicated in new buffers.
18266  */
18267 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
18268
18269 /**
18270  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
18271  */
18272 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
18273
18274 /**
18275  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
18276  */
18277 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
18278
18279 /**
18280  * Checks if the given object is currently in the success state
18281  */
18282 bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o);
18283
18284 /**
18285  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
18286  */
18287 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
18288
18289 /**
18290  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
18291  * but with all dynamically-allocated buffers duplicated in new buffers.
18292  */
18293 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
18294
18295 /**
18296  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
18297  */
18298 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
18299
18300 /**
18301  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
18302  */
18303 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
18304
18305 /**
18306  * Checks if the given object is currently in the success state
18307  */
18308 bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o);
18309
18310 /**
18311  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
18312  */
18313 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
18314
18315 /**
18316  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
18317  * but with all dynamically-allocated buffers duplicated in new buffers.
18318  */
18319 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
18320
18321 /**
18322  * Creates a new CResult_u32GraphSyncErrorZ in the success state.
18323  */
18324 struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_ok(uint32_t o);
18325
18326 /**
18327  * Creates a new CResult_u32GraphSyncErrorZ in the error state.
18328  */
18329 struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_err(struct LDKGraphSyncError e);
18330
18331 /**
18332  * Checks if the given object is currently in the success state
18333  */
18334 bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR o);
18335
18336 /**
18337  * Frees any resources used by the CResult_u32GraphSyncErrorZ.
18338  */
18339 void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res);
18340
18341 /**
18342  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
18343  */
18344 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
18345
18346 /**
18347  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
18348  */
18349 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
18350
18351 /**
18352  * Checks if the given object is currently in the success state
18353  */
18354 bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o);
18355
18356 /**
18357  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
18358  */
18359 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
18360
18361 /**
18362  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
18363  * but with all dynamically-allocated buffers duplicated in new buffers.
18364  */
18365 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
18366
18367 /**
18368  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18369  */
18370 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
18371
18372 /**
18373  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18374  */
18375 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
18376
18377 /**
18378  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18379  */
18380 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
18381
18382 /**
18383  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18384  */
18385 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
18386
18387 /**
18388  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
18389  */
18390 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
18391
18392 /**
18393  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
18394  */
18395 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
18396
18397 /**
18398  * Checks if the given object is currently in the success state
18399  */
18400 bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o);
18401
18402 /**
18403  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
18404  */
18405 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
18406
18407 /**
18408  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
18409  * but with all dynamically-allocated buffers duplicated in new buffers.
18410  */
18411 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
18412
18413 /**
18414  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
18415  */
18416 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
18417
18418 /**
18419  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
18420  */
18421 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
18422
18423 /**
18424  * Checks if the given object is currently in the success state
18425  */
18426 bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o);
18427
18428 /**
18429  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
18430  */
18431 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
18432
18433 /**
18434  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
18435  * but with all dynamically-allocated buffers duplicated in new buffers.
18436  */
18437 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
18438
18439 /**
18440  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
18441  */
18442 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
18443
18444 /**
18445  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
18446  */
18447 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
18448
18449 /**
18450  * Checks if the given object is currently in the success state
18451  */
18452 bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o);
18453
18454 /**
18455  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
18456  */
18457 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
18458
18459 /**
18460  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
18461  * but with all dynamically-allocated buffers duplicated in new buffers.
18462  */
18463 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
18464
18465 /**
18466  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
18467  */
18468 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
18469
18470 /**
18471  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
18472  */
18473 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
18474
18475 /**
18476  * Checks if the given object is currently in the success state
18477  */
18478 bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o);
18479
18480 /**
18481  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
18482  */
18483 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
18484
18485 /**
18486  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
18487  * but with all dynamically-allocated buffers duplicated in new buffers.
18488  */
18489 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
18490
18491 /**
18492  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
18493  */
18494 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
18495
18496 /**
18497  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
18498  */
18499 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
18500
18501 /**
18502  * Checks if the given object is currently in the success state
18503  */
18504 bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o);
18505
18506 /**
18507  * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
18508  */
18509 void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
18510
18511 /**
18512  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
18513  * but with all dynamically-allocated buffers duplicated in new buffers.
18514  */
18515 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
18516
18517 /**
18518  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
18519  */
18520 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
18521
18522 /**
18523  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
18524  */
18525 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
18526
18527 /**
18528  * Checks if the given object is currently in the success state
18529  */
18530 bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o);
18531
18532 /**
18533  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
18534  */
18535 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
18536
18537 /**
18538  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
18539  * but with all dynamically-allocated buffers duplicated in new buffers.
18540  */
18541 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
18542
18543 /**
18544  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
18545  */
18546 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
18547
18548 /**
18549  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
18550  */
18551 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
18552
18553 /**
18554  * Checks if the given object is currently in the success state
18555  */
18556 bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o);
18557
18558 /**
18559  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
18560  */
18561 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
18562
18563 /**
18564  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
18565  * but with all dynamically-allocated buffers duplicated in new buffers.
18566  */
18567 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
18568
18569 /**
18570  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
18571  */
18572 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
18573
18574 /**
18575  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
18576  */
18577 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
18578
18579 /**
18580  * Checks if the given object is currently in the success state
18581  */
18582 bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o);
18583
18584 /**
18585  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
18586  */
18587 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
18588
18589 /**
18590  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
18591  * but with all dynamically-allocated buffers duplicated in new buffers.
18592  */
18593 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
18594
18595 /**
18596  * Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
18597  */
18598 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_ok(struct LDKChannelReady o);
18599
18600 /**
18601  * Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
18602  */
18603 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_err(struct LDKDecodeError e);
18604
18605 /**
18606  * Checks if the given object is currently in the success state
18607  */
18608 bool CResult_ChannelReadyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR o);
18609
18610 /**
18611  * Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
18612  */
18613 void CResult_ChannelReadyDecodeErrorZ_free(struct LDKCResult_ChannelReadyDecodeErrorZ _res);
18614
18615 /**
18616  * Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
18617  * but with all dynamically-allocated buffers duplicated in new buffers.
18618  */
18619 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_clone(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR orig);
18620
18621 /**
18622  * Creates a new CResult_InitDecodeErrorZ in the success state.
18623  */
18624 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
18625
18626 /**
18627  * Creates a new CResult_InitDecodeErrorZ in the error state.
18628  */
18629 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
18630
18631 /**
18632  * Checks if the given object is currently in the success state
18633  */
18634 bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o);
18635
18636 /**
18637  * Frees any resources used by the CResult_InitDecodeErrorZ.
18638  */
18639 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
18640
18641 /**
18642  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
18643  * but with all dynamically-allocated buffers duplicated in new buffers.
18644  */
18645 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
18646
18647 /**
18648  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
18649  */
18650 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
18651
18652 /**
18653  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
18654  */
18655 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
18656
18657 /**
18658  * Checks if the given object is currently in the success state
18659  */
18660 bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o);
18661
18662 /**
18663  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
18664  */
18665 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
18666
18667 /**
18668  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
18669  * but with all dynamically-allocated buffers duplicated in new buffers.
18670  */
18671 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
18672
18673 /**
18674  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
18675  */
18676 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
18677
18678 /**
18679  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
18680  */
18681 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
18682
18683 /**
18684  * Checks if the given object is currently in the success state
18685  */
18686 bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o);
18687
18688 /**
18689  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
18690  */
18691 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
18692
18693 /**
18694  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
18695  * but with all dynamically-allocated buffers duplicated in new buffers.
18696  */
18697 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
18698
18699 /**
18700  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
18701  */
18702 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
18703
18704 /**
18705  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
18706  */
18707 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
18708
18709 /**
18710  * Checks if the given object is currently in the success state
18711  */
18712 bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o);
18713
18714 /**
18715  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
18716  */
18717 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
18718
18719 /**
18720  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
18721  * but with all dynamically-allocated buffers duplicated in new buffers.
18722  */
18723 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
18724
18725 /**
18726  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
18727  */
18728 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
18729
18730 /**
18731  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
18732  */
18733 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
18734
18735 /**
18736  * Checks if the given object is currently in the success state
18737  */
18738 bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o);
18739
18740 /**
18741  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
18742  */
18743 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
18744
18745 /**
18746  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
18747  * but with all dynamically-allocated buffers duplicated in new buffers.
18748  */
18749 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
18750
18751 /**
18752  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
18753  */
18754 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
18755
18756 /**
18757  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
18758  */
18759 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
18760
18761 /**
18762  * Checks if the given object is currently in the success state
18763  */
18764 bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o);
18765
18766 /**
18767  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
18768  */
18769 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
18770
18771 /**
18772  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
18773  * but with all dynamically-allocated buffers duplicated in new buffers.
18774  */
18775 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
18776
18777 /**
18778  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
18779  */
18780 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
18781
18782 /**
18783  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
18784  */
18785 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
18786
18787 /**
18788  * Checks if the given object is currently in the success state
18789  */
18790 bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o);
18791
18792 /**
18793  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
18794  */
18795 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
18796
18797 /**
18798  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
18799  * but with all dynamically-allocated buffers duplicated in new buffers.
18800  */
18801 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
18802
18803 /**
18804  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
18805  */
18806 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
18807
18808 /**
18809  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
18810  */
18811 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
18812
18813 /**
18814  * Checks if the given object is currently in the success state
18815  */
18816 bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o);
18817
18818 /**
18819  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
18820  */
18821 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
18822
18823 /**
18824  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
18825  * but with all dynamically-allocated buffers duplicated in new buffers.
18826  */
18827 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
18828
18829 /**
18830  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
18831  */
18832 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
18833
18834 /**
18835  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
18836  */
18837 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
18838
18839 /**
18840  * Checks if the given object is currently in the success state
18841  */
18842 bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o);
18843
18844 /**
18845  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
18846  */
18847 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
18848
18849 /**
18850  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
18851  * but with all dynamically-allocated buffers duplicated in new buffers.
18852  */
18853 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
18854
18855 /**
18856  * Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
18857  */
18858 struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_ok(struct LDKOnionMessage o);
18859
18860 /**
18861  * Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
18862  */
18863 struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_err(struct LDKDecodeError e);
18864
18865 /**
18866  * Checks if the given object is currently in the success state
18867  */
18868 bool CResult_OnionMessageDecodeErrorZ_is_ok(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR o);
18869
18870 /**
18871  * Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
18872  */
18873 void CResult_OnionMessageDecodeErrorZ_free(struct LDKCResult_OnionMessageDecodeErrorZ _res);
18874
18875 /**
18876  * Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
18877  * but with all dynamically-allocated buffers duplicated in new buffers.
18878  */
18879 struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_clone(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR orig);
18880
18881 /**
18882  * Creates a new CResult_PingDecodeErrorZ in the success state.
18883  */
18884 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
18885
18886 /**
18887  * Creates a new CResult_PingDecodeErrorZ in the error state.
18888  */
18889 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
18890
18891 /**
18892  * Checks if the given object is currently in the success state
18893  */
18894 bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o);
18895
18896 /**
18897  * Frees any resources used by the CResult_PingDecodeErrorZ.
18898  */
18899 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
18900
18901 /**
18902  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
18903  * but with all dynamically-allocated buffers duplicated in new buffers.
18904  */
18905 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
18906
18907 /**
18908  * Creates a new CResult_PongDecodeErrorZ in the success state.
18909  */
18910 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
18911
18912 /**
18913  * Creates a new CResult_PongDecodeErrorZ in the error state.
18914  */
18915 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
18916
18917 /**
18918  * Checks if the given object is currently in the success state
18919  */
18920 bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o);
18921
18922 /**
18923  * Frees any resources used by the CResult_PongDecodeErrorZ.
18924  */
18925 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
18926
18927 /**
18928  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
18929  * but with all dynamically-allocated buffers duplicated in new buffers.
18930  */
18931 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
18932
18933 /**
18934  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
18935  */
18936 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
18937
18938 /**
18939  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
18940  */
18941 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
18942
18943 /**
18944  * Checks if the given object is currently in the success state
18945  */
18946 bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
18947
18948 /**
18949  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
18950  */
18951 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
18952
18953 /**
18954  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
18955  * but with all dynamically-allocated buffers duplicated in new buffers.
18956  */
18957 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
18958
18959 /**
18960  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
18961  */
18962 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
18963
18964 /**
18965  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
18966  */
18967 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
18968
18969 /**
18970  * Checks if the given object is currently in the success state
18971  */
18972 bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
18973
18974 /**
18975  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
18976  */
18977 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
18978
18979 /**
18980  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
18981  * but with all dynamically-allocated buffers duplicated in new buffers.
18982  */
18983 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
18984
18985 /**
18986  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
18987  */
18988 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
18989
18990 /**
18991  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
18992  */
18993 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
18994
18995 /**
18996  * Checks if the given object is currently in the success state
18997  */
18998 bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o);
18999
19000 /**
19001  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
19002  */
19003 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
19004
19005 /**
19006  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
19007  * but with all dynamically-allocated buffers duplicated in new buffers.
19008  */
19009 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
19010
19011 /**
19012  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
19013  */
19014 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
19015
19016 /**
19017  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
19018  */
19019 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
19020
19021 /**
19022  * Checks if the given object is currently in the success state
19023  */
19024 bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o);
19025
19026 /**
19027  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
19028  */
19029 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
19030
19031 /**
19032  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
19033  * but with all dynamically-allocated buffers duplicated in new buffers.
19034  */
19035 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
19036
19037 /**
19038  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
19039  */
19040 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
19041
19042 /**
19043  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
19044  */
19045 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
19046
19047 /**
19048  * Checks if the given object is currently in the success state
19049  */
19050 bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o);
19051
19052 /**
19053  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
19054  */
19055 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
19056
19057 /**
19058  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
19059  * but with all dynamically-allocated buffers duplicated in new buffers.
19060  */
19061 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
19062
19063 /**
19064  * Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
19065  */
19066 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o);
19067
19068 /**
19069  * Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
19070  */
19071 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e);
19072
19073 /**
19074  * Checks if the given object is currently in the success state
19075  */
19076 bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o);
19077
19078 /**
19079  * Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
19080  */
19081 void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res);
19082
19083 /**
19084  * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
19085  * but with all dynamically-allocated buffers duplicated in new buffers.
19086  */
19087 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig);
19088
19089 /**
19090  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
19091  */
19092 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
19093
19094 /**
19095  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
19096  */
19097 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
19098
19099 /**
19100  * Checks if the given object is currently in the success state
19101  */
19102 bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
19103
19104 /**
19105  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
19106  */
19107 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
19108
19109 /**
19110  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
19111  * but with all dynamically-allocated buffers duplicated in new buffers.
19112  */
19113 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
19114
19115 /**
19116  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
19117  */
19118 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
19119
19120 /**
19121  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
19122  */
19123 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
19124
19125 /**
19126  * Checks if the given object is currently in the success state
19127  */
19128 bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
19129
19130 /**
19131  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
19132  */
19133 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
19134
19135 /**
19136  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
19137  * but with all dynamically-allocated buffers duplicated in new buffers.
19138  */
19139 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
19140
19141 /**
19142  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
19143  */
19144 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
19145
19146 /**
19147  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
19148  */
19149 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
19150
19151 /**
19152  * Checks if the given object is currently in the success state
19153  */
19154 bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o);
19155
19156 /**
19157  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
19158  */
19159 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
19160
19161 /**
19162  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
19163  * but with all dynamically-allocated buffers duplicated in new buffers.
19164  */
19165 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
19166
19167 /**
19168  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
19169  */
19170 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
19171
19172 /**
19173  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
19174  */
19175 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
19176
19177 /**
19178  * Checks if the given object is currently in the success state
19179  */
19180 bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o);
19181
19182 /**
19183  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
19184  */
19185 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
19186
19187 /**
19188  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
19189  * but with all dynamically-allocated buffers duplicated in new buffers.
19190  */
19191 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
19192
19193 /**
19194  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
19195  */
19196 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
19197
19198 /**
19199  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
19200  */
19201 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
19202
19203 /**
19204  * Checks if the given object is currently in the success state
19205  */
19206 bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o);
19207
19208 /**
19209  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
19210  */
19211 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
19212
19213 /**
19214  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
19215  * but with all dynamically-allocated buffers duplicated in new buffers.
19216  */
19217 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
19218
19219 /**
19220  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
19221  */
19222 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
19223
19224 /**
19225  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
19226  */
19227 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
19228
19229 /**
19230  * Checks if the given object is currently in the success state
19231  */
19232 bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o);
19233
19234 /**
19235  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
19236  */
19237 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
19238
19239 /**
19240  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
19241  * but with all dynamically-allocated buffers duplicated in new buffers.
19242  */
19243 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
19244
19245 /**
19246  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
19247  */
19248 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
19249
19250 /**
19251  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
19252  */
19253 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
19254
19255 /**
19256  * Checks if the given object is currently in the success state
19257  */
19258 bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o);
19259
19260 /**
19261  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
19262  */
19263 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
19264
19265 /**
19266  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
19267  * but with all dynamically-allocated buffers duplicated in new buffers.
19268  */
19269 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
19270
19271 /**
19272  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19273  */
19274 void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res);
19275
19276 /**
19277  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
19278  */
19279 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
19280
19281 /**
19282  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
19283  */
19284 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
19285
19286 /**
19287  * Checks if the given object is currently in the success state
19288  */
19289 bool CResult_InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR o);
19290
19291 /**
19292  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
19293  */
19294 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
19295
19296 /**
19297  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
19298  * but with all dynamically-allocated buffers duplicated in new buffers.
19299  */
19300 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
19301
19302 /**
19303  * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
19304  */
19305 struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
19306
19307 /**
19308  * Constructs a new COption_FilterZ containing nothing
19309  */
19310 struct LDKCOption_FilterZ COption_FilterZ_none(void);
19311
19312 /**
19313  * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
19314  */
19315 void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
19316
19317 /**
19318  * Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
19319  */
19320 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o);
19321
19322 /**
19323  * Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
19324  */
19325 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
19326
19327 /**
19328  * Checks if the given object is currently in the success state
19329  */
19330 bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o);
19331
19332 /**
19333  * Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
19334  */
19335 void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res);
19336
19337 /**
19338  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19339  */
19340 void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res);
19341
19342 /**
19343  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19344  */
19345 void CVec_MonitorUpdateIdZ_free(struct LDKCVec_MonitorUpdateIdZ _res);
19346
19347 /**
19348  * Creates a new tuple which has the same data as `orig`
19349  * but with all dynamically-allocated buffers duplicated in new buffers.
19350  */
19351 struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(const struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR orig);
19352
19353 /**
19354  * Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
19355  */
19356 struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorUpdateIdZ b);
19357
19358 /**
19359  * Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
19360  */
19361 void C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res);
19362
19363 /**
19364  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19365  */
19366 void CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res);
19367
19368 /**
19369  * Frees any resources used by the PaymentPurpose
19370  */
19371 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
19372
19373 /**
19374  * Creates a copy of the PaymentPurpose
19375  */
19376 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
19377
19378 /**
19379  * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
19380  */
19381 struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret);
19382
19383 /**
19384  * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
19385  */
19386 struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
19387
19388 /**
19389  * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read
19390  */
19391 struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_PTR obj);
19392
19393 /**
19394  * Read a PaymentPurpose from a byte array, created by PaymentPurpose_write
19395  */
19396 struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser);
19397
19398 /**
19399  * Frees any resources used by the ClosureReason
19400  */
19401 void ClosureReason_free(struct LDKClosureReason this_ptr);
19402
19403 /**
19404  * Creates a copy of the ClosureReason
19405  */
19406 struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
19407
19408 /**
19409  * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
19410  */
19411 struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg);
19412
19413 /**
19414  * Utility method to constructs a new HolderForceClosed-variant ClosureReason
19415  */
19416 struct LDKClosureReason ClosureReason_holder_force_closed(void);
19417
19418 /**
19419  * Utility method to constructs a new CooperativeClosure-variant ClosureReason
19420  */
19421 struct LDKClosureReason ClosureReason_cooperative_closure(void);
19422
19423 /**
19424  * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
19425  */
19426 struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
19427
19428 /**
19429  * Utility method to constructs a new FundingTimedOut-variant ClosureReason
19430  */
19431 struct LDKClosureReason ClosureReason_funding_timed_out(void);
19432
19433 /**
19434  * Utility method to constructs a new ProcessingError-variant ClosureReason
19435  */
19436 struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
19437
19438 /**
19439  * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
19440  */
19441 struct LDKClosureReason ClosureReason_disconnected_peer(void);
19442
19443 /**
19444  * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
19445  */
19446 struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
19447
19448 /**
19449  * Checks if two ClosureReasons contain equal inner contents.
19450  * This ignores pointers and is_owned flags and looks at the values in fields.
19451  */
19452 bool ClosureReason_eq(const struct LDKClosureReason *NONNULL_PTR a, const struct LDKClosureReason *NONNULL_PTR b);
19453
19454 /**
19455  * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
19456  */
19457 struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
19458
19459 /**
19460  * Read a ClosureReason from a byte array, created by ClosureReason_write
19461  */
19462 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser);
19463
19464 /**
19465  * Frees any resources used by the HTLCDestination
19466  */
19467 void HTLCDestination_free(struct LDKHTLCDestination this_ptr);
19468
19469 /**
19470  * Creates a copy of the HTLCDestination
19471  */
19472 struct LDKHTLCDestination HTLCDestination_clone(const struct LDKHTLCDestination *NONNULL_PTR orig);
19473
19474 /**
19475  * Utility method to constructs a new NextHopChannel-variant HTLCDestination
19476  */
19477 struct LDKHTLCDestination HTLCDestination_next_hop_channel(struct LDKPublicKey node_id, struct LDKThirtyTwoBytes channel_id);
19478
19479 /**
19480  * Utility method to constructs a new UnknownNextHop-variant HTLCDestination
19481  */
19482 struct LDKHTLCDestination HTLCDestination_unknown_next_hop(uint64_t requested_forward_scid);
19483
19484 /**
19485  * Utility method to constructs a new InvalidForward-variant HTLCDestination
19486  */
19487 struct LDKHTLCDestination HTLCDestination_invalid_forward(uint64_t requested_forward_scid);
19488
19489 /**
19490  * Utility method to constructs a new FailedPayment-variant HTLCDestination
19491  */
19492 struct LDKHTLCDestination HTLCDestination_failed_payment(struct LDKThirtyTwoBytes payment_hash);
19493
19494 /**
19495  * Checks if two HTLCDestinations contain equal inner contents.
19496  * This ignores pointers and is_owned flags and looks at the values in fields.
19497  */
19498 bool HTLCDestination_eq(const struct LDKHTLCDestination *NONNULL_PTR a, const struct LDKHTLCDestination *NONNULL_PTR b);
19499
19500 /**
19501  * Serialize the HTLCDestination object into a byte array which can be read by HTLCDestination_read
19502  */
19503 struct LDKCVec_u8Z HTLCDestination_write(const struct LDKHTLCDestination *NONNULL_PTR obj);
19504
19505 /**
19506  * Read a HTLCDestination from a byte array, created by HTLCDestination_write
19507  */
19508 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ HTLCDestination_read(struct LDKu8slice ser);
19509
19510 /**
19511  * Frees any resources used by the Event
19512  */
19513 void Event_free(struct LDKEvent this_ptr);
19514
19515 /**
19516  * Creates a copy of the Event
19517  */
19518 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
19519
19520 /**
19521  * Utility method to constructs a new FundingGenerationReady-variant Event
19522  */
19523 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, struct LDKU128 user_channel_id);
19524
19525 /**
19526  * Utility method to constructs a new PaymentClaimable-variant Event
19527  */
19528 struct LDKEvent Event_payment_claimable(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose, struct LDKThirtyTwoBytes via_channel_id, struct LDKCOption_u128Z via_user_channel_id);
19529
19530 /**
19531  * Utility method to constructs a new PaymentClaimed-variant Event
19532  */
19533 struct LDKEvent Event_payment_claimed(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose);
19534
19535 /**
19536  * Utility method to constructs a new PaymentSent-variant Event
19537  */
19538 struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
19539
19540 /**
19541  * Utility method to constructs a new PaymentFailed-variant Event
19542  */
19543 struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash);
19544
19545 /**
19546  * Utility method to constructs a new PaymentPathSuccessful-variant Event
19547  */
19548 struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
19549
19550 /**
19551  * Utility method to constructs a new PaymentPathFailed-variant Event
19552  */
19553 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);
19554
19555 /**
19556  * Utility method to constructs a new ProbeSuccessful-variant Event
19557  */
19558 struct LDKEvent Event_probe_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
19559
19560 /**
19561  * Utility method to constructs a new ProbeFailed-variant Event
19562  */
19563 struct LDKEvent Event_probe_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id);
19564
19565 /**
19566  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
19567  */
19568 struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
19569
19570 /**
19571  * Utility method to constructs a new HTLCIntercepted-variant Event
19572  */
19573 struct LDKEvent Event_htlcintercepted(struct LDKThirtyTwoBytes intercept_id, uint64_t requested_next_hop_scid, struct LDKThirtyTwoBytes payment_hash, uint64_t inbound_amount_msat, uint64_t expected_outbound_amount_msat);
19574
19575 /**
19576  * Utility method to constructs a new SpendableOutputs-variant Event
19577  */
19578 struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
19579
19580 /**
19581  * Utility method to constructs a new PaymentForwarded-variant Event
19582  */
19583 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);
19584
19585 /**
19586  * Utility method to constructs a new ChannelReady-variant Event
19587  */
19588 struct LDKEvent Event_channel_ready(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKChannelTypeFeatures channel_type);
19589
19590 /**
19591  * Utility method to constructs a new ChannelClosed-variant Event
19592  */
19593 struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKClosureReason reason);
19594
19595 /**
19596  * Utility method to constructs a new DiscardFunding-variant Event
19597  */
19598 struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
19599
19600 /**
19601  * Utility method to constructs a new OpenChannelRequest-variant Event
19602  */
19603 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);
19604
19605 /**
19606  * Utility method to constructs a new HTLCHandlingFailed-variant Event
19607  */
19608 struct LDKEvent Event_htlchandling_failed(struct LDKThirtyTwoBytes prev_channel_id, struct LDKHTLCDestination failed_next_destination);
19609
19610 /**
19611  * Serialize the Event object into a byte array which can be read by Event_read
19612  */
19613 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
19614
19615 /**
19616  * Read a Event from a byte array, created by Event_write
19617  */
19618 struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser);
19619
19620 /**
19621  * Frees any resources used by the MessageSendEvent
19622  */
19623 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
19624
19625 /**
19626  * Creates a copy of the MessageSendEvent
19627  */
19628 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
19629
19630 /**
19631  * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
19632  */
19633 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
19634
19635 /**
19636  * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
19637  */
19638 struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
19639
19640 /**
19641  * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
19642  */
19643 struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
19644
19645 /**
19646  * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
19647  */
19648 struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
19649
19650 /**
19651  * Utility method to constructs a new SendChannelReady-variant MessageSendEvent
19652  */
19653 struct LDKMessageSendEvent MessageSendEvent_send_channel_ready(struct LDKPublicKey node_id, struct LDKChannelReady msg);
19654
19655 /**
19656  * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
19657  */
19658 struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
19659
19660 /**
19661  * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
19662  */
19663 struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
19664
19665 /**
19666  * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
19667  */
19668 struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
19669
19670 /**
19671  * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
19672  */
19673 struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
19674
19675 /**
19676  * Utility method to constructs a new SendShutdown-variant MessageSendEvent
19677  */
19678 struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
19679
19680 /**
19681  * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
19682  */
19683 struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
19684
19685 /**
19686  * Utility method to constructs a new SendChannelAnnouncement-variant MessageSendEvent
19687  */
19688 struct LDKMessageSendEvent MessageSendEvent_send_channel_announcement(struct LDKPublicKey node_id, struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
19689
19690 /**
19691  * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
19692  */
19693 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
19694
19695 /**
19696  * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
19697  */
19698 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
19699
19700 /**
19701  * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
19702  */
19703 struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
19704
19705 /**
19706  * Utility method to constructs a new HandleError-variant MessageSendEvent
19707  */
19708 struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
19709
19710 /**
19711  * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
19712  */
19713 struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
19714
19715 /**
19716  * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
19717  */
19718 struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
19719
19720 /**
19721  * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
19722  */
19723 struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
19724
19725 /**
19726  * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent
19727  */
19728 struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg);
19729
19730 /**
19731  * Calls the free function if one is set
19732  */
19733 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
19734
19735 /**
19736  * Calls the free function if one is set
19737  */
19738 void OnionMessageProvider_free(struct LDKOnionMessageProvider this_ptr);
19739
19740 /**
19741  * Calls the free function if one is set
19742  */
19743 void EventsProvider_free(struct LDKEventsProvider this_ptr);
19744
19745 /**
19746  * Calls the free function if one is set
19747  */
19748 void EventHandler_free(struct LDKEventHandler this_ptr);
19749
19750 /**
19751  * Frees any resources used by the APIError
19752  */
19753 void APIError_free(struct LDKAPIError this_ptr);
19754
19755 /**
19756  * Creates a copy of the APIError
19757  */
19758 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
19759
19760 /**
19761  * Utility method to constructs a new APIMisuseError-variant APIError
19762  */
19763 struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
19764
19765 /**
19766  * Utility method to constructs a new FeeRateTooHigh-variant APIError
19767  */
19768 struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
19769
19770 /**
19771  * Utility method to constructs a new InvalidRoute-variant APIError
19772  */
19773 struct LDKAPIError APIError_invalid_route(struct LDKStr err);
19774
19775 /**
19776  * Utility method to constructs a new ChannelUnavailable-variant APIError
19777  */
19778 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
19779
19780 /**
19781  * Utility method to constructs a new MonitorUpdateInProgress-variant APIError
19782  */
19783 struct LDKAPIError APIError_monitor_update_in_progress(void);
19784
19785 /**
19786  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
19787  */
19788 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
19789
19790 /**
19791  * Checks if two APIErrors contain equal inner contents.
19792  * This ignores pointers and is_owned flags and looks at the values in fields.
19793  */
19794 bool APIError_eq(const struct LDKAPIError *NONNULL_PTR a, const struct LDKAPIError *NONNULL_PTR b);
19795
19796 /**
19797  * Frees any resources used by the BigSize, if is_owned is set and inner is non-NULL.
19798  */
19799 void BigSize_free(struct LDKBigSize this_obj);
19800
19801 uint64_t BigSize_get_a(const struct LDKBigSize *NONNULL_PTR this_ptr);
19802
19803 void BigSize_set_a(struct LDKBigSize *NONNULL_PTR this_ptr, uint64_t val);
19804
19805 /**
19806  * Constructs a new BigSize given each field
19807  */
19808 MUST_USE_RES struct LDKBigSize BigSize_new(uint64_t a_arg);
19809
19810 /**
19811  * Frees any resources used by the Hostname, if is_owned is set and inner is non-NULL.
19812  */
19813 void Hostname_free(struct LDKHostname this_obj);
19814
19815 /**
19816  * Creates a copy of the Hostname
19817  */
19818 struct LDKHostname Hostname_clone(const struct LDKHostname *NONNULL_PTR orig);
19819
19820 /**
19821  * Checks if two Hostnames contain equal inner contents.
19822  * This ignores pointers and is_owned flags and looks at the values in fields.
19823  * Two objects with NULL inner values will be considered "equal" here.
19824  */
19825 bool Hostname_eq(const struct LDKHostname *NONNULL_PTR a, const struct LDKHostname *NONNULL_PTR b);
19826
19827 /**
19828  * Returns the length of the hostname.
19829  */
19830 MUST_USE_RES uint8_t Hostname_len(const struct LDKHostname *NONNULL_PTR this_arg);
19831
19832 /**
19833  * Creates a digital signature of a message given a SecretKey, like the node's secret.
19834  * 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.
19835  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
19836  */
19837 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
19838
19839 /**
19840  * Recovers the PublicKey of the signer of the message given the message and the signature.
19841  */
19842 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
19843
19844 /**
19845  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
19846  * and the PublicKey.
19847  */
19848 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
19849
19850 /**
19851  * Construct the invoice's HRP and signatureless data into a preimage to be hashed.
19852  */
19853 struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z data_without_signature);
19854
19855 /**
19856  * Calls the free function if one is set
19857  */
19858 void Persister_free(struct LDKPersister this_ptr);
19859
19860 /**
19861  * Frees any resources used by the PrintableString, if is_owned is set and inner is non-NULL.
19862  */
19863 void PrintableString_free(struct LDKPrintableString this_obj);
19864
19865 struct LDKStr PrintableString_get_a(const struct LDKPrintableString *NONNULL_PTR this_ptr);
19866
19867 void PrintableString_set_a(struct LDKPrintableString *NONNULL_PTR this_ptr, struct LDKStr val);
19868
19869 /**
19870  * Constructs a new PrintableString given each field
19871  */
19872 MUST_USE_RES struct LDKPrintableString PrintableString_new(struct LDKStr a_arg);
19873
19874 /**
19875  * Calls the free function if one is set
19876  */
19877 void FutureCallback_free(struct LDKFutureCallback this_ptr);
19878
19879 /**
19880  * Frees any resources used by the Future, if is_owned is set and inner is non-NULL.
19881  */
19882 void Future_free(struct LDKFuture this_obj);
19883
19884 /**
19885  * Registers a callback to be called upon completion of this future. If the future has already
19886  * completed, the callback will be called immediately.
19887  */
19888 void Future_register_callback_fn(const struct LDKFuture *NONNULL_PTR this_arg, struct LDKFutureCallback callback);
19889
19890 /**
19891  * Creates a copy of the Level
19892  */
19893 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
19894
19895 /**
19896  * Utility method to constructs a new Gossip-variant Level
19897  */
19898 enum LDKLevel Level_gossip(void);
19899
19900 /**
19901  * Utility method to constructs a new Trace-variant Level
19902  */
19903 enum LDKLevel Level_trace(void);
19904
19905 /**
19906  * Utility method to constructs a new Debug-variant Level
19907  */
19908 enum LDKLevel Level_debug(void);
19909
19910 /**
19911  * Utility method to constructs a new Info-variant Level
19912  */
19913 enum LDKLevel Level_info(void);
19914
19915 /**
19916  * Utility method to constructs a new Warn-variant Level
19917  */
19918 enum LDKLevel Level_warn(void);
19919
19920 /**
19921  * Utility method to constructs a new Error-variant Level
19922  */
19923 enum LDKLevel Level_error(void);
19924
19925 /**
19926  * Checks if two Levels contain equal inner contents.
19927  * This ignores pointers and is_owned flags and looks at the values in fields.
19928  */
19929 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
19930
19931 /**
19932  * Checks if two Levels contain equal inner contents.
19933  */
19934 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
19935
19936 /**
19937  * Returns the most verbose logging level.
19938  */
19939 MUST_USE_RES enum LDKLevel Level_max(void);
19940
19941 /**
19942  * Frees any resources used by the Record, if is_owned is set and inner is non-NULL.
19943  */
19944 void Record_free(struct LDKRecord this_obj);
19945
19946 /**
19947  * The verbosity level of the message.
19948  */
19949 enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr);
19950
19951 /**
19952  * The verbosity level of the message.
19953  */
19954 void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val);
19955
19956 /**
19957  * The message body.
19958  */
19959 struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr);
19960
19961 /**
19962  * The message body.
19963  */
19964 void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
19965
19966 /**
19967  * The module path of the message.
19968  */
19969 struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr);
19970
19971 /**
19972  * The module path of the message.
19973  */
19974 void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
19975
19976 /**
19977  * The source file containing the message.
19978  */
19979 struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr);
19980
19981 /**
19982  * The source file containing the message.
19983  */
19984 void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
19985
19986 /**
19987  * The line containing the message.
19988  */
19989 uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr);
19990
19991 /**
19992  * The line containing the message.
19993  */
19994 void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val);
19995
19996 /**
19997  * Creates a copy of the Record
19998  */
19999 struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig);
20000
20001 /**
20002  * Calls the free function if one is set
20003  */
20004 void Logger_free(struct LDKLogger this_ptr);
20005
20006 /**
20007  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
20008  */
20009 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
20010
20011 /**
20012  * Confirmations we will wait for before considering the channel locked in.
20013  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
20014  * equivalent limit applied to outbound channels).
20015  *
20016  * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
20017  * transaction before operation. If you wish to accept channels with zero confirmations, see
20018  * [`UserConfig::manually_accept_inbound_channels`] and
20019  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
20020  *
20021  * Default value: 6.
20022  *
20023  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
20024  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
20025  */
20026 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
20027
20028 /**
20029  * Confirmations we will wait for before considering the channel locked in.
20030  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
20031  * equivalent limit applied to outbound channels).
20032  *
20033  * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
20034  * transaction before operation. If you wish to accept channels with zero confirmations, see
20035  * [`UserConfig::manually_accept_inbound_channels`] and
20036  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
20037  *
20038  * Default value: 6.
20039  *
20040  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
20041  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
20042  */
20043 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
20044
20045 /**
20046  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
20047  * the number of blocks we have to punish our counterparty if they broadcast a revoked
20048  * transaction).
20049  *
20050  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
20051  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
20052  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
20053  * possibly with time in between to RBF the spending transaction).
20054  *
20055  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
20056  * case of an honest unilateral channel close, which implicitly decrease the economic value of
20057  * our channel.
20058  *
20059  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
20060  * can tweak config to ask for more security, not less.
20061  */
20062 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
20063
20064 /**
20065  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
20066  * the number of blocks we have to punish our counterparty if they broadcast a revoked
20067  * transaction).
20068  *
20069  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
20070  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
20071  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
20072  * possibly with time in between to RBF the spending transaction).
20073  *
20074  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
20075  * case of an honest unilateral channel close, which implicitly decrease the economic value of
20076  * our channel.
20077  *
20078  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
20079  * can tweak config to ask for more security, not less.
20080  */
20081 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
20082
20083 /**
20084  * Set to the smallest value HTLC we will accept to process.
20085  *
20086  * This value is sent to our counterparty on channel-open and we close the channel any time
20087  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
20088  *
20089  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
20090  * by the protocol.
20091  */
20092 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
20093
20094 /**
20095  * Set to the smallest value HTLC we will accept to process.
20096  *
20097  * This value is sent to our counterparty on channel-open and we close the channel any time
20098  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
20099  *
20100  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
20101  * by the protocol.
20102  */
20103 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
20104
20105 /**
20106  * Sets the percentage of the channel value we will cap the total value of outstanding inbound
20107  * HTLCs to.
20108  *
20109  * This can be set to a value between 1-100, where the value corresponds to the percent of the
20110  * channel value in whole percentages.
20111  *
20112  * Note that:
20113  * * If configured to another value than the default value 10, any new channels created with
20114  * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
20115  * `ChannelManager`.
20116  *
20117  * * This caps the total value for inbound HTLCs in-flight only, and there's currently
20118  * no way to configure the cap for the total value of outbound HTLCs in-flight.
20119  *
20120  * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
20121  * are different from the non-HTLC-encumbered funds. This makes this an important knob to
20122  * restrict exposure to loss due to being offline for too long.
20123  * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
20124  * for more information.
20125  *
20126  * Default value: 10.
20127  * Minimum value: 1, any values less than 1 will be treated as 1 instead.
20128  * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
20129  */
20130 uint8_t ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
20131
20132 /**
20133  * Sets the percentage of the channel value we will cap the total value of outstanding inbound
20134  * HTLCs to.
20135  *
20136  * This can be set to a value between 1-100, where the value corresponds to the percent of the
20137  * channel value in whole percentages.
20138  *
20139  * Note that:
20140  * * If configured to another value than the default value 10, any new channels created with
20141  * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
20142  * `ChannelManager`.
20143  *
20144  * * This caps the total value for inbound HTLCs in-flight only, and there's currently
20145  * no way to configure the cap for the total value of outbound HTLCs in-flight.
20146  *
20147  * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
20148  * are different from the non-HTLC-encumbered funds. This makes this an important knob to
20149  * restrict exposure to loss due to being offline for too long.
20150  * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
20151  * for more information.
20152  *
20153  * Default value: 10.
20154  * Minimum value: 1, any values less than 1 will be treated as 1 instead.
20155  * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
20156  */
20157 void ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint8_t val);
20158
20159 /**
20160  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
20161  * BOLTs) option for outbound private channels. This provides better privacy by not including
20162  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
20163  * relay HTLCs to us using the channel's SCID alias.
20164  *
20165  * If this option is set, channels may be created that will not be readable by LDK versions
20166  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
20167  * [`DecodeError::InvalidValue`].
20168  *
20169  * Note that setting this to true does *not* prevent us from opening channels with
20170  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
20171  * private channel without that option.
20172  *
20173  * Ignored if the channel is negotiated to be announced, see
20174  * [`ChannelHandshakeConfig::announced_channel`] and
20175  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
20176  *
20177  * Default value: false. This value is likely to change to true in the future.
20178  *
20179  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
20180  * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
20181  */
20182 bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
20183
20184 /**
20185  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
20186  * BOLTs) option for outbound private channels. This provides better privacy by not including
20187  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
20188  * relay HTLCs to us using the channel's SCID alias.
20189  *
20190  * If this option is set, channels may be created that will not be readable by LDK versions
20191  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
20192  * [`DecodeError::InvalidValue`].
20193  *
20194  * Note that setting this to true does *not* prevent us from opening channels with
20195  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
20196  * private channel without that option.
20197  *
20198  * Ignored if the channel is negotiated to be announced, see
20199  * [`ChannelHandshakeConfig::announced_channel`] and
20200  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
20201  *
20202  * Default value: false. This value is likely to change to true in the future.
20203  *
20204  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
20205  * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
20206  */
20207 void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
20208
20209 /**
20210  * Set to announce the channel publicly and notify all nodes that they can route via this
20211  * channel.
20212  *
20213  * This should only be set to true for nodes which expect to be online reliably.
20214  *
20215  * As the node which funds a channel picks this value this will only apply for new outbound
20216  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
20217  *
20218  * Default value: false.
20219  */
20220 bool ChannelHandshakeConfig_get_announced_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
20221
20222 /**
20223  * Set to announce the channel publicly and notify all nodes that they can route via this
20224  * channel.
20225  *
20226  * This should only be set to true for nodes which expect to be online reliably.
20227  *
20228  * As the node which funds a channel picks this value this will only apply for new outbound
20229  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
20230  *
20231  * Default value: false.
20232  */
20233 void ChannelHandshakeConfig_set_announced_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
20234
20235 /**
20236  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
20237  * supports it, they will then enforce the mutual-close output to us matches what we provided
20238  * at intialization, preventing us from closing to an alternate pubkey.
20239  *
20240  * This is set to true by default to provide a slight increase in security, though ultimately
20241  * any attacker who is able to take control of a channel can just as easily send the funds via
20242  * lightning payments, so we never require that our counterparties support this option.
20243  *
20244  * The upfront key committed is provided from [`KeysInterface::get_shutdown_scriptpubkey`].
20245  *
20246  * Default value: true.
20247  *
20248  * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
20249  */
20250 bool ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
20251
20252 /**
20253  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
20254  * supports it, they will then enforce the mutual-close output to us matches what we provided
20255  * at intialization, preventing us from closing to an alternate pubkey.
20256  *
20257  * This is set to true by default to provide a slight increase in security, though ultimately
20258  * any attacker who is able to take control of a channel can just as easily send the funds via
20259  * lightning payments, so we never require that our counterparties support this option.
20260  *
20261  * The upfront key committed is provided from [`KeysInterface::get_shutdown_scriptpubkey`].
20262  *
20263  * Default value: true.
20264  *
20265  * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
20266  */
20267 void ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
20268
20269 /**
20270  * The Proportion of the channel value to configure as counterparty's channel reserve,
20271  * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels.
20272  *
20273  * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain
20274  * on their side, at all times.
20275  * This ensures that if our counterparty broadcasts a revoked state, we can punish them by
20276  * claiming at least this value on chain.
20277  *
20278  * Channel reserve values greater than 30% could be considered highly unreasonable, since that
20279  * amount can never be used for payments.
20280  * Also, if our selected channel reserve for counterparty and counterparty's selected
20281  * channel reserve for us sum up to equal or greater than channel value, channel negotiations
20282  * will fail.
20283  *
20284  * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve
20285  * other than the default value.
20286  *
20287  * Default value: 1% of channel value, i.e., configured as 10,000 millionths.
20288  * Minimum value: If the calculated proportional value is less than 1000 sats, it will be treated
20289  *                as 1000 sats instead, which is a safe implementation-specific lower bound.
20290  * Maximum value: 1,000,000, any values larger than 1 Million will be treated as 1 Million (or 100%)
20291  *                instead, although channel negotiations will fail in that case.
20292  */
20293 uint32_t ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
20294
20295 /**
20296  * The Proportion of the channel value to configure as counterparty's channel reserve,
20297  * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels.
20298  *
20299  * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain
20300  * on their side, at all times.
20301  * This ensures that if our counterparty broadcasts a revoked state, we can punish them by
20302  * claiming at least this value on chain.
20303  *
20304  * Channel reserve values greater than 30% could be considered highly unreasonable, since that
20305  * amount can never be used for payments.
20306  * Also, if our selected channel reserve for counterparty and counterparty's selected
20307  * channel reserve for us sum up to equal or greater than channel value, channel negotiations
20308  * will fail.
20309  *
20310  * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve
20311  * other than the default value.
20312  *
20313  * Default value: 1% of channel value, i.e., configured as 10,000 millionths.
20314  * Minimum value: If the calculated proportional value is less than 1000 sats, it will be treated
20315  *                as 1000 sats instead, which is a safe implementation-specific lower bound.
20316  * Maximum value: 1,000,000, any values larger than 1 Million will be treated as 1 Million (or 100%)
20317  *                instead, although channel negotiations will fail in that case.
20318  */
20319 void ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
20320
20321 /**
20322  * Constructs a new ChannelHandshakeConfig given each field
20323  */
20324 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);
20325
20326 /**
20327  * Creates a copy of the ChannelHandshakeConfig
20328  */
20329 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
20330
20331 /**
20332  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
20333  */
20334 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
20335
20336 /**
20337  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
20338  */
20339 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
20340
20341 /**
20342  * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
20343  * only applies to inbound channels.
20344  *
20345  * Default value: 0.
20346  */
20347 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
20348
20349 /**
20350  * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
20351  * only applies to inbound channels.
20352  *
20353  * Default value: 0.
20354  */
20355 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
20356
20357 /**
20358  * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
20359  * only applies to inbound channels.
20360  *
20361  * Default value: 2^24 - 1.
20362  */
20363 uint64_t ChannelHandshakeLimits_get_max_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
20364
20365 /**
20366  * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
20367  * only applies to inbound channels.
20368  *
20369  * Default value: 2^24 - 1.
20370  */
20371 void ChannelHandshakeLimits_set_max_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
20372
20373 /**
20374  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
20375  * you to limit the maximum minimum-size they can require.
20376  *
20377  * Default value: u64::max_value.
20378  */
20379 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
20380
20381 /**
20382  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
20383  * you to limit the maximum minimum-size they can require.
20384  *
20385  * Default value: u64::max_value.
20386  */
20387 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
20388
20389 /**
20390  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
20391  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
20392  *
20393  * Default value: 0.
20394  */
20395 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
20396
20397 /**
20398  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
20399  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
20400  *
20401  * Default value: 0.
20402  */
20403 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
20404
20405 /**
20406  * The remote node will require we keep a certain amount in direct payment to ourselves at all
20407  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
20408  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
20409  *
20410  * Default value: u64::max_value.
20411  */
20412 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
20413
20414 /**
20415  * The remote node will require we keep a certain amount in direct payment to ourselves at all
20416  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
20417  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
20418  *
20419  * Default value: u64::max_value.
20420  */
20421 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
20422
20423 /**
20424  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
20425  * time. This allows you to set a minimum such value.
20426  *
20427  * Default value: 0.
20428  */
20429 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
20430
20431 /**
20432  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
20433  * time. This allows you to set a minimum such value.
20434  *
20435  * Default value: 0.
20436  */
20437 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
20438
20439 /**
20440  * Before a channel is usable the funding transaction will need to be confirmed by at least a
20441  * certain number of blocks, specified by the node which is not the funder (as the funder can
20442  * assume they aren't going to double-spend themselves).
20443  * This config allows you to set a limit on the maximum amount of time to wait.
20444  *
20445  * Default value: 144, or roughly one day and only applies to outbound channels.
20446  */
20447 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
20448
20449 /**
20450  * Before a channel is usable the funding transaction will need to be confirmed by at least a
20451  * certain number of blocks, specified by the node which is not the funder (as the funder can
20452  * assume they aren't going to double-spend themselves).
20453  * This config allows you to set a limit on the maximum amount of time to wait.
20454  *
20455  * Default value: 144, or roughly one day and only applies to outbound channels.
20456  */
20457 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
20458
20459 /**
20460  * Whether we implicitly trust funding transactions generated by us for our own outbound
20461  * channels to not be double-spent.
20462  *
20463  * If this is set, we assume that our own funding transactions are *never* double-spent, and
20464  * thus we can trust them without any confirmations. This is generally a reasonable
20465  * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
20466  * control of the signing keys).
20467  *
20468  * You may wish to un-set this if you allow the user to (or do in an automated fashion)
20469  * double-spend the funding transaction to RBF with an alternative channel open.
20470  *
20471  * This only applies if our counterparty set their confirmations-required value to 0, and we
20472  * always trust our own funding transaction at 1 confirmation irrespective of this value.
20473  * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
20474  * `true` (0) and `false` (1).
20475  *
20476  * Default value: true
20477  */
20478 bool ChannelHandshakeLimits_get_trust_own_funding_0conf(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
20479
20480 /**
20481  * Whether we implicitly trust funding transactions generated by us for our own outbound
20482  * channels to not be double-spent.
20483  *
20484  * If this is set, we assume that our own funding transactions are *never* double-spent, and
20485  * thus we can trust them without any confirmations. This is generally a reasonable
20486  * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
20487  * control of the signing keys).
20488  *
20489  * You may wish to un-set this if you allow the user to (or do in an automated fashion)
20490  * double-spend the funding transaction to RBF with an alternative channel open.
20491  *
20492  * This only applies if our counterparty set their confirmations-required value to 0, and we
20493  * always trust our own funding transaction at 1 confirmation irrespective of this value.
20494  * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
20495  * `true` (0) and `false` (1).
20496  *
20497  * Default value: true
20498  */
20499 void ChannelHandshakeLimits_set_trust_own_funding_0conf(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
20500
20501 /**
20502  * Set to force an incoming channel to match our announced channel preference in
20503  * [`ChannelHandshakeConfig::announced_channel`].
20504  *
20505  * For a node which is not online reliably, this should be set to true and
20506  * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public)
20507  * channels will ever be opened.
20508  *
20509  * Default value: true.
20510  */
20511 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
20512
20513 /**
20514  * Set to force an incoming channel to match our announced channel preference in
20515  * [`ChannelHandshakeConfig::announced_channel`].
20516  *
20517  * For a node which is not online reliably, this should be set to true and
20518  * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public)
20519  * channels will ever be opened.
20520  *
20521  * Default value: true.
20522  */
20523 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
20524
20525 /**
20526  * Set to the amount of time we're willing to wait to claim money back to us.
20527  *
20528  * Not checking this value would be a security issue, as our peer would be able to set it to
20529  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
20530  *
20531  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
20532  * reduce the loss of having useless locked funds (if your peer accepts)
20533  */
20534 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
20535
20536 /**
20537  * Set to the amount of time we're willing to wait to claim money back to us.
20538  *
20539  * Not checking this value would be a security issue, as our peer would be able to set it to
20540  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
20541  *
20542  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
20543  * reduce the loss of having useless locked funds (if your peer accepts)
20544  */
20545 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
20546
20547 /**
20548  * Constructs a new ChannelHandshakeLimits given each field
20549  */
20550 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);
20551
20552 /**
20553  * Creates a copy of the ChannelHandshakeLimits
20554  */
20555 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
20556
20557 /**
20558  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
20559  */
20560 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
20561
20562 /**
20563  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
20564  */
20565 void ChannelConfig_free(struct LDKChannelConfig this_obj);
20566
20567 /**
20568  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
20569  * over the channel.
20570  * This may be allowed to change at runtime in a later update, however doing so must result in
20571  * update messages sent to notify all nodes of our updated relay fee.
20572  *
20573  * Default value: 0.
20574  */
20575 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
20576
20577 /**
20578  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
20579  * over the channel.
20580  * This may be allowed to change at runtime in a later update, however doing so must result in
20581  * update messages sent to notify all nodes of our updated relay fee.
20582  *
20583  * Default value: 0.
20584  */
20585 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
20586
20587 /**
20588  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
20589  * excess of [`forwarding_fee_proportional_millionths`].
20590  * This may be allowed to change at runtime in a later update, however doing so must result in
20591  * update messages sent to notify all nodes of our updated relay fee.
20592  *
20593  * The default value of a single satoshi roughly matches the market rate on many routing nodes
20594  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
20595  * this node.
20596  *
20597  * Default value: 1000.
20598  *
20599  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
20600  */
20601 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
20602
20603 /**
20604  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
20605  * excess of [`forwarding_fee_proportional_millionths`].
20606  * This may be allowed to change at runtime in a later update, however doing so must result in
20607  * update messages sent to notify all nodes of our updated relay fee.
20608  *
20609  * The default value of a single satoshi roughly matches the market rate on many routing nodes
20610  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
20611  * this node.
20612  *
20613  * Default value: 1000.
20614  *
20615  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
20616  */
20617 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
20618
20619 /**
20620  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
20621  * the channel this config applies to.
20622  *
20623  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
20624  * HTLC balance when a channel appears on-chain whereas
20625  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
20626  * (non-HTLC-encumbered) balance.
20627  *
20628  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
20629  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
20630  * commitment transaction at least once per this many blocks (minus some margin to allow us
20631  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
20632  * the spending transaction).
20633  *
20634  * Default value: 72 (12 hours at an average of 6 blocks/hour).
20635  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
20636  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
20637  *
20638  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
20639  */
20640 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
20641
20642 /**
20643  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
20644  * the channel this config applies to.
20645  *
20646  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
20647  * HTLC balance when a channel appears on-chain whereas
20648  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
20649  * (non-HTLC-encumbered) balance.
20650  *
20651  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
20652  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
20653  * commitment transaction at least once per this many blocks (minus some margin to allow us
20654  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
20655  * the spending transaction).
20656  *
20657  * Default value: 72 (12 hours at an average of 6 blocks/hour).
20658  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
20659  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
20660  *
20661  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
20662  */
20663 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
20664
20665 /**
20666  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
20667  * small to claim on-chain.
20668  *
20669  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
20670  * not be claimable on-chain, instead being turned into additional miner fees if either
20671  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
20672  * to such payments may be sustantial if there are many dust HTLCs present when the
20673  * channel is force-closed.
20674  *
20675  * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a
20676  * channel negotiated throughout the channel open process, along with the fees required to have
20677  * a broadcastable HTLC spending transaction. When a channel supports anchor outputs
20678  * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into
20679  * account the HTLC transaction fee as it is zero.
20680  *
20681  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
20682  * exposure across all three types per-channel. Setting this too low may prevent the
20683  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
20684  * important to prevent stealing of dust HTLCs by miners.
20685  *
20686  * Default value: 5_000_000 msat.
20687  */
20688 uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
20689
20690 /**
20691  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
20692  * small to claim on-chain.
20693  *
20694  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
20695  * not be claimable on-chain, instead being turned into additional miner fees if either
20696  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
20697  * to such payments may be sustantial if there are many dust HTLCs present when the
20698  * channel is force-closed.
20699  *
20700  * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a
20701  * channel negotiated throughout the channel open process, along with the fees required to have
20702  * a broadcastable HTLC spending transaction. When a channel supports anchor outputs
20703  * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into
20704  * account the HTLC transaction fee as it is zero.
20705  *
20706  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
20707  * exposure across all three types per-channel. Setting this too low may prevent the
20708  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
20709  * important to prevent stealing of dust HTLCs by miners.
20710  *
20711  * Default value: 5_000_000 msat.
20712  */
20713 void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
20714
20715 /**
20716  * The additional fee we're willing to pay to avoid waiting for the counterparty's
20717  * `to_self_delay` to reclaim funds.
20718  *
20719  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
20720  * closing transaction which both sides find acceptable, ultimately paid by the channel
20721  * funder/initiator.
20722  *
20723  * When we are the funder, because we have to pay the channel closing fee, we bound the
20724  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
20725  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
20726  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
20727  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
20728  * funds.
20729  *
20730  * When we are not the funder, we require the closing transaction fee pay at least our
20731  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
20732  * Thus, this value is ignored when we are not the funder.
20733  *
20734  * Default value: 1000 satoshis.
20735  *
20736  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
20737  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
20738  */
20739 uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
20740
20741 /**
20742  * The additional fee we're willing to pay to avoid waiting for the counterparty's
20743  * `to_self_delay` to reclaim funds.
20744  *
20745  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
20746  * closing transaction which both sides find acceptable, ultimately paid by the channel
20747  * funder/initiator.
20748  *
20749  * When we are the funder, because we have to pay the channel closing fee, we bound the
20750  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
20751  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
20752  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
20753  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
20754  * funds.
20755  *
20756  * When we are not the funder, we require the closing transaction fee pay at least our
20757  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
20758  * Thus, this value is ignored when we are not the funder.
20759  *
20760  * Default value: 1000 satoshis.
20761  *
20762  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
20763  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
20764  */
20765 void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
20766
20767 /**
20768  * Constructs a new ChannelConfig given each field
20769  */
20770 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);
20771
20772 /**
20773  * Creates a copy of the ChannelConfig
20774  */
20775 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
20776
20777 /**
20778  * Checks if two ChannelConfigs contain equal inner contents.
20779  * This ignores pointers and is_owned flags and looks at the values in fields.
20780  * Two objects with NULL inner values will be considered "equal" here.
20781  */
20782 bool ChannelConfig_eq(const struct LDKChannelConfig *NONNULL_PTR a, const struct LDKChannelConfig *NONNULL_PTR b);
20783
20784 /**
20785  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
20786  */
20787 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
20788
20789 /**
20790  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
20791  */
20792 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
20793
20794 /**
20795  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
20796  */
20797 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
20798
20799 /**
20800  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
20801  */
20802 void UserConfig_free(struct LDKUserConfig this_obj);
20803
20804 /**
20805  * Channel handshake config that we propose to our counterparty.
20806  */
20807 struct LDKChannelHandshakeConfig UserConfig_get_channel_handshake_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
20808
20809 /**
20810  * Channel handshake config that we propose to our counterparty.
20811  */
20812 void UserConfig_set_channel_handshake_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
20813
20814 /**
20815  * Limits applied to our counterparty's proposed channel handshake config settings.
20816  */
20817 struct LDKChannelHandshakeLimits UserConfig_get_channel_handshake_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
20818
20819 /**
20820  * Limits applied to our counterparty's proposed channel handshake config settings.
20821  */
20822 void UserConfig_set_channel_handshake_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
20823
20824 /**
20825  * Channel config which affects behavior during channel lifetime.
20826  */
20827 struct LDKChannelConfig UserConfig_get_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
20828
20829 /**
20830  * Channel config which affects behavior during channel lifetime.
20831  */
20832 void UserConfig_set_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
20833
20834 /**
20835  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
20836  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
20837  * node which is not online reliably.
20838  *
20839  * For nodes which are not online reliably, you should set all channels to *not* be announced
20840  * (using [`ChannelHandshakeConfig::announced_channel`] and
20841  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
20842  * ensure you are not exposed to any forwarding risk.
20843  *
20844  * Note that because you cannot change a channel's announced state after creation, there is no
20845  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
20846  * from a publicly-announced forwarding node to a private non-forwarding node you must close
20847  * all your channels and open new ones. For privacy, you should also change your node_id
20848  * (swapping all private and public key material for new ones) at that time.
20849  *
20850  * Default value: false.
20851  */
20852 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
20853
20854 /**
20855  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
20856  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
20857  * node which is not online reliably.
20858  *
20859  * For nodes which are not online reliably, you should set all channels to *not* be announced
20860  * (using [`ChannelHandshakeConfig::announced_channel`] and
20861  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
20862  * ensure you are not exposed to any forwarding risk.
20863  *
20864  * Note that because you cannot change a channel's announced state after creation, there is no
20865  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
20866  * from a publicly-announced forwarding node to a private non-forwarding node you must close
20867  * all your channels and open new ones. For privacy, you should also change your node_id
20868  * (swapping all private and public key material for new ones) at that time.
20869  *
20870  * Default value: false.
20871  */
20872 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
20873
20874 /**
20875  * If this is set to false, we do not accept inbound requests to open a new channel.
20876  * Default value: true.
20877  */
20878 bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
20879
20880 /**
20881  * If this is set to false, we do not accept inbound requests to open a new channel.
20882  * Default value: true.
20883  */
20884 void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
20885
20886 /**
20887  * If this is set to true, the user needs to manually accept inbound requests to open a new
20888  * channel.
20889  *
20890  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
20891  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
20892  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
20893  * user explicitly chooses to accept the request.
20894  *
20895  * Default value: false.
20896  *
20897  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
20898  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
20899  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
20900  */
20901 bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
20902
20903 /**
20904  * If this is set to true, the user needs to manually accept inbound requests to open a new
20905  * channel.
20906  *
20907  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
20908  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
20909  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
20910  * user explicitly chooses to accept the request.
20911  *
20912  * Default value: false.
20913  *
20914  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
20915  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
20916  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
20917  */
20918 void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
20919
20920 /**
20921  *  If this is set to true, LDK will intercept HTLCs that are attempting to be forwarded over
20922  *  fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC
20923  *  intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user.
20924  *
20925  *  Setting this to true may break backwards compatibility with LDK versions < 0.0.113.
20926  *
20927  *  Default value: false.
20928  *
20929  * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
20930  * [`Event::HTLCIntercepted`]: crate::util::events::Event::HTLCIntercepted
20931  */
20932 bool UserConfig_get_accept_intercept_htlcs(const struct LDKUserConfig *NONNULL_PTR this_ptr);
20933
20934 /**
20935  *  If this is set to true, LDK will intercept HTLCs that are attempting to be forwarded over
20936  *  fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC
20937  *  intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user.
20938  *
20939  *  Setting this to true may break backwards compatibility with LDK versions < 0.0.113.
20940  *
20941  *  Default value: false.
20942  *
20943  * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
20944  * [`Event::HTLCIntercepted`]: crate::util::events::Event::HTLCIntercepted
20945  */
20946 void UserConfig_set_accept_intercept_htlcs(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
20947
20948 /**
20949  * Constructs a new UserConfig given each field
20950  */
20951 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, bool accept_intercept_htlcs_arg);
20952
20953 /**
20954  * Creates a copy of the UserConfig
20955  */
20956 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
20957
20958 /**
20959  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
20960  */
20961 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
20962
20963 /**
20964  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
20965  */
20966 void BestBlock_free(struct LDKBestBlock this_obj);
20967
20968 /**
20969  * Creates a copy of the BestBlock
20970  */
20971 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
20972
20973 /**
20974  * Checks if two BestBlocks contain equal inner contents.
20975  * This ignores pointers and is_owned flags and looks at the values in fields.
20976  * Two objects with NULL inner values will be considered "equal" here.
20977  */
20978 bool BestBlock_eq(const struct LDKBestBlock *NONNULL_PTR a, const struct LDKBestBlock *NONNULL_PTR b);
20979
20980 /**
20981  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
20982  * network.
20983  */
20984 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
20985
20986 /**
20987  * Returns a `BestBlock` as identified by the given block hash and height.
20988  */
20989 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
20990
20991 /**
20992  * Returns the best block hash.
20993  */
20994 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
20995
20996 /**
20997  * Returns the best block height.
20998  */
20999 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
21000
21001 /**
21002  * Creates a copy of the AccessError
21003  */
21004 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
21005
21006 /**
21007  * Utility method to constructs a new UnknownChain-variant AccessError
21008  */
21009 enum LDKAccessError AccessError_unknown_chain(void);
21010
21011 /**
21012  * Utility method to constructs a new UnknownTx-variant AccessError
21013  */
21014 enum LDKAccessError AccessError_unknown_tx(void);
21015
21016 /**
21017  * Calls the free function if one is set
21018  */
21019 void Access_free(struct LDKAccess this_ptr);
21020
21021 /**
21022  * Calls the free function if one is set
21023  */
21024 void Listen_free(struct LDKListen this_ptr);
21025
21026 /**
21027  * Calls the free function if one is set
21028  */
21029 void Confirm_free(struct LDKConfirm this_ptr);
21030
21031 /**
21032  * Creates a copy of the ChannelMonitorUpdateStatus
21033  */
21034 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_clone(const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR orig);
21035
21036 /**
21037  * Utility method to constructs a new Completed-variant ChannelMonitorUpdateStatus
21038  */
21039 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_completed(void);
21040
21041 /**
21042  * Utility method to constructs a new InProgress-variant ChannelMonitorUpdateStatus
21043  */
21044 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_in_progress(void);
21045
21046 /**
21047  * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateStatus
21048  */
21049 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_permanent_failure(void);
21050
21051 /**
21052  * Checks if two ChannelMonitorUpdateStatuss contain equal inner contents.
21053  * This ignores pointers and is_owned flags and looks at the values in fields.
21054  */
21055 bool ChannelMonitorUpdateStatus_eq(const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR a, const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR b);
21056
21057 /**
21058  * Calls the free function if one is set
21059  */
21060 void Watch_free(struct LDKWatch this_ptr);
21061
21062 /**
21063  * Calls the free function if one is set
21064  */
21065 void Filter_free(struct LDKFilter this_ptr);
21066
21067 /**
21068  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
21069  */
21070 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
21071
21072 /**
21073  * First block where the transaction output may have been spent.
21074  *
21075  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21076  */
21077 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
21078
21079 /**
21080  * First block where the transaction output may have been spent.
21081  *
21082  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21083  */
21084 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21085
21086 /**
21087  * Outpoint identifying the transaction output.
21088  */
21089 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
21090
21091 /**
21092  * Outpoint identifying the transaction output.
21093  */
21094 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
21095
21096 /**
21097  * Spending condition of the transaction output.
21098  */
21099 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
21100
21101 /**
21102  * Spending condition of the transaction output.
21103  */
21104 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
21105
21106 /**
21107  * Constructs a new WatchedOutput given each field
21108  */
21109 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
21110
21111 /**
21112  * Creates a copy of the WatchedOutput
21113  */
21114 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
21115
21116 /**
21117  * Checks if two WatchedOutputs contain equal inner contents.
21118  * This ignores pointers and is_owned flags and looks at the values in fields.
21119  * Two objects with NULL inner values will be considered "equal" here.
21120  */
21121 bool WatchedOutput_eq(const struct LDKWatchedOutput *NONNULL_PTR a, const struct LDKWatchedOutput *NONNULL_PTR b);
21122
21123 /**
21124  * Checks if two WatchedOutputs contain equal inner contents.
21125  */
21126 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
21127
21128 /**
21129  * Calls the free function if one is set
21130  */
21131 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
21132
21133 /**
21134  * Creates a copy of the ConfirmationTarget
21135  */
21136 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
21137
21138 /**
21139  * Utility method to constructs a new Background-variant ConfirmationTarget
21140  */
21141 enum LDKConfirmationTarget ConfirmationTarget_background(void);
21142
21143 /**
21144  * Utility method to constructs a new Normal-variant ConfirmationTarget
21145  */
21146 enum LDKConfirmationTarget ConfirmationTarget_normal(void);
21147
21148 /**
21149  * Utility method to constructs a new HighPriority-variant ConfirmationTarget
21150  */
21151 enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
21152
21153 /**
21154  * Checks if two ConfirmationTargets contain equal inner contents.
21155  */
21156 uint64_t ConfirmationTarget_hash(const enum LDKConfirmationTarget *NONNULL_PTR o);
21157
21158 /**
21159  * Checks if two ConfirmationTargets contain equal inner contents.
21160  * This ignores pointers and is_owned flags and looks at the values in fields.
21161  */
21162 bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
21163
21164 /**
21165  * Calls the free function if one is set
21166  */
21167 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
21168
21169 /**
21170  * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
21171  */
21172 void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj);
21173
21174 /**
21175  * Creates a copy of the MonitorUpdateId
21176  */
21177 struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
21178
21179 /**
21180  * Checks if two MonitorUpdateIds contain equal inner contents.
21181  */
21182 uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
21183
21184 /**
21185  * Checks if two MonitorUpdateIds contain equal inner contents.
21186  * This ignores pointers and is_owned flags and looks at the values in fields.
21187  * Two objects with NULL inner values will be considered "equal" here.
21188  */
21189 bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b);
21190
21191 /**
21192  * Calls the free function if one is set
21193  */
21194 void Persist_free(struct LDKPersist this_ptr);
21195
21196 /**
21197  * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL.
21198  */
21199 void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj);
21200
21201 /**
21202  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
21203  */
21204 void ChainMonitor_free(struct LDKChainMonitor this_obj);
21205
21206 /**
21207  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
21208  *
21209  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
21210  * will call back to it indicating transactions and outputs of interest. This allows clients to
21211  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
21212  * always need to fetch full blocks absent another means for determining which blocks contain
21213  * transactions relevant to the watched channels.
21214  */
21215 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
21216
21217 /**
21218  * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
21219  * claims which are awaiting confirmation.
21220  *
21221  * Includes the balances from each [`ChannelMonitor`] *except* those included in
21222  * `ignored_channels`, allowing you to filter out balances from channels which are still open
21223  * (and whose balance should likely be pulled from the [`ChannelDetails`]).
21224  *
21225  * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
21226  * inclusion in the return value.
21227  */
21228 MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
21229
21230 /**
21231  * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no
21232  * such [`ChannelMonitor`] is currently being monitored for.
21233  *
21234  * Note that the result holds a mutex over our monitor set, and should not be held
21235  * indefinitely.
21236  */
21237 MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo);
21238
21239 /**
21240  * Lists the funding outpoint of each [`ChannelMonitor`] being monitored.
21241  *
21242  * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always
21243  * monitoring for on-chain state resolutions.
21244  */
21245 MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
21246
21247 /**
21248  * Lists the pending updates for each [`ChannelMonitor`] (by `OutPoint` being monitored).
21249  */
21250 MUST_USE_RES struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ChainMonitor_list_pending_monitor_updates(const struct LDKChainMonitor *NONNULL_PTR this_arg);
21251
21252 /**
21253  * Indicates the persistence of a [`ChannelMonitor`] has completed after
21254  * [`ChannelMonitorUpdateStatus::InProgress`] was returned from an update operation.
21255  *
21256  * Thus, the anticipated use is, at a high level:
21257  *  1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
21258  *     update to disk and begins updating any remote (e.g. watchtower/backup) copies,
21259  *     returning [`ChannelMonitorUpdateStatus::InProgress`],
21260  *  2) once all remote copies are updated, you call this function with the
21261  *     `completed_update_id` that completed, and once all pending updates have completed the
21262  *     channel will be re-enabled.
21263  *
21264  * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
21265  * registered [`ChannelMonitor`]s.
21266  */
21267 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);
21268
21269 /**
21270  * Constructs a new Listen which calls the relevant methods on this_arg.
21271  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
21272  */
21273 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
21274
21275 /**
21276  * Constructs a new Confirm which calls the relevant methods on this_arg.
21277  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
21278  */
21279 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
21280
21281 /**
21282  * Constructs a new Watch which calls the relevant methods on this_arg.
21283  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
21284  */
21285 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
21286
21287 /**
21288  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
21289  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
21290  */
21291 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
21292
21293 /**
21294  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
21295  */
21296 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
21297
21298 /**
21299  * The sequence number of this update. Updates *must* be replayed in-order according to this
21300  * sequence number (and updates may panic if they are not). The update_id values are strictly
21301  * increasing and increase by one for each new update, with one exception specified below.
21302  *
21303  * This sequence number is also used to track up to which points updates which returned
21304  * [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given
21305  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
21306  *
21307  * The only instance where update_id values are not strictly increasing is the case where we
21308  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
21309  * its docs for more details.
21310  *
21311  * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
21312  */
21313 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
21314
21315 /**
21316  * The sequence number of this update. Updates *must* be replayed in-order according to this
21317  * sequence number (and updates may panic if they are not). The update_id values are strictly
21318  * increasing and increase by one for each new update, with one exception specified below.
21319  *
21320  * This sequence number is also used to track up to which points updates which returned
21321  * [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given
21322  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
21323  *
21324  * The only instance where update_id values are not strictly increasing is the case where we
21325  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
21326  * its docs for more details.
21327  *
21328  * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
21329  */
21330 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
21331
21332 /**
21333  * Creates a copy of the ChannelMonitorUpdate
21334  */
21335 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
21336
21337 /**
21338  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
21339  */
21340 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
21341
21342 /**
21343  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
21344  */
21345 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
21346
21347 /**
21348  * Frees any resources used by the MonitorEvent
21349  */
21350 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
21351
21352 /**
21353  * Creates a copy of the MonitorEvent
21354  */
21355 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
21356
21357 /**
21358  * Utility method to constructs a new HTLCEvent-variant MonitorEvent
21359  */
21360 struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
21361
21362 /**
21363  * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
21364  */
21365 struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
21366
21367 /**
21368  * Utility method to constructs a new Completed-variant MonitorEvent
21369  */
21370 struct LDKMonitorEvent MonitorEvent_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id);
21371
21372 /**
21373  * Utility method to constructs a new UpdateFailed-variant MonitorEvent
21374  */
21375 struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a);
21376
21377 /**
21378  * Checks if two MonitorEvents contain equal inner contents.
21379  * This ignores pointers and is_owned flags and looks at the values in fields.
21380  */
21381 bool MonitorEvent_eq(const struct LDKMonitorEvent *NONNULL_PTR a, const struct LDKMonitorEvent *NONNULL_PTR b);
21382
21383 /**
21384  * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
21385  */
21386 struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj);
21387
21388 /**
21389  * Read a MonitorEvent from a byte array, created by MonitorEvent_write
21390  */
21391 struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser);
21392
21393 /**
21394  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
21395  */
21396 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
21397
21398 /**
21399  * Creates a copy of the HTLCUpdate
21400  */
21401 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
21402
21403 /**
21404  * Checks if two HTLCUpdates contain equal inner contents.
21405  * This ignores pointers and is_owned flags and looks at the values in fields.
21406  * Two objects with NULL inner values will be considered "equal" here.
21407  */
21408 bool HTLCUpdate_eq(const struct LDKHTLCUpdate *NONNULL_PTR a, const struct LDKHTLCUpdate *NONNULL_PTR b);
21409
21410 /**
21411  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
21412  */
21413 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
21414
21415 /**
21416  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
21417  */
21418 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
21419
21420 /**
21421  * Frees any resources used by the Balance
21422  */
21423 void Balance_free(struct LDKBalance this_ptr);
21424
21425 /**
21426  * Creates a copy of the Balance
21427  */
21428 struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
21429
21430 /**
21431  * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
21432  */
21433 struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
21434
21435 /**
21436  * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
21437  */
21438 struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
21439
21440 /**
21441  * Utility method to constructs a new ContentiousClaimable-variant Balance
21442  */
21443 struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height);
21444
21445 /**
21446  * Utility method to constructs a new MaybeTimeoutClaimableHTLC-variant Balance
21447  */
21448 struct LDKBalance Balance_maybe_timeout_claimable_htlc(uint64_t claimable_amount_satoshis, uint32_t claimable_height);
21449
21450 /**
21451  * Utility method to constructs a new MaybePreimageClaimableHTLC-variant Balance
21452  */
21453 struct LDKBalance Balance_maybe_preimage_claimable_htlc(uint64_t claimable_amount_satoshis, uint32_t expiry_height);
21454
21455 /**
21456  * Utility method to constructs a new CounterpartyRevokedOutputClaimable-variant Balance
21457  */
21458 struct LDKBalance Balance_counterparty_revoked_output_claimable(uint64_t claimable_amount_satoshis);
21459
21460 /**
21461  * Checks if two Balances contain equal inner contents.
21462  * This ignores pointers and is_owned flags and looks at the values in fields.
21463  */
21464 bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
21465
21466 /**
21467  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
21468  */
21469 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
21470
21471 /**
21472  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
21473  */
21474 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
21475
21476 /**
21477  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
21478  * itself.
21479  *
21480  * panics if the given update is not the next update by update_id.
21481  */
21482 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);
21483
21484 /**
21485  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
21486  * ChannelMonitor.
21487  */
21488 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
21489
21490 /**
21491  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
21492  */
21493 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
21494
21495 /**
21496  * Gets a list of txids, with their output scripts (in the order they appear in the
21497  * transaction), which we must learn about spends of via block_connected().
21498  */
21499 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
21500
21501 /**
21502  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
21503  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
21504  * have been registered.
21505  */
21506 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
21507
21508 /**
21509  * Get the list of HTLCs who's status has been updated on chain. This should be called by
21510  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
21511  */
21512 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
21513
21514 /**
21515  * Gets the list of pending events which were generated by previous actions, clearing the list
21516  * in the process.
21517  *
21518  * This is called by the [`EventsProvider::process_pending_events`] implementation for
21519  * [`ChainMonitor`].
21520  *
21521  * [`EventsProvider::process_pending_events`]: crate::util::events::EventsProvider::process_pending_events
21522  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
21523  */
21524 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
21525
21526 /**
21527  * Gets the `node_id` of the counterparty for this channel.
21528  *
21529  * Will be `None` for channels constructed on LDK versions prior to 0.0.110 and always `Some`
21530  * otherwise.
21531  *
21532  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21533  */
21534 MUST_USE_RES struct LDKPublicKey ChannelMonitor_get_counterparty_node_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
21535
21536 /**
21537  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
21538  * the Channel was out-of-date.
21539  *
21540  * You may also use this to broadcast the latest local commitment transaction, either because
21541  * a monitor update failed with [`ChannelMonitorUpdateStatus::PermanentFailure`] or because we've
21542  * fallen behind (i.e. we've received proof that our counterparty side knows a revocation
21543  * secret we gave them that they shouldn't know).
21544  *
21545  * Broadcasting these transactions in the second case is UNSAFE, as they allow counterparty
21546  * side to punish you. Nevertheless you may want to broadcast them if counterparty doesn't
21547  * close channel with their commitment transaction after a substantial amount of time. Best
21548  * may be to contact the other node operator out-of-band to coordinate other options available
21549  * to you. In any-case, the choice is up to you.
21550  *
21551  * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure
21552  */
21553 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);
21554
21555 /**
21556  * Processes transactions in a newly connected block, which may result in any of the following:
21557  * - update the monitor's state against resolved HTLCs
21558  * - punish the counterparty in the case of seeing a revoked commitment transaction
21559  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
21560  * - detect settled outputs for later spending
21561  * - schedule and bump any in-flight claims
21562  *
21563  * Returns any new outputs to watch from `txdata`; after called, these are also included in
21564  * [`get_outputs_to_watch`].
21565  *
21566  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
21567  */
21568 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);
21569
21570 /**
21571  * Determines if the disconnected block contained any transactions of interest and updates
21572  * appropriately.
21573  */
21574 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);
21575
21576 /**
21577  * Processes transactions confirmed in a block with the given header and height, returning new
21578  * outputs to watch. See [`block_connected`] for details.
21579  *
21580  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
21581  * blocks. See [`chain::Confirm`] for calling expectations.
21582  *
21583  * [`block_connected`]: Self::block_connected
21584  */
21585 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);
21586
21587 /**
21588  * Processes a transaction that was reorganized out of the chain.
21589  *
21590  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
21591  * than blocks. See [`chain::Confirm`] for calling expectations.
21592  *
21593  * [`block_disconnected`]: Self::block_disconnected
21594  */
21595 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);
21596
21597 /**
21598  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
21599  * [`block_connected`] for details.
21600  *
21601  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
21602  * blocks. See [`chain::Confirm`] for calling expectations.
21603  *
21604  * [`block_connected`]: Self::block_connected
21605  */
21606 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);
21607
21608 /**
21609  * Returns the set of txids that should be monitored for re-organization out of the chain.
21610  */
21611 MUST_USE_RES struct LDKCVec_C2Tuple_TxidBlockHashZZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
21612
21613 /**
21614  * Gets the latest best block which was connected either via the [`chain::Listen`] or
21615  * [`chain::Confirm`] interfaces.
21616  */
21617 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
21618
21619 /**
21620  * Gets the balances in this channel which are either claimable by us if we were to
21621  * force-close the channel now or which are claimable on-chain (possibly awaiting
21622  * confirmation).
21623  *
21624  * Any balances in the channel which are available on-chain (excluding on-chain fees) are
21625  * included here until an [`Event::SpendableOutputs`] event has been generated for the
21626  * balance, or until our counterparty has claimed the balance and accrued several
21627  * confirmations on the claim transaction.
21628  *
21629  * Note that for `ChannelMonitors` which track a channel which went on-chain with versions of
21630  * LDK prior to 0.0.111, balances may not be fully captured if our counterparty broadcasted
21631  * a revoked state.
21632  *
21633  * See [`Balance`] for additional details on the types of claimable balances which
21634  * may be returned here and their meanings.
21635  */
21636 MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
21637
21638 /**
21639  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
21640  */
21641 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
21642
21643 /**
21644  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
21645  */
21646 void OutPoint_free(struct LDKOutPoint this_obj);
21647
21648 /**
21649  * The referenced transaction's txid.
21650  */
21651 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
21652
21653 /**
21654  * The referenced transaction's txid.
21655  */
21656 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21657
21658 /**
21659  * The index of the referenced output in its transaction's vout.
21660  */
21661 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
21662
21663 /**
21664  * The index of the referenced output in its transaction's vout.
21665  */
21666 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
21667
21668 /**
21669  * Constructs a new OutPoint given each field
21670  */
21671 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
21672
21673 /**
21674  * Creates a copy of the OutPoint
21675  */
21676 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
21677
21678 /**
21679  * Checks if two OutPoints contain equal inner contents.
21680  * This ignores pointers and is_owned flags and looks at the values in fields.
21681  * Two objects with NULL inner values will be considered "equal" here.
21682  */
21683 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
21684
21685 /**
21686  * Checks if two OutPoints contain equal inner contents.
21687  */
21688 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
21689
21690 /**
21691  * Convert an `OutPoint` to a lightning channel id.
21692  */
21693 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
21694
21695 /**
21696  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
21697  */
21698 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
21699
21700 /**
21701  * Read a OutPoint from a byte array, created by OutPoint_write
21702  */
21703 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
21704
21705 /**
21706  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
21707  */
21708 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
21709
21710 /**
21711  * The outpoint which is spendable.
21712  */
21713 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
21714
21715 /**
21716  * The outpoint which is spendable.
21717  */
21718 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
21719
21720 /**
21721  * Per commitment point to derive the delayed payment key by key holder.
21722  */
21723 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
21724
21725 /**
21726  * Per commitment point to derive the delayed payment key by key holder.
21727  */
21728 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21729
21730 /**
21731  * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in
21732  * the witness_script.
21733  */
21734 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
21735
21736 /**
21737  * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in
21738  * the witness_script.
21739  */
21740 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
21741
21742 /**
21743  * The output which is referenced by the given outpoint.
21744  *
21745  * Returns a copy of the field.
21746  */
21747 struct LDKTxOut DelayedPaymentOutputDescriptor_get_output(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
21748
21749 /**
21750  * The output which is referenced by the given outpoint.
21751  */
21752 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
21753
21754 /**
21755  * The revocation point specific to the commitment transaction which was broadcast. Used to
21756  * derive the witnessScript for this output.
21757  */
21758 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
21759
21760 /**
21761  * The revocation point specific to the commitment transaction which was broadcast. Used to
21762  * derive the witnessScript for this output.
21763  */
21764 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21765
21766 /**
21767  * Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`].
21768  * This may be useful in re-deriving keys used in the channel to spend the output.
21769  */
21770 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
21771
21772 /**
21773  * Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`].
21774  * This may be useful in re-deriving keys used in the channel to spend the output.
21775  */
21776 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21777
21778 /**
21779  * The value of the channel which this output originated from, possibly indirectly.
21780  */
21781 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
21782
21783 /**
21784  * The value of the channel which this output originated from, possibly indirectly.
21785  */
21786 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
21787
21788 /**
21789  * Constructs a new DelayedPaymentOutputDescriptor given each field
21790  */
21791 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);
21792
21793 /**
21794  * Creates a copy of the DelayedPaymentOutputDescriptor
21795  */
21796 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
21797
21798 /**
21799  * Checks if two DelayedPaymentOutputDescriptors contain equal inner contents.
21800  * This ignores pointers and is_owned flags and looks at the values in fields.
21801  * Two objects with NULL inner values will be considered "equal" here.
21802  */
21803 bool DelayedPaymentOutputDescriptor_eq(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR b);
21804
21805 /**
21806  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
21807  */
21808 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
21809
21810 /**
21811  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
21812  */
21813 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
21814
21815 /**
21816  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
21817  */
21818 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
21819
21820 /**
21821  * The outpoint which is spendable.
21822  */
21823 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
21824
21825 /**
21826  * The outpoint which is spendable.
21827  */
21828 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
21829
21830 /**
21831  * The output which is referenced by the given outpoint.
21832  *
21833  * Returns a copy of the field.
21834  */
21835 struct LDKTxOut StaticPaymentOutputDescriptor_get_output(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
21836
21837 /**
21838  * The output which is referenced by the given outpoint.
21839  */
21840 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
21841
21842 /**
21843  * Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`].
21844  * This may be useful in re-deriving keys used in the channel to spend the output.
21845  */
21846 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
21847
21848 /**
21849  * Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`].
21850  * This may be useful in re-deriving keys used in the channel to spend the output.
21851  */
21852 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21853
21854 /**
21855  * The value of the channel which this transactions spends.
21856  */
21857 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
21858
21859 /**
21860  * The value of the channel which this transactions spends.
21861  */
21862 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
21863
21864 /**
21865  * Constructs a new StaticPaymentOutputDescriptor given each field
21866  */
21867 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);
21868
21869 /**
21870  * Creates a copy of the StaticPaymentOutputDescriptor
21871  */
21872 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
21873
21874 /**
21875  * Checks if two StaticPaymentOutputDescriptors contain equal inner contents.
21876  * This ignores pointers and is_owned flags and looks at the values in fields.
21877  * Two objects with NULL inner values will be considered "equal" here.
21878  */
21879 bool StaticPaymentOutputDescriptor_eq(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR b);
21880
21881 /**
21882  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
21883  */
21884 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
21885
21886 /**
21887  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
21888  */
21889 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
21890
21891 /**
21892  * Frees any resources used by the SpendableOutputDescriptor
21893  */
21894 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
21895
21896 /**
21897  * Creates a copy of the SpendableOutputDescriptor
21898  */
21899 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
21900
21901 /**
21902  * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
21903  */
21904 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output);
21905
21906 /**
21907  * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
21908  */
21909 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a);
21910
21911 /**
21912  * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
21913  */
21914 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
21915
21916 /**
21917  * Checks if two SpendableOutputDescriptors contain equal inner contents.
21918  * This ignores pointers and is_owned flags and looks at the values in fields.
21919  */
21920 bool SpendableOutputDescriptor_eq(const struct LDKSpendableOutputDescriptor *NONNULL_PTR a, const struct LDKSpendableOutputDescriptor *NONNULL_PTR b);
21921
21922 /**
21923  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
21924  */
21925 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
21926
21927 /**
21928  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
21929  */
21930 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
21931
21932 /**
21933  * Calls the free function if one is set
21934  */
21935 void BaseSign_free(struct LDKBaseSign this_ptr);
21936
21937 /**
21938  * Calls the free function if one is set
21939  */
21940 void Sign_free(struct LDKSign this_ptr);
21941
21942 /**
21943  * Creates a copy of the Recipient
21944  */
21945 enum LDKRecipient Recipient_clone(const enum LDKRecipient *NONNULL_PTR orig);
21946
21947 /**
21948  * Utility method to constructs a new Node-variant Recipient
21949  */
21950 enum LDKRecipient Recipient_node(void);
21951
21952 /**
21953  * Utility method to constructs a new PhantomNode-variant Recipient
21954  */
21955 enum LDKRecipient Recipient_phantom_node(void);
21956
21957 /**
21958  * Calls the free function if one is set
21959  */
21960 void KeysInterface_free(struct LDKKeysInterface this_ptr);
21961
21962 /**
21963  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
21964  */
21965 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
21966
21967 /**
21968  * Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the
21969  * holder's anchor output in a commitment transaction, if one is present.
21970  */
21971 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
21972
21973 /**
21974  * Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the
21975  * holder's anchor output in a commitment transaction, if one is present.
21976  */
21977 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
21978
21979 /**
21980  * Holder secret key for blinded revocation pubkey.
21981  */
21982 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
21983
21984 /**
21985  * Holder secret key for blinded revocation pubkey.
21986  */
21987 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
21988
21989 /**
21990  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions.
21991  */
21992 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
21993
21994 /**
21995  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions.
21996  */
21997 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
21998
21999 /**
22000  * Holder secret key used in an HTLC transaction.
22001  */
22002 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
22003
22004 /**
22005  * Holder secret key used in an HTLC transaction.
22006  */
22007 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
22008
22009 /**
22010  * Holder HTLC secret key used in commitment transaction HTLC outputs.
22011  */
22012 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
22013
22014 /**
22015  * Holder HTLC secret key used in commitment transaction HTLC outputs.
22016  */
22017 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
22018
22019 /**
22020  * Commitment seed.
22021  */
22022 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
22023
22024 /**
22025  * Commitment seed.
22026  */
22027 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22028
22029 /**
22030  * Creates a copy of the InMemorySigner
22031  */
22032 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
22033
22034 /**
22035  * Creates a new [`InMemorySigner`].
22036  */
22037 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);
22038
22039 /**
22040  * Returns the counterparty's pubkeys.
22041  *
22042  * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before.
22043  */
22044 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
22045
22046 /**
22047  * Returns the `contest_delay` value specified by our counterparty and applied on holder-broadcastable
22048  * transactions, i.e., the amount of time that we have to wait to recover our funds if we
22049  * broadcast a transaction.
22050  *
22051  * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before.
22052  */
22053 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
22054
22055 /**
22056  * Returns the `contest_delay` value specified by us and applied on transactions broadcastable
22057  * by our counterparty, i.e., the amount of time that they have to wait to recover their funds
22058  * if they broadcast a transaction.
22059  *
22060  * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before.
22061  */
22062 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
22063
22064 /**
22065  * Returns whether the holder is the initiator.
22066  *
22067  * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before.
22068  */
22069 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
22070
22071 /**
22072  * Funding outpoint
22073  *
22074  * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before.
22075  */
22076 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
22077
22078 /**
22079  * Returns a [`ChannelTransactionParameters`] for this channel, to be used when verifying or
22080  * building transactions.
22081  *
22082  * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before.
22083  */
22084 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
22085
22086 /**
22087  * Returns whether anchors should be used.
22088  *
22089  * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before.
22090  */
22091 MUST_USE_RES bool InMemorySigner_opt_anchors(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
22092
22093 /**
22094  * Sign the single input of `spend_tx` at index `input_idx`, which spends the output described
22095  * by `descriptor`, returning the witness stack for the input.
22096  *
22097  * Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`,
22098  * is not spending the outpoint described by [`descriptor.outpoint`],
22099  * or if an output descriptor `script_pubkey` does not match the one we can spend.
22100  *
22101  * [`descriptor.outpoint`]: StaticPaymentOutputDescriptor::outpoint
22102  */
22103 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);
22104
22105 /**
22106  * Sign the single input of `spend_tx` at index `input_idx` which spends the output
22107  * described by `descriptor`, returning the witness stack for the input.
22108  *
22109  * Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`,
22110  * is not spending the outpoint described by [`descriptor.outpoint`], does not have a
22111  * sequence set to [`descriptor.to_self_delay`], or if an output descriptor
22112  * `script_pubkey` does not match the one we can spend.
22113  *
22114  * [`descriptor.outpoint`]: DelayedPaymentOutputDescriptor::outpoint
22115  * [`descriptor.to_self_delay`]: DelayedPaymentOutputDescriptor::to_self_delay
22116  */
22117 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);
22118
22119 /**
22120  * Constructs a new BaseSign which calls the relevant methods on this_arg.
22121  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
22122  */
22123 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
22124
22125 /**
22126  * Constructs a new Sign which calls the relevant methods on this_arg.
22127  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
22128  */
22129 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
22130
22131 /**
22132  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
22133  */
22134 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
22135
22136 /**
22137  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
22138  */
22139 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKSecretKey arg);
22140
22141 /**
22142  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
22143  */
22144 void KeysManager_free(struct LDKKeysManager this_obj);
22145
22146 /**
22147  * Constructs a [`KeysManager`] from a 32-byte seed. If the seed is in some way biased (e.g.,
22148  * your CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
22149  * `starting_time` isn't strictly required to actually be a time, but it must absolutely,
22150  * without a doubt, be unique to this instance. ie if you start multiple times with the same
22151  * `seed`, `starting_time` must be unique to each run. Thus, the easiest way to achieve this
22152  * is to simply use the current time (with very high precision).
22153  *
22154  * The `seed` MUST be backed up safely prior to use so that the keys can be re-created, however,
22155  * obviously, `starting_time` should be unique every time you reload the library - it is only
22156  * used to generate new ephemeral key data (which will be stored by the individual channel if
22157  * necessary).
22158  *
22159  * Note that the seed is required to recover certain on-chain funds independent of
22160  * [`ChannelMonitor`] data, though a current copy of [`ChannelMonitor`] data is also required
22161  * for any channel, and some on-chain during-closing funds.
22162  *
22163  * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
22164  */
22165 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
22166
22167 /**
22168  * Derive an old [`Sign`] containing per-channel secrets based on a key derivation parameters.
22169  */
22170 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]);
22171
22172 /**
22173  * Creates a [`Transaction`] which spends the given descriptors to the given outputs, plus an
22174  * output to the given change destination (if sufficient change value remains). The
22175  * transaction will have a feerate, at least, of the given value.
22176  *
22177  * Returns `Err(())` if the output value is greater than the input value minus required fee,
22178  * if a descriptor was duplicated, or if an output descriptor `script_pubkey`
22179  * does not match the one we can spend.
22180  *
22181  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
22182  *
22183  * May panic if the [`SpendableOutputDescriptor`]s were not generated by channels which used
22184  * this [`KeysManager`] or one of the [`InMemorySigner`] created by this [`KeysManager`].
22185  */
22186 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);
22187
22188 /**
22189  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
22190  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
22191  */
22192 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
22193
22194 /**
22195  * Frees any resources used by the PhantomKeysManager, if is_owned is set and inner is non-NULL.
22196  */
22197 void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj);
22198
22199 /**
22200  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
22201  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
22202  */
22203 struct LDKKeysInterface PhantomKeysManager_as_KeysInterface(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
22204
22205 /**
22206  * Constructs a [`PhantomKeysManager`] given a 32-byte seed and an additional `cross_node_seed`
22207  * that is shared across all nodes that intend to participate in [phantom node payments]
22208  * together.
22209  *
22210  * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and
22211  * `starting_time_nanos`.
22212  *
22213  * `cross_node_seed` must be the same across all phantom payment-receiving nodes and also the
22214  * same across restarts, or else inbound payments may fail.
22215  *
22216  * [phantom node payments]: PhantomKeysManager
22217  */
22218 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]);
22219
22220 /**
22221  * See [`KeysManager::spend_spendable_outputs`] for documentation on this method.
22222  */
22223 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);
22224
22225 /**
22226  * See [`KeysManager::derive_channel_keys`] for documentation on this method.
22227  */
22228 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]);
22229
22230 /**
22231  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
22232  */
22233 void ChannelManager_free(struct LDKChannelManager this_obj);
22234
22235 /**
22236  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
22237  */
22238 void ChainParameters_free(struct LDKChainParameters this_obj);
22239
22240 /**
22241  * The network for determining the `chain_hash` in Lightning messages.
22242  */
22243 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
22244
22245 /**
22246  * The network for determining the `chain_hash` in Lightning messages.
22247  */
22248 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
22249
22250 /**
22251  * The hash and height of the latest block successfully connected.
22252  *
22253  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
22254  */
22255 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
22256
22257 /**
22258  * The hash and height of the latest block successfully connected.
22259  *
22260  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
22261  */
22262 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
22263
22264 /**
22265  * Constructs a new ChainParameters given each field
22266  */
22267 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
22268
22269 /**
22270  * Creates a copy of the ChainParameters
22271  */
22272 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
22273
22274 /**
22275  * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL.
22276  */
22277 void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
22278
22279 /**
22280  * Base routing fee in millisatoshis.
22281  */
22282 uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
22283
22284 /**
22285  * Base routing fee in millisatoshis.
22286  */
22287 void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
22288
22289 /**
22290  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
22291  */
22292 uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
22293
22294 /**
22295  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
22296  */
22297 void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
22298
22299 /**
22300  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
22301  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
22302  * `cltv_expiry_delta` for more details.
22303  */
22304 uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
22305
22306 /**
22307  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
22308  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
22309  * `cltv_expiry_delta` for more details.
22310  */
22311 void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
22312
22313 /**
22314  * Constructs a new CounterpartyForwardingInfo given each field
22315  */
22316 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);
22317
22318 /**
22319  * Creates a copy of the CounterpartyForwardingInfo
22320  */
22321 struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
22322
22323 /**
22324  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
22325  */
22326 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
22327
22328 /**
22329  * The node_id of our counterparty
22330  */
22331 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
22332
22333 /**
22334  * The node_id of our counterparty
22335  */
22336 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22337
22338 /**
22339  * The Features the channel counterparty provided upon last connection.
22340  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
22341  * many routing-relevant features are present in the init context.
22342  */
22343 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
22344
22345 /**
22346  * The Features the channel counterparty provided upon last connection.
22347  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
22348  * many routing-relevant features are present in the init context.
22349  */
22350 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
22351
22352 /**
22353  * The value, in satoshis, that must always be held in the channel for our counterparty. This
22354  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
22355  * claiming at least this value on chain.
22356  *
22357  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
22358  *
22359  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
22360  */
22361 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
22362
22363 /**
22364  * The value, in satoshis, that must always be held in the channel for our counterparty. This
22365  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
22366  * claiming at least this value on chain.
22367  *
22368  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
22369  *
22370  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
22371  */
22372 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
22373
22374 /**
22375  * Information on the fees and requirements that the counterparty requires when forwarding
22376  * payments to us through this channel.
22377  *
22378  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22379  */
22380 struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
22381
22382 /**
22383  * Information on the fees and requirements that the counterparty requires when forwarding
22384  * payments to us through this channel.
22385  *
22386  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22387  */
22388 void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
22389
22390 /**
22391  * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
22392  * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
22393  * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
22394  */
22395 struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_minimum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
22396
22397 /**
22398  * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
22399  * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
22400  * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
22401  */
22402 void ChannelCounterparty_set_outbound_htlc_minimum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
22403
22404 /**
22405  * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
22406  */
22407 struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_maximum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
22408
22409 /**
22410  * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
22411  */
22412 void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
22413
22414 /**
22415  * Constructs a new ChannelCounterparty given each field
22416  */
22417 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);
22418
22419 /**
22420  * Creates a copy of the ChannelCounterparty
22421  */
22422 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
22423
22424 /**
22425  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
22426  */
22427 void ChannelDetails_free(struct LDKChannelDetails this_obj);
22428
22429 /**
22430  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
22431  * thereafter this is the txid of the funding transaction xor the funding transaction output).
22432  * Note that this means this value is *not* persistent - it can change once during the
22433  * lifetime of the channel.
22434  */
22435 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
22436
22437 /**
22438  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
22439  * thereafter this is the txid of the funding transaction xor the funding transaction output).
22440  * Note that this means this value is *not* persistent - it can change once during the
22441  * lifetime of the channel.
22442  */
22443 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22444
22445 /**
22446  * Parameters which apply to our counterparty. See individual fields for more information.
22447  */
22448 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22449
22450 /**
22451  * Parameters which apply to our counterparty. See individual fields for more information.
22452  */
22453 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
22454
22455 /**
22456  * The Channel's funding transaction output, if we've negotiated the funding transaction with
22457  * our counterparty already.
22458  *
22459  * Note that, if this has been set, `channel_id` will be equivalent to
22460  * `funding_txo.unwrap().to_channel_id()`.
22461  *
22462  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22463  */
22464 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22465
22466 /**
22467  * The Channel's funding transaction output, if we've negotiated the funding transaction with
22468  * our counterparty already.
22469  *
22470  * Note that, if this has been set, `channel_id` will be equivalent to
22471  * `funding_txo.unwrap().to_channel_id()`.
22472  *
22473  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22474  */
22475 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
22476
22477 /**
22478  * The features which this channel operates with. See individual features for more info.
22479  *
22480  * `None` until negotiation completes and the channel type is finalized.
22481  *
22482  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22483  */
22484 struct LDKChannelTypeFeatures ChannelDetails_get_channel_type(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22485
22486 /**
22487  * The features which this channel operates with. See individual features for more info.
22488  *
22489  * `None` until negotiation completes and the channel type is finalized.
22490  *
22491  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22492  */
22493 void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
22494
22495 /**
22496  * The position of the funding transaction in the chain. None if the funding transaction has
22497  * not yet been confirmed and the channel fully opened.
22498  *
22499  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
22500  * payments instead of this. See [`get_inbound_payment_scid`].
22501  *
22502  * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
22503  * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
22504  *
22505  * [`inbound_scid_alias`]: Self::inbound_scid_alias
22506  * [`outbound_scid_alias`]: Self::outbound_scid_alias
22507  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
22508  * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
22509  * [`confirmations_required`]: Self::confirmations_required
22510  */
22511 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22512
22513 /**
22514  * The position of the funding transaction in the chain. None if the funding transaction has
22515  * not yet been confirmed and the channel fully opened.
22516  *
22517  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
22518  * payments instead of this. See [`get_inbound_payment_scid`].
22519  *
22520  * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
22521  * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
22522  *
22523  * [`inbound_scid_alias`]: Self::inbound_scid_alias
22524  * [`outbound_scid_alias`]: Self::outbound_scid_alias
22525  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
22526  * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
22527  * [`confirmations_required`]: Self::confirmations_required
22528  */
22529 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
22530
22531 /**
22532  * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
22533  * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
22534  * the channel has not yet been confirmed (as long as [`confirmations_required`] is
22535  * `Some(0)`).
22536  *
22537  * This will be `None` as long as the channel is not available for routing outbound payments.
22538  *
22539  * [`short_channel_id`]: Self::short_channel_id
22540  * [`confirmations_required`]: Self::confirmations_required
22541  */
22542 struct LDKCOption_u64Z ChannelDetails_get_outbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22543
22544 /**
22545  * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
22546  * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
22547  * the channel has not yet been confirmed (as long as [`confirmations_required`] is
22548  * `Some(0)`).
22549  *
22550  * This will be `None` as long as the channel is not available for routing outbound payments.
22551  *
22552  * [`short_channel_id`]: Self::short_channel_id
22553  * [`confirmations_required`]: Self::confirmations_required
22554  */
22555 void ChannelDetails_set_outbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
22556
22557 /**
22558  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
22559  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
22560  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
22561  * when they see a payment to be routed to us.
22562  *
22563  * Our counterparty may choose to rotate this value at any time, though will always recognize
22564  * previous values for inbound payment forwarding.
22565  *
22566  * [`short_channel_id`]: Self::short_channel_id
22567  */
22568 struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22569
22570 /**
22571  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
22572  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
22573  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
22574  * when they see a payment to be routed to us.
22575  *
22576  * Our counterparty may choose to rotate this value at any time, though will always recognize
22577  * previous values for inbound payment forwarding.
22578  *
22579  * [`short_channel_id`]: Self::short_channel_id
22580  */
22581 void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
22582
22583 /**
22584  * The value, in satoshis, of this channel as appears in the funding output
22585  */
22586 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22587
22588 /**
22589  * The value, in satoshis, of this channel as appears in the funding output
22590  */
22591 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
22592
22593 /**
22594  * The value, in satoshis, that must always be held in the channel for us. This value ensures
22595  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
22596  * this value on chain.
22597  *
22598  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
22599  *
22600  * This value will be `None` for outbound channels until the counterparty accepts the channel.
22601  *
22602  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
22603  */
22604 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22605
22606 /**
22607  * The value, in satoshis, that must always be held in the channel for us. This value ensures
22608  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
22609  * this value on chain.
22610  *
22611  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
22612  *
22613  * This value will be `None` for outbound channels until the counterparty accepts the channel.
22614  *
22615  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
22616  */
22617 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
22618
22619 /**
22620  * The `user_channel_id` passed in to create_channel, or a random value if the channel was
22621  * inbound. This may be zero for inbound channels serialized with LDK versions prior to
22622  * 0.0.113.
22623  */
22624 struct LDKU128 ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22625
22626 /**
22627  * The `user_channel_id` passed in to create_channel, or a random value if the channel was
22628  * inbound. This may be zero for inbound channels serialized with LDK versions prior to
22629  * 0.0.113.
22630  */
22631 void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKU128 val);
22632
22633 /**
22634  * Our total balance.  This is the amount we would get if we close the channel.
22635  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
22636  * amount is not likely to be recoverable on close.
22637  *
22638  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
22639  * balance is not available for inclusion in new outbound HTLCs). This further does not include
22640  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
22641  * This does not consider any on-chain fees.
22642  *
22643  * See also [`ChannelDetails::outbound_capacity_msat`]
22644  */
22645 uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22646
22647 /**
22648  * Our total balance.  This is the amount we would get if we close the channel.
22649  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
22650  * amount is not likely to be recoverable on close.
22651  *
22652  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
22653  * balance is not available for inclusion in new outbound HTLCs). This further does not include
22654  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
22655  * This does not consider any on-chain fees.
22656  *
22657  * See also [`ChannelDetails::outbound_capacity_msat`]
22658  */
22659 void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
22660
22661 /**
22662  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
22663  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
22664  * available for inclusion in new outbound HTLCs). This further does not include any pending
22665  * outgoing HTLCs which are awaiting some other resolution to be sent.
22666  *
22667  * See also [`ChannelDetails::balance_msat`]
22668  *
22669  * This value is not exact. Due to various in-flight changes, feerate changes, and our
22670  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
22671  * should be able to spend nearly this amount.
22672  */
22673 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22674
22675 /**
22676  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
22677  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
22678  * available for inclusion in new outbound HTLCs). This further does not include any pending
22679  * outgoing HTLCs which are awaiting some other resolution to be sent.
22680  *
22681  * See also [`ChannelDetails::balance_msat`]
22682  *
22683  * This value is not exact. Due to various in-flight changes, feerate changes, and our
22684  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
22685  * should be able to spend nearly this amount.
22686  */
22687 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
22688
22689 /**
22690  * The available outbound capacity for sending a single HTLC to the remote peer. This is
22691  * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
22692  * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
22693  * to use a limit as close as possible to the HTLC limit we can currently send.
22694  *
22695  * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
22696  */
22697 uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22698
22699 /**
22700  * The available outbound capacity for sending a single HTLC to the remote peer. This is
22701  * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
22702  * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
22703  * to use a limit as close as possible to the HTLC limit we can currently send.
22704  *
22705  * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
22706  */
22707 void ChannelDetails_set_next_outbound_htlc_limit_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
22708
22709 /**
22710  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
22711  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
22712  * available for inclusion in new inbound HTLCs).
22713  * Note that there are some corner cases not fully handled here, so the actual available
22714  * inbound capacity may be slightly higher than this.
22715  *
22716  * This value is not exact. Due to various in-flight changes, feerate changes, and our
22717  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
22718  * However, our counterparty should be able to spend nearly this amount.
22719  */
22720 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22721
22722 /**
22723  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
22724  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
22725  * available for inclusion in new inbound HTLCs).
22726  * Note that there are some corner cases not fully handled here, so the actual available
22727  * inbound capacity may be slightly higher than this.
22728  *
22729  * This value is not exact. Due to various in-flight changes, feerate changes, and our
22730  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
22731  * However, our counterparty should be able to spend nearly this amount.
22732  */
22733 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
22734
22735 /**
22736  * The number of required confirmations on the funding transaction before the funding will be
22737  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
22738  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
22739  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
22740  * [`ChannelHandshakeLimits::max_minimum_depth`].
22741  *
22742  * This value will be `None` for outbound channels until the counterparty accepts the channel.
22743  *
22744  * [`is_outbound`]: ChannelDetails::is_outbound
22745  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
22746  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
22747  */
22748 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22749
22750 /**
22751  * The number of required confirmations on the funding transaction before the funding will be
22752  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
22753  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
22754  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
22755  * [`ChannelHandshakeLimits::max_minimum_depth`].
22756  *
22757  * This value will be `None` for outbound channels until the counterparty accepts the channel.
22758  *
22759  * [`is_outbound`]: ChannelDetails::is_outbound
22760  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
22761  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
22762  */
22763 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
22764
22765 /**
22766  * The current number of confirmations on the funding transaction.
22767  *
22768  * This value will be `None` for objects serialized with LDK versions prior to 0.0.113.
22769  */
22770 struct LDKCOption_u32Z ChannelDetails_get_confirmations(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22771
22772 /**
22773  * The current number of confirmations on the funding transaction.
22774  *
22775  * This value will be `None` for objects serialized with LDK versions prior to 0.0.113.
22776  */
22777 void ChannelDetails_set_confirmations(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
22778
22779 /**
22780  * The number of blocks (after our commitment transaction confirms) that we will need to wait
22781  * until we can claim our funds after we force-close the channel. During this time our
22782  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
22783  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
22784  * time to claim our non-HTLC-encumbered funds.
22785  *
22786  * This value will be `None` for outbound channels until the counterparty accepts the channel.
22787  */
22788 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22789
22790 /**
22791  * The number of blocks (after our commitment transaction confirms) that we will need to wait
22792  * until we can claim our funds after we force-close the channel. During this time our
22793  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
22794  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
22795  * time to claim our non-HTLC-encumbered funds.
22796  *
22797  * This value will be `None` for outbound channels until the counterparty accepts the channel.
22798  */
22799 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
22800
22801 /**
22802  * True if the channel was initiated (and thus funded) by us.
22803  */
22804 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22805
22806 /**
22807  * True if the channel was initiated (and thus funded) by us.
22808  */
22809 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
22810
22811 /**
22812  * True if the channel is confirmed, channel_ready messages have been exchanged, and the
22813  * channel is not currently being shut down. `channel_ready` message exchange implies the
22814  * required confirmation count has been reached (and we were connected to the peer at some
22815  * point after the funding transaction received enough confirmations). The required
22816  * confirmation count is provided in [`confirmations_required`].
22817  *
22818  * [`confirmations_required`]: ChannelDetails::confirmations_required
22819  */
22820 bool ChannelDetails_get_is_channel_ready(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22821
22822 /**
22823  * True if the channel is confirmed, channel_ready messages have been exchanged, and the
22824  * channel is not currently being shut down. `channel_ready` message exchange implies the
22825  * required confirmation count has been reached (and we were connected to the peer at some
22826  * point after the funding transaction received enough confirmations). The required
22827  * confirmation count is provided in [`confirmations_required`].
22828  *
22829  * [`confirmations_required`]: ChannelDetails::confirmations_required
22830  */
22831 void ChannelDetails_set_is_channel_ready(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
22832
22833 /**
22834  * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
22835  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
22836  *
22837  * This is a strict superset of `is_channel_ready`.
22838  */
22839 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22840
22841 /**
22842  * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
22843  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
22844  *
22845  * This is a strict superset of `is_channel_ready`.
22846  */
22847 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
22848
22849 /**
22850  * True if this channel is (or will be) publicly-announced.
22851  */
22852 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22853
22854 /**
22855  * True if this channel is (or will be) publicly-announced.
22856  */
22857 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
22858
22859 /**
22860  * The smallest value HTLC (in msat) we will accept, for this channel. This field
22861  * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
22862  */
22863 struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22864
22865 /**
22866  * The smallest value HTLC (in msat) we will accept, for this channel. This field
22867  * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
22868  */
22869 void ChannelDetails_set_inbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
22870
22871 /**
22872  * The largest value HTLC (in msat) we currently will accept, for this channel.
22873  */
22874 struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_maximum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22875
22876 /**
22877  * The largest value HTLC (in msat) we currently will accept, for this channel.
22878  */
22879 void ChannelDetails_set_inbound_htlc_maximum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
22880
22881 /**
22882  * Set of configurable parameters that affect channel operation.
22883  *
22884  * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
22885  *
22886  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22887  */
22888 struct LDKChannelConfig ChannelDetails_get_config(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
22889
22890 /**
22891  * Set of configurable parameters that affect channel operation.
22892  *
22893  * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
22894  *
22895  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22896  */
22897 void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
22898
22899 /**
22900  * Constructs a new ChannelDetails given each field
22901  */
22902 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, struct LDKU128 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_u32Z confirmations_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);
22903
22904 /**
22905  * Creates a copy of the ChannelDetails
22906  */
22907 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
22908
22909 /**
22910  * Gets the current SCID which should be used to identify this channel for inbound payments.
22911  * This should be used for providing invoice hints or in any other context where our
22912  * counterparty will forward a payment to us.
22913  *
22914  * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the
22915  * [`ChannelDetails::short_channel_id`]. See those for more information.
22916  */
22917 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
22918
22919 /**
22920  * Gets the current SCID which should be used to identify this channel for outbound payments.
22921  * This should be used in [`Route`]s to describe the first hop or in other contexts where
22922  * we're sending or forwarding a payment outbound over this channel.
22923  *
22924  * This is either the [`ChannelDetails::short_channel_id`], if set, or the
22925  * [`ChannelDetails::outbound_scid_alias`]. See those for more information.
22926  */
22927 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
22928
22929 /**
22930  * Frees any resources used by the PaymentSendFailure
22931  */
22932 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
22933
22934 /**
22935  * Creates a copy of the PaymentSendFailure
22936  */
22937 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
22938
22939 /**
22940  * Utility method to constructs a new ParameterError-variant PaymentSendFailure
22941  */
22942 struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a);
22943
22944 /**
22945  * Utility method to constructs a new PathParameterError-variant PaymentSendFailure
22946  */
22947 struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a);
22948
22949 /**
22950  * Utility method to constructs a new AllFailedResendSafe-variant PaymentSendFailure
22951  */
22952 struct LDKPaymentSendFailure PaymentSendFailure_all_failed_resend_safe(struct LDKCVec_APIErrorZ a);
22953
22954 /**
22955  * Utility method to constructs a new DuplicatePayment-variant PaymentSendFailure
22956  */
22957 struct LDKPaymentSendFailure PaymentSendFailure_duplicate_payment(void);
22958
22959 /**
22960  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
22961  */
22962 struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id);
22963
22964 /**
22965  * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL.
22966  */
22967 void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj);
22968
22969 /**
22970  * The list of channels to be included in the invoice route hints.
22971  */
22972 struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
22973
22974 /**
22975  * The list of channels to be included in the invoice route hints.
22976  */
22977 void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val);
22978
22979 /**
22980  * A fake scid used for representing the phantom node's fake channel in generating the invoice
22981  * route hints.
22982  */
22983 uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
22984
22985 /**
22986  * A fake scid used for representing the phantom node's fake channel in generating the invoice
22987  * route hints.
22988  */
22989 void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val);
22990
22991 /**
22992  * The pubkey of the real backing node that would ultimately receive the payment.
22993  */
22994 struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
22995
22996 /**
22997  * The pubkey of the real backing node that would ultimately receive the payment.
22998  */
22999 void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23000
23001 /**
23002  * Constructs a new PhantomRouteHints given each field
23003  */
23004 MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg);
23005
23006 /**
23007  * Creates a copy of the PhantomRouteHints
23008  */
23009 struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig);
23010
23011 /**
23012  * Constructs a new ChannelManager to hold several channels and route between them.
23013  *
23014  * This is the main \"logic hub\" for all channel-related actions, and implements
23015  * ChannelMessageHandler.
23016  *
23017  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
23018  *
23019  * Users need to notify the new ChannelManager when a new block is connected or
23020  * disconnected using its `block_connected` and `block_disconnected` methods, starting
23021  * from after `params.latest_hash`.
23022  */
23023 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);
23024
23025 /**
23026  * Gets the current configuration applied to all new channels.
23027  */
23028 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
23029
23030 /**
23031  * Creates a new outbound channel to the given remote node and with the given value.
23032  *
23033  * `user_channel_id` will be provided back as in
23034  * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
23035  * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to a
23036  * randomized value for inbound channels. `user_channel_id` has no meaning inside of LDK, it
23037  * is simply copied to events and otherwise ignored.
23038  *
23039  * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
23040  * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
23041  *
23042  * Note that we do not check if you are currently connected to the given peer. If no
23043  * connection is available, the outbound `open_channel` message may fail to send, resulting in
23044  * the channel eventually being silently forgotten (dropped on reload).
23045  *
23046  * Returns the new Channel's temporary `channel_id`. This ID will appear as
23047  * [`Event::FundingGenerationReady::temporary_channel_id`] and in
23048  * [`ChannelDetails::channel_id`] until after
23049  * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
23050  * one derived from the funding transaction's TXID. If the counterparty rejects the channel
23051  * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
23052  *
23053  * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
23054  * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
23055  * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
23056  *
23057  * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
23058  */
23059 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, struct LDKU128 user_channel_id, struct LDKUserConfig override_config);
23060
23061 /**
23062  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
23063  * more information.
23064  */
23065 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
23066
23067 /**
23068  * Gets the list of usable channels, in random order. Useful as an argument to [`find_route`]
23069  * to ensure non-announced channels are used.
23070  *
23071  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
23072  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
23073  * are.
23074  *
23075  * [`find_route`]: crate::routing::router::find_route
23076  */
23077 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
23078
23079 /**
23080  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
23081  * will be accepted on the given channel, and after additional timeout/the closing of all
23082  * pending HTLCs, the channel will be closed on chain.
23083  *
23084  *  * If we are the channel initiator, we will pay between our [`Background`] and
23085  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
23086  *    estimate.
23087  *  * If our counterparty is the channel initiator, we will require a channel closing
23088  *    transaction feerate of at least our [`Background`] feerate or the feerate which
23089  *    would appear on a force-closure transaction, whichever is lower. We will allow our
23090  *    counterparty to pay as much fee as they'd like, however.
23091  *
23092  * May generate a SendShutdown message event on success, which should be relayed.
23093  *
23094  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
23095  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
23096  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
23097  */
23098 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);
23099
23100 /**
23101  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
23102  * will be accepted on the given channel, and after additional timeout/the closing of all
23103  * pending HTLCs, the channel will be closed on chain.
23104  *
23105  * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
23106  * the channel being closed or not:
23107  *  * If we are the channel initiator, we will pay at least this feerate on the closing
23108  *    transaction. The upper-bound is set by
23109  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
23110  *    estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
23111  *  * If our counterparty is the channel initiator, we will refuse to accept a channel closure
23112  *    transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
23113  *    will appear on a force-closure transaction, whichever is lower).
23114  *
23115  * May generate a SendShutdown message event on success, which should be relayed.
23116  *
23117  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
23118  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
23119  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
23120  */
23121 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);
23122
23123 /**
23124  * Force closes a channel, immediately broadcasting the latest local transaction(s) and
23125  * rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to
23126  * the manager, or if the `counterparty_node_id` isn't the counterparty of the corresponding
23127  * channel.
23128  */
23129 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);
23130
23131 /**
23132  * Force closes a channel, rejecting new HTLCs on the given channel but skips broadcasting
23133  * the latest local transaction(s). Fails if `channel_id` is unknown to the manager, or if the
23134  * `counterparty_node_id` isn't the counterparty of the corresponding channel.
23135  *
23136  * You can always get the latest local transaction(s) to broadcast from
23137  * [`ChannelMonitor::get_latest_holder_commitment_txn`].
23138  */
23139 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);
23140
23141 /**
23142  * Force close all channels, immediately broadcasting the latest local commitment transaction
23143  * for each to the chain and rejecting new HTLCs on each.
23144  */
23145 void ChannelManager_force_close_all_channels_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg);
23146
23147 /**
23148  * Force close all channels rejecting new HTLCs on each but without broadcasting the latest
23149  * local transaction(s).
23150  */
23151 void ChannelManager_force_close_all_channels_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg);
23152
23153 /**
23154  * Sends a payment along a given route.
23155  *
23156  * Value parameters are provided via the last hop in route, see documentation for RouteHop
23157  * fields for more info.
23158  *
23159  * If a pending payment is currently in-flight with the same [`PaymentId`] provided, this
23160  * method will error with an [`APIError::InvalidRoute`]. Note, however, that once a payment
23161  * is no longer pending (either via [`ChannelManager::abandon_payment`], or handling of an
23162  * [`Event::PaymentSent`]) LDK will not stop you from sending a second payment with the same
23163  * [`PaymentId`].
23164  *
23165  * Thus, in order to ensure duplicate payments are not sent, you should implement your own
23166  * tracking of payments, including state to indicate once a payment has completed. Because you
23167  * should also ensure that [`PaymentHash`]es are not re-used, for simplicity, you should
23168  * consider using the [`PaymentHash`] as the key for tracking payments. In that case, the
23169  * [`PaymentId`] should be a copy of the [`PaymentHash`] bytes.
23170  *
23171  * May generate SendHTLCs message(s) event on success, which should be relayed (e.g. via
23172  * [`PeerManager::process_events`]).
23173  *
23174  * Each path may have a different return value, and PaymentSendValue may return a Vec with
23175  * each entry matching the corresponding-index entry in the route paths, see
23176  * PaymentSendFailure for more info.
23177  *
23178  * In general, a path may raise:
23179  *  * [`APIError::InvalidRoute`] when an invalid route or forwarding parameter (cltv_delta, fee,
23180  *    node public key) is specified.
23181  *  * [`APIError::ChannelUnavailable`] if the next-hop channel is not available for updates
23182  *    (including due to previous monitor update failure or new permanent monitor update
23183  *    failure).
23184  *  * [`APIError::MonitorUpdateInProgress`] if a new monitor update failure prevented sending the
23185  *    relevant updates.
23186  *
23187  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
23188  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
23189  * different route unless you intend to pay twice!
23190  *
23191  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
23192  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
23193  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
23194  * must not contain multiple paths as multi-path payments require a recipient-provided
23195  * payment_secret.
23196  *
23197  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
23198  * bit set (either as required or as available). If multiple paths are present in the Route,
23199  * we assume the invoice had the basic_mpp feature set.
23200  *
23201  * [`Event::PaymentSent`]: events::Event::PaymentSent
23202  * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
23203  *
23204  * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
23205  */
23206 MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKThirtyTwoBytes payment_id);
23207
23208 /**
23209  * Retries a payment along the given [`Route`].
23210  *
23211  * Errors returned are a superset of those returned from [`send_payment`], so see
23212  * [`send_payment`] documentation for more details on errors. This method will also error if the
23213  * retry amount puts the payment more than 10% over the payment's total amount, if the payment
23214  * for the given `payment_id` cannot be found (likely due to timeout or success), or if
23215  * further retries have been disabled with [`abandon_payment`].
23216  *
23217  * [`send_payment`]: [`ChannelManager::send_payment`]
23218  * [`abandon_payment`]: [`ChannelManager::abandon_payment`]
23219  */
23220 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);
23221
23222 /**
23223  * Signals that no further retries for the given payment will occur.
23224  *
23225  * After this method returns, no future calls to [`retry_payment`] for the given `payment_id`
23226  * are allowed. If no [`Event::PaymentFailed`] event had been generated before, one will be
23227  * generated as soon as there are no remaining pending HTLCs for this payment.
23228  *
23229  * Note that calling this method does *not* prevent a payment from succeeding. You must still
23230  * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
23231  * determine the ultimate status of a payment.
23232  *
23233  * If an [`Event::PaymentFailed`] event is generated and we restart without this
23234  * [`ChannelManager`] having been persisted, the payment may still be in the pending state
23235  * upon restart. This allows further calls to [`retry_payment`] (and requiring a second call
23236  * to [`abandon_payment`] to mark the payment as failed again). Otherwise, future calls to
23237  * [`retry_payment`] will fail with [`PaymentSendFailure::ParameterError`].
23238  *
23239  * [`abandon_payment`]: Self::abandon_payment
23240  * [`retry_payment`]: Self::retry_payment
23241  * [`Event::PaymentFailed`]: events::Event::PaymentFailed
23242  * [`Event::PaymentSent`]: events::Event::PaymentSent
23243  */
23244 void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id);
23245
23246 /**
23247  * Send a spontaneous payment, which is a payment that does not require the recipient to have
23248  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
23249  * the preimage, it must be a cryptographically secure random value that no intermediate node
23250  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
23251  * never reach the recipient.
23252  *
23253  * See [`send_payment`] documentation for more details on the return value of this function
23254  * and idempotency guarantees provided by the [`PaymentId`] key.
23255  *
23256  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
23257  * [`send_payment`] for more information about the risks of duplicate preimage usage.
23258  *
23259  * Note that `route` must have exactly one path.
23260  *
23261  * [`send_payment`]: Self::send_payment
23262  *
23263  * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
23264  */
23265 MUST_USE_RES struct LDKCResult_PaymentHashPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_id);
23266
23267 /**
23268  * Send a payment that is probing the given route for liquidity. We calculate the
23269  * [`PaymentHash`] of probes based on a static secret and a random [`PaymentId`], which allows
23270  * us to easily discern them from real payments.
23271  */
23272 MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCVec_RouteHopZ hops);
23273
23274 /**
23275  * Call this upon creation of a funding transaction for the given channel.
23276  *
23277  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
23278  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
23279  *
23280  * Returns [`APIError::APIMisuseError`] if the funding transaction is not final for propagation
23281  * across the p2p network.
23282  *
23283  * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided
23284  * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`].
23285  *
23286  * May panic if the output found in the funding transaction is duplicative with some other
23287  * channel (note that this should be trivially prevented by using unique funding transaction
23288  * keys per-channel).
23289  *
23290  * Do NOT broadcast the funding transaction yourself. When we have safely received our
23291  * counterparty's signature the funding transaction will automatically be broadcast via the
23292  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
23293  *
23294  * Note that this includes RBF or similar transaction replacement strategies - lightning does
23295  * not currently support replacing a funding transaction on an existing channel. Instead,
23296  * create a new channel with a conflicting funding transaction.
23297  *
23298  * Note to keep the miner incentives aligned in moving the blockchain forward, we recommend
23299  * the wallet software generating the funding transaction to apply anti-fee sniping as
23300  * implemented by Bitcoin Core wallet. See <https://bitcoinops.org/en/topics/fee-sniping/>
23301  * for more details.
23302  *
23303  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
23304  * [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed
23305  */
23306 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);
23307
23308 /**
23309  * Atomically updates the [`ChannelConfig`] for the given channels.
23310  *
23311  * Once the updates are applied, each eligible channel (advertised with a known short channel
23312  * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`],
23313  * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated
23314  * containing the new [`ChannelUpdate`] message which should be broadcast to the network.
23315  *
23316  * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect
23317  * `counterparty_node_id` is provided.
23318  *
23319  * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value
23320  * below [`MIN_CLTV_EXPIRY_DELTA`].
23321  *
23322  * If an error is returned, none of the updates should be considered applied.
23323  *
23324  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
23325  * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat
23326  * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta
23327  * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate
23328  * [`ChannelUpdate`]: msgs::ChannelUpdate
23329  * [`ChannelUnavailable`]: APIError::ChannelUnavailable
23330  * [`APIMisuseError`]: APIError::APIMisuseError
23331  */
23332 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);
23333
23334 /**
23335  * Attempts to forward an intercepted HTLC over the provided channel id and with the provided
23336  * amount to forward. Should only be called in response to an [`HTLCIntercepted`] event.
23337  *
23338  * Intercepted HTLCs can be useful for Lightning Service Providers (LSPs) to open a just-in-time
23339  * channel to a receiving node if the node lacks sufficient inbound liquidity.
23340  *
23341  * To make use of intercepted HTLCs, set [`UserConfig::accept_intercept_htlcs`] and use
23342  * [`ChannelManager::get_intercept_scid`] to generate short channel id(s) to put in the
23343  * receiver's invoice route hints. These route hints will signal to LDK to generate an
23344  * [`HTLCIntercepted`] event when it receives the forwarded HTLC, and this method or
23345  * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to the event.
23346  *
23347  * Note that LDK does not enforce fee requirements in `amt_to_forward_msat`, and will not stop
23348  * you from forwarding more than you received.
23349  *
23350  * Errors if the event was not handled in time, in which case the HTLC was automatically failed
23351  * backwards.
23352  *
23353  * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
23354  * [`HTLCIntercepted`]: events::Event::HTLCIntercepted
23355  */
23356 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_forward_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id, const uint8_t (*next_hop_channel_id)[32], struct LDKPublicKey _next_node_id, uint64_t amt_to_forward_msat);
23357
23358 /**
23359  * Fails the intercepted HTLC indicated by intercept_id. Should only be called in response to
23360  * an [`HTLCIntercepted`] event. See [`ChannelManager::forward_intercepted_htlc`].
23361  *
23362  * Errors if the event was not handled in time, in which case the HTLC was automatically failed
23363  * backwards.
23364  *
23365  * [`HTLCIntercepted`]: events::Event::HTLCIntercepted
23366  */
23367 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_fail_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id);
23368
23369 /**
23370  * Processes HTLCs which are pending waiting on random forward delay.
23371  *
23372  * Should only really ever be called in response to a PendingHTLCsForwardable event.
23373  * Will likely generate further events.
23374  */
23375 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
23376
23377 /**
23378  * Performs actions which should happen on startup and roughly once per minute thereafter.
23379  *
23380  * This currently includes:
23381  *  * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
23382  *  * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more
23383  *    than a minute, informing the network that they should no longer attempt to route over
23384  *    the channel.
23385  *  * Expiring a channel's previous `ChannelConfig` if necessary to only allow forwarding HTLCs
23386  *    with the current `ChannelConfig`.
23387  *
23388  * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate
23389  * estimate fetches.
23390  */
23391 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
23392
23393 /**
23394  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
23395  * after a PaymentClaimable event, failing the HTLC back to its origin and freeing resources
23396  * along the path (including in our own channel on which we received it).
23397  *
23398  * Note that in some cases around unclean shutdown, it is possible the payment may have
23399  * already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a
23400  * second copy of) the [`events::Event::PaymentClaimable`] event. Alternatively, the payment
23401  * may have already been failed automatically by LDK if it was nearing its expiration time.
23402  *
23403  * While LDK will never claim a payment automatically on your behalf (i.e. without you calling
23404  * [`ChannelManager::claim_funds`]), you should still monitor for
23405  * [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on
23406  * startup during which time claims that were in-progress at shutdown may be replayed.
23407  */
23408 void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
23409
23410 /**
23411  * Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any
23412  * [`MessageSendEvent`]s needed to claim the payment.
23413  *
23414  * Note that calling this method does *not* guarantee that the payment has been claimed. You
23415  * *must* wait for an [`Event::PaymentClaimed`] event which upon a successful claim will be
23416  * provided to your [`EventHandler`] when [`process_pending_events`] is next called.
23417  *
23418  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
23419  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentClaimable`
23420  * event matches your expectation. If you fail to do so and call this method, you may provide
23421  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
23422  *
23423  * [`Event::PaymentClaimable`]: crate::util::events::Event::PaymentClaimable
23424  * [`Event::PaymentClaimed`]: crate::util::events::Event::PaymentClaimed
23425  * [`process_pending_events`]: EventsProvider::process_pending_events
23426  * [`create_inbound_payment`]: Self::create_inbound_payment
23427  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
23428  */
23429 void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
23430
23431 /**
23432  * Gets the node_id held by this ChannelManager
23433  */
23434 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
23435
23436 /**
23437  * Accepts a request to open a channel after a [`Event::OpenChannelRequest`].
23438  *
23439  * The `temporary_channel_id` parameter indicates which inbound channel should be accepted,
23440  * and the `counterparty_node_id` parameter is the id of the peer which has requested to open
23441  * the channel.
23442  *
23443  * The `user_channel_id` parameter will be provided back in
23444  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
23445  * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
23446  *
23447  * Note that this method will return an error and reject the channel, if it requires support
23448  * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be
23449  * used to accept such channels.
23450  *
23451  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
23452  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
23453  */
23454 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, struct LDKU128 user_channel_id);
23455
23456 /**
23457  * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating
23458  * it as confirmed immediately.
23459  *
23460  * The `user_channel_id` parameter will be provided back in
23461  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
23462  * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
23463  *
23464  * Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel
23465  * and (if the counterparty agrees), enables forwarding of payments immediately.
23466  *
23467  * This fully trusts that the counterparty has honestly and correctly constructed the funding
23468  * transaction and blindly assumes that it will eventually confirm.
23469  *
23470  * If it does not confirm before we decide to close the channel, or if the funding transaction
23471  * does not pay to the correct script the correct amount, *you will lose funds*.
23472  *
23473  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
23474  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
23475  */
23476 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, struct LDKU128 user_channel_id);
23477
23478 /**
23479  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
23480  * to pay us.
23481  *
23482  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
23483  * [`PaymentHash`] and [`PaymentPreimage`] for you.
23484  *
23485  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentClaimable`], which
23486  * will have the [`PaymentClaimable::payment_preimage`] field filled in. That should then be
23487  * passed directly to [`claim_funds`].
23488  *
23489  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
23490  *
23491  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
23492  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
23493  *
23494  * # Note
23495  *
23496  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
23497  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
23498  *
23499  * Errors if `min_value_msat` is greater than total bitcoin supply.
23500  *
23501  * [`claim_funds`]: Self::claim_funds
23502  * [`PaymentClaimable`]: events::Event::PaymentClaimable
23503  * [`PaymentClaimable::payment_preimage`]: events::Event::PaymentClaimable::payment_preimage
23504  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
23505  */
23506 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);
23507
23508 /**
23509  * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share
23510  * serialized state with LDK node(s) running 0.0.103 and earlier.
23511  *
23512  * May panic if `invoice_expiry_delta_secs` is greater than one year.
23513  *
23514  * # Note
23515  * This method is deprecated and will be removed soon.
23516  *
23517  * [`create_inbound_payment`]: Self::create_inbound_payment
23518  */
23519 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);
23520
23521 /**
23522  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
23523  * stored external to LDK.
23524  *
23525  * A [`PaymentClaimable`] event will only be generated if the [`PaymentSecret`] matches a
23526  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
23527  * the `min_value_msat` provided here, if one is provided.
23528  *
23529  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
23530  * note that LDK will not stop you from registering duplicate payment hashes for inbound
23531  * payments.
23532  *
23533  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
23534  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
23535  * before a [`PaymentClaimable`] event will be generated, ensuring that we do not provide the
23536  * sender \"proof-of-payment\" unless they have paid the required amount.
23537  *
23538  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
23539  * in excess of the current time. This should roughly match the expiry time set in the invoice.
23540  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
23541  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
23542  * invoices when no timeout is set.
23543  *
23544  * Note that we use block header time to time-out pending inbound payments (with some margin
23545  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
23546  * accept a payment and generate a [`PaymentClaimable`] event for some time after the expiry.
23547  * If you need exact expiry semantics, you should enforce them upon receipt of
23548  * [`PaymentClaimable`].
23549  *
23550  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
23551  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
23552  *
23553  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
23554  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
23555  *
23556  * # Note
23557  *
23558  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
23559  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
23560  *
23561  * Errors if `min_value_msat` is greater than total bitcoin supply.
23562  *
23563  * [`create_inbound_payment`]: Self::create_inbound_payment
23564  * [`PaymentClaimable`]: events::Event::PaymentClaimable
23565  */
23566 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);
23567
23568 /**
23569  * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
23570  * serialized state with LDK node(s) running 0.0.103 and earlier.
23571  *
23572  * May panic if `invoice_expiry_delta_secs` is greater than one year.
23573  *
23574  * # Note
23575  * This method is deprecated and will be removed soon.
23576  *
23577  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
23578  */
23579 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);
23580
23581 /**
23582  * Gets an LDK-generated payment preimage from a payment hash and payment secret that were
23583  * previously returned from [`create_inbound_payment`].
23584  *
23585  * [`create_inbound_payment`]: Self::create_inbound_payment
23586  */
23587 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);
23588
23589 /**
23590  * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
23591  * are used when constructing the phantom invoice's route hints.
23592  *
23593  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
23594  */
23595 MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg);
23596
23597 /**
23598  * Gets route hints for use in receiving [phantom node payments].
23599  *
23600  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
23601  */
23602 MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg);
23603
23604 /**
23605  * Gets a fake short channel id for use in receiving intercepted payments. These fake scids are
23606  * used when constructing the route hints for HTLCs intended to be intercepted. See
23607  * [`ChannelManager::forward_intercepted_htlc`].
23608  *
23609  * Note that this method is not guaranteed to return unique values, you may need to call it a few
23610  * times to get a unique scid.
23611  */
23612 MUST_USE_RES uint64_t ChannelManager_get_intercept_scid(const struct LDKChannelManager *NONNULL_PTR this_arg);
23613
23614 /**
23615  * Gets inflight HTLC information by processing pending outbound payments that are in
23616  * our channels. May be used during pathfinding to account for in-use channel liquidity.
23617  */
23618 MUST_USE_RES struct LDKInFlightHtlcs ChannelManager_compute_inflight_htlcs(const struct LDKChannelManager *NONNULL_PTR this_arg);
23619
23620 /**
23621  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
23622  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
23623  */
23624 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
23625
23626 /**
23627  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
23628  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
23629  */
23630 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
23631
23632 /**
23633  * Constructs a new Listen which calls the relevant methods on this_arg.
23634  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
23635  */
23636 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
23637
23638 /**
23639  * Constructs a new Confirm which calls the relevant methods on this_arg.
23640  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
23641  */
23642 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
23643
23644 /**
23645  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
23646  * indicating whether persistence is necessary. Only one listener on
23647  * [`await_persistable_update`], [`await_persistable_update_timeout`], or a future returned by
23648  * [`get_persistable_update_future`] is guaranteed to be woken up.
23649  *
23650  * Note that this method is not available with the `no-std` feature.
23651  *
23652  * [`await_persistable_update`]: Self::await_persistable_update
23653  * [`await_persistable_update_timeout`]: Self::await_persistable_update_timeout
23654  * [`get_persistable_update_future`]: Self::get_persistable_update_future
23655  */
23656 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
23657
23658 /**
23659  * Blocks until ChannelManager needs to be persisted. Only one listener on
23660  * [`await_persistable_update`], `await_persistable_update_timeout`, or a future returned by
23661  * [`get_persistable_update_future`] is guaranteed to be woken up.
23662  *
23663  * [`await_persistable_update`]: Self::await_persistable_update
23664  * [`get_persistable_update_future`]: Self::get_persistable_update_future
23665  */
23666 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
23667
23668 /**
23669  * Gets a [`Future`] that completes when a persistable update is available. Note that
23670  * callbacks registered on the [`Future`] MUST NOT call back into this [`ChannelManager`] and
23671  * should instead register actions to be taken later.
23672  */
23673 MUST_USE_RES struct LDKFuture ChannelManager_get_persistable_update_future(const struct LDKChannelManager *NONNULL_PTR this_arg);
23674
23675 /**
23676  * Gets the latest best block which was connected either via the [`chain::Listen`] or
23677  * [`chain::Confirm`] interfaces.
23678  */
23679 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
23680
23681 /**
23682  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
23683  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
23684  */
23685 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
23686
23687 /**
23688  * Fetches the set of [`NodeFeatures`] flags which are provided by or required by
23689  * [`ChannelManager`].
23690  */
23691 struct LDKNodeFeatures provided_node_features(void);
23692
23693 /**
23694  * Fetches the set of [`ChannelFeatures`] flags which are provided by or required by
23695  * [`ChannelManager`].
23696  */
23697 struct LDKChannelFeatures provided_channel_features(void);
23698
23699 /**
23700  * Fetches the set of [`InitFeatures`] flags which are provided by or required by
23701  * [`ChannelManager`].
23702  */
23703 struct LDKInitFeatures provided_init_features(void);
23704
23705 /**
23706  * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read
23707  */
23708 struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj);
23709
23710 /**
23711  * Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write
23712  */
23713 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser);
23714
23715 /**
23716  * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read
23717  */
23718 struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj);
23719
23720 /**
23721  * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write
23722  */
23723 struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser);
23724
23725 /**
23726  * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read
23727  */
23728 struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj);
23729
23730 /**
23731  * Read a ChannelDetails from a byte array, created by ChannelDetails_write
23732  */
23733 struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser);
23734
23735 /**
23736  * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read
23737  */
23738 struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj);
23739
23740 /**
23741  * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write
23742  */
23743 struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser);
23744
23745 /**
23746  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
23747  */
23748 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
23749
23750 /**
23751  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
23752  */
23753 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
23754
23755 /**
23756  * The keys provider which will give us relevant keys. Some keys will be loaded during
23757  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
23758  * signing data.
23759  */
23760 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
23761
23762 /**
23763  * The keys provider which will give us relevant keys. Some keys will be loaded during
23764  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
23765  * signing data.
23766  */
23767 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
23768
23769 /**
23770  * The fee_estimator for use in the ChannelManager in the future.
23771  *
23772  * No calls to the FeeEstimator will be made during deserialization.
23773  */
23774 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
23775
23776 /**
23777  * The fee_estimator for use in the ChannelManager in the future.
23778  *
23779  * No calls to the FeeEstimator will be made during deserialization.
23780  */
23781 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
23782
23783 /**
23784  * The chain::Watch for use in the ChannelManager in the future.
23785  *
23786  * No calls to the chain::Watch will be made during deserialization. It is assumed that
23787  * you have deserialized ChannelMonitors separately and will add them to your
23788  * chain::Watch after deserializing this ChannelManager.
23789  */
23790 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
23791
23792 /**
23793  * The chain::Watch for use in the ChannelManager in the future.
23794  *
23795  * No calls to the chain::Watch will be made during deserialization. It is assumed that
23796  * you have deserialized ChannelMonitors separately and will add them to your
23797  * chain::Watch after deserializing this ChannelManager.
23798  */
23799 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
23800
23801 /**
23802  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
23803  * used to broadcast the latest local commitment transactions of channels which must be
23804  * force-closed during deserialization.
23805  */
23806 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
23807
23808 /**
23809  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
23810  * used to broadcast the latest local commitment transactions of channels which must be
23811  * force-closed during deserialization.
23812  */
23813 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
23814
23815 /**
23816  * The Logger for use in the ChannelManager and which may be used to log information during
23817  * deserialization.
23818  */
23819 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
23820
23821 /**
23822  * The Logger for use in the ChannelManager and which may be used to log information during
23823  * deserialization.
23824  */
23825 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
23826
23827 /**
23828  * Default settings used for new channels. Any existing channels will continue to use the
23829  * runtime settings which were stored when the ChannelManager was serialized.
23830  */
23831 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
23832
23833 /**
23834  * Default settings used for new channels. Any existing channels will continue to use the
23835  * runtime settings which were stored when the ChannelManager was serialized.
23836  */
23837 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
23838
23839 /**
23840  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
23841  * HashMap for you. This is primarily useful for C bindings where it is not practical to
23842  * populate a HashMap directly from C.
23843  */
23844 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);
23845
23846 /**
23847  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
23848  */
23849 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
23850
23851 /**
23852  * Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL.
23853  */
23854 void ExpandedKey_free(struct LDKExpandedKey this_obj);
23855
23856 /**
23857  * Create a  new [`ExpandedKey`] for generating an inbound payment hash and secret.
23858  *
23859  * It is recommended to cache this value and not regenerate it for each new inbound payment.
23860  */
23861 MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material)[32]);
23862
23863 /**
23864  * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no
23865  * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without
23866  * a `ChannelManager`.
23867  *
23868  * `keys` is generated by calling [`KeysInterface::get_inbound_payment_key_material`] and then
23869  * calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not
23870  * regenerate it for each new inbound payment.
23871  *
23872  * `current_time` is a Unix timestamp representing the current time.
23873  *
23874  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
23875  */
23876 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);
23877
23878 /**
23879  * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`],
23880  * but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments]
23881  * without a `ChannelManager`.
23882  *
23883  * See [`create`] for information on the `keys` and `current_time` parameters.
23884  *
23885  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
23886  */
23887 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);
23888
23889 /**
23890  * Frees any resources used by the DecodeError
23891  */
23892 void DecodeError_free(struct LDKDecodeError this_ptr);
23893
23894 /**
23895  * Creates a copy of the DecodeError
23896  */
23897 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
23898
23899 /**
23900  * Utility method to constructs a new UnknownVersion-variant DecodeError
23901  */
23902 struct LDKDecodeError DecodeError_unknown_version(void);
23903
23904 /**
23905  * Utility method to constructs a new UnknownRequiredFeature-variant DecodeError
23906  */
23907 struct LDKDecodeError DecodeError_unknown_required_feature(void);
23908
23909 /**
23910  * Utility method to constructs a new InvalidValue-variant DecodeError
23911  */
23912 struct LDKDecodeError DecodeError_invalid_value(void);
23913
23914 /**
23915  * Utility method to constructs a new ShortRead-variant DecodeError
23916  */
23917 struct LDKDecodeError DecodeError_short_read(void);
23918
23919 /**
23920  * Utility method to constructs a new BadLengthDescriptor-variant DecodeError
23921  */
23922 struct LDKDecodeError DecodeError_bad_length_descriptor(void);
23923
23924 /**
23925  * Utility method to constructs a new Io-variant DecodeError
23926  */
23927 struct LDKDecodeError DecodeError_io(enum LDKIOError a);
23928
23929 /**
23930  * Utility method to constructs a new UnsupportedCompression-variant DecodeError
23931  */
23932 struct LDKDecodeError DecodeError_unsupported_compression(void);
23933
23934 /**
23935  * Checks if two DecodeErrors contain equal inner contents.
23936  * This ignores pointers and is_owned flags and looks at the values in fields.
23937  */
23938 bool DecodeError_eq(const struct LDKDecodeError *NONNULL_PTR a, const struct LDKDecodeError *NONNULL_PTR b);
23939
23940 /**
23941  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
23942  */
23943 void Init_free(struct LDKInit this_obj);
23944
23945 /**
23946  * The relevant features which the sender supports
23947  */
23948 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
23949
23950 /**
23951  * The relevant features which the sender supports
23952  */
23953 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
23954
23955 /**
23956  * The receipient's network address. This adds the option to report a remote IP address
23957  * back to a connecting peer using the init message. A node can decide to use that information
23958  * to discover a potential update to its public IPv4 address (NAT) and use
23959  * that for a node_announcement update message containing the new address.
23960  */
23961 struct LDKCOption_NetAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr);
23962
23963 /**
23964  * The receipient's network address. This adds the option to report a remote IP address
23965  * back to a connecting peer using the init message. A node can decide to use that information
23966  * to discover a potential update to its public IPv4 address (NAT) and use
23967  * that for a node_announcement update message containing the new address.
23968  */
23969 void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_NetAddressZ val);
23970
23971 /**
23972  * Constructs a new Init given each field
23973  */
23974 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_NetAddressZ remote_network_address_arg);
23975
23976 /**
23977  * Creates a copy of the Init
23978  */
23979 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
23980
23981 /**
23982  * Checks if two Inits contain equal inner contents.
23983  * This ignores pointers and is_owned flags and looks at the values in fields.
23984  * Two objects with NULL inner values will be considered "equal" here.
23985  */
23986 bool Init_eq(const struct LDKInit *NONNULL_PTR a, const struct LDKInit *NONNULL_PTR b);
23987
23988 /**
23989  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
23990  */
23991 void ErrorMessage_free(struct LDKErrorMessage this_obj);
23992
23993 /**
23994  * The channel ID involved in the error.
23995  *
23996  * All-0s indicates a general error unrelated to a specific channel, after which all channels
23997  * with the sending peer should be closed.
23998  */
23999 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
24000
24001 /**
24002  * The channel ID involved in the error.
24003  *
24004  * All-0s indicates a general error unrelated to a specific channel, after which all channels
24005  * with the sending peer should be closed.
24006  */
24007 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24008
24009 /**
24010  * A possibly human-readable error description.
24011  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
24012  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
24013  * the terminal emulator or the logging subsystem.
24014  */
24015 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
24016
24017 /**
24018  * A possibly human-readable error description.
24019  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
24020  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
24021  * the terminal emulator or the logging subsystem.
24022  */
24023 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
24024
24025 /**
24026  * Constructs a new ErrorMessage given each field
24027  */
24028 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
24029
24030 /**
24031  * Creates a copy of the ErrorMessage
24032  */
24033 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
24034
24035 /**
24036  * Checks if two ErrorMessages contain equal inner contents.
24037  * This ignores pointers and is_owned flags and looks at the values in fields.
24038  * Two objects with NULL inner values will be considered "equal" here.
24039  */
24040 bool ErrorMessage_eq(const struct LDKErrorMessage *NONNULL_PTR a, const struct LDKErrorMessage *NONNULL_PTR b);
24041
24042 /**
24043  * Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL.
24044  */
24045 void WarningMessage_free(struct LDKWarningMessage this_obj);
24046
24047 /**
24048  * The channel ID involved in the warning.
24049  *
24050  * All-0s indicates a warning unrelated to a specific channel.
24051  */
24052 const uint8_t (*WarningMessage_get_channel_id(const struct LDKWarningMessage *NONNULL_PTR this_ptr))[32];
24053
24054 /**
24055  * The channel ID involved in the warning.
24056  *
24057  * All-0s indicates a warning unrelated to a specific channel.
24058  */
24059 void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24060
24061 /**
24062  * A possibly human-readable warning description.
24063  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
24064  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
24065  * the terminal emulator or the logging subsystem.
24066  */
24067 struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PTR this_ptr);
24068
24069 /**
24070  * A possibly human-readable warning description.
24071  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
24072  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
24073  * the terminal emulator or the logging subsystem.
24074  */
24075 void WarningMessage_set_data(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKStr val);
24076
24077 /**
24078  * Constructs a new WarningMessage given each field
24079  */
24080 MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
24081
24082 /**
24083  * Creates a copy of the WarningMessage
24084  */
24085 struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig);
24086
24087 /**
24088  * Checks if two WarningMessages contain equal inner contents.
24089  * This ignores pointers and is_owned flags and looks at the values in fields.
24090  * Two objects with NULL inner values will be considered "equal" here.
24091  */
24092 bool WarningMessage_eq(const struct LDKWarningMessage *NONNULL_PTR a, const struct LDKWarningMessage *NONNULL_PTR b);
24093
24094 /**
24095  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
24096  */
24097 void Ping_free(struct LDKPing this_obj);
24098
24099 /**
24100  * The desired response length
24101  */
24102 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
24103
24104 /**
24105  * The desired response length
24106  */
24107 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
24108
24109 /**
24110  * The ping packet size.
24111  * This field is not sent on the wire. byteslen zeros are sent.
24112  */
24113 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
24114
24115 /**
24116  * The ping packet size.
24117  * This field is not sent on the wire. byteslen zeros are sent.
24118  */
24119 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
24120
24121 /**
24122  * Constructs a new Ping given each field
24123  */
24124 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
24125
24126 /**
24127  * Creates a copy of the Ping
24128  */
24129 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
24130
24131 /**
24132  * Checks if two Pings contain equal inner contents.
24133  * This ignores pointers and is_owned flags and looks at the values in fields.
24134  * Two objects with NULL inner values will be considered "equal" here.
24135  */
24136 bool Ping_eq(const struct LDKPing *NONNULL_PTR a, const struct LDKPing *NONNULL_PTR b);
24137
24138 /**
24139  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
24140  */
24141 void Pong_free(struct LDKPong this_obj);
24142
24143 /**
24144  * The pong packet size.
24145  * This field is not sent on the wire. byteslen zeros are sent.
24146  */
24147 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
24148
24149 /**
24150  * The pong packet size.
24151  * This field is not sent on the wire. byteslen zeros are sent.
24152  */
24153 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
24154
24155 /**
24156  * Constructs a new Pong given each field
24157  */
24158 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
24159
24160 /**
24161  * Creates a copy of the Pong
24162  */
24163 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
24164
24165 /**
24166  * Checks if two Pongs contain equal inner contents.
24167  * This ignores pointers and is_owned flags and looks at the values in fields.
24168  * Two objects with NULL inner values will be considered "equal" here.
24169  */
24170 bool Pong_eq(const struct LDKPong *NONNULL_PTR a, const struct LDKPong *NONNULL_PTR b);
24171
24172 /**
24173  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
24174  */
24175 void OpenChannel_free(struct LDKOpenChannel this_obj);
24176
24177 /**
24178  * The genesis hash of the blockchain where the channel is to be opened
24179  */
24180 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
24181
24182 /**
24183  * The genesis hash of the blockchain where the channel is to be opened
24184  */
24185 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24186
24187 /**
24188  * A temporary channel ID, until the funding outpoint is announced
24189  */
24190 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
24191
24192 /**
24193  * A temporary channel ID, until the funding outpoint is announced
24194  */
24195 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24196
24197 /**
24198  * The channel value
24199  */
24200 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
24201
24202 /**
24203  * The channel value
24204  */
24205 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
24206
24207 /**
24208  * The amount to push to the counterparty as part of the open, in milli-satoshi
24209  */
24210 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
24211
24212 /**
24213  * The amount to push to the counterparty as part of the open, in milli-satoshi
24214  */
24215 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
24216
24217 /**
24218  * The threshold below which outputs on transactions broadcast by sender will be omitted
24219  */
24220 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
24221
24222 /**
24223  * The threshold below which outputs on transactions broadcast by sender will be omitted
24224  */
24225 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
24226
24227 /**
24228  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
24229  */
24230 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
24231
24232 /**
24233  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
24234  */
24235 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
24236
24237 /**
24238  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
24239  */
24240 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
24241
24242 /**
24243  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
24244  */
24245 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
24246
24247 /**
24248  * The minimum HTLC size incoming to sender, in milli-satoshi
24249  */
24250 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
24251
24252 /**
24253  * The minimum HTLC size incoming to sender, in milli-satoshi
24254  */
24255 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
24256
24257 /**
24258  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
24259  */
24260 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
24261
24262 /**
24263  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
24264  */
24265 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
24266
24267 /**
24268  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
24269  */
24270 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
24271
24272 /**
24273  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
24274  */
24275 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
24276
24277 /**
24278  * The maximum number of inbound HTLCs towards sender
24279  */
24280 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
24281
24282 /**
24283  * The maximum number of inbound HTLCs towards sender
24284  */
24285 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
24286
24287 /**
24288  * The sender's key controlling the funding transaction
24289  */
24290 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
24291
24292 /**
24293  * The sender's key controlling the funding transaction
24294  */
24295 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24296
24297 /**
24298  * Used to derive a revocation key for transactions broadcast by counterparty
24299  */
24300 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
24301
24302 /**
24303  * Used to derive a revocation key for transactions broadcast by counterparty
24304  */
24305 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24306
24307 /**
24308  * A payment key to sender for transactions broadcast by counterparty
24309  */
24310 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
24311
24312 /**
24313  * A payment key to sender for transactions broadcast by counterparty
24314  */
24315 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24316
24317 /**
24318  * Used to derive a payment key to sender for transactions broadcast by sender
24319  */
24320 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
24321
24322 /**
24323  * Used to derive a payment key to sender for transactions broadcast by sender
24324  */
24325 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24326
24327 /**
24328  * Used to derive an HTLC payment key to sender
24329  */
24330 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
24331
24332 /**
24333  * Used to derive an HTLC payment key to sender
24334  */
24335 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24336
24337 /**
24338  * The first to-be-broadcast-by-sender transaction's per commitment point
24339  */
24340 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
24341
24342 /**
24343  * The first to-be-broadcast-by-sender transaction's per commitment point
24344  */
24345 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24346
24347 /**
24348  * Channel flags
24349  */
24350 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
24351
24352 /**
24353  * Channel flags
24354  */
24355 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
24356
24357 /**
24358  * The channel type that this channel will represent. If none is set, we derive the channel
24359  * type from the intersection of our feature bits with our counterparty's feature bits from
24360  * the Init message.
24361  *
24362  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24363  */
24364 struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
24365
24366 /**
24367  * The channel type that this channel will represent. If none is set, we derive the channel
24368  * type from the intersection of our feature bits with our counterparty's feature bits from
24369  * the Init message.
24370  *
24371  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24372  */
24373 void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
24374
24375 /**
24376  * Creates a copy of the OpenChannel
24377  */
24378 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
24379
24380 /**
24381  * Checks if two OpenChannels contain equal inner contents.
24382  * This ignores pointers and is_owned flags and looks at the values in fields.
24383  * Two objects with NULL inner values will be considered "equal" here.
24384  */
24385 bool OpenChannel_eq(const struct LDKOpenChannel *NONNULL_PTR a, const struct LDKOpenChannel *NONNULL_PTR b);
24386
24387 /**
24388  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
24389  */
24390 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
24391
24392 /**
24393  * A temporary channel ID, until the funding outpoint is announced
24394  */
24395 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
24396
24397 /**
24398  * A temporary channel ID, until the funding outpoint is announced
24399  */
24400 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24401
24402 /**
24403  * The threshold below which outputs on transactions broadcast by sender will be omitted
24404  */
24405 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
24406
24407 /**
24408  * The threshold below which outputs on transactions broadcast by sender will be omitted
24409  */
24410 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
24411
24412 /**
24413  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
24414  */
24415 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
24416
24417 /**
24418  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
24419  */
24420 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
24421
24422 /**
24423  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
24424  */
24425 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
24426
24427 /**
24428  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
24429  */
24430 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
24431
24432 /**
24433  * The minimum HTLC size incoming to sender, in milli-satoshi
24434  */
24435 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
24436
24437 /**
24438  * The minimum HTLC size incoming to sender, in milli-satoshi
24439  */
24440 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
24441
24442 /**
24443  * Minimum depth of the funding transaction before the channel is considered open
24444  */
24445 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
24446
24447 /**
24448  * Minimum depth of the funding transaction before the channel is considered open
24449  */
24450 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
24451
24452 /**
24453  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
24454  */
24455 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
24456
24457 /**
24458  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
24459  */
24460 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
24461
24462 /**
24463  * The maximum number of inbound HTLCs towards sender
24464  */
24465 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
24466
24467 /**
24468  * The maximum number of inbound HTLCs towards sender
24469  */
24470 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
24471
24472 /**
24473  * The sender's key controlling the funding transaction
24474  */
24475 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
24476
24477 /**
24478  * The sender's key controlling the funding transaction
24479  */
24480 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24481
24482 /**
24483  * Used to derive a revocation key for transactions broadcast by counterparty
24484  */
24485 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
24486
24487 /**
24488  * Used to derive a revocation key for transactions broadcast by counterparty
24489  */
24490 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24491
24492 /**
24493  * A payment key to sender for transactions broadcast by counterparty
24494  */
24495 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
24496
24497 /**
24498  * A payment key to sender for transactions broadcast by counterparty
24499  */
24500 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24501
24502 /**
24503  * Used to derive a payment key to sender for transactions broadcast by sender
24504  */
24505 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
24506
24507 /**
24508  * Used to derive a payment key to sender for transactions broadcast by sender
24509  */
24510 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24511
24512 /**
24513  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
24514  */
24515 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
24516
24517 /**
24518  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
24519  */
24520 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24521
24522 /**
24523  * The first to-be-broadcast-by-sender transaction's per commitment point
24524  */
24525 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
24526
24527 /**
24528  * The first to-be-broadcast-by-sender transaction's per commitment point
24529  */
24530 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24531
24532 /**
24533  * The channel type that this channel will represent. If none is set, we derive the channel
24534  * type from the intersection of our feature bits with our counterparty's feature bits from
24535  * the Init message.
24536  *
24537  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
24538  *
24539  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24540  */
24541 struct LDKChannelTypeFeatures AcceptChannel_get_channel_type(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
24542
24543 /**
24544  * The channel type that this channel will represent. If none is set, we derive the channel
24545  * type from the intersection of our feature bits with our counterparty's feature bits from
24546  * the Init message.
24547  *
24548  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
24549  *
24550  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24551  */
24552 void AcceptChannel_set_channel_type(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
24553
24554 /**
24555  * Creates a copy of the AcceptChannel
24556  */
24557 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
24558
24559 /**
24560  * Checks if two AcceptChannels contain equal inner contents.
24561  * This ignores pointers and is_owned flags and looks at the values in fields.
24562  * Two objects with NULL inner values will be considered "equal" here.
24563  */
24564 bool AcceptChannel_eq(const struct LDKAcceptChannel *NONNULL_PTR a, const struct LDKAcceptChannel *NONNULL_PTR b);
24565
24566 /**
24567  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
24568  */
24569 void FundingCreated_free(struct LDKFundingCreated this_obj);
24570
24571 /**
24572  * A temporary channel ID, until the funding is established
24573  */
24574 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
24575
24576 /**
24577  * A temporary channel ID, until the funding is established
24578  */
24579 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24580
24581 /**
24582  * The funding transaction ID
24583  */
24584 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
24585
24586 /**
24587  * The funding transaction ID
24588  */
24589 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24590
24591 /**
24592  * The specific output index funding this channel
24593  */
24594 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
24595
24596 /**
24597  * The specific output index funding this channel
24598  */
24599 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
24600
24601 /**
24602  * The signature of the channel initiator (funder) on the initial commitment transaction
24603  */
24604 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
24605
24606 /**
24607  * The signature of the channel initiator (funder) on the initial commitment transaction
24608  */
24609 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
24610
24611 /**
24612  * Constructs a new FundingCreated given each field
24613  */
24614 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);
24615
24616 /**
24617  * Creates a copy of the FundingCreated
24618  */
24619 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
24620
24621 /**
24622  * Checks if two FundingCreateds contain equal inner contents.
24623  * This ignores pointers and is_owned flags and looks at the values in fields.
24624  * Two objects with NULL inner values will be considered "equal" here.
24625  */
24626 bool FundingCreated_eq(const struct LDKFundingCreated *NONNULL_PTR a, const struct LDKFundingCreated *NONNULL_PTR b);
24627
24628 /**
24629  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
24630  */
24631 void FundingSigned_free(struct LDKFundingSigned this_obj);
24632
24633 /**
24634  * The channel ID
24635  */
24636 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
24637
24638 /**
24639  * The channel ID
24640  */
24641 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24642
24643 /**
24644  * The signature of the channel acceptor (fundee) on the initial commitment transaction
24645  */
24646 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
24647
24648 /**
24649  * The signature of the channel acceptor (fundee) on the initial commitment transaction
24650  */
24651 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
24652
24653 /**
24654  * Constructs a new FundingSigned given each field
24655  */
24656 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
24657
24658 /**
24659  * Creates a copy of the FundingSigned
24660  */
24661 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
24662
24663 /**
24664  * Checks if two FundingSigneds contain equal inner contents.
24665  * This ignores pointers and is_owned flags and looks at the values in fields.
24666  * Two objects with NULL inner values will be considered "equal" here.
24667  */
24668 bool FundingSigned_eq(const struct LDKFundingSigned *NONNULL_PTR a, const struct LDKFundingSigned *NONNULL_PTR b);
24669
24670 /**
24671  * Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL.
24672  */
24673 void ChannelReady_free(struct LDKChannelReady this_obj);
24674
24675 /**
24676  * The channel ID
24677  */
24678 const uint8_t (*ChannelReady_get_channel_id(const struct LDKChannelReady *NONNULL_PTR this_ptr))[32];
24679
24680 /**
24681  * The channel ID
24682  */
24683 void ChannelReady_set_channel_id(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24684
24685 /**
24686  * The per-commitment point of the second commitment transaction
24687  */
24688 struct LDKPublicKey ChannelReady_get_next_per_commitment_point(const struct LDKChannelReady *NONNULL_PTR this_ptr);
24689
24690 /**
24691  * The per-commitment point of the second commitment transaction
24692  */
24693 void ChannelReady_set_next_per_commitment_point(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24694
24695 /**
24696  * If set, provides a short_channel_id alias for this channel. The sender will accept payments
24697  * to be forwarded over this SCID and forward them to this messages' recipient.
24698  */
24699 struct LDKCOption_u64Z ChannelReady_get_short_channel_id_alias(const struct LDKChannelReady *NONNULL_PTR this_ptr);
24700
24701 /**
24702  * If set, provides a short_channel_id alias for this channel. The sender will accept payments
24703  * to be forwarded over this SCID and forward them to this messages' recipient.
24704  */
24705 void ChannelReady_set_short_channel_id_alias(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
24706
24707 /**
24708  * Constructs a new ChannelReady given each field
24709  */
24710 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);
24711
24712 /**
24713  * Creates a copy of the ChannelReady
24714  */
24715 struct LDKChannelReady ChannelReady_clone(const struct LDKChannelReady *NONNULL_PTR orig);
24716
24717 /**
24718  * Checks if two ChannelReadys contain equal inner contents.
24719  * This ignores pointers and is_owned flags and looks at the values in fields.
24720  * Two objects with NULL inner values will be considered "equal" here.
24721  */
24722 bool ChannelReady_eq(const struct LDKChannelReady *NONNULL_PTR a, const struct LDKChannelReady *NONNULL_PTR b);
24723
24724 /**
24725  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
24726  */
24727 void Shutdown_free(struct LDKShutdown this_obj);
24728
24729 /**
24730  * The channel ID
24731  */
24732 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
24733
24734 /**
24735  * The channel ID
24736  */
24737 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24738
24739 /**
24740  * The destination of this peer's funds on closing.
24741  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
24742  */
24743 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
24744
24745 /**
24746  * The destination of this peer's funds on closing.
24747  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
24748  */
24749 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
24750
24751 /**
24752  * Constructs a new Shutdown given each field
24753  */
24754 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
24755
24756 /**
24757  * Creates a copy of the Shutdown
24758  */
24759 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
24760
24761 /**
24762  * Checks if two Shutdowns contain equal inner contents.
24763  * This ignores pointers and is_owned flags and looks at the values in fields.
24764  * Two objects with NULL inner values will be considered "equal" here.
24765  */
24766 bool Shutdown_eq(const struct LDKShutdown *NONNULL_PTR a, const struct LDKShutdown *NONNULL_PTR b);
24767
24768 /**
24769  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
24770  */
24771 void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
24772
24773 /**
24774  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
24775  * transaction.
24776  */
24777 uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
24778
24779 /**
24780  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
24781  * transaction.
24782  */
24783 void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
24784
24785 /**
24786  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
24787  * transaction.
24788  */
24789 uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
24790
24791 /**
24792  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
24793  * transaction.
24794  */
24795 void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
24796
24797 /**
24798  * Constructs a new ClosingSignedFeeRange given each field
24799  */
24800 MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
24801
24802 /**
24803  * Creates a copy of the ClosingSignedFeeRange
24804  */
24805 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
24806
24807 /**
24808  * Checks if two ClosingSignedFeeRanges contain equal inner contents.
24809  * This ignores pointers and is_owned flags and looks at the values in fields.
24810  * Two objects with NULL inner values will be considered "equal" here.
24811  */
24812 bool ClosingSignedFeeRange_eq(const struct LDKClosingSignedFeeRange *NONNULL_PTR a, const struct LDKClosingSignedFeeRange *NONNULL_PTR b);
24813
24814 /**
24815  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
24816  */
24817 void ClosingSigned_free(struct LDKClosingSigned this_obj);
24818
24819 /**
24820  * The channel ID
24821  */
24822 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
24823
24824 /**
24825  * The channel ID
24826  */
24827 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24828
24829 /**
24830  * The proposed total fee for the closing transaction
24831  */
24832 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
24833
24834 /**
24835  * The proposed total fee for the closing transaction
24836  */
24837 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
24838
24839 /**
24840  * A signature on the closing transaction
24841  */
24842 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
24843
24844 /**
24845  * A signature on the closing transaction
24846  */
24847 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
24848
24849 /**
24850  * The minimum and maximum fees which the sender is willing to accept, provided only by new
24851  * nodes.
24852  *
24853  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24854  */
24855 struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
24856
24857 /**
24858  * The minimum and maximum fees which the sender is willing to accept, provided only by new
24859  * nodes.
24860  *
24861  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24862  */
24863 void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
24864
24865 /**
24866  * Constructs a new ClosingSigned given each field
24867  */
24868 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);
24869
24870 /**
24871  * Creates a copy of the ClosingSigned
24872  */
24873 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
24874
24875 /**
24876  * Checks if two ClosingSigneds contain equal inner contents.
24877  * This ignores pointers and is_owned flags and looks at the values in fields.
24878  * Two objects with NULL inner values will be considered "equal" here.
24879  */
24880 bool ClosingSigned_eq(const struct LDKClosingSigned *NONNULL_PTR a, const struct LDKClosingSigned *NONNULL_PTR b);
24881
24882 /**
24883  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
24884  */
24885 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
24886
24887 /**
24888  * The channel ID
24889  */
24890 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
24891
24892 /**
24893  * The channel ID
24894  */
24895 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24896
24897 /**
24898  * The HTLC ID
24899  */
24900 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
24901
24902 /**
24903  * The HTLC ID
24904  */
24905 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
24906
24907 /**
24908  * The HTLC value in milli-satoshi
24909  */
24910 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
24911
24912 /**
24913  * The HTLC value in milli-satoshi
24914  */
24915 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
24916
24917 /**
24918  * The payment hash, the pre-image of which controls HTLC redemption
24919  */
24920 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
24921
24922 /**
24923  * The payment hash, the pre-image of which controls HTLC redemption
24924  */
24925 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24926
24927 /**
24928  * The expiry height of the HTLC
24929  */
24930 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
24931
24932 /**
24933  * The expiry height of the HTLC
24934  */
24935 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
24936
24937 /**
24938  * Creates a copy of the UpdateAddHTLC
24939  */
24940 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
24941
24942 /**
24943  * Checks if two UpdateAddHTLCs contain equal inner contents.
24944  * This ignores pointers and is_owned flags and looks at the values in fields.
24945  * Two objects with NULL inner values will be considered "equal" here.
24946  */
24947 bool UpdateAddHTLC_eq(const struct LDKUpdateAddHTLC *NONNULL_PTR a, const struct LDKUpdateAddHTLC *NONNULL_PTR b);
24948
24949 /**
24950  * Frees any resources used by the OnionMessage, if is_owned is set and inner is non-NULL.
24951  */
24952 void OnionMessage_free(struct LDKOnionMessage this_obj);
24953
24954 /**
24955  * Used in decrypting the onion packet's payload.
24956  */
24957 struct LDKPublicKey OnionMessage_get_blinding_point(const struct LDKOnionMessage *NONNULL_PTR this_ptr);
24958
24959 /**
24960  * Used in decrypting the onion packet's payload.
24961  */
24962 void OnionMessage_set_blinding_point(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24963
24964 /**
24965  * Creates a copy of the OnionMessage
24966  */
24967 struct LDKOnionMessage OnionMessage_clone(const struct LDKOnionMessage *NONNULL_PTR orig);
24968
24969 /**
24970  * Checks if two OnionMessages contain equal inner contents.
24971  * This ignores pointers and is_owned flags and looks at the values in fields.
24972  * Two objects with NULL inner values will be considered "equal" here.
24973  */
24974 bool OnionMessage_eq(const struct LDKOnionMessage *NONNULL_PTR a, const struct LDKOnionMessage *NONNULL_PTR b);
24975
24976 /**
24977  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
24978  */
24979 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
24980
24981 /**
24982  * The channel ID
24983  */
24984 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
24985
24986 /**
24987  * The channel ID
24988  */
24989 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24990
24991 /**
24992  * The HTLC ID
24993  */
24994 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
24995
24996 /**
24997  * The HTLC ID
24998  */
24999 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
25000
25001 /**
25002  * The pre-image of the payment hash, allowing HTLC redemption
25003  */
25004 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
25005
25006 /**
25007  * The pre-image of the payment hash, allowing HTLC redemption
25008  */
25009 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25010
25011 /**
25012  * Constructs a new UpdateFulfillHTLC given each field
25013  */
25014 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
25015
25016 /**
25017  * Creates a copy of the UpdateFulfillHTLC
25018  */
25019 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
25020
25021 /**
25022  * Checks if two UpdateFulfillHTLCs contain equal inner contents.
25023  * This ignores pointers and is_owned flags and looks at the values in fields.
25024  * Two objects with NULL inner values will be considered "equal" here.
25025  */
25026 bool UpdateFulfillHTLC_eq(const struct LDKUpdateFulfillHTLC *NONNULL_PTR a, const struct LDKUpdateFulfillHTLC *NONNULL_PTR b);
25027
25028 /**
25029  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
25030  */
25031 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
25032
25033 /**
25034  * The channel ID
25035  */
25036 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
25037
25038 /**
25039  * The channel ID
25040  */
25041 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25042
25043 /**
25044  * The HTLC ID
25045  */
25046 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
25047
25048 /**
25049  * The HTLC ID
25050  */
25051 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
25052
25053 /**
25054  * Creates a copy of the UpdateFailHTLC
25055  */
25056 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
25057
25058 /**
25059  * Checks if two UpdateFailHTLCs contain equal inner contents.
25060  * This ignores pointers and is_owned flags and looks at the values in fields.
25061  * Two objects with NULL inner values will be considered "equal" here.
25062  */
25063 bool UpdateFailHTLC_eq(const struct LDKUpdateFailHTLC *NONNULL_PTR a, const struct LDKUpdateFailHTLC *NONNULL_PTR b);
25064
25065 /**
25066  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
25067  */
25068 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
25069
25070 /**
25071  * The channel ID
25072  */
25073 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
25074
25075 /**
25076  * The channel ID
25077  */
25078 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25079
25080 /**
25081  * The HTLC ID
25082  */
25083 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
25084
25085 /**
25086  * The HTLC ID
25087  */
25088 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
25089
25090 /**
25091  * The failure code
25092  */
25093 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
25094
25095 /**
25096  * The failure code
25097  */
25098 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
25099
25100 /**
25101  * Creates a copy of the UpdateFailMalformedHTLC
25102  */
25103 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
25104
25105 /**
25106  * Checks if two UpdateFailMalformedHTLCs contain equal inner contents.
25107  * This ignores pointers and is_owned flags and looks at the values in fields.
25108  * Two objects with NULL inner values will be considered "equal" here.
25109  */
25110 bool UpdateFailMalformedHTLC_eq(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR a, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR b);
25111
25112 /**
25113  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
25114  */
25115 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
25116
25117 /**
25118  * The channel ID
25119  */
25120 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
25121
25122 /**
25123  * The channel ID
25124  */
25125 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25126
25127 /**
25128  * A signature on the commitment transaction
25129  */
25130 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
25131
25132 /**
25133  * A signature on the commitment transaction
25134  */
25135 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
25136
25137 /**
25138  * Signatures on the HTLC transactions
25139  *
25140  * Returns a copy of the field.
25141  */
25142 struct LDKCVec_SignatureZ CommitmentSigned_get_htlc_signatures(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
25143
25144 /**
25145  * Signatures on the HTLC transactions
25146  */
25147 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
25148
25149 /**
25150  * Constructs a new CommitmentSigned given each field
25151  */
25152 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
25153
25154 /**
25155  * Creates a copy of the CommitmentSigned
25156  */
25157 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
25158
25159 /**
25160  * Checks if two CommitmentSigneds contain equal inner contents.
25161  * This ignores pointers and is_owned flags and looks at the values in fields.
25162  * Two objects with NULL inner values will be considered "equal" here.
25163  */
25164 bool CommitmentSigned_eq(const struct LDKCommitmentSigned *NONNULL_PTR a, const struct LDKCommitmentSigned *NONNULL_PTR b);
25165
25166 /**
25167  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
25168  */
25169 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
25170
25171 /**
25172  * The channel ID
25173  */
25174 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
25175
25176 /**
25177  * The channel ID
25178  */
25179 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25180
25181 /**
25182  * The secret corresponding to the per-commitment point
25183  */
25184 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
25185
25186 /**
25187  * The secret corresponding to the per-commitment point
25188  */
25189 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25190
25191 /**
25192  * The next sender-broadcast commitment transaction's per-commitment point
25193  */
25194 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
25195
25196 /**
25197  * The next sender-broadcast commitment transaction's per-commitment point
25198  */
25199 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25200
25201 /**
25202  * Constructs a new RevokeAndACK given each field
25203  */
25204 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);
25205
25206 /**
25207  * Creates a copy of the RevokeAndACK
25208  */
25209 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
25210
25211 /**
25212  * Checks if two RevokeAndACKs contain equal inner contents.
25213  * This ignores pointers and is_owned flags and looks at the values in fields.
25214  * Two objects with NULL inner values will be considered "equal" here.
25215  */
25216 bool RevokeAndACK_eq(const struct LDKRevokeAndACK *NONNULL_PTR a, const struct LDKRevokeAndACK *NONNULL_PTR b);
25217
25218 /**
25219  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
25220  */
25221 void UpdateFee_free(struct LDKUpdateFee this_obj);
25222
25223 /**
25224  * The channel ID
25225  */
25226 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
25227
25228 /**
25229  * The channel ID
25230  */
25231 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25232
25233 /**
25234  * Fee rate per 1000-weight of the transaction
25235  */
25236 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
25237
25238 /**
25239  * Fee rate per 1000-weight of the transaction
25240  */
25241 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
25242
25243 /**
25244  * Constructs a new UpdateFee given each field
25245  */
25246 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
25247
25248 /**
25249  * Creates a copy of the UpdateFee
25250  */
25251 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
25252
25253 /**
25254  * Checks if two UpdateFees contain equal inner contents.
25255  * This ignores pointers and is_owned flags and looks at the values in fields.
25256  * Two objects with NULL inner values will be considered "equal" here.
25257  */
25258 bool UpdateFee_eq(const struct LDKUpdateFee *NONNULL_PTR a, const struct LDKUpdateFee *NONNULL_PTR b);
25259
25260 /**
25261  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
25262  */
25263 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
25264
25265 /**
25266  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
25267  * belonging to the recipient
25268  */
25269 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
25270
25271 /**
25272  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
25273  * belonging to the recipient
25274  */
25275 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25276
25277 /**
25278  * The sender's per-commitment point for their current commitment transaction
25279  */
25280 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
25281
25282 /**
25283  * The sender's per-commitment point for their current commitment transaction
25284  */
25285 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25286
25287 /**
25288  * Constructs a new DataLossProtect given each field
25289  */
25290 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
25291
25292 /**
25293  * Creates a copy of the DataLossProtect
25294  */
25295 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
25296
25297 /**
25298  * Checks if two DataLossProtects contain equal inner contents.
25299  * This ignores pointers and is_owned flags and looks at the values in fields.
25300  * Two objects with NULL inner values will be considered "equal" here.
25301  */
25302 bool DataLossProtect_eq(const struct LDKDataLossProtect *NONNULL_PTR a, const struct LDKDataLossProtect *NONNULL_PTR b);
25303
25304 /**
25305  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
25306  */
25307 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
25308
25309 /**
25310  * The channel ID
25311  */
25312 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
25313
25314 /**
25315  * The channel ID
25316  */
25317 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25318
25319 /**
25320  * The next commitment number for the sender
25321  */
25322 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
25323
25324 /**
25325  * The next commitment number for the sender
25326  */
25327 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
25328
25329 /**
25330  * The next commitment number for the recipient
25331  */
25332 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
25333
25334 /**
25335  * The next commitment number for the recipient
25336  */
25337 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
25338
25339 /**
25340  * Creates a copy of the ChannelReestablish
25341  */
25342 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
25343
25344 /**
25345  * Checks if two ChannelReestablishs contain equal inner contents.
25346  * This ignores pointers and is_owned flags and looks at the values in fields.
25347  * Two objects with NULL inner values will be considered "equal" here.
25348  */
25349 bool ChannelReestablish_eq(const struct LDKChannelReestablish *NONNULL_PTR a, const struct LDKChannelReestablish *NONNULL_PTR b);
25350
25351 /**
25352  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
25353  */
25354 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
25355
25356 /**
25357  * The channel ID
25358  */
25359 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
25360
25361 /**
25362  * The channel ID
25363  */
25364 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25365
25366 /**
25367  * The short channel ID
25368  */
25369 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
25370
25371 /**
25372  * The short channel ID
25373  */
25374 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
25375
25376 /**
25377  * A signature by the node key
25378  */
25379 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
25380
25381 /**
25382  * A signature by the node key
25383  */
25384 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
25385
25386 /**
25387  * A signature by the funding key
25388  */
25389 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
25390
25391 /**
25392  * A signature by the funding key
25393  */
25394 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
25395
25396 /**
25397  * Constructs a new AnnouncementSignatures given each field
25398  */
25399 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);
25400
25401 /**
25402  * Creates a copy of the AnnouncementSignatures
25403  */
25404 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
25405
25406 /**
25407  * Checks if two AnnouncementSignaturess contain equal inner contents.
25408  * This ignores pointers and is_owned flags and looks at the values in fields.
25409  * Two objects with NULL inner values will be considered "equal" here.
25410  */
25411 bool AnnouncementSignatures_eq(const struct LDKAnnouncementSignatures *NONNULL_PTR a, const struct LDKAnnouncementSignatures *NONNULL_PTR b);
25412
25413 /**
25414  * Frees any resources used by the NetAddress
25415  */
25416 void NetAddress_free(struct LDKNetAddress this_ptr);
25417
25418 /**
25419  * Creates a copy of the NetAddress
25420  */
25421 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
25422
25423 /**
25424  * Utility method to constructs a new IPv4-variant NetAddress
25425  */
25426 struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port);
25427
25428 /**
25429  * Utility method to constructs a new IPv6-variant NetAddress
25430  */
25431 struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port);
25432
25433 /**
25434  * Utility method to constructs a new OnionV2-variant NetAddress
25435  */
25436 struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a);
25437
25438 /**
25439  * Utility method to constructs a new OnionV3-variant NetAddress
25440  */
25441 struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port);
25442
25443 /**
25444  * Utility method to constructs a new Hostname-variant NetAddress
25445  */
25446 struct LDKNetAddress NetAddress_hostname(struct LDKHostname hostname, uint16_t port);
25447
25448 /**
25449  * Checks if two NetAddresss contain equal inner contents.
25450  * This ignores pointers and is_owned flags and looks at the values in fields.
25451  */
25452 bool NetAddress_eq(const struct LDKNetAddress *NONNULL_PTR a, const struct LDKNetAddress *NONNULL_PTR b);
25453
25454 /**
25455  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
25456  */
25457 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
25458
25459 /**
25460  * Read a NetAddress from a byte array, created by NetAddress_write
25461  */
25462 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
25463
25464 /**
25465  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
25466  */
25467 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
25468
25469 /**
25470  * The advertised features
25471  */
25472 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
25473
25474 /**
25475  * The advertised features
25476  */
25477 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
25478
25479 /**
25480  * A strictly monotonic announcement counter, with gaps allowed
25481  */
25482 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
25483
25484 /**
25485  * A strictly monotonic announcement counter, with gaps allowed
25486  */
25487 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
25488
25489 /**
25490  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
25491  * to this node).
25492  */
25493 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
25494
25495 /**
25496  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
25497  * to this node).
25498  */
25499 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25500
25501 /**
25502  * An RGB color for UI purposes
25503  */
25504 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
25505
25506 /**
25507  * An RGB color for UI purposes
25508  */
25509 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
25510
25511 /**
25512  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
25513  * of uniqueness.
25514  */
25515 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
25516
25517 /**
25518  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
25519  * of uniqueness.
25520  */
25521 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25522
25523 /**
25524  * List of addresses on which this node is reachable
25525  *
25526  * Returns a copy of the field.
25527  */
25528 struct LDKCVec_NetAddressZ UnsignedNodeAnnouncement_get_addresses(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
25529
25530 /**
25531  * List of addresses on which this node is reachable
25532  */
25533 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
25534
25535 /**
25536  * Creates a copy of the UnsignedNodeAnnouncement
25537  */
25538 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
25539
25540 /**
25541  * Checks if two UnsignedNodeAnnouncements contain equal inner contents.
25542  * This ignores pointers and is_owned flags and looks at the values in fields.
25543  * Two objects with NULL inner values will be considered "equal" here.
25544  */
25545 bool UnsignedNodeAnnouncement_eq(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR a, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR b);
25546
25547 /**
25548  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
25549  */
25550 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
25551
25552 /**
25553  * The signature by the node key
25554  */
25555 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
25556
25557 /**
25558  * The signature by the node key
25559  */
25560 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
25561
25562 /**
25563  * The actual content of the announcement
25564  */
25565 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
25566
25567 /**
25568  * The actual content of the announcement
25569  */
25570 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
25571
25572 /**
25573  * Constructs a new NodeAnnouncement given each field
25574  */
25575 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
25576
25577 /**
25578  * Creates a copy of the NodeAnnouncement
25579  */
25580 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
25581
25582 /**
25583  * Checks if two NodeAnnouncements contain equal inner contents.
25584  * This ignores pointers and is_owned flags and looks at the values in fields.
25585  * Two objects with NULL inner values will be considered "equal" here.
25586  */
25587 bool NodeAnnouncement_eq(const struct LDKNodeAnnouncement *NONNULL_PTR a, const struct LDKNodeAnnouncement *NONNULL_PTR b);
25588
25589 /**
25590  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
25591  */
25592 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
25593
25594 /**
25595  * The advertised channel features
25596  */
25597 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
25598
25599 /**
25600  * The advertised channel features
25601  */
25602 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
25603
25604 /**
25605  * The genesis hash of the blockchain where the channel is to be opened
25606  */
25607 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
25608
25609 /**
25610  * The genesis hash of the blockchain where the channel is to be opened
25611  */
25612 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25613
25614 /**
25615  * The short channel ID
25616  */
25617 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
25618
25619 /**
25620  * The short channel ID
25621  */
25622 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
25623
25624 /**
25625  * One of the two node_ids which are endpoints of this channel
25626  */
25627 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
25628
25629 /**
25630  * One of the two node_ids which are endpoints of this channel
25631  */
25632 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25633
25634 /**
25635  * The other of the two node_ids which are endpoints of this channel
25636  */
25637 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
25638
25639 /**
25640  * The other of the two node_ids which are endpoints of this channel
25641  */
25642 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25643
25644 /**
25645  * The funding key for the first node
25646  */
25647 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
25648
25649 /**
25650  * The funding key for the first node
25651  */
25652 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25653
25654 /**
25655  * The funding key for the second node
25656  */
25657 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
25658
25659 /**
25660  * The funding key for the second node
25661  */
25662 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25663
25664 /**
25665  * Creates a copy of the UnsignedChannelAnnouncement
25666  */
25667 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
25668
25669 /**
25670  * Checks if two UnsignedChannelAnnouncements contain equal inner contents.
25671  * This ignores pointers and is_owned flags and looks at the values in fields.
25672  * Two objects with NULL inner values will be considered "equal" here.
25673  */
25674 bool UnsignedChannelAnnouncement_eq(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR a, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR b);
25675
25676 /**
25677  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
25678  */
25679 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
25680
25681 /**
25682  * Authentication of the announcement by the first public node
25683  */
25684 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
25685
25686 /**
25687  * Authentication of the announcement by the first public node
25688  */
25689 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
25690
25691 /**
25692  * Authentication of the announcement by the second public node
25693  */
25694 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
25695
25696 /**
25697  * Authentication of the announcement by the second public node
25698  */
25699 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
25700
25701 /**
25702  * Proof of funding UTXO ownership by the first public node
25703  */
25704 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
25705
25706 /**
25707  * Proof of funding UTXO ownership by the first public node
25708  */
25709 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
25710
25711 /**
25712  * Proof of funding UTXO ownership by the second public node
25713  */
25714 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
25715
25716 /**
25717  * Proof of funding UTXO ownership by the second public node
25718  */
25719 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
25720
25721 /**
25722  * The actual announcement
25723  */
25724 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
25725
25726 /**
25727  * The actual announcement
25728  */
25729 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
25730
25731 /**
25732  * Constructs a new ChannelAnnouncement given each field
25733  */
25734 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);
25735
25736 /**
25737  * Creates a copy of the ChannelAnnouncement
25738  */
25739 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
25740
25741 /**
25742  * Checks if two ChannelAnnouncements contain equal inner contents.
25743  * This ignores pointers and is_owned flags and looks at the values in fields.
25744  * Two objects with NULL inner values will be considered "equal" here.
25745  */
25746 bool ChannelAnnouncement_eq(const struct LDKChannelAnnouncement *NONNULL_PTR a, const struct LDKChannelAnnouncement *NONNULL_PTR b);
25747
25748 /**
25749  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
25750  */
25751 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
25752
25753 /**
25754  * The genesis hash of the blockchain where the channel is to be opened
25755  */
25756 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
25757
25758 /**
25759  * The genesis hash of the blockchain where the channel is to be opened
25760  */
25761 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25762
25763 /**
25764  * The short channel ID
25765  */
25766 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
25767
25768 /**
25769  * The short channel ID
25770  */
25771 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
25772
25773 /**
25774  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
25775  */
25776 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
25777
25778 /**
25779  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
25780  */
25781 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
25782
25783 /**
25784  * Channel flags
25785  */
25786 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
25787
25788 /**
25789  * Channel flags
25790  */
25791 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
25792
25793 /**
25794  * The number of blocks such that if:
25795  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
25796  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
25797  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
25798  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
25799  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
25800  * forwarding. Note that the HTLC sender is the one who originally sets this value when
25801  * constructing the route.
25802  */
25803 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
25804
25805 /**
25806  * The number of blocks such that if:
25807  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
25808  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
25809  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
25810  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
25811  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
25812  * forwarding. Note that the HTLC sender is the one who originally sets this value when
25813  * constructing the route.
25814  */
25815 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
25816
25817 /**
25818  * The minimum HTLC size incoming to sender, in milli-satoshi
25819  */
25820 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
25821
25822 /**
25823  * The minimum HTLC size incoming to sender, in milli-satoshi
25824  */
25825 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
25826
25827 /**
25828  * The maximum HTLC value incoming to sender, in milli-satoshi. Used to be optional.
25829  */
25830 uint64_t UnsignedChannelUpdate_get_htlc_maximum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
25831
25832 /**
25833  * The maximum HTLC value incoming to sender, in milli-satoshi. Used to be optional.
25834  */
25835 void UnsignedChannelUpdate_set_htlc_maximum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
25836
25837 /**
25838  * The base HTLC fee charged by sender, in milli-satoshi
25839  */
25840 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
25841
25842 /**
25843  * The base HTLC fee charged by sender, in milli-satoshi
25844  */
25845 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
25846
25847 /**
25848  * The amount to fee multiplier, in micro-satoshi
25849  */
25850 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
25851
25852 /**
25853  * The amount to fee multiplier, in micro-satoshi
25854  */
25855 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
25856
25857 /**
25858  * Excess data which was signed as a part of the message which we do not (yet) understand how
25859  * to decode. This is stored to ensure forward-compatibility as new fields are added to the
25860  * lightning gossip
25861  *
25862  * Returns a copy of the field.
25863  */
25864 struct LDKCVec_u8Z UnsignedChannelUpdate_get_excess_data(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
25865
25866 /**
25867  * Excess data which was signed as a part of the message which we do not (yet) understand how
25868  * to decode. This is stored to ensure forward-compatibility as new fields are added to the
25869  * lightning gossip
25870  */
25871 void UnsignedChannelUpdate_set_excess_data(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
25872
25873 /**
25874  * Constructs a new UnsignedChannelUpdate given each field
25875  */
25876 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);
25877
25878 /**
25879  * Creates a copy of the UnsignedChannelUpdate
25880  */
25881 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
25882
25883 /**
25884  * Checks if two UnsignedChannelUpdates contain equal inner contents.
25885  * This ignores pointers and is_owned flags and looks at the values in fields.
25886  * Two objects with NULL inner values will be considered "equal" here.
25887  */
25888 bool UnsignedChannelUpdate_eq(const struct LDKUnsignedChannelUpdate *NONNULL_PTR a, const struct LDKUnsignedChannelUpdate *NONNULL_PTR b);
25889
25890 /**
25891  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
25892  */
25893 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
25894
25895 /**
25896  * A signature of the channel update
25897  */
25898 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
25899
25900 /**
25901  * A signature of the channel update
25902  */
25903 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
25904
25905 /**
25906  * The actual channel update
25907  */
25908 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
25909
25910 /**
25911  * The actual channel update
25912  */
25913 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
25914
25915 /**
25916  * Constructs a new ChannelUpdate given each field
25917  */
25918 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
25919
25920 /**
25921  * Creates a copy of the ChannelUpdate
25922  */
25923 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
25924
25925 /**
25926  * Checks if two ChannelUpdates contain equal inner contents.
25927  * This ignores pointers and is_owned flags and looks at the values in fields.
25928  * Two objects with NULL inner values will be considered "equal" here.
25929  */
25930 bool ChannelUpdate_eq(const struct LDKChannelUpdate *NONNULL_PTR a, const struct LDKChannelUpdate *NONNULL_PTR b);
25931
25932 /**
25933  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
25934  */
25935 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
25936
25937 /**
25938  * The genesis hash of the blockchain being queried
25939  */
25940 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
25941
25942 /**
25943  * The genesis hash of the blockchain being queried
25944  */
25945 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25946
25947 /**
25948  * The height of the first block for the channel UTXOs being queried
25949  */
25950 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
25951
25952 /**
25953  * The height of the first block for the channel UTXOs being queried
25954  */
25955 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
25956
25957 /**
25958  * The number of blocks to include in the query results
25959  */
25960 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
25961
25962 /**
25963  * The number of blocks to include in the query results
25964  */
25965 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
25966
25967 /**
25968  * Constructs a new QueryChannelRange given each field
25969  */
25970 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
25971
25972 /**
25973  * Creates a copy of the QueryChannelRange
25974  */
25975 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
25976
25977 /**
25978  * Checks if two QueryChannelRanges contain equal inner contents.
25979  * This ignores pointers and is_owned flags and looks at the values in fields.
25980  * Two objects with NULL inner values will be considered "equal" here.
25981  */
25982 bool QueryChannelRange_eq(const struct LDKQueryChannelRange *NONNULL_PTR a, const struct LDKQueryChannelRange *NONNULL_PTR b);
25983
25984 /**
25985  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
25986  */
25987 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
25988
25989 /**
25990  * The genesis hash of the blockchain being queried
25991  */
25992 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
25993
25994 /**
25995  * The genesis hash of the blockchain being queried
25996  */
25997 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25998
25999 /**
26000  * The height of the first block in the range of the reply
26001  */
26002 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
26003
26004 /**
26005  * The height of the first block in the range of the reply
26006  */
26007 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
26008
26009 /**
26010  * The number of blocks included in the range of the reply
26011  */
26012 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
26013
26014 /**
26015  * The number of blocks included in the range of the reply
26016  */
26017 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
26018
26019 /**
26020  * True when this is the final reply for a query
26021  */
26022 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
26023
26024 /**
26025  * True when this is the final reply for a query
26026  */
26027 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
26028
26029 /**
26030  * The short_channel_ids in the channel range
26031  *
26032  * Returns a copy of the field.
26033  */
26034 struct LDKCVec_u64Z ReplyChannelRange_get_short_channel_ids(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
26035
26036 /**
26037  * The short_channel_ids in the channel range
26038  */
26039 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
26040
26041 /**
26042  * Constructs a new ReplyChannelRange given each field
26043  */
26044 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);
26045
26046 /**
26047  * Creates a copy of the ReplyChannelRange
26048  */
26049 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
26050
26051 /**
26052  * Checks if two ReplyChannelRanges contain equal inner contents.
26053  * This ignores pointers and is_owned flags and looks at the values in fields.
26054  * Two objects with NULL inner values will be considered "equal" here.
26055  */
26056 bool ReplyChannelRange_eq(const struct LDKReplyChannelRange *NONNULL_PTR a, const struct LDKReplyChannelRange *NONNULL_PTR b);
26057
26058 /**
26059  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
26060  */
26061 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
26062
26063 /**
26064  * The genesis hash of the blockchain being queried
26065  */
26066 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
26067
26068 /**
26069  * The genesis hash of the blockchain being queried
26070  */
26071 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26072
26073 /**
26074  * The short_channel_ids that are being queried
26075  *
26076  * Returns a copy of the field.
26077  */
26078 struct LDKCVec_u64Z QueryShortChannelIds_get_short_channel_ids(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr);
26079
26080 /**
26081  * The short_channel_ids that are being queried
26082  */
26083 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
26084
26085 /**
26086  * Constructs a new QueryShortChannelIds given each field
26087  */
26088 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
26089
26090 /**
26091  * Creates a copy of the QueryShortChannelIds
26092  */
26093 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
26094
26095 /**
26096  * Checks if two QueryShortChannelIdss contain equal inner contents.
26097  * This ignores pointers and is_owned flags and looks at the values in fields.
26098  * Two objects with NULL inner values will be considered "equal" here.
26099  */
26100 bool QueryShortChannelIds_eq(const struct LDKQueryShortChannelIds *NONNULL_PTR a, const struct LDKQueryShortChannelIds *NONNULL_PTR b);
26101
26102 /**
26103  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
26104  */
26105 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
26106
26107 /**
26108  * The genesis hash of the blockchain that was queried
26109  */
26110 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
26111
26112 /**
26113  * The genesis hash of the blockchain that was queried
26114  */
26115 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26116
26117 /**
26118  * Indicates if the query recipient maintains up-to-date channel
26119  * information for the chain_hash
26120  */
26121 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
26122
26123 /**
26124  * Indicates if the query recipient maintains up-to-date channel
26125  * information for the chain_hash
26126  */
26127 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
26128
26129 /**
26130  * Constructs a new ReplyShortChannelIdsEnd given each field
26131  */
26132 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
26133
26134 /**
26135  * Creates a copy of the ReplyShortChannelIdsEnd
26136  */
26137 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
26138
26139 /**
26140  * Checks if two ReplyShortChannelIdsEnds contain equal inner contents.
26141  * This ignores pointers and is_owned flags and looks at the values in fields.
26142  * Two objects with NULL inner values will be considered "equal" here.
26143  */
26144 bool ReplyShortChannelIdsEnd_eq(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR a, const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR b);
26145
26146 /**
26147  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
26148  */
26149 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
26150
26151 /**
26152  * The genesis hash of the blockchain for channel and node information
26153  */
26154 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
26155
26156 /**
26157  * The genesis hash of the blockchain for channel and node information
26158  */
26159 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26160
26161 /**
26162  * The starting unix timestamp
26163  */
26164 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
26165
26166 /**
26167  * The starting unix timestamp
26168  */
26169 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
26170
26171 /**
26172  * The range of information in seconds
26173  */
26174 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
26175
26176 /**
26177  * The range of information in seconds
26178  */
26179 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
26180
26181 /**
26182  * Constructs a new GossipTimestampFilter given each field
26183  */
26184 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
26185
26186 /**
26187  * Creates a copy of the GossipTimestampFilter
26188  */
26189 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
26190
26191 /**
26192  * Checks if two GossipTimestampFilters contain equal inner contents.
26193  * This ignores pointers and is_owned flags and looks at the values in fields.
26194  * Two objects with NULL inner values will be considered "equal" here.
26195  */
26196 bool GossipTimestampFilter_eq(const struct LDKGossipTimestampFilter *NONNULL_PTR a, const struct LDKGossipTimestampFilter *NONNULL_PTR b);
26197
26198 /**
26199  * Frees any resources used by the ErrorAction
26200  */
26201 void ErrorAction_free(struct LDKErrorAction this_ptr);
26202
26203 /**
26204  * Creates a copy of the ErrorAction
26205  */
26206 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
26207
26208 /**
26209  * Utility method to constructs a new DisconnectPeer-variant ErrorAction
26210  */
26211 struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg);
26212
26213 /**
26214  * Utility method to constructs a new IgnoreError-variant ErrorAction
26215  */
26216 struct LDKErrorAction ErrorAction_ignore_error(void);
26217
26218 /**
26219  * Utility method to constructs a new IgnoreAndLog-variant ErrorAction
26220  */
26221 struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
26222
26223 /**
26224  * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction
26225  */
26226 struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void);
26227
26228 /**
26229  * Utility method to constructs a new SendErrorMessage-variant ErrorAction
26230  */
26231 struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg);
26232
26233 /**
26234  * Utility method to constructs a new SendWarningMessage-variant ErrorAction
26235  */
26236 struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level);
26237
26238 /**
26239  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
26240  */
26241 void LightningError_free(struct LDKLightningError this_obj);
26242
26243 /**
26244  * A human-readable message describing the error
26245  */
26246 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
26247
26248 /**
26249  * A human-readable message describing the error
26250  */
26251 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
26252
26253 /**
26254  * The action which should be taken against the offending peer.
26255  */
26256 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
26257
26258 /**
26259  * The action which should be taken against the offending peer.
26260  */
26261 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
26262
26263 /**
26264  * Constructs a new LightningError given each field
26265  */
26266 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
26267
26268 /**
26269  * Creates a copy of the LightningError
26270  */
26271 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
26272
26273 /**
26274  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
26275  */
26276 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
26277
26278 /**
26279  * update_add_htlc messages which should be sent
26280  */
26281 struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
26282
26283 /**
26284  * update_add_htlc messages which should be sent
26285  */
26286 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
26287
26288 /**
26289  * update_fulfill_htlc messages which should be sent
26290  */
26291 struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
26292
26293 /**
26294  * update_fulfill_htlc messages which should be sent
26295  */
26296 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
26297
26298 /**
26299  * update_fail_htlc messages which should be sent
26300  */
26301 struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
26302
26303 /**
26304  * update_fail_htlc messages which should be sent
26305  */
26306 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
26307
26308 /**
26309  * update_fail_malformed_htlc messages which should be sent
26310  */
26311 struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
26312
26313 /**
26314  * update_fail_malformed_htlc messages which should be sent
26315  */
26316 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
26317
26318 /**
26319  * An update_fee message which should be sent
26320  *
26321  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26322  */
26323 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
26324
26325 /**
26326  * An update_fee message which should be sent
26327  *
26328  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26329  */
26330 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
26331
26332 /**
26333  * Finally, the commitment_signed message which should be sent
26334  */
26335 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
26336
26337 /**
26338  * Finally, the commitment_signed message which should be sent
26339  */
26340 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
26341
26342 /**
26343  * Constructs a new CommitmentUpdate given each field
26344  */
26345 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);
26346
26347 /**
26348  * Creates a copy of the CommitmentUpdate
26349  */
26350 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
26351
26352 /**
26353  * Checks if two CommitmentUpdates contain equal inner contents.
26354  * This ignores pointers and is_owned flags and looks at the values in fields.
26355  * Two objects with NULL inner values will be considered "equal" here.
26356  */
26357 bool CommitmentUpdate_eq(const struct LDKCommitmentUpdate *NONNULL_PTR a, const struct LDKCommitmentUpdate *NONNULL_PTR b);
26358
26359 /**
26360  * Calls the free function if one is set
26361  */
26362 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
26363
26364 /**
26365  * Calls the free function if one is set
26366  */
26367 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
26368
26369 /**
26370  * Calls the free function if one is set
26371  */
26372 void OnionMessageHandler_free(struct LDKOnionMessageHandler this_ptr);
26373
26374 /**
26375  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
26376  */
26377 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
26378
26379 /**
26380  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
26381  */
26382 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
26383
26384 /**
26385  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
26386  */
26387 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
26388
26389 /**
26390  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
26391  */
26392 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
26393
26394 /**
26395  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
26396  */
26397 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
26398
26399 /**
26400  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
26401  */
26402 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
26403
26404 /**
26405  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
26406  */
26407 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
26408
26409 /**
26410  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
26411  */
26412 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
26413
26414 /**
26415  * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
26416  */
26417 struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
26418
26419 /**
26420  * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
26421  */
26422 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
26423
26424 /**
26425  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
26426  */
26427 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
26428
26429 /**
26430  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
26431  */
26432 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
26433
26434 /**
26435  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
26436  */
26437 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
26438
26439 /**
26440  * Read a FundingCreated from a byte array, created by FundingCreated_write
26441  */
26442 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
26443
26444 /**
26445  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
26446  */
26447 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
26448
26449 /**
26450  * Read a FundingSigned from a byte array, created by FundingSigned_write
26451  */
26452 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
26453
26454 /**
26455  * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read
26456  */
26457 struct LDKCVec_u8Z ChannelReady_write(const struct LDKChannelReady *NONNULL_PTR obj);
26458
26459 /**
26460  * Read a ChannelReady from a byte array, created by ChannelReady_write
26461  */
26462 struct LDKCResult_ChannelReadyDecodeErrorZ ChannelReady_read(struct LDKu8slice ser);
26463
26464 /**
26465  * Serialize the Init object into a byte array which can be read by Init_read
26466  */
26467 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
26468
26469 /**
26470  * Read a Init from a byte array, created by Init_write
26471  */
26472 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
26473
26474 /**
26475  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
26476  */
26477 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
26478
26479 /**
26480  * Read a OpenChannel from a byte array, created by OpenChannel_write
26481  */
26482 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
26483
26484 /**
26485  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
26486  */
26487 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
26488
26489 /**
26490  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
26491  */
26492 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
26493
26494 /**
26495  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
26496  */
26497 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
26498
26499 /**
26500  * Read a Shutdown from a byte array, created by Shutdown_write
26501  */
26502 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
26503
26504 /**
26505  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
26506  */
26507 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
26508
26509 /**
26510  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
26511  */
26512 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
26513
26514 /**
26515  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
26516  */
26517 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
26518
26519 /**
26520  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
26521  */
26522 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
26523
26524 /**
26525  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
26526  */
26527 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
26528
26529 /**
26530  * Read a UpdateFee from a byte array, created by UpdateFee_write
26531  */
26532 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
26533
26534 /**
26535  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
26536  */
26537 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
26538
26539 /**
26540  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
26541  */
26542 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
26543
26544 /**
26545  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
26546  */
26547 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
26548
26549 /**
26550  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
26551  */
26552 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
26553
26554 /**
26555  * Read a OnionMessage from a byte array, created by OnionMessage_write
26556  */
26557 struct LDKCResult_OnionMessageDecodeErrorZ OnionMessage_read(struct LDKu8slice ser);
26558
26559 /**
26560  * Serialize the OnionMessage object into a byte array which can be read by OnionMessage_read
26561  */
26562 struct LDKCVec_u8Z OnionMessage_write(const struct LDKOnionMessage *NONNULL_PTR obj);
26563
26564 /**
26565  * Serialize the Ping object into a byte array which can be read by Ping_read
26566  */
26567 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
26568
26569 /**
26570  * Read a Ping from a byte array, created by Ping_write
26571  */
26572 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
26573
26574 /**
26575  * Serialize the Pong object into a byte array which can be read by Pong_read
26576  */
26577 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
26578
26579 /**
26580  * Read a Pong from a byte array, created by Pong_write
26581  */
26582 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
26583
26584 /**
26585  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
26586  */
26587 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
26588
26589 /**
26590  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
26591  */
26592 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
26593
26594 /**
26595  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
26596  */
26597 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
26598
26599 /**
26600  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
26601  */
26602 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
26603
26604 /**
26605  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
26606  */
26607 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
26608
26609 /**
26610  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
26611  */
26612 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
26613
26614 /**
26615  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
26616  */
26617 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
26618
26619 /**
26620  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
26621  */
26622 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
26623
26624 /**
26625  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
26626  */
26627 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
26628
26629 /**
26630  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
26631  */
26632 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
26633
26634 /**
26635  * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read
26636  */
26637 struct LDKCVec_u8Z WarningMessage_write(const struct LDKWarningMessage *NONNULL_PTR obj);
26638
26639 /**
26640  * Read a WarningMessage from a byte array, created by WarningMessage_write
26641  */
26642 struct LDKCResult_WarningMessageDecodeErrorZ WarningMessage_read(struct LDKu8slice ser);
26643
26644 /**
26645  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
26646  */
26647 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
26648
26649 /**
26650  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
26651  */
26652 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
26653
26654 /**
26655  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
26656  */
26657 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
26658
26659 /**
26660  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
26661  */
26662 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
26663
26664 /**
26665  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
26666  */
26667 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
26668
26669 /**
26670  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
26671  */
26672 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
26673
26674 /**
26675  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
26676  */
26677 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
26678
26679 /**
26680  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
26681  */
26682 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
26683
26684 /**
26685  *\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
26686  */
26687 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
26688
26689 /**
26690  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
26691  */
26692 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
26693
26694 /**
26695  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
26696  */
26697 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
26698
26699 /**
26700  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
26701  */
26702 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
26703
26704 /**
26705  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
26706  */
26707 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
26708
26709 /**
26710  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
26711  */
26712 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
26713
26714 /**
26715  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
26716  */
26717 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
26718
26719 /**
26720  * Calls the free function if one is set
26721  */
26722 void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
26723
26724 /**
26725  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
26726  */
26727 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
26728
26729 /**
26730  * Constructs a new IgnoringMessageHandler given each field
26731  */
26732 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
26733
26734 /**
26735  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
26736  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
26737  */
26738 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
26739
26740 /**
26741  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
26742  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
26743  */
26744 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
26745
26746 /**
26747  * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg.
26748  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is
26749  */
26750 struct LDKOnionMessageProvider IgnoringMessageHandler_as_OnionMessageProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
26751
26752 /**
26753  * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg.
26754  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is
26755  */
26756 struct LDKOnionMessageHandler IgnoringMessageHandler_as_OnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
26757
26758 /**
26759  * Constructs a new CustomOnionMessageHandler which calls the relevant methods on this_arg.
26760  * This copies the `inner` pointer in this_arg and thus the returned CustomOnionMessageHandler must be freed before this_arg is
26761  */
26762 struct LDKCustomOnionMessageHandler IgnoringMessageHandler_as_CustomOnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
26763
26764 /**
26765  * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
26766  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
26767  */
26768 struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
26769
26770 /**
26771  * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg.
26772  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is
26773  */
26774 struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
26775
26776 /**
26777  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
26778  */
26779 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
26780
26781 /**
26782  * Constructs a new ErroringMessageHandler
26783  */
26784 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
26785
26786 /**
26787  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
26788  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
26789  */
26790 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
26791
26792 /**
26793  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
26794  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
26795  */
26796 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
26797
26798 /**
26799  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
26800  */
26801 void MessageHandler_free(struct LDKMessageHandler this_obj);
26802
26803 /**
26804  * A message handler which handles messages specific to channels. Usually this is just a
26805  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
26806  *
26807  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
26808  */
26809 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
26810
26811 /**
26812  * A message handler which handles messages specific to channels. Usually this is just a
26813  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
26814  *
26815  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
26816  */
26817 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
26818
26819 /**
26820  * A message handler which handles messages updating our knowledge of the network channel
26821  * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
26822  *
26823  * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
26824  */
26825 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
26826
26827 /**
26828  * A message handler which handles messages updating our knowledge of the network channel
26829  * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
26830  *
26831  * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
26832  */
26833 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
26834
26835 /**
26836  * A message handler which handles onion messages. For now, this can only be an
26837  * [`IgnoringMessageHandler`].
26838  */
26839 const struct LDKOnionMessageHandler *MessageHandler_get_onion_message_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
26840
26841 /**
26842  * A message handler which handles onion messages. For now, this can only be an
26843  * [`IgnoringMessageHandler`].
26844  */
26845 void MessageHandler_set_onion_message_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKOnionMessageHandler val);
26846
26847 /**
26848  * Constructs a new MessageHandler given each field
26849  */
26850 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg, struct LDKOnionMessageHandler onion_message_handler_arg);
26851
26852 /**
26853  * Creates a copy of a SocketDescriptor
26854  */
26855 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
26856
26857 /**
26858  * Calls the free function if one is set
26859  */
26860 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
26861
26862 /**
26863  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
26864  */
26865 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
26866
26867 /**
26868  * Used to indicate that we probably can't make any future connections to this peer (e.g.
26869  * because we required features that our peer was missing, or vice versa).
26870  *
26871  * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close
26872  * any channels with this peer or check for new versions of LDK.
26873  *
26874  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
26875  */
26876 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
26877
26878 /**
26879  * Used to indicate that we probably can't make any future connections to this peer (e.g.
26880  * because we required features that our peer was missing, or vice versa).
26881  *
26882  * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close
26883  * any channels with this peer or check for new versions of LDK.
26884  *
26885  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
26886  */
26887 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
26888
26889 /**
26890  * Constructs a new PeerHandleError given each field
26891  */
26892 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
26893
26894 /**
26895  * Creates a copy of the PeerHandleError
26896  */
26897 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
26898
26899 /**
26900  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
26901  */
26902 void PeerManager_free(struct LDKPeerManager this_obj);
26903
26904 /**
26905  * Constructs a new PeerManager with the given message handlers and node_id secret key
26906  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
26907  * cryptographically secure random bytes.
26908  *
26909  * `current_time` is used as an always-increasing counter that survives across restarts and is
26910  * incremented irregularly internally. In general it is best to simply use the current UNIX
26911  * timestamp, however if it is not available a persistent counter that increases once per
26912  * minute should suffice.
26913  */
26914 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);
26915
26916 /**
26917  * Get the list of node ids for peers which have completed the initial handshake.
26918  *
26919  * For outbound connections, this will be the same as the their_node_id parameter passed in to
26920  * new_outbound_connection, however entries will only appear once the initial handshake has
26921  * completed and we are sure the remote peer has the private key for the given node_id.
26922  */
26923 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
26924
26925 /**
26926  * Indicates a new outbound connection has been established to a node with the given node_id
26927  * and an optional remote network address.
26928  *
26929  * The remote network address adds the option to report a remote IP address back to a connecting
26930  * peer using the init message.
26931  * The user should pass the remote network address of the host they are connected to.
26932  *
26933  * If an `Err` is returned here you must disconnect the connection immediately.
26934  *
26935  * Returns a small number of bytes to send to the remote node (currently always 50).
26936  *
26937  * Panics if descriptor is duplicative with some other descriptor which has not yet been
26938  * [`socket_disconnected()`].
26939  *
26940  * [`socket_disconnected()`]: PeerManager::socket_disconnected
26941  */
26942 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);
26943
26944 /**
26945  * Indicates a new inbound connection has been established to a node with an optional remote
26946  * network address.
26947  *
26948  * The remote network address adds the option to report a remote IP address back to a connecting
26949  * peer using the init message.
26950  * The user should pass the remote network address of the host they are connected to.
26951  *
26952  * May refuse the connection by returning an Err, but will never write bytes to the remote end
26953  * (outbound connector always speaks first). If an `Err` is returned here you must disconnect
26954  * the connection immediately.
26955  *
26956  * Panics if descriptor is duplicative with some other descriptor which has not yet been
26957  * [`socket_disconnected()`].
26958  *
26959  * [`socket_disconnected()`]: PeerManager::socket_disconnected
26960  */
26961 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);
26962
26963 /**
26964  * Indicates that there is room to write data to the given socket descriptor.
26965  *
26966  * May return an Err to indicate that the connection should be closed.
26967  *
26968  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
26969  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
26970  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
26971  * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't
26972  * sufficient!
26973  *
26974  * [`send_data`]: SocketDescriptor::send_data
26975  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
26976  */
26977 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
26978
26979 /**
26980  * Indicates that data was read from the given socket descriptor.
26981  *
26982  * May return an Err to indicate that the connection should be closed.
26983  *
26984  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
26985  * Thus, however, you should call [`process_events`] after any `read_event` to generate
26986  * [`send_data`] calls to handle responses.
26987  *
26988  * If `Ok(true)` is returned, further read_events should not be triggered until a
26989  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
26990  * send buffer).
26991  *
26992  * [`send_data`]: SocketDescriptor::send_data
26993  * [`process_events`]: PeerManager::process_events
26994  */
26995 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);
26996
26997 /**
26998  * Checks for any events generated by our handlers and processes them. Includes sending most
26999  * response messages as well as messages generated by calls to handler functions directly (eg
27000  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
27001  *
27002  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
27003  * issues!
27004  *
27005  * You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
27006  * or one of the other clients provided in our language bindings.
27007  *
27008  * Note that if there are any other calls to this function waiting on lock(s) this may return
27009  * without doing any work. All available events that need handling will be handled before the
27010  * other calls return.
27011  *
27012  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
27013  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
27014  * [`send_data`]: SocketDescriptor::send_data
27015  */
27016 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
27017
27018 /**
27019  * Indicates that the given socket descriptor's connection is now closed.
27020  */
27021 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
27022
27023 /**
27024  * Disconnect a peer given its node id.
27025  *
27026  * Set `no_connection_possible` to true to prevent any further connection with this peer,
27027  * force-closing any channels we have with it.
27028  *
27029  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
27030  * peer. Thus, be very careful about reentrancy issues.
27031  *
27032  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
27033  */
27034 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
27035
27036 /**
27037  * Disconnects all currently-connected peers. This is useful on platforms where there may be
27038  * an indication that TCP sockets have stalled even if we weren't around to time them out
27039  * using regular ping/pongs.
27040  */
27041 void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg);
27042
27043 /**
27044  * Send pings to each peer and disconnect those which did not respond to the last round of
27045  * pings.
27046  *
27047  * This may be called on any timescale you want, however, roughly once every ten seconds is
27048  * preferred. The call rate determines both how often we send a ping to our peers and how much
27049  * time they have to respond before we disconnect them.
27050  *
27051  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
27052  * issues!
27053  *
27054  * [`send_data`]: SocketDescriptor::send_data
27055  */
27056 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
27057
27058 /**
27059  * Generates a signed node_announcement from the given arguments, sending it to all connected
27060  * peers. Note that peers will likely ignore this message unless we have at least one public
27061  * channel which has at least six confirmations on-chain.
27062  *
27063  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
27064  * node to humans. They carry no in-protocol meaning.
27065  *
27066  * `addresses` represent the set (possibly empty) of socket addresses on which this node
27067  * accepts incoming connections. These will be included in the node_announcement, publicly
27068  * tying these addresses together and to this node. If you wish to preserve user privacy,
27069  * addresses should likely contain only Tor Onion addresses.
27070  *
27071  * Panics if `addresses` is absurdly large (more than 100).
27072  *
27073  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
27074  */
27075 void PeerManager_broadcast_node_announcement(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
27076
27077 /**
27078  * Gets the weight for an HTLC-Success transaction.
27079  */
27080 uint64_t htlc_success_tx_weight(bool opt_anchors);
27081
27082 /**
27083  * Gets the weight for an HTLC-Timeout transaction.
27084  */
27085 uint64_t htlc_timeout_tx_weight(bool opt_anchors);
27086
27087 /**
27088  * Creates a copy of the HTLCClaim
27089  */
27090 enum LDKHTLCClaim HTLCClaim_clone(const enum LDKHTLCClaim *NONNULL_PTR orig);
27091
27092 /**
27093  * Utility method to constructs a new OfferedTimeout-variant HTLCClaim
27094  */
27095 enum LDKHTLCClaim HTLCClaim_offered_timeout(void);
27096
27097 /**
27098  * Utility method to constructs a new OfferedPreimage-variant HTLCClaim
27099  */
27100 enum LDKHTLCClaim HTLCClaim_offered_preimage(void);
27101
27102 /**
27103  * Utility method to constructs a new AcceptedTimeout-variant HTLCClaim
27104  */
27105 enum LDKHTLCClaim HTLCClaim_accepted_timeout(void);
27106
27107 /**
27108  * Utility method to constructs a new AcceptedPreimage-variant HTLCClaim
27109  */
27110 enum LDKHTLCClaim HTLCClaim_accepted_preimage(void);
27111
27112 /**
27113  * Utility method to constructs a new Revocation-variant HTLCClaim
27114  */
27115 enum LDKHTLCClaim HTLCClaim_revocation(void);
27116
27117 /**
27118  * Checks if two HTLCClaims contain equal inner contents.
27119  * This ignores pointers and is_owned flags and looks at the values in fields.
27120  */
27121 bool HTLCClaim_eq(const enum LDKHTLCClaim *NONNULL_PTR a, const enum LDKHTLCClaim *NONNULL_PTR b);
27122
27123 /**
27124  * Check if a given input witness attempts to claim a HTLC.
27125  */
27126 MUST_USE_RES struct LDKCOption_HTLCClaimZ HTLCClaim_from_witness(struct LDKWitness witness);
27127
27128 /**
27129  * Build the commitment secret from the seed and the commitment number
27130  */
27131 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
27132
27133 /**
27134  * Build a closing transaction
27135  */
27136 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);
27137
27138 /**
27139  * Frees any resources used by the CounterpartyCommitmentSecrets, if is_owned is set and inner is non-NULL.
27140  */
27141 void CounterpartyCommitmentSecrets_free(struct LDKCounterpartyCommitmentSecrets this_obj);
27142
27143 /**
27144  * Creates a copy of the CounterpartyCommitmentSecrets
27145  */
27146 struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_clone(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR orig);
27147
27148 /**
27149  * Creates a new empty `CounterpartyCommitmentSecrets` structure.
27150  */
27151 MUST_USE_RES struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_new(void);
27152
27153 /**
27154  * Returns the minimum index of all stored secrets. Note that indexes start
27155  * at 1 << 48 and get decremented by one for each new secret.
27156  */
27157 MUST_USE_RES uint64_t CounterpartyCommitmentSecrets_get_min_seen_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg);
27158
27159 /**
27160  * Inserts the `secret` at `idx`. Returns `Ok(())` if the secret
27161  * was generated in accordance with BOLT 3 and is consistent with previous secrets.
27162  */
27163 MUST_USE_RES struct LDKCResult_NoneNoneZ CounterpartyCommitmentSecrets_provide_secret(struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx, struct LDKThirtyTwoBytes secret);
27164
27165 /**
27166  * Returns the secret at `idx`.
27167  * Returns `None` if `idx` is < [`CounterpartyCommitmentSecrets::get_min_seen_secret`].
27168  *
27169  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27170  */
27171 MUST_USE_RES struct LDKThirtyTwoBytes CounterpartyCommitmentSecrets_get_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx);
27172
27173 /**
27174  * Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read
27175  */
27176 struct LDKCVec_u8Z CounterpartyCommitmentSecrets_write(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR obj);
27177
27178 /**
27179  * Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write
27180  */
27181 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitmentSecrets_read(struct LDKu8slice ser);
27182
27183 /**
27184  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
27185  * from the base secret and the per_commitment_point.
27186  */
27187 struct LDKSecretKey derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
27188
27189 /**
27190  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
27191  * from the base point and the per_commitment_key. This is the public equivalent of
27192  * derive_private_key - using only public keys to derive a public key instead of private keys.
27193  */
27194 struct LDKPublicKey derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
27195
27196 /**
27197  * Derives a per-commitment-transaction revocation key from its constituent parts.
27198  *
27199  * Only the cheating participant owns a valid witness to propagate a revoked
27200  * commitment transaction, thus per_commitment_secret always come from cheater
27201  * and revocation_base_secret always come from punisher, which is the broadcaster
27202  * of the transaction spending with this key knowledge.
27203  */
27204 struct LDKSecretKey derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
27205
27206 /**
27207  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
27208  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
27209  * public key instead of private keys.
27210  *
27211  * Only the cheating participant owns a valid witness to propagate a revoked
27212  * commitment transaction, thus per_commitment_point always come from cheater
27213  * and revocation_base_point always come from punisher, which is the broadcaster
27214  * of the transaction spending with this key knowledge.
27215  *
27216  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
27217  * generated (ie our own).
27218  */
27219 struct LDKPublicKey derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
27220
27221 /**
27222  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
27223  */
27224 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
27225
27226 /**
27227  * The broadcaster's per-commitment public key which was used to derive the other keys.
27228  */
27229 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
27230
27231 /**
27232  * The broadcaster's per-commitment public key which was used to derive the other keys.
27233  */
27234 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
27235
27236 /**
27237  * The revocation key which is used to allow the broadcaster of the commitment
27238  * transaction to provide their counterparty the ability to punish them if they broadcast
27239  * an old state.
27240  */
27241 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
27242
27243 /**
27244  * The revocation key which is used to allow the broadcaster of the commitment
27245  * transaction to provide their counterparty the ability to punish them if they broadcast
27246  * an old state.
27247  */
27248 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
27249
27250 /**
27251  * Broadcaster's HTLC Key
27252  */
27253 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
27254
27255 /**
27256  * Broadcaster's HTLC Key
27257  */
27258 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
27259
27260 /**
27261  * Countersignatory's HTLC Key
27262  */
27263 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
27264
27265 /**
27266  * Countersignatory's HTLC Key
27267  */
27268 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
27269
27270 /**
27271  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
27272  */
27273 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
27274
27275 /**
27276  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
27277  */
27278 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
27279
27280 /**
27281  * Constructs a new TxCreationKeys given each field
27282  */
27283 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);
27284
27285 /**
27286  * Checks if two TxCreationKeyss contain equal inner contents.
27287  * This ignores pointers and is_owned flags and looks at the values in fields.
27288  * Two objects with NULL inner values will be considered "equal" here.
27289  */
27290 bool TxCreationKeys_eq(const struct LDKTxCreationKeys *NONNULL_PTR a, const struct LDKTxCreationKeys *NONNULL_PTR b);
27291
27292 /**
27293  * Creates a copy of the TxCreationKeys
27294  */
27295 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
27296
27297 /**
27298  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
27299  */
27300 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
27301
27302 /**
27303  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
27304  */
27305 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
27306
27307 /**
27308  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
27309  */
27310 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
27311
27312 /**
27313  * The public key which is used to sign all commitment transactions, as it appears in the
27314  * on-chain channel lock-in 2-of-2 multisig output.
27315  */
27316 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
27317
27318 /**
27319  * The public key which is used to sign all commitment transactions, as it appears in the
27320  * on-chain channel lock-in 2-of-2 multisig output.
27321  */
27322 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
27323
27324 /**
27325  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
27326  * revocation keys. This is combined with the per-commitment-secret generated by the
27327  * counterparty to create a secret which the counterparty can reveal to revoke previous
27328  * states.
27329  */
27330 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
27331
27332 /**
27333  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
27334  * revocation keys. This is combined with the per-commitment-secret generated by the
27335  * counterparty to create a secret which the counterparty can reveal to revoke previous
27336  * states.
27337  */
27338 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
27339
27340 /**
27341  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
27342  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
27343  * static across every commitment transaction.
27344  */
27345 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
27346
27347 /**
27348  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
27349  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
27350  * static across every commitment transaction.
27351  */
27352 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
27353
27354 /**
27355  * The base point which is used (with derive_public_key) to derive a per-commitment payment
27356  * public key which receives non-HTLC-encumbered funds which are only available for spending
27357  * after some delay (or can be claimed via the revocation path).
27358  */
27359 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
27360
27361 /**
27362  * The base point which is used (with derive_public_key) to derive a per-commitment payment
27363  * public key which receives non-HTLC-encumbered funds which are only available for spending
27364  * after some delay (or can be claimed via the revocation path).
27365  */
27366 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
27367
27368 /**
27369  * The base point which is used (with derive_public_key) to derive a per-commitment public key
27370  * which is used to encumber HTLC-in-flight outputs.
27371  */
27372 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
27373
27374 /**
27375  * The base point which is used (with derive_public_key) to derive a per-commitment public key
27376  * which is used to encumber HTLC-in-flight outputs.
27377  */
27378 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
27379
27380 /**
27381  * Constructs a new ChannelPublicKeys given each field
27382  */
27383 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);
27384
27385 /**
27386  * Creates a copy of the ChannelPublicKeys
27387  */
27388 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
27389
27390 /**
27391  * Checks if two ChannelPublicKeyss contain equal inner contents.
27392  * This ignores pointers and is_owned flags and looks at the values in fields.
27393  * Two objects with NULL inner values will be considered "equal" here.
27394  */
27395 bool ChannelPublicKeys_eq(const struct LDKChannelPublicKeys *NONNULL_PTR a, const struct LDKChannelPublicKeys *NONNULL_PTR b);
27396
27397 /**
27398  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
27399  */
27400 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
27401
27402 /**
27403  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
27404  */
27405 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
27406
27407 /**
27408  * Create per-state keys from channel base points and the per-commitment point.
27409  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
27410  */
27411 MUST_USE_RES struct LDKTxCreationKeys 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);
27412
27413 /**
27414  * Generate per-state keys from channel static keys.
27415  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
27416  */
27417 MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_from_channel_static_keys(struct LDKPublicKey per_commitment_point, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys);
27418
27419 /**
27420  * A script either spendable by the revocation
27421  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
27422  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
27423  */
27424 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
27425
27426 /**
27427  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
27428  */
27429 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
27430
27431 /**
27432  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
27433  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
27434  * need to compare this value to whether the commitment transaction in question is that of
27435  * the counterparty or our own.
27436  */
27437 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
27438
27439 /**
27440  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
27441  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
27442  * need to compare this value to whether the commitment transaction in question is that of
27443  * the counterparty or our own.
27444  */
27445 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
27446
27447 /**
27448  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
27449  * this divided by 1000.
27450  */
27451 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
27452
27453 /**
27454  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
27455  * this divided by 1000.
27456  */
27457 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
27458
27459 /**
27460  * The CLTV lock-time at which this HTLC expires.
27461  */
27462 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
27463
27464 /**
27465  * The CLTV lock-time at which this HTLC expires.
27466  */
27467 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
27468
27469 /**
27470  * The hash of the preimage which unlocks this HTLC.
27471  */
27472 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
27473
27474 /**
27475  * The hash of the preimage which unlocks this HTLC.
27476  */
27477 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
27478
27479 /**
27480  * The position within the commitment transactions' outputs. This may be None if the value is
27481  * below the dust limit (in which case no output appears in the commitment transaction and the
27482  * value is spent to additional transaction fees).
27483  */
27484 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
27485
27486 /**
27487  * The position within the commitment transactions' outputs. This may be None if the value is
27488  * below the dust limit (in which case no output appears in the commitment transaction and the
27489  * value is spent to additional transaction fees).
27490  */
27491 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
27492
27493 /**
27494  * Constructs a new HTLCOutputInCommitment given each field
27495  */
27496 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);
27497
27498 /**
27499  * Creates a copy of the HTLCOutputInCommitment
27500  */
27501 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
27502
27503 /**
27504  * Checks if two HTLCOutputInCommitments contain equal inner contents.
27505  * This ignores pointers and is_owned flags and looks at the values in fields.
27506  * Two objects with NULL inner values will be considered "equal" here.
27507  */
27508 bool HTLCOutputInCommitment_eq(const struct LDKHTLCOutputInCommitment *NONNULL_PTR a, const struct LDKHTLCOutputInCommitment *NONNULL_PTR b);
27509
27510 /**
27511  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
27512  */
27513 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
27514
27515 /**
27516  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
27517  */
27518 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
27519
27520 /**
27521  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
27522  * does not need to have its previous_output_index filled.
27523  */
27524 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, const struct LDKTxCreationKeys *NONNULL_PTR keys);
27525
27526 /**
27527  * Gets the redeemscript for a funding output from the two funding public keys.
27528  * Note that the order of funding public keys does not matter.
27529  */
27530 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
27531
27532 /**
27533  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
27534  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
27535  * transaction which needs signing, and can be used to construct an HTLC transaction which is
27536  * broadcastable given a counterparty HTLC signature.
27537  *
27538  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
27539  * commitment transaction).
27540  */
27541 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, bool use_non_zero_fee_anchors, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key);
27542
27543 /**
27544  * Returns the witness required to satisfy and spend a HTLC input.
27545  *
27546  * Note that preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
27547  */
27548 struct LDKWitness build_htlc_input_witness(struct LDKSignature local_sig, struct LDKSignature remote_sig, struct LDKThirtyTwoBytes preimage, struct LDKu8slice redeem_script, bool opt_anchors);
27549
27550 /**
27551  * Gets the witnessScript for the to_remote output when anchors are enabled.
27552  */
27553 struct LDKCVec_u8Z get_to_countersignatory_with_anchors_redeemscript(struct LDKPublicKey payment_point);
27554
27555 /**
27556  * Gets the witnessScript for an anchor output from the funding public key.
27557  * The witness in the spending input must be:
27558  * <BIP 143 funding_signature>
27559  * After 16 blocks of confirmation, an alternative satisfying witness could be:
27560  * <>
27561  * (empty vector required to satisfy compliance with MINIMALIF-standard rule)
27562  */
27563 struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey);
27564
27565 /**
27566  * Returns the witness required to satisfy and spend an anchor input.
27567  */
27568 struct LDKWitness build_anchor_input_witness(struct LDKPublicKey funding_key, struct LDKSignature funding_sig);
27569
27570 /**
27571  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
27572  */
27573 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
27574
27575 /**
27576  * Holder public keys
27577  */
27578 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
27579
27580 /**
27581  * Holder public keys
27582  */
27583 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
27584
27585 /**
27586  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
27587  */
27588 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
27589
27590 /**
27591  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
27592  */
27593 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
27594
27595 /**
27596  * Whether the holder is the initiator of this channel.
27597  * This is an input to the commitment number obscure factor computation.
27598  */
27599 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
27600
27601 /**
27602  * Whether the holder is the initiator of this channel.
27603  * This is an input to the commitment number obscure factor computation.
27604  */
27605 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
27606
27607 /**
27608  * The late-bound counterparty channel transaction parameters.
27609  * These parameters are populated at the point in the protocol where the counterparty provides them.
27610  *
27611  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27612  */
27613 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
27614
27615 /**
27616  * The late-bound counterparty channel transaction parameters.
27617  * These parameters are populated at the point in the protocol where the counterparty provides them.
27618  *
27619  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
27620  */
27621 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
27622
27623 /**
27624  * The late-bound funding outpoint
27625  *
27626  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27627  */
27628 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
27629
27630 /**
27631  * The late-bound funding outpoint
27632  *
27633  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
27634  */
27635 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
27636
27637 /**
27638  * Are anchors (zero fee HTLC transaction variant) used for this channel. Boolean is
27639  * serialization backwards-compatible.
27640  */
27641 enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
27642
27643 /**
27644  * Are anchors (zero fee HTLC transaction variant) used for this channel. Boolean is
27645  * serialization backwards-compatible.
27646  */
27647 void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
27648
27649 /**
27650  * Are non-zero-fee anchors are enabled (used in conjuction with opt_anchors)
27651  * It is intended merely for backwards compatibility with signers that need it.
27652  * There is no support for this feature in LDK channel negotiation.
27653  */
27654 enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_non_zero_fee_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
27655
27656 /**
27657  * Are non-zero-fee anchors are enabled (used in conjuction with opt_anchors)
27658  * It is intended merely for backwards compatibility with signers that need it.
27659  * There is no support for this feature in LDK channel negotiation.
27660  */
27661 void ChannelTransactionParameters_set_opt_non_zero_fee_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
27662
27663 /**
27664  * Constructs a new ChannelTransactionParameters given each field
27665  */
27666 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, enum LDKCOption_NoneZ opt_non_zero_fee_anchors_arg);
27667
27668 /**
27669  * Creates a copy of the ChannelTransactionParameters
27670  */
27671 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
27672
27673 /**
27674  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
27675  */
27676 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
27677
27678 /**
27679  * Counter-party public keys
27680  */
27681 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
27682
27683 /**
27684  * Counter-party public keys
27685  */
27686 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
27687
27688 /**
27689  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
27690  */
27691 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
27692
27693 /**
27694  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
27695  */
27696 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
27697
27698 /**
27699  * Constructs a new CounterpartyChannelTransactionParameters given each field
27700  */
27701 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
27702
27703 /**
27704  * Creates a copy of the CounterpartyChannelTransactionParameters
27705  */
27706 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
27707
27708 /**
27709  * Whether the late bound parameters are populated.
27710  */
27711 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
27712
27713 /**
27714  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
27715  * given that the holder is the broadcaster.
27716  *
27717  * self.is_populated() must be true before calling this function.
27718  */
27719 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
27720
27721 /**
27722  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
27723  * given that the counterparty is the broadcaster.
27724  *
27725  * self.is_populated() must be true before calling this function.
27726  */
27727 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
27728
27729 /**
27730  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
27731  */
27732 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
27733
27734 /**
27735  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
27736  */
27737 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
27738
27739 /**
27740  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
27741  */
27742 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
27743
27744 /**
27745  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
27746  */
27747 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
27748
27749 /**
27750  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
27751  */
27752 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
27753
27754 /**
27755  * Get the channel pubkeys for the broadcaster
27756  */
27757 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
27758
27759 /**
27760  * Get the channel pubkeys for the countersignatory
27761  */
27762 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
27763
27764 /**
27765  * Get the contest delay applicable to the transactions.
27766  * Note that the contest delay was selected by the countersignatory.
27767  */
27768 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
27769
27770 /**
27771  * Whether the channel is outbound from the broadcaster.
27772  *
27773  * The boolean representing the side that initiated the channel is
27774  * an input to the commitment number obscure factor computation.
27775  */
27776 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
27777
27778 /**
27779  * The funding outpoint
27780  */
27781 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
27782
27783 /**
27784  * Whether to use anchors for this channel
27785  */
27786 MUST_USE_RES bool DirectedChannelTransactionParameters_opt_anchors(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
27787
27788 /**
27789  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
27790  */
27791 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
27792
27793 /**
27794  * Our counterparty's signature for the transaction
27795  */
27796 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
27797
27798 /**
27799  * Our counterparty's signature for the transaction
27800  */
27801 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
27802
27803 /**
27804  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
27805  *
27806  * Returns a copy of the field.
27807  */
27808 struct LDKCVec_SignatureZ HolderCommitmentTransaction_get_counterparty_htlc_sigs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
27809
27810 /**
27811  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
27812  */
27813 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
27814
27815 /**
27816  * Creates a copy of the HolderCommitmentTransaction
27817  */
27818 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
27819
27820 /**
27821  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
27822  */
27823 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
27824
27825 /**
27826  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
27827  */
27828 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
27829
27830 /**
27831  * Create a new holder transaction with the given counterparty signatures.
27832  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
27833  */
27834 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);
27835
27836 /**
27837  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
27838  */
27839 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
27840
27841 /**
27842  * The commitment transaction
27843  */
27844 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
27845
27846 /**
27847  * The commitment transaction
27848  */
27849 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
27850
27851 /**
27852  * The txid for the commitment transaction.
27853  *
27854  * This is provided as a performance optimization, instead of calling transaction.txid()
27855  * multiple times.
27856  */
27857 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
27858
27859 /**
27860  * The txid for the commitment transaction.
27861  *
27862  * This is provided as a performance optimization, instead of calling transaction.txid()
27863  * multiple times.
27864  */
27865 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
27866
27867 /**
27868  * Constructs a new BuiltCommitmentTransaction given each field
27869  */
27870 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
27871
27872 /**
27873  * Creates a copy of the BuiltCommitmentTransaction
27874  */
27875 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
27876
27877 /**
27878  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
27879  */
27880 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
27881
27882 /**
27883  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
27884  */
27885 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
27886
27887 /**
27888  * Get the SIGHASH_ALL sighash value of the transaction.
27889  *
27890  * This can be used to verify a signature.
27891  */
27892 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);
27893
27894 /**
27895  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
27896  * because we are about to broadcast a holder transaction.
27897  */
27898 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);
27899
27900 /**
27901  * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL.
27902  */
27903 void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
27904
27905 /**
27906  * Creates a copy of the ClosingTransaction
27907  */
27908 struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig);
27909
27910 /**
27911  * Checks if two ClosingTransactions contain equal inner contents.
27912  */
27913 uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o);
27914
27915 /**
27916  * Checks if two ClosingTransactions contain equal inner contents.
27917  * This ignores pointers and is_owned flags and looks at the values in fields.
27918  * Two objects with NULL inner values will be considered "equal" here.
27919  */
27920 bool ClosingTransaction_eq(const struct LDKClosingTransaction *NONNULL_PTR a, const struct LDKClosingTransaction *NONNULL_PTR b);
27921
27922 /**
27923  * Construct an object of the class
27924  */
27925 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);
27926
27927 /**
27928  * Trust our pre-built transaction.
27929  *
27930  * Applies a wrapper which allows access to the transaction.
27931  *
27932  * This should only be used if you fully trust the builder of this object. It should not
27933  * be used by an external signer - instead use the verify function.
27934  */
27935 MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
27936
27937 /**
27938  * Verify our pre-built transaction.
27939  *
27940  * Applies a wrapper which allows access to the transaction.
27941  *
27942  * An external validating signer must call this method before signing
27943  * or using the built transaction.
27944  */
27945 MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
27946
27947 /**
27948  * The value to be sent to the holder, or zero if the output will be omitted
27949  */
27950 MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
27951
27952 /**
27953  * The value to be sent to the counterparty, or zero if the output will be omitted
27954  */
27955 MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
27956
27957 /**
27958  * The destination of the holder's output
27959  */
27960 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
27961
27962 /**
27963  * The destination of the counterparty's output
27964  */
27965 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
27966
27967 /**
27968  * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL.
27969  */
27970 void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
27971
27972 /**
27973  * The pre-built Bitcoin commitment transaction
27974  */
27975 MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
27976
27977 /**
27978  * Get the SIGHASH_ALL sighash value of the transaction.
27979  *
27980  * This can be used to verify a signature.
27981  */
27982 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);
27983
27984 /**
27985  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
27986  * because we are about to broadcast a holder transaction.
27987  */
27988 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);
27989
27990 /**
27991  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
27992  */
27993 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
27994
27995 /**
27996  * Creates a copy of the CommitmentTransaction
27997  */
27998 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
27999
28000 /**
28001  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
28002  */
28003 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
28004
28005 /**
28006  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
28007  */
28008 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
28009
28010 /**
28011  * The backwards-counting commitment number
28012  */
28013 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
28014
28015 /**
28016  * The value to be sent to the broadcaster
28017  */
28018 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
28019
28020 /**
28021  * The value to be sent to the counterparty
28022  */
28023 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
28024
28025 /**
28026  * The feerate paid per 1000-weight-unit in this commitment transaction.
28027  */
28028 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
28029
28030 /**
28031  * Trust our pre-built transaction and derived transaction creation public keys.
28032  *
28033  * Applies a wrapper which allows access to these fields.
28034  *
28035  * This should only be used if you fully trust the builder of this object.  It should not
28036  * be used by an external signer - instead use the verify function.
28037  */
28038 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
28039
28040 /**
28041  * Verify our pre-built transaction and derived transaction creation public keys.
28042  *
28043  * Applies a wrapper which allows access to these fields.
28044  *
28045  * An external validating signer must call this method before signing
28046  * or using the built transaction.
28047  */
28048 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);
28049
28050 /**
28051  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
28052  */
28053 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
28054
28055 /**
28056  * The transaction ID of the built Bitcoin transaction
28057  */
28058 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
28059
28060 /**
28061  * The pre-built Bitcoin commitment transaction
28062  */
28063 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
28064
28065 /**
28066  * The pre-calculated transaction creation public keys.
28067  */
28068 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
28069
28070 /**
28071  * Should anchors be used.
28072  */
28073 MUST_USE_RES bool TrustedCommitmentTransaction_opt_anchors(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
28074
28075 /**
28076  * Get a signature for each HTLC which was included in the commitment transaction (ie for
28077  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
28078  *
28079  * The returned Vec has one entry for each HTLC, and in the same order.
28080  *
28081  * This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All.
28082  */
28083 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);
28084
28085 /**
28086  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
28087  * shared secret first. This prevents on-chain observers from discovering how many commitment
28088  * transactions occurred in a channel before it was closed.
28089  *
28090  * This function gets the shared secret from relevant channel public keys and can be used to
28091  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
28092  */
28093 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
28094
28095 /**
28096  * Checks if two InitFeaturess contain equal inner contents.
28097  * This ignores pointers and is_owned flags and looks at the values in fields.
28098  * Two objects with NULL inner values will be considered "equal" here.
28099  */
28100 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
28101
28102 /**
28103  * Checks if two NodeFeaturess contain equal inner contents.
28104  * This ignores pointers and is_owned flags and looks at the values in fields.
28105  * Two objects with NULL inner values will be considered "equal" here.
28106  */
28107 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
28108
28109 /**
28110  * Checks if two ChannelFeaturess contain equal inner contents.
28111  * This ignores pointers and is_owned flags and looks at the values in fields.
28112  * Two objects with NULL inner values will be considered "equal" here.
28113  */
28114 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
28115
28116 /**
28117  * Checks if two InvoiceFeaturess contain equal inner contents.
28118  * This ignores pointers and is_owned flags and looks at the values in fields.
28119  * Two objects with NULL inner values will be considered "equal" here.
28120  */
28121 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
28122
28123 /**
28124  * Checks if two OfferFeaturess contain equal inner contents.
28125  * This ignores pointers and is_owned flags and looks at the values in fields.
28126  * Two objects with NULL inner values will be considered "equal" here.
28127  */
28128 bool OfferFeatures_eq(const struct LDKOfferFeatures *NONNULL_PTR a, const struct LDKOfferFeatures *NONNULL_PTR b);
28129
28130 /**
28131  * Checks if two InvoiceRequestFeaturess contain equal inner contents.
28132  * This ignores pointers and is_owned flags and looks at the values in fields.
28133  * Two objects with NULL inner values will be considered "equal" here.
28134  */
28135 bool InvoiceRequestFeatures_eq(const struct LDKInvoiceRequestFeatures *NONNULL_PTR a, const struct LDKInvoiceRequestFeatures *NONNULL_PTR b);
28136
28137 /**
28138  * Checks if two ChannelTypeFeaturess contain equal inner contents.
28139  * This ignores pointers and is_owned flags and looks at the values in fields.
28140  * Two objects with NULL inner values will be considered "equal" here.
28141  */
28142 bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b);
28143
28144 /**
28145  * Creates a copy of the InitFeatures
28146  */
28147 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
28148
28149 /**
28150  * Creates a copy of the NodeFeatures
28151  */
28152 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
28153
28154 /**
28155  * Creates a copy of the ChannelFeatures
28156  */
28157 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
28158
28159 /**
28160  * Creates a copy of the InvoiceFeatures
28161  */
28162 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
28163
28164 /**
28165  * Creates a copy of the OfferFeatures
28166  */
28167 struct LDKOfferFeatures OfferFeatures_clone(const struct LDKOfferFeatures *NONNULL_PTR orig);
28168
28169 /**
28170  * Creates a copy of the InvoiceRequestFeatures
28171  */
28172 struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_clone(const struct LDKInvoiceRequestFeatures *NONNULL_PTR orig);
28173
28174 /**
28175  * Creates a copy of the ChannelTypeFeatures
28176  */
28177 struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig);
28178
28179 /**
28180  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
28181  */
28182 void InitFeatures_free(struct LDKInitFeatures this_obj);
28183
28184 /**
28185  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
28186  */
28187 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
28188
28189 /**
28190  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
28191  */
28192 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
28193
28194 /**
28195  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
28196  */
28197 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
28198
28199 /**
28200  * Frees any resources used by the OfferFeatures, if is_owned is set and inner is non-NULL.
28201  */
28202 void OfferFeatures_free(struct LDKOfferFeatures this_obj);
28203
28204 /**
28205  * Frees any resources used by the InvoiceRequestFeatures, if is_owned is set and inner is non-NULL.
28206  */
28207 void InvoiceRequestFeatures_free(struct LDKInvoiceRequestFeatures this_obj);
28208
28209 /**
28210  * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL.
28211  */
28212 void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj);
28213
28214 /**
28215  * Create a blank Features with no features set
28216  */
28217 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
28218
28219 /**
28220  * Returns true if this `Features` object contains unknown feature flags which are set as
28221  * \"required\".
28222  */
28223 MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28224
28225 /**
28226  * Create a blank Features with no features set
28227  */
28228 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
28229
28230 /**
28231  * Returns true if this `Features` object contains unknown feature flags which are set as
28232  * \"required\".
28233  */
28234 MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28235
28236 /**
28237  * Create a blank Features with no features set
28238  */
28239 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
28240
28241 /**
28242  * Returns true if this `Features` object contains unknown feature flags which are set as
28243  * \"required\".
28244  */
28245 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
28246
28247 /**
28248  * Create a blank Features with no features set
28249  */
28250 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
28251
28252 /**
28253  * Returns true if this `Features` object contains unknown feature flags which are set as
28254  * \"required\".
28255  */
28256 MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
28257
28258 /**
28259  * Create a blank Features with no features set
28260  */
28261 MUST_USE_RES struct LDKOfferFeatures OfferFeatures_empty(void);
28262
28263 /**
28264  * Returns true if this `Features` object contains unknown feature flags which are set as
28265  * \"required\".
28266  */
28267 MUST_USE_RES bool OfferFeatures_requires_unknown_bits(const struct LDKOfferFeatures *NONNULL_PTR this_arg);
28268
28269 /**
28270  * Create a blank Features with no features set
28271  */
28272 MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_empty(void);
28273
28274 /**
28275  * Returns true if this `Features` object contains unknown feature flags which are set as
28276  * \"required\".
28277  */
28278 MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg);
28279
28280 /**
28281  * Create a blank Features with no features set
28282  */
28283 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void);
28284
28285 /**
28286  * Returns true if this `Features` object contains unknown feature flags which are set as
28287  * \"required\".
28288  */
28289 MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
28290
28291 /**
28292  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
28293  */
28294 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
28295
28296 /**
28297  * Read a InitFeatures from a byte array, created by InitFeatures_write
28298  */
28299 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
28300
28301 /**
28302  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
28303  */
28304 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
28305
28306 /**
28307  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
28308  */
28309 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
28310
28311 /**
28312  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
28313  */
28314 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
28315
28316 /**
28317  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
28318  */
28319 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
28320
28321 /**
28322  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
28323  */
28324 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
28325
28326 /**
28327  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
28328  */
28329 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
28330
28331 /**
28332  * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
28333  */
28334 struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj);
28335
28336 /**
28337  * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
28338  */
28339 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser);
28340
28341 /**
28342  * Serialize the OfferFeatures object into a byte array which can be read by OfferFeatures_read
28343  */
28344 struct LDKCVec_u8Z OfferFeatures_write(const struct LDKOfferFeatures *NONNULL_PTR obj);
28345
28346 /**
28347  * Read a OfferFeatures from a byte array, created by OfferFeatures_write
28348  */
28349 struct LDKCResult_OfferFeaturesDecodeErrorZ OfferFeatures_read(struct LDKu8slice ser);
28350
28351 /**
28352  * Serialize the InvoiceRequestFeatures object into a byte array which can be read by InvoiceRequestFeatures_read
28353  */
28354 struct LDKCVec_u8Z InvoiceRequestFeatures_write(const struct LDKInvoiceRequestFeatures *NONNULL_PTR obj);
28355
28356 /**
28357  * Read a InvoiceRequestFeatures from a byte array, created by InvoiceRequestFeatures_write
28358  */
28359 struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ InvoiceRequestFeatures_read(struct LDKu8slice ser);
28360
28361 /**
28362  * Set this feature as optional.
28363  */
28364 void InitFeatures_set_data_loss_protect_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
28365
28366 /**
28367  * Set this feature as required.
28368  */
28369 void InitFeatures_set_data_loss_protect_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
28370
28371 /**
28372  * Checks if this feature is supported.
28373  */
28374 MUST_USE_RES bool InitFeatures_supports_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28375
28376 /**
28377  * Set this feature as optional.
28378  */
28379 void NodeFeatures_set_data_loss_protect_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28380
28381 /**
28382  * Set this feature as required.
28383  */
28384 void NodeFeatures_set_data_loss_protect_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28385
28386 /**
28387  * Checks if this feature is supported.
28388  */
28389 MUST_USE_RES bool NodeFeatures_supports_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28390
28391 /**
28392  * Checks if this feature is required.
28393  */
28394 MUST_USE_RES bool InitFeatures_requires_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28395
28396 /**
28397  * Checks if this feature is required.
28398  */
28399 MUST_USE_RES bool NodeFeatures_requires_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28400
28401 /**
28402  * Set this feature as optional.
28403  */
28404 void InitFeatures_set_initial_routing_sync_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
28405
28406 /**
28407  * Set this feature as required.
28408  */
28409 void InitFeatures_set_initial_routing_sync_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
28410
28411 /**
28412  * Checks if this feature is supported.
28413  */
28414 MUST_USE_RES bool InitFeatures_initial_routing_sync(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28415
28416 /**
28417  * Set this feature as optional.
28418  */
28419 void InitFeatures_set_upfront_shutdown_script_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
28420
28421 /**
28422  * Set this feature as required.
28423  */
28424 void InitFeatures_set_upfront_shutdown_script_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
28425
28426 /**
28427  * Checks if this feature is supported.
28428  */
28429 MUST_USE_RES bool InitFeatures_supports_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28430
28431 /**
28432  * Set this feature as optional.
28433  */
28434 void NodeFeatures_set_upfront_shutdown_script_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28435
28436 /**
28437  * Set this feature as required.
28438  */
28439 void NodeFeatures_set_upfront_shutdown_script_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28440
28441 /**
28442  * Checks if this feature is supported.
28443  */
28444 MUST_USE_RES bool NodeFeatures_supports_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28445
28446 /**
28447  * Checks if this feature is required.
28448  */
28449 MUST_USE_RES bool InitFeatures_requires_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28450
28451 /**
28452  * Checks if this feature is required.
28453  */
28454 MUST_USE_RES bool NodeFeatures_requires_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28455
28456 /**
28457  * Set this feature as optional.
28458  */
28459 void InitFeatures_set_gossip_queries_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
28460
28461 /**
28462  * Set this feature as required.
28463  */
28464 void InitFeatures_set_gossip_queries_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
28465
28466 /**
28467  * Checks if this feature is supported.
28468  */
28469 MUST_USE_RES bool InitFeatures_supports_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28470
28471 /**
28472  * Set this feature as optional.
28473  */
28474 void NodeFeatures_set_gossip_queries_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28475
28476 /**
28477  * Set this feature as required.
28478  */
28479 void NodeFeatures_set_gossip_queries_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28480
28481 /**
28482  * Checks if this feature is supported.
28483  */
28484 MUST_USE_RES bool NodeFeatures_supports_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28485
28486 /**
28487  * Checks if this feature is required.
28488  */
28489 MUST_USE_RES bool InitFeatures_requires_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28490
28491 /**
28492  * Checks if this feature is required.
28493  */
28494 MUST_USE_RES bool NodeFeatures_requires_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28495
28496 /**
28497  * Set this feature as optional.
28498  */
28499 void InitFeatures_set_variable_length_onion_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
28500
28501 /**
28502  * Set this feature as required.
28503  */
28504 void InitFeatures_set_variable_length_onion_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
28505
28506 /**
28507  * Checks if this feature is supported.
28508  */
28509 MUST_USE_RES bool InitFeatures_supports_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28510
28511 /**
28512  * Set this feature as optional.
28513  */
28514 void NodeFeatures_set_variable_length_onion_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28515
28516 /**
28517  * Set this feature as required.
28518  */
28519 void NodeFeatures_set_variable_length_onion_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28520
28521 /**
28522  * Checks if this feature is supported.
28523  */
28524 MUST_USE_RES bool NodeFeatures_supports_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28525
28526 /**
28527  * Set this feature as optional.
28528  */
28529 void InvoiceFeatures_set_variable_length_onion_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
28530
28531 /**
28532  * Set this feature as required.
28533  */
28534 void InvoiceFeatures_set_variable_length_onion_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
28535
28536 /**
28537  * Checks if this feature is supported.
28538  */
28539 MUST_USE_RES bool InvoiceFeatures_supports_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
28540
28541 /**
28542  * Checks if this feature is required.
28543  */
28544 MUST_USE_RES bool InitFeatures_requires_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28545
28546 /**
28547  * Checks if this feature is required.
28548  */
28549 MUST_USE_RES bool NodeFeatures_requires_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28550
28551 /**
28552  * Checks if this feature is required.
28553  */
28554 MUST_USE_RES bool InvoiceFeatures_requires_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
28555
28556 /**
28557  * Set this feature as optional.
28558  */
28559 void InitFeatures_set_static_remote_key_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
28560
28561 /**
28562  * Set this feature as required.
28563  */
28564 void InitFeatures_set_static_remote_key_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
28565
28566 /**
28567  * Checks if this feature is supported.
28568  */
28569 MUST_USE_RES bool InitFeatures_supports_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28570
28571 /**
28572  * Set this feature as optional.
28573  */
28574 void NodeFeatures_set_static_remote_key_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28575
28576 /**
28577  * Set this feature as required.
28578  */
28579 void NodeFeatures_set_static_remote_key_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28580
28581 /**
28582  * Checks if this feature is supported.
28583  */
28584 MUST_USE_RES bool NodeFeatures_supports_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28585
28586 /**
28587  * Set this feature as optional.
28588  */
28589 void ChannelTypeFeatures_set_static_remote_key_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
28590
28591 /**
28592  * Set this feature as required.
28593  */
28594 void ChannelTypeFeatures_set_static_remote_key_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
28595
28596 /**
28597  * Checks if this feature is supported.
28598  */
28599 MUST_USE_RES bool ChannelTypeFeatures_supports_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
28600
28601 /**
28602  * Checks if this feature is required.
28603  */
28604 MUST_USE_RES bool InitFeatures_requires_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28605
28606 /**
28607  * Checks if this feature is required.
28608  */
28609 MUST_USE_RES bool NodeFeatures_requires_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28610
28611 /**
28612  * Checks if this feature is required.
28613  */
28614 MUST_USE_RES bool ChannelTypeFeatures_requires_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
28615
28616 /**
28617  * Set this feature as optional.
28618  */
28619 void InitFeatures_set_payment_secret_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
28620
28621 /**
28622  * Set this feature as required.
28623  */
28624 void InitFeatures_set_payment_secret_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
28625
28626 /**
28627  * Checks if this feature is supported.
28628  */
28629 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28630
28631 /**
28632  * Set this feature as optional.
28633  */
28634 void NodeFeatures_set_payment_secret_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28635
28636 /**
28637  * Set this feature as required.
28638  */
28639 void NodeFeatures_set_payment_secret_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28640
28641 /**
28642  * Checks if this feature is supported.
28643  */
28644 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28645
28646 /**
28647  * Set this feature as optional.
28648  */
28649 void InvoiceFeatures_set_payment_secret_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
28650
28651 /**
28652  * Set this feature as required.
28653  */
28654 void InvoiceFeatures_set_payment_secret_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
28655
28656 /**
28657  * Checks if this feature is supported.
28658  */
28659 MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
28660
28661 /**
28662  * Checks if this feature is required.
28663  */
28664 MUST_USE_RES bool InitFeatures_requires_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28665
28666 /**
28667  * Checks if this feature is required.
28668  */
28669 MUST_USE_RES bool NodeFeatures_requires_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28670
28671 /**
28672  * Checks if this feature is required.
28673  */
28674 MUST_USE_RES bool InvoiceFeatures_requires_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
28675
28676 /**
28677  * Set this feature as optional.
28678  */
28679 void InitFeatures_set_basic_mpp_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
28680
28681 /**
28682  * Set this feature as required.
28683  */
28684 void InitFeatures_set_basic_mpp_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
28685
28686 /**
28687  * Checks if this feature is supported.
28688  */
28689 MUST_USE_RES bool InitFeatures_supports_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28690
28691 /**
28692  * Set this feature as optional.
28693  */
28694 void NodeFeatures_set_basic_mpp_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28695
28696 /**
28697  * Set this feature as required.
28698  */
28699 void NodeFeatures_set_basic_mpp_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28700
28701 /**
28702  * Checks if this feature is supported.
28703  */
28704 MUST_USE_RES bool NodeFeatures_supports_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28705
28706 /**
28707  * Set this feature as optional.
28708  */
28709 void InvoiceFeatures_set_basic_mpp_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
28710
28711 /**
28712  * Set this feature as required.
28713  */
28714 void InvoiceFeatures_set_basic_mpp_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
28715
28716 /**
28717  * Checks if this feature is supported.
28718  */
28719 MUST_USE_RES bool InvoiceFeatures_supports_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
28720
28721 /**
28722  * Checks if this feature is required.
28723  */
28724 MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28725
28726 /**
28727  * Checks if this feature is required.
28728  */
28729 MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28730
28731 /**
28732  * Checks if this feature is required.
28733  */
28734 MUST_USE_RES bool InvoiceFeatures_requires_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
28735
28736 /**
28737  * Set this feature as optional.
28738  */
28739 void InitFeatures_set_wumbo_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
28740
28741 /**
28742  * Set this feature as required.
28743  */
28744 void InitFeatures_set_wumbo_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
28745
28746 /**
28747  * Checks if this feature is supported.
28748  */
28749 MUST_USE_RES bool InitFeatures_supports_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28750
28751 /**
28752  * Set this feature as optional.
28753  */
28754 void NodeFeatures_set_wumbo_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28755
28756 /**
28757  * Set this feature as required.
28758  */
28759 void NodeFeatures_set_wumbo_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28760
28761 /**
28762  * Checks if this feature is supported.
28763  */
28764 MUST_USE_RES bool NodeFeatures_supports_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28765
28766 /**
28767  * Checks if this feature is required.
28768  */
28769 MUST_USE_RES bool InitFeatures_requires_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28770
28771 /**
28772  * Checks if this feature is required.
28773  */
28774 MUST_USE_RES bool NodeFeatures_requires_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28775
28776 /**
28777  * Set this feature as optional.
28778  */
28779 void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
28780
28781 /**
28782  * Set this feature as required.
28783  */
28784 void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
28785
28786 /**
28787  * Checks if this feature is supported.
28788  */
28789 MUST_USE_RES bool InitFeatures_supports_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28790
28791 /**
28792  * Set this feature as optional.
28793  */
28794 void NodeFeatures_set_shutdown_any_segwit_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28795
28796 /**
28797  * Set this feature as required.
28798  */
28799 void NodeFeatures_set_shutdown_any_segwit_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28800
28801 /**
28802  * Checks if this feature is supported.
28803  */
28804 MUST_USE_RES bool NodeFeatures_supports_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28805
28806 /**
28807  * Checks if this feature is required.
28808  */
28809 MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28810
28811 /**
28812  * Checks if this feature is required.
28813  */
28814 MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28815
28816 /**
28817  * Set this feature as optional.
28818  */
28819 void InitFeatures_set_onion_messages_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
28820
28821 /**
28822  * Set this feature as required.
28823  */
28824 void InitFeatures_set_onion_messages_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
28825
28826 /**
28827  * Checks if this feature is supported.
28828  */
28829 MUST_USE_RES bool InitFeatures_supports_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28830
28831 /**
28832  * Set this feature as optional.
28833  */
28834 void NodeFeatures_set_onion_messages_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28835
28836 /**
28837  * Set this feature as required.
28838  */
28839 void NodeFeatures_set_onion_messages_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28840
28841 /**
28842  * Checks if this feature is supported.
28843  */
28844 MUST_USE_RES bool NodeFeatures_supports_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28845
28846 /**
28847  * Checks if this feature is required.
28848  */
28849 MUST_USE_RES bool InitFeatures_requires_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28850
28851 /**
28852  * Checks if this feature is required.
28853  */
28854 MUST_USE_RES bool NodeFeatures_requires_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28855
28856 /**
28857  * Set this feature as optional.
28858  */
28859 void InitFeatures_set_channel_type_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
28860
28861 /**
28862  * Set this feature as required.
28863  */
28864 void InitFeatures_set_channel_type_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
28865
28866 /**
28867  * Checks if this feature is supported.
28868  */
28869 MUST_USE_RES bool InitFeatures_supports_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28870
28871 /**
28872  * Set this feature as optional.
28873  */
28874 void NodeFeatures_set_channel_type_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28875
28876 /**
28877  * Set this feature as required.
28878  */
28879 void NodeFeatures_set_channel_type_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28880
28881 /**
28882  * Checks if this feature is supported.
28883  */
28884 MUST_USE_RES bool NodeFeatures_supports_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28885
28886 /**
28887  * Checks if this feature is required.
28888  */
28889 MUST_USE_RES bool InitFeatures_requires_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28890
28891 /**
28892  * Checks if this feature is required.
28893  */
28894 MUST_USE_RES bool NodeFeatures_requires_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28895
28896 /**
28897  * Set this feature as optional.
28898  */
28899 void InitFeatures_set_scid_privacy_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
28900
28901 /**
28902  * Set this feature as required.
28903  */
28904 void InitFeatures_set_scid_privacy_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
28905
28906 /**
28907  * Checks if this feature is supported.
28908  */
28909 MUST_USE_RES bool InitFeatures_supports_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28910
28911 /**
28912  * Set this feature as optional.
28913  */
28914 void NodeFeatures_set_scid_privacy_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28915
28916 /**
28917  * Set this feature as required.
28918  */
28919 void NodeFeatures_set_scid_privacy_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28920
28921 /**
28922  * Checks if this feature is supported.
28923  */
28924 MUST_USE_RES bool NodeFeatures_supports_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28925
28926 /**
28927  * Set this feature as optional.
28928  */
28929 void ChannelTypeFeatures_set_scid_privacy_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
28930
28931 /**
28932  * Set this feature as required.
28933  */
28934 void ChannelTypeFeatures_set_scid_privacy_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
28935
28936 /**
28937  * Checks if this feature is supported.
28938  */
28939 MUST_USE_RES bool ChannelTypeFeatures_supports_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
28940
28941 /**
28942  * Checks if this feature is required.
28943  */
28944 MUST_USE_RES bool InitFeatures_requires_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28945
28946 /**
28947  * Checks if this feature is required.
28948  */
28949 MUST_USE_RES bool NodeFeatures_requires_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28950
28951 /**
28952  * Checks if this feature is required.
28953  */
28954 MUST_USE_RES bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
28955
28956 /**
28957  * Set this feature as optional.
28958  */
28959 void InitFeatures_set_zero_conf_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
28960
28961 /**
28962  * Set this feature as required.
28963  */
28964 void InitFeatures_set_zero_conf_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
28965
28966 /**
28967  * Checks if this feature is supported.
28968  */
28969 MUST_USE_RES bool InitFeatures_supports_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
28970
28971 /**
28972  * Set this feature as optional.
28973  */
28974 void NodeFeatures_set_zero_conf_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28975
28976 /**
28977  * Set this feature as required.
28978  */
28979 void NodeFeatures_set_zero_conf_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
28980
28981 /**
28982  * Checks if this feature is supported.
28983  */
28984 MUST_USE_RES bool NodeFeatures_supports_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
28985
28986 /**
28987  * Set this feature as optional.
28988  */
28989 void ChannelTypeFeatures_set_zero_conf_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
28990
28991 /**
28992  * Set this feature as required.
28993  */
28994 void ChannelTypeFeatures_set_zero_conf_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
28995
28996 /**
28997  * Checks if this feature is supported.
28998  */
28999 MUST_USE_RES bool ChannelTypeFeatures_supports_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
29000
29001 /**
29002  * Checks if this feature is required.
29003  */
29004 MUST_USE_RES bool InitFeatures_requires_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29005
29006 /**
29007  * Checks if this feature is required.
29008  */
29009 MUST_USE_RES bool NodeFeatures_requires_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29010
29011 /**
29012  * Checks if this feature is required.
29013  */
29014 MUST_USE_RES bool ChannelTypeFeatures_requires_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
29015
29016 /**
29017  * Set this feature as optional.
29018  */
29019 void NodeFeatures_set_keysend_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29020
29021 /**
29022  * Set this feature as required.
29023  */
29024 void NodeFeatures_set_keysend_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29025
29026 /**
29027  * Checks if this feature is supported.
29028  */
29029 MUST_USE_RES bool NodeFeatures_supports_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29030
29031 /**
29032  * Checks if this feature is required.
29033  */
29034 MUST_USE_RES bool NodeFeatures_requires_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29035
29036 /**
29037  * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
29038  */
29039 void ShutdownScript_free(struct LDKShutdownScript this_obj);
29040
29041 /**
29042  * Creates a copy of the ShutdownScript
29043  */
29044 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
29045
29046 /**
29047  * Checks if two ShutdownScripts contain equal inner contents.
29048  * This ignores pointers and is_owned flags and looks at the values in fields.
29049  * Two objects with NULL inner values will be considered "equal" here.
29050  */
29051 bool ShutdownScript_eq(const struct LDKShutdownScript *NONNULL_PTR a, const struct LDKShutdownScript *NONNULL_PTR b);
29052
29053 /**
29054  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
29055  */
29056 void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
29057
29058 /**
29059  * The script that did not meet the requirements from [BOLT #2].
29060  *
29061  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
29062  */
29063 struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
29064
29065 /**
29066  * The script that did not meet the requirements from [BOLT #2].
29067  *
29068  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
29069  */
29070 void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
29071
29072 /**
29073  * Constructs a new InvalidShutdownScript given each field
29074  */
29075 MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
29076
29077 /**
29078  * Creates a copy of the InvalidShutdownScript
29079  */
29080 struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig);
29081
29082 /**
29083  * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
29084  */
29085 struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
29086
29087 /**
29088  * Read a ShutdownScript from a byte array, created by ShutdownScript_write
29089  */
29090 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
29091
29092 /**
29093  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
29094  */
29095 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
29096
29097 /**
29098  * Generates a P2WSH script pubkey from the given [`WScriptHash`].
29099  */
29100 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
29101
29102 /**
29103  * Generates a witness script pubkey from the given segwit version and program.
29104  *
29105  * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
29106  * [`ShutdownScript::new_p2wsh`] instead.
29107  *
29108  * # Errors
29109  *
29110  * This function may return an error if `program` is invalid for the segwit `version`.
29111  */
29112 MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(struct LDKWitnessVersion version, struct LDKu8slice program);
29113
29114 /**
29115  * Converts the shutdown script into the underlying [`Script`].
29116  */
29117 MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
29118
29119 /**
29120  * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
29121  *
29122  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
29123  */
29124 MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
29125
29126 /**
29127  * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
29128  *
29129  * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
29130  */
29131 MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
29132
29133 /**
29134  * Calls the free function if one is set
29135  */
29136 void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
29137
29138 /**
29139  * Calls the free function if one is set
29140  */
29141 void Type_free(struct LDKType this_ptr);
29142
29143 /**
29144  * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
29145  */
29146 void NodeId_free(struct LDKNodeId this_obj);
29147
29148 /**
29149  * Creates a copy of the NodeId
29150  */
29151 struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig);
29152
29153 /**
29154  * Create a new NodeId from a public key
29155  */
29156 MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey);
29157
29158 /**
29159  * Get the public key slice from this NodeId
29160  */
29161 MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
29162
29163 /**
29164  * Checks if two NodeIds contain equal inner contents.
29165  */
29166 uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
29167
29168 /**
29169  * Serialize the NodeId object into a byte array which can be read by NodeId_read
29170  */
29171 struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj);
29172
29173 /**
29174  * Read a NodeId from a byte array, created by NodeId_write
29175  */
29176 struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser);
29177
29178 /**
29179  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
29180  */
29181 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
29182
29183 /**
29184  * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
29185  */
29186 void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
29187
29188 /**
29189  * Frees any resources used by the NetworkUpdate
29190  */
29191 void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
29192
29193 /**
29194  * Creates a copy of the NetworkUpdate
29195  */
29196 struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
29197
29198 /**
29199  * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
29200  */
29201 struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
29202
29203 /**
29204  * Utility method to constructs a new ChannelFailure-variant NetworkUpdate
29205  */
29206 struct LDKNetworkUpdate NetworkUpdate_channel_failure(uint64_t short_channel_id, bool is_permanent);
29207
29208 /**
29209  * Utility method to constructs a new NodeFailure-variant NetworkUpdate
29210  */
29211 struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
29212
29213 /**
29214  * Checks if two NetworkUpdates contain equal inner contents.
29215  * This ignores pointers and is_owned flags and looks at the values in fields.
29216  */
29217 bool NetworkUpdate_eq(const struct LDKNetworkUpdate *NONNULL_PTR a, const struct LDKNetworkUpdate *NONNULL_PTR b);
29218
29219 /**
29220  * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
29221  */
29222 struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
29223
29224 /**
29225  * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
29226  */
29227 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser);
29228
29229 /**
29230  * Frees any resources used by the P2PGossipSync, if is_owned is set and inner is non-NULL.
29231  */
29232 void P2PGossipSync_free(struct LDKP2PGossipSync this_obj);
29233
29234 /**
29235  * Creates a new tracker of the actual state of the network of channels and nodes,
29236  * assuming an existing Network Graph.
29237  * Chain monitor is used to make sure announced channels exist on-chain,
29238  * channel data is correct, and that the announcement is signed with
29239  * channel owners' keys.
29240  */
29241 MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
29242
29243 /**
29244  * Adds a provider used to check new announcements. Does not affect
29245  * existing announcements unless they are updated.
29246  * Add, update or remove the provider would replace the current one.
29247  */
29248 void P2PGossipSync_add_chain_access(struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access);
29249
29250 /**
29251  * Handles any network updates originating from [`Event`]s.
29252  *
29253  * [`Event`]: crate::util::events::Event
29254  */
29255 void NetworkGraph_handle_network_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNetworkUpdate *NONNULL_PTR network_update);
29256
29257 /**
29258  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
29259  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
29260  */
29261 struct LDKRoutingMessageHandler P2PGossipSync_as_RoutingMessageHandler(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
29262
29263 /**
29264  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
29265  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
29266  */
29267 struct LDKMessageSendEventsProvider P2PGossipSync_as_MessageSendEventsProvider(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
29268
29269 /**
29270  * Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL.
29271  */
29272 void ChannelUpdateInfo_free(struct LDKChannelUpdateInfo this_obj);
29273
29274 /**
29275  * When the last update to the channel direction was issued.
29276  * Value is opaque, as set in the announcement.
29277  */
29278 uint32_t ChannelUpdateInfo_get_last_update(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
29279
29280 /**
29281  * When the last update to the channel direction was issued.
29282  * Value is opaque, as set in the announcement.
29283  */
29284 void ChannelUpdateInfo_set_last_update(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint32_t val);
29285
29286 /**
29287  * Whether the channel can be currently used for payments (in this one direction).
29288  */
29289 bool ChannelUpdateInfo_get_enabled(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
29290
29291 /**
29292  * Whether the channel can be currently used for payments (in this one direction).
29293  */
29294 void ChannelUpdateInfo_set_enabled(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, bool val);
29295
29296 /**
29297  * The difference in CLTV values that you must have when routing through this channel.
29298  */
29299 uint16_t ChannelUpdateInfo_get_cltv_expiry_delta(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
29300
29301 /**
29302  * The difference in CLTV values that you must have when routing through this channel.
29303  */
29304 void ChannelUpdateInfo_set_cltv_expiry_delta(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint16_t val);
29305
29306 /**
29307  * The minimum value, which must be relayed to the next hop via the channel
29308  */
29309 uint64_t ChannelUpdateInfo_get_htlc_minimum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
29310
29311 /**
29312  * The minimum value, which must be relayed to the next hop via the channel
29313  */
29314 void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
29315
29316 /**
29317  * The maximum value which may be relayed to the next hop via the channel.
29318  */
29319 uint64_t ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
29320
29321 /**
29322  * The maximum value which may be relayed to the next hop via the channel.
29323  */
29324 void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
29325
29326 /**
29327  * Fees charged when the channel is used for routing
29328  */
29329 struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
29330
29331 /**
29332  * Fees charged when the channel is used for routing
29333  */
29334 void ChannelUpdateInfo_set_fees(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
29335
29336 /**
29337  * Most recent update for the channel received from the network
29338  * Mostly redundant with the data we store in fields explicitly.
29339  * Everything else is useful only for sending out for initial routing sync.
29340  * Not stored if contains excess data to prevent DoS.
29341  *
29342  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
29343  */
29344 struct LDKChannelUpdate ChannelUpdateInfo_get_last_update_message(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
29345
29346 /**
29347  * Most recent update for the channel received from the network
29348  * Mostly redundant with the data we store in fields explicitly.
29349  * Everything else is useful only for sending out for initial routing sync.
29350  * Not stored if contains excess data to prevent DoS.
29351  *
29352  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
29353  */
29354 void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
29355
29356 /**
29357  * Constructs a new ChannelUpdateInfo given each field
29358  */
29359 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);
29360
29361 /**
29362  * Creates a copy of the ChannelUpdateInfo
29363  */
29364 struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig);
29365
29366 /**
29367  * Checks if two ChannelUpdateInfos contain equal inner contents.
29368  * This ignores pointers and is_owned flags and looks at the values in fields.
29369  * Two objects with NULL inner values will be considered "equal" here.
29370  */
29371 bool ChannelUpdateInfo_eq(const struct LDKChannelUpdateInfo *NONNULL_PTR a, const struct LDKChannelUpdateInfo *NONNULL_PTR b);
29372
29373 /**
29374  * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read
29375  */
29376 struct LDKCVec_u8Z ChannelUpdateInfo_write(const struct LDKChannelUpdateInfo *NONNULL_PTR obj);
29377
29378 /**
29379  * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write
29380  */
29381 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ ChannelUpdateInfo_read(struct LDKu8slice ser);
29382
29383 /**
29384  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
29385  */
29386 void ChannelInfo_free(struct LDKChannelInfo this_obj);
29387
29388 /**
29389  * Protocol features of a channel communicated during its announcement
29390  */
29391 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
29392
29393 /**
29394  * Protocol features of a channel communicated during its announcement
29395  */
29396 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
29397
29398 /**
29399  * Source node of the first direction of a channel
29400  */
29401 struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
29402
29403 /**
29404  * Source node of the first direction of a channel
29405  */
29406 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
29407
29408 /**
29409  * Details about the first direction of a channel
29410  *
29411  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
29412  */
29413 struct LDKChannelUpdateInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
29414
29415 /**
29416  * Details about the first direction of a channel
29417  *
29418  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
29419  */
29420 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
29421
29422 /**
29423  * Source node of the second direction of a channel
29424  */
29425 struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
29426
29427 /**
29428  * Source node of the second direction of a channel
29429  */
29430 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
29431
29432 /**
29433  * Details about the second direction of a channel
29434  *
29435  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
29436  */
29437 struct LDKChannelUpdateInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
29438
29439 /**
29440  * Details about the second direction of a channel
29441  *
29442  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
29443  */
29444 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
29445
29446 /**
29447  * The channel capacity as seen on-chain, if chain lookup is available.
29448  */
29449 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
29450
29451 /**
29452  * The channel capacity as seen on-chain, if chain lookup is available.
29453  */
29454 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
29455
29456 /**
29457  * An initial announcement of the channel
29458  * Mostly redundant with the data we store in fields explicitly.
29459  * Everything else is useful only for sending out for initial routing sync.
29460  * Not stored if contains excess data to prevent DoS.
29461  *
29462  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
29463  */
29464 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
29465
29466 /**
29467  * An initial announcement of the channel
29468  * Mostly redundant with the data we store in fields explicitly.
29469  * Everything else is useful only for sending out for initial routing sync.
29470  * Not stored if contains excess data to prevent DoS.
29471  *
29472  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
29473  */
29474 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
29475
29476 /**
29477  * Creates a copy of the ChannelInfo
29478  */
29479 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
29480
29481 /**
29482  * Checks if two ChannelInfos contain equal inner contents.
29483  * This ignores pointers and is_owned flags and looks at the values in fields.
29484  * Two objects with NULL inner values will be considered "equal" here.
29485  */
29486 bool ChannelInfo_eq(const struct LDKChannelInfo *NONNULL_PTR a, const struct LDKChannelInfo *NONNULL_PTR b);
29487
29488 /**
29489  * Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag.
29490  *
29491  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
29492  */
29493 MUST_USE_RES struct LDKChannelUpdateInfo ChannelInfo_get_directional_info(const struct LDKChannelInfo *NONNULL_PTR this_arg, uint8_t channel_flags);
29494
29495 /**
29496  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
29497  */
29498 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
29499
29500 /**
29501  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
29502  */
29503 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
29504
29505 /**
29506  * Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL.
29507  */
29508 void DirectedChannelInfo_free(struct LDKDirectedChannelInfo this_obj);
29509
29510 /**
29511  * Creates a copy of the DirectedChannelInfo
29512  */
29513 struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirectedChannelInfo *NONNULL_PTR orig);
29514
29515 /**
29516  * Returns information for the channel.
29517  */
29518 MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
29519
29520 /**
29521  * Returns the maximum HTLC amount allowed over the channel in the direction.
29522  */
29523 MUST_USE_RES uint64_t DirectedChannelInfo_htlc_maximum_msat(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
29524
29525 /**
29526  * Returns the [`EffectiveCapacity`] of the channel in the direction.
29527  *
29528  * This is either the total capacity from the funding transaction, if known, or the
29529  * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
29530  * otherwise.
29531  */
29532 MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
29533
29534 /**
29535  * Frees any resources used by the EffectiveCapacity
29536  */
29537 void EffectiveCapacity_free(struct LDKEffectiveCapacity this_ptr);
29538
29539 /**
29540  * Creates a copy of the EffectiveCapacity
29541  */
29542 struct LDKEffectiveCapacity EffectiveCapacity_clone(const struct LDKEffectiveCapacity *NONNULL_PTR orig);
29543
29544 /**
29545  * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity
29546  */
29547 struct LDKEffectiveCapacity EffectiveCapacity_exact_liquidity(uint64_t liquidity_msat);
29548
29549 /**
29550  * Utility method to constructs a new MaximumHTLC-variant EffectiveCapacity
29551  */
29552 struct LDKEffectiveCapacity EffectiveCapacity_maximum_htlc(uint64_t amount_msat);
29553
29554 /**
29555  * Utility method to constructs a new Total-variant EffectiveCapacity
29556  */
29557 struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat, uint64_t htlc_maximum_msat);
29558
29559 /**
29560  * Utility method to constructs a new Infinite-variant EffectiveCapacity
29561  */
29562 struct LDKEffectiveCapacity EffectiveCapacity_infinite(void);
29563
29564 /**
29565  * Utility method to constructs a new Unknown-variant EffectiveCapacity
29566  */
29567 struct LDKEffectiveCapacity EffectiveCapacity_unknown(void);
29568
29569 /**
29570  * Returns the effective capacity denominated in millisatoshi.
29571  */
29572 MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacity *NONNULL_PTR this_arg);
29573
29574 /**
29575  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
29576  */
29577 void RoutingFees_free(struct LDKRoutingFees this_obj);
29578
29579 /**
29580  * Flat routing fee in satoshis
29581  */
29582 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
29583
29584 /**
29585  * Flat routing fee in satoshis
29586  */
29587 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
29588
29589 /**
29590  * Liquidity-based routing fee in millionths of a routed amount.
29591  * In other words, 10000 is 1%.
29592  */
29593 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
29594
29595 /**
29596  * Liquidity-based routing fee in millionths of a routed amount.
29597  * In other words, 10000 is 1%.
29598  */
29599 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
29600
29601 /**
29602  * Constructs a new RoutingFees given each field
29603  */
29604 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
29605
29606 /**
29607  * Checks if two RoutingFeess contain equal inner contents.
29608  * This ignores pointers and is_owned flags and looks at the values in fields.
29609  * Two objects with NULL inner values will be considered "equal" here.
29610  */
29611 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
29612
29613 /**
29614  * Creates a copy of the RoutingFees
29615  */
29616 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
29617
29618 /**
29619  * Checks if two RoutingFeess contain equal inner contents.
29620  */
29621 uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
29622
29623 /**
29624  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
29625  */
29626 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
29627
29628 /**
29629  * Read a RoutingFees from a byte array, created by RoutingFees_write
29630  */
29631 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
29632
29633 /**
29634  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
29635  */
29636 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
29637
29638 /**
29639  * Protocol features the node announced support for
29640  */
29641 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
29642
29643 /**
29644  * Protocol features the node announced support for
29645  */
29646 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
29647
29648 /**
29649  * When the last known update to the node state was issued.
29650  * Value is opaque, as set in the announcement.
29651  */
29652 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
29653
29654 /**
29655  * When the last known update to the node state was issued.
29656  * Value is opaque, as set in the announcement.
29657  */
29658 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
29659
29660 /**
29661  * Color assigned to the node
29662  */
29663 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
29664
29665 /**
29666  * Color assigned to the node
29667  */
29668 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
29669
29670 /**
29671  * Moniker assigned to the node.
29672  * May be invalid or malicious (eg control chars),
29673  * should not be exposed to the user.
29674  */
29675 struct LDKNodeAlias NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
29676
29677 /**
29678  * Moniker assigned to the node.
29679  * May be invalid or malicious (eg control chars),
29680  * should not be exposed to the user.
29681  */
29682 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAlias val);
29683
29684 /**
29685  * Internet-level addresses via which one can connect to the node
29686  *
29687  * Returns a copy of the field.
29688  */
29689 struct LDKCVec_NetAddressZ NodeAnnouncementInfo_get_addresses(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
29690
29691 /**
29692  * Internet-level addresses via which one can connect to the node
29693  */
29694 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
29695
29696 /**
29697  * An initial announcement of the node
29698  * Mostly redundant with the data we store in fields explicitly.
29699  * Everything else is useful only for sending out for initial routing sync.
29700  * Not stored if contains excess data to prevent DoS.
29701  *
29702  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
29703  */
29704 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
29705
29706 /**
29707  * An initial announcement of the node
29708  * Mostly redundant with the data we store in fields explicitly.
29709  * Everything else is useful only for sending out for initial routing sync.
29710  * Not stored if contains excess data to prevent DoS.
29711  *
29712  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
29713  */
29714 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
29715
29716 /**
29717  * Constructs a new NodeAnnouncementInfo given each field
29718  */
29719 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);
29720
29721 /**
29722  * Creates a copy of the NodeAnnouncementInfo
29723  */
29724 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
29725
29726 /**
29727  * Checks if two NodeAnnouncementInfos contain equal inner contents.
29728  * This ignores pointers and is_owned flags and looks at the values in fields.
29729  * Two objects with NULL inner values will be considered "equal" here.
29730  */
29731 bool NodeAnnouncementInfo_eq(const struct LDKNodeAnnouncementInfo *NONNULL_PTR a, const struct LDKNodeAnnouncementInfo *NONNULL_PTR b);
29732
29733 /**
29734  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
29735  */
29736 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
29737
29738 /**
29739  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
29740  */
29741 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
29742
29743 /**
29744  * Frees any resources used by the NodeAlias, if is_owned is set and inner is non-NULL.
29745  */
29746 void NodeAlias_free(struct LDKNodeAlias this_obj);
29747
29748 const uint8_t (*NodeAlias_get_a(const struct LDKNodeAlias *NONNULL_PTR this_ptr))[32];
29749
29750 void NodeAlias_set_a(struct LDKNodeAlias *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
29751
29752 /**
29753  * Constructs a new NodeAlias given each field
29754  */
29755 MUST_USE_RES struct LDKNodeAlias NodeAlias_new(struct LDKThirtyTwoBytes a_arg);
29756
29757 /**
29758  * Creates a copy of the NodeAlias
29759  */
29760 struct LDKNodeAlias NodeAlias_clone(const struct LDKNodeAlias *NONNULL_PTR orig);
29761
29762 /**
29763  * Checks if two NodeAliass contain equal inner contents.
29764  * This ignores pointers and is_owned flags and looks at the values in fields.
29765  * Two objects with NULL inner values will be considered "equal" here.
29766  */
29767 bool NodeAlias_eq(const struct LDKNodeAlias *NONNULL_PTR a, const struct LDKNodeAlias *NONNULL_PTR b);
29768
29769 /**
29770  * Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read
29771  */
29772 struct LDKCVec_u8Z NodeAlias_write(const struct LDKNodeAlias *NONNULL_PTR obj);
29773
29774 /**
29775  * Read a NodeAlias from a byte array, created by NodeAlias_write
29776  */
29777 struct LDKCResult_NodeAliasDecodeErrorZ NodeAlias_read(struct LDKu8slice ser);
29778
29779 /**
29780  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
29781  */
29782 void NodeInfo_free(struct LDKNodeInfo this_obj);
29783
29784 /**
29785  * All valid channels a node has announced
29786  *
29787  * Returns a copy of the field.
29788  */
29789 struct LDKCVec_u64Z NodeInfo_get_channels(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
29790
29791 /**
29792  * All valid channels a node has announced
29793  */
29794 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
29795
29796 /**
29797  * Lowest fees enabling routing via any of the enabled, known channels to a node.
29798  * The two fields (flat and proportional fee) are independent,
29799  * meaning they don't have to refer to the same channel.
29800  *
29801  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
29802  */
29803 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
29804
29805 /**
29806  * Lowest fees enabling routing via any of the enabled, known channels to a node.
29807  * The two fields (flat and proportional fee) are independent,
29808  * meaning they don't have to refer to the same channel.
29809  *
29810  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
29811  */
29812 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
29813
29814 /**
29815  * More information about a node from node_announcement.
29816  * Optional because we store a Node entry after learning about it from
29817  * a channel announcement, but before receiving a node announcement.
29818  *
29819  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
29820  */
29821 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
29822
29823 /**
29824  * More information about a node from node_announcement.
29825  * Optional because we store a Node entry after learning about it from
29826  * a channel announcement, but before receiving a node announcement.
29827  *
29828  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
29829  */
29830 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
29831
29832 /**
29833  * Constructs a new NodeInfo given each field
29834  */
29835 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
29836
29837 /**
29838  * Creates a copy of the NodeInfo
29839  */
29840 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
29841
29842 /**
29843  * Checks if two NodeInfos contain equal inner contents.
29844  * This ignores pointers and is_owned flags and looks at the values in fields.
29845  * Two objects with NULL inner values will be considered "equal" here.
29846  */
29847 bool NodeInfo_eq(const struct LDKNodeInfo *NONNULL_PTR a, const struct LDKNodeInfo *NONNULL_PTR b);
29848
29849 /**
29850  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
29851  */
29852 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
29853
29854 /**
29855  * Read a NodeInfo from a byte array, created by NodeInfo_write
29856  */
29857 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
29858
29859 /**
29860  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
29861  */
29862 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
29863
29864 /**
29865  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
29866  */
29867 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser, struct LDKLogger arg);
29868
29869 /**
29870  * Creates a new, empty, network graph.
29871  */
29872 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKLogger logger);
29873
29874 /**
29875  * Returns a read-only view of the network graph.
29876  */
29877 MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
29878
29879 /**
29880  * The unix timestamp provided by the most recent rapid gossip sync.
29881  * It will be set by the rapid sync process after every sync completion.
29882  */
29883 MUST_USE_RES struct LDKCOption_u32Z NetworkGraph_get_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
29884
29885 /**
29886  * Update the unix timestamp provided by the most recent rapid gossip sync.
29887  * This should be done automatically by the rapid sync process after every sync completion.
29888  */
29889 void NetworkGraph_set_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint32_t last_rapid_gossip_sync_timestamp);
29890
29891 /**
29892  * For an already known node (from channel announcements), update its stored properties from a
29893  * given node announcement.
29894  *
29895  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
29896  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
29897  * routing messages from a source using a protocol other than the lightning P2P protocol.
29898  */
29899 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
29900
29901 /**
29902  * For an already known node (from channel announcements), update its stored properties from a
29903  * given node announcement without verifying the associated signatures. Because we aren't
29904  * given the associated signatures here we cannot relay the node announcement to any of our
29905  * peers.
29906  */
29907 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);
29908
29909 /**
29910  * Store or update channel info from a channel announcement.
29911  *
29912  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
29913  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
29914  * routing messages from a source using a protocol other than the lightning P2P protocol.
29915  *
29916  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
29917  * the corresponding UTXO exists on chain and is correctly-formatted.
29918  */
29919 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);
29920
29921 /**
29922  * Store or update channel info from a channel announcement without verifying the associated
29923  * signatures. Because we aren't given the associated signatures here we cannot relay the
29924  * channel announcement to any of our peers.
29925  *
29926  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
29927  * the corresponding UTXO exists on chain and is correctly-formatted.
29928  */
29929 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);
29930
29931 /**
29932  * Update channel from partial announcement data received via rapid gossip sync
29933  *
29934  * `timestamp: u64`: Timestamp emulating the backdated original announcement receipt (by the
29935  * rapid gossip sync server)
29936  *
29937  * All other parameters as used in [`msgs::UnsignedChannelAnnouncement`] fields.
29938  */
29939 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);
29940
29941 /**
29942  * Marks a channel in the graph as failed if a corresponding HTLC fail was sent.
29943  * If permanent, removes a channel from the local storage.
29944  * May cause the removal of nodes too, if this was their last channel.
29945  * If not permanent, makes channels unavailable for routing.
29946  */
29947 void NetworkGraph_channel_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
29948
29949 /**
29950  * Marks a node in the graph as permanently failed, effectively removing it and its channels
29951  * from local storage.
29952  */
29953 void NetworkGraph_node_failed_permanent(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey node_id);
29954
29955 /**
29956  * Removes information about channels that we haven't heard any updates about in some time.
29957  * This can be used regularly to prune the network graph of channels that likely no longer
29958  * exist.
29959  *
29960  * While there is no formal requirement that nodes regularly re-broadcast their channel
29961  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
29962  * pruning occur for updates which are at least two weeks old, which we implement here.
29963  *
29964  * Note that for users of the `lightning-background-processor` crate this method may be
29965  * automatically called regularly for you.
29966  *
29967  * This method will also cause us to stop tracking removed nodes and channels if they have been
29968  * in the map for a while so that these can be resynced from gossip in the future.
29969  *
29970  * This method is only available with the `std` feature. See
29971  * [`NetworkGraph::remove_stale_channels_and_tracking_with_time`] for `no-std` use.
29972  */
29973 void NetworkGraph_remove_stale_channels_and_tracking(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
29974
29975 /**
29976  * Removes information about channels that we haven't heard any updates about in some time.
29977  * This can be used regularly to prune the network graph of channels that likely no longer
29978  * exist.
29979  *
29980  * While there is no formal requirement that nodes regularly re-broadcast their channel
29981  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
29982  * pruning occur for updates which are at least two weeks old, which we implement here.
29983  *
29984  * This method will also cause us to stop tracking removed nodes and channels if they have been
29985  * in the map for a while so that these can be resynced from gossip in the future.
29986  *
29987  * This function takes the current unix time as an argument. For users with the `std` feature
29988  * enabled, [`NetworkGraph::remove_stale_channels_and_tracking`] may be preferable.
29989  */
29990 void NetworkGraph_remove_stale_channels_and_tracking_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix);
29991
29992 /**
29993  * For an already known (from announcement) channel, update info about one of the directions
29994  * of the channel.
29995  *
29996  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
29997  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
29998  * routing messages from a source using a protocol other than the lightning P2P protocol.
29999  *
30000  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
30001  * materially in the future will be rejected.
30002  */
30003 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
30004
30005 /**
30006  * For an already known (from announcement) channel, update info about one of the directions
30007  * of the channel without verifying the associated signatures. Because we aren't given the
30008  * associated signatures here we cannot relay the channel update to any of our peers.
30009  *
30010  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
30011  * materially in the future will be rejected.
30012  */
30013 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
30014
30015 /**
30016  * Returns information on a channel with the given id.
30017  *
30018  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30019  */
30020 MUST_USE_RES struct LDKChannelInfo ReadOnlyNetworkGraph_channel(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id);
30021
30022 /**
30023  * Returns the list of channels in the graph
30024  */
30025 MUST_USE_RES struct LDKCVec_u64Z ReadOnlyNetworkGraph_list_channels(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg);
30026
30027 /**
30028  * Returns information on a node with the given id.
30029  *
30030  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30031  */
30032 MUST_USE_RES struct LDKNodeInfo ReadOnlyNetworkGraph_node(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
30033
30034 /**
30035  * Returns the list of nodes in the graph
30036  */
30037 MUST_USE_RES struct LDKCVec_NodeIdZ ReadOnlyNetworkGraph_list_nodes(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg);
30038
30039 /**
30040  * Get network addresses by node id.
30041  * Returns None if the requested node is completely unknown,
30042  * or if node announcement for the node was never received.
30043  */
30044 MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey);
30045
30046 /**
30047  * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
30048  */
30049 void DefaultRouter_free(struct LDKDefaultRouter this_obj);
30050
30051 /**
30052  * Creates a new router.
30053  */
30054 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);
30055
30056 /**
30057  * Constructs a new Router which calls the relevant methods on this_arg.
30058  * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
30059  */
30060 struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg);
30061
30062 /**
30063  * Calls the free function if one is set
30064  */
30065 void Router_free(struct LDKRouter this_ptr);
30066
30067 /**
30068  * Frees any resources used by the ScorerAccountingForInFlightHtlcs, if is_owned is set and inner is non-NULL.
30069  */
30070 void ScorerAccountingForInFlightHtlcs_free(struct LDKScorerAccountingForInFlightHtlcs this_obj);
30071
30072 /**
30073  * Initialize a new `ScorerAccountingForInFlightHtlcs`.
30074  */
30075 MUST_USE_RES struct LDKScorerAccountingForInFlightHtlcs ScorerAccountingForInFlightHtlcs_new(struct LDKScore scorer, struct LDKInFlightHtlcs inflight_htlcs);
30076
30077 /**
30078  * Serialize the ScorerAccountingForInFlightHtlcs object into a byte array which can be read by ScorerAccountingForInFlightHtlcs_read
30079  */
30080 struct LDKCVec_u8Z ScorerAccountingForInFlightHtlcs_write(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR obj);
30081
30082 /**
30083  * Constructs a new Score which calls the relevant methods on this_arg.
30084  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
30085  */
30086 struct LDKScore ScorerAccountingForInFlightHtlcs_as_Score(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR this_arg);
30087
30088 /**
30089  * Frees any resources used by the InFlightHtlcs, if is_owned is set and inner is non-NULL.
30090  */
30091 void InFlightHtlcs_free(struct LDKInFlightHtlcs this_obj);
30092
30093 /**
30094  * Creates a copy of the InFlightHtlcs
30095  */
30096 struct LDKInFlightHtlcs InFlightHtlcs_clone(const struct LDKInFlightHtlcs *NONNULL_PTR orig);
30097
30098 /**
30099  * Constructs an empty `InFlightHtlcs`.
30100  */
30101 MUST_USE_RES struct LDKInFlightHtlcs InFlightHtlcs_new(void);
30102
30103 /**
30104  * Returns liquidity in msat given the public key of the HTLC source, target, and short channel
30105  * id.
30106  */
30107 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);
30108
30109 /**
30110  * Serialize the InFlightHtlcs object into a byte array which can be read by InFlightHtlcs_read
30111  */
30112 struct LDKCVec_u8Z InFlightHtlcs_write(const struct LDKInFlightHtlcs *NONNULL_PTR obj);
30113
30114 /**
30115  * Read a InFlightHtlcs from a byte array, created by InFlightHtlcs_write
30116  */
30117 struct LDKCResult_InFlightHtlcsDecodeErrorZ InFlightHtlcs_read(struct LDKu8slice ser);
30118
30119 /**
30120  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
30121  */
30122 void RouteHop_free(struct LDKRouteHop this_obj);
30123
30124 /**
30125  * The node_id of the node at this hop.
30126  */
30127 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
30128
30129 /**
30130  * The node_id of the node at this hop.
30131  */
30132 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30133
30134 /**
30135  * The node_announcement features of the node at this hop. For the last hop, these may be
30136  * amended to match the features present in the invoice this node generated.
30137  */
30138 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
30139
30140 /**
30141  * The node_announcement features of the node at this hop. For the last hop, these may be
30142  * amended to match the features present in the invoice this node generated.
30143  */
30144 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
30145
30146 /**
30147  * The channel that should be used from the previous hop to reach this node.
30148  */
30149 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
30150
30151 /**
30152  * The channel that should be used from the previous hop to reach this node.
30153  */
30154 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
30155
30156 /**
30157  * The channel_announcement features of the channel that should be used from the previous hop
30158  * to reach this node.
30159  */
30160 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
30161
30162 /**
30163  * The channel_announcement features of the channel that should be used from the previous hop
30164  * to reach this node.
30165  */
30166 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
30167
30168 /**
30169  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
30170  * For the last hop, this should be the full value of the payment (might be more than
30171  * requested if we had to match htlc_minimum_msat).
30172  */
30173 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
30174
30175 /**
30176  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
30177  * For the last hop, this should be the full value of the payment (might be more than
30178  * requested if we had to match htlc_minimum_msat).
30179  */
30180 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
30181
30182 /**
30183  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
30184  * expected at the destination, in excess of the current block height.
30185  */
30186 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
30187
30188 /**
30189  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
30190  * expected at the destination, in excess of the current block height.
30191  */
30192 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
30193
30194 /**
30195  * Constructs a new RouteHop given each field
30196  */
30197 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);
30198
30199 /**
30200  * Creates a copy of the RouteHop
30201  */
30202 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
30203
30204 /**
30205  * Checks if two RouteHops contain equal inner contents.
30206  */
30207 uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
30208
30209 /**
30210  * Checks if two RouteHops contain equal inner contents.
30211  * This ignores pointers and is_owned flags and looks at the values in fields.
30212  * Two objects with NULL inner values will be considered "equal" here.
30213  */
30214 bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
30215
30216 /**
30217  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
30218  */
30219 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
30220
30221 /**
30222  * Read a RouteHop from a byte array, created by RouteHop_write
30223  */
30224 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
30225
30226 /**
30227  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
30228  */
30229 void Route_free(struct LDKRoute this_obj);
30230
30231 /**
30232  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
30233  * last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
30234  * INCLUDING our own, where the last hop is the destination. Thus, this must always be at
30235  * least length one. While the maximum length of any given path is variable, keeping the length
30236  * of any path less or equal to 19 should currently ensure it is viable.
30237  */
30238 struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
30239
30240 /**
30241  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
30242  * last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
30243  * INCLUDING our own, where the last hop is the destination. Thus, this must always be at
30244  * least length one. While the maximum length of any given path is variable, keeping the length
30245  * of any path less or equal to 19 should currently ensure it is viable.
30246  */
30247 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
30248
30249 /**
30250  * The `payment_params` parameter passed to [`find_route`].
30251  * This is used by `ChannelManager` to track information which may be required for retries,
30252  * provided back to you via [`Event::PaymentPathFailed`].
30253  *
30254  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
30255  *
30256  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30257  */
30258 struct LDKPaymentParameters Route_get_payment_params(const struct LDKRoute *NONNULL_PTR this_ptr);
30259
30260 /**
30261  * The `payment_params` parameter passed to [`find_route`].
30262  * This is used by `ChannelManager` to track information which may be required for retries,
30263  * provided back to you via [`Event::PaymentPathFailed`].
30264  *
30265  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
30266  *
30267  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
30268  */
30269 void Route_set_payment_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
30270
30271 /**
30272  * Constructs a new Route given each field
30273  */
30274 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPaymentParameters payment_params_arg);
30275
30276 /**
30277  * Creates a copy of the Route
30278  */
30279 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
30280
30281 /**
30282  * Checks if two Routes contain equal inner contents.
30283  */
30284 uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
30285
30286 /**
30287  * Checks if two Routes contain equal inner contents.
30288  * This ignores pointers and is_owned flags and looks at the values in fields.
30289  * Two objects with NULL inner values will be considered "equal" here.
30290  */
30291 bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
30292
30293 /**
30294  * Returns the total amount of fees paid on this [`Route`].
30295  *
30296  * This doesn't include any extra payment made to the recipient, which can happen in excess of
30297  * the amount passed to [`find_route`]'s `params.final_value_msat`.
30298  */
30299 MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
30300
30301 /**
30302  * Returns the total amount paid on this [`Route`], excluding the fees.
30303  */
30304 MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
30305
30306 /**
30307  * Serialize the Route object into a byte array which can be read by Route_read
30308  */
30309 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
30310
30311 /**
30312  * Read a Route from a byte array, created by Route_write
30313  */
30314 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
30315
30316 /**
30317  * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL.
30318  */
30319 void RouteParameters_free(struct LDKRouteParameters this_obj);
30320
30321 /**
30322  * The parameters of the failed payment path.
30323  */
30324 struct LDKPaymentParameters RouteParameters_get_payment_params(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
30325
30326 /**
30327  * The parameters of the failed payment path.
30328  */
30329 void RouteParameters_set_payment_params(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
30330
30331 /**
30332  * The amount in msats sent on the failed payment path.
30333  */
30334 uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
30335
30336 /**
30337  * The amount in msats sent on the failed payment path.
30338  */
30339 void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val);
30340
30341 /**
30342  * The CLTV on the final hop of the failed payment path.
30343  */
30344 uint32_t RouteParameters_get_final_cltv_expiry_delta(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
30345
30346 /**
30347  * The CLTV on the final hop of the failed payment path.
30348  */
30349 void RouteParameters_set_final_cltv_expiry_delta(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint32_t val);
30350
30351 /**
30352  * Constructs a new RouteParameters given each field
30353  */
30354 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);
30355
30356 /**
30357  * Creates a copy of the RouteParameters
30358  */
30359 struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig);
30360
30361 /**
30362  * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
30363  */
30364 struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj);
30365
30366 /**
30367  * Read a RouteParameters from a byte array, created by RouteParameters_write
30368  */
30369 struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser);
30370
30371 /**
30372  * Frees any resources used by the PaymentParameters, if is_owned is set and inner is non-NULL.
30373  */
30374 void PaymentParameters_free(struct LDKPaymentParameters this_obj);
30375
30376 /**
30377  * The node id of the payee.
30378  */
30379 struct LDKPublicKey PaymentParameters_get_payee_pubkey(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
30380
30381 /**
30382  * The node id of the payee.
30383  */
30384 void PaymentParameters_set_payee_pubkey(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30385
30386 /**
30387  * Features supported by the payee.
30388  *
30389  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
30390  * does not contain any features.
30391  *
30392  * [`for_keysend`]: Self::for_keysend
30393  *
30394  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30395  */
30396 struct LDKInvoiceFeatures PaymentParameters_get_features(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
30397
30398 /**
30399  * Features supported by the payee.
30400  *
30401  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
30402  * does not contain any features.
30403  *
30404  * [`for_keysend`]: Self::for_keysend
30405  *
30406  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
30407  */
30408 void PaymentParameters_set_features(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val);
30409
30410 /**
30411  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
30412  */
30413 struct LDKCVec_RouteHintZ PaymentParameters_get_route_hints(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
30414
30415 /**
30416  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
30417  */
30418 void PaymentParameters_set_route_hints(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val);
30419
30420 /**
30421  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
30422  */
30423 struct LDKCOption_u64Z PaymentParameters_get_expiry_time(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
30424
30425 /**
30426  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
30427  */
30428 void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
30429
30430 /**
30431  * The maximum total CLTV delta we accept for the route.
30432  * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`].
30433  */
30434 uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
30435
30436 /**
30437  * The maximum total CLTV delta we accept for the route.
30438  * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`].
30439  */
30440 void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val);
30441
30442 /**
30443  * The maximum number of paths that may be used by (MPP) payments.
30444  * Defaults to [`DEFAULT_MAX_PATH_COUNT`].
30445  */
30446 uint8_t PaymentParameters_get_max_path_count(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
30447
30448 /**
30449  * The maximum number of paths that may be used by (MPP) payments.
30450  * Defaults to [`DEFAULT_MAX_PATH_COUNT`].
30451  */
30452 void PaymentParameters_set_max_path_count(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val);
30453
30454 /**
30455  * Selects the maximum share of a channel's total capacity which will be sent over a channel,
30456  * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas
30457  * a lower value prefers to send larger MPP parts, potentially saturating channels and
30458  * increasing failure probability for those paths.
30459  *
30460  * Note that this restriction will be relaxed during pathfinding after paths which meet this
30461  * restriction have been found. While paths which meet this criteria will be searched for, it
30462  * is ultimately up to the scorer to select them over other paths.
30463  *
30464  * A value of 0 will allow payments up to and including a channel's total announced usable
30465  * capacity, a value of one will only use up to half its capacity, two 1/4, etc.
30466  *
30467  * Default value: 2
30468  */
30469 uint8_t PaymentParameters_get_max_channel_saturation_power_of_half(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
30470
30471 /**
30472  * Selects the maximum share of a channel's total capacity which will be sent over a channel,
30473  * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas
30474  * a lower value prefers to send larger MPP parts, potentially saturating channels and
30475  * increasing failure probability for those paths.
30476  *
30477  * Note that this restriction will be relaxed during pathfinding after paths which meet this
30478  * restriction have been found. While paths which meet this criteria will be searched for, it
30479  * is ultimately up to the scorer to select them over other paths.
30480  *
30481  * A value of 0 will allow payments up to and including a channel's total announced usable
30482  * capacity, a value of one will only use up to half its capacity, two 1/4, etc.
30483  *
30484  * Default value: 2
30485  */
30486 void PaymentParameters_set_max_channel_saturation_power_of_half(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val);
30487
30488 /**
30489  * A list of SCIDs which this payment was previously attempted over and which caused the
30490  * payment to fail. Future attempts for the same payment shouldn't be relayed through any of
30491  * these SCIDs.
30492  *
30493  * Returns a copy of the field.
30494  */
30495 struct LDKCVec_u64Z PaymentParameters_get_previously_failed_channels(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
30496
30497 /**
30498  * A list of SCIDs which this payment was previously attempted over and which caused the
30499  * payment to fail. Future attempts for the same payment shouldn't be relayed through any of
30500  * these SCIDs.
30501  */
30502 void PaymentParameters_set_previously_failed_channels(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
30503
30504 /**
30505  * Constructs a new PaymentParameters given each field
30506  */
30507 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);
30508
30509 /**
30510  * Creates a copy of the PaymentParameters
30511  */
30512 struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig);
30513
30514 /**
30515  * Checks if two PaymentParameterss contain equal inner contents.
30516  */
30517 uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o);
30518
30519 /**
30520  * Checks if two PaymentParameterss contain equal inner contents.
30521  * This ignores pointers and is_owned flags and looks at the values in fields.
30522  * Two objects with NULL inner values will be considered "equal" here.
30523  */
30524 bool PaymentParameters_eq(const struct LDKPaymentParameters *NONNULL_PTR a, const struct LDKPaymentParameters *NONNULL_PTR b);
30525
30526 /**
30527  * Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read
30528  */
30529 struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NONNULL_PTR obj);
30530
30531 /**
30532  * Read a PaymentParameters from a byte array, created by PaymentParameters_write
30533  */
30534 struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser);
30535
30536 /**
30537  * Creates a payee with the node id of the given `pubkey`.
30538  */
30539 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey);
30540
30541 /**
30542  * Creates a payee with the node id of the given `pubkey` to use for keysend payments.
30543  */
30544 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey);
30545
30546 /**
30547  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
30548  */
30549 void RouteHint_free(struct LDKRouteHint this_obj);
30550
30551 struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr);
30552
30553 void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val);
30554
30555 /**
30556  * Constructs a new RouteHint given each field
30557  */
30558 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg);
30559
30560 /**
30561  * Creates a copy of the RouteHint
30562  */
30563 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
30564
30565 /**
30566  * Checks if two RouteHints contain equal inner contents.
30567  */
30568 uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
30569
30570 /**
30571  * Checks if two RouteHints contain equal inner contents.
30572  * This ignores pointers and is_owned flags and looks at the values in fields.
30573  * Two objects with NULL inner values will be considered "equal" here.
30574  */
30575 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
30576
30577 /**
30578  * Serialize the RouteHint object into a byte array which can be read by RouteHint_read
30579  */
30580 struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj);
30581
30582 /**
30583  * Read a RouteHint from a byte array, created by RouteHint_write
30584  */
30585 struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser);
30586
30587 /**
30588  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
30589  */
30590 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
30591
30592 /**
30593  * The node_id of the non-target end of the route
30594  */
30595 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
30596
30597 /**
30598  * The node_id of the non-target end of the route
30599  */
30600 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
30601
30602 /**
30603  * The short_channel_id of this channel
30604  */
30605 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
30606
30607 /**
30608  * The short_channel_id of this channel
30609  */
30610 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
30611
30612 /**
30613  * The fees which must be paid to use this channel
30614  */
30615 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
30616
30617 /**
30618  * The fees which must be paid to use this channel
30619  */
30620 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
30621
30622 /**
30623  * The difference in CLTV values between this node and the next node.
30624  */
30625 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
30626
30627 /**
30628  * The difference in CLTV values between this node and the next node.
30629  */
30630 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
30631
30632 /**
30633  * The minimum value, in msat, which must be relayed to the next hop.
30634  */
30635 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
30636
30637 /**
30638  * The minimum value, in msat, which must be relayed to the next hop.
30639  */
30640 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
30641
30642 /**
30643  * The maximum value in msat available for routing with a single HTLC.
30644  */
30645 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
30646
30647 /**
30648  * The maximum value in msat available for routing with a single HTLC.
30649  */
30650 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
30651
30652 /**
30653  * Constructs a new RouteHintHop given each field
30654  */
30655 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);
30656
30657 /**
30658  * Creates a copy of the RouteHintHop
30659  */
30660 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
30661
30662 /**
30663  * Checks if two RouteHintHops contain equal inner contents.
30664  */
30665 uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
30666
30667 /**
30668  * Checks if two RouteHintHops contain equal inner contents.
30669  * This ignores pointers and is_owned flags and looks at the values in fields.
30670  * Two objects with NULL inner values will be considered "equal" here.
30671  */
30672 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
30673
30674 /**
30675  * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
30676  */
30677 struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj);
30678
30679 /**
30680  * Read a RouteHintHop from a byte array, created by RouteHintHop_write
30681  */
30682 struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser);
30683
30684 /**
30685  * Finds a route from us (payer) to the given target node (payee).
30686  *
30687  * If the payee provided features in their invoice, they should be provided via `params.payee`.
30688  * Without this, MPP will only be used if the payee's features are available in the network graph.
30689  *
30690  * Private routing paths between a public node and the target may be included in `params.payee`.
30691  *
30692  * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
30693  * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels
30694  * from `network_graph` will be ignored, and only those in `first_hops` will be used.
30695  *
30696  * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
30697  * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
30698  * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
30699  *
30700  * # Note
30701  *
30702  * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
30703  * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
30704  * function.
30705  *
30706  * # Panics
30707  *
30708  * Panics if first_hops contains channels without short_channel_ids;
30709  * [`ChannelManager::list_usable_channels`] will never include such channels.
30710  *
30711  * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
30712  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
30713  * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
30714  *
30715  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
30716  */
30717 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]);
30718
30719 /**
30720  * Construct a route from us (payer) to the target node (payee) via the given hops (which should
30721  * exclude the payer, but include the payee). This may be useful, e.g., for probing the chosen path.
30722  *
30723  * Re-uses logic from `find_route`, so the restrictions described there also apply here.
30724  */
30725 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]);
30726
30727 /**
30728  * Calls the free function if one is set
30729  */
30730 void Score_free(struct LDKScore this_ptr);
30731
30732 /**
30733  * Calls the free function if one is set
30734  */
30735 void LockableScore_free(struct LDKLockableScore this_ptr);
30736
30737 /**
30738  * Calls the free function if one is set
30739  */
30740 void WriteableScore_free(struct LDKWriteableScore this_ptr);
30741
30742 /**
30743  * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL.
30744  */
30745 void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj);
30746
30747 /**
30748  * Frees any resources used by the MultiThreadedScoreLock, if is_owned is set and inner is non-NULL.
30749  */
30750 void MultiThreadedScoreLock_free(struct LDKMultiThreadedScoreLock this_obj);
30751
30752 /**
30753  * Constructs a new Score which calls the relevant methods on this_arg.
30754  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
30755  */
30756 struct LDKScore MultiThreadedScoreLock_as_Score(const struct LDKMultiThreadedScoreLock *NONNULL_PTR this_arg);
30757
30758 /**
30759  * Serialize the MultiThreadedScoreLock object into a byte array which can be read by MultiThreadedScoreLock_read
30760  */
30761 struct LDKCVec_u8Z MultiThreadedScoreLock_write(const struct LDKMultiThreadedScoreLock *NONNULL_PTR obj);
30762
30763 /**
30764  * Constructs a new LockableScore which calls the relevant methods on this_arg.
30765  * This copies the `inner` pointer in this_arg and thus the returned LockableScore must be freed before this_arg is
30766  */
30767 struct LDKLockableScore MultiThreadedLockableScore_as_LockableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg);
30768
30769 /**
30770  * Serialize the MultiThreadedLockableScore object into a byte array which can be read by MultiThreadedLockableScore_read
30771  */
30772 struct LDKCVec_u8Z MultiThreadedLockableScore_write(const struct LDKMultiThreadedLockableScore *NONNULL_PTR obj);
30773
30774 /**
30775  * Constructs a new WriteableScore which calls the relevant methods on this_arg.
30776  * This copies the `inner` pointer in this_arg and thus the returned WriteableScore must be freed before this_arg is
30777  */
30778 struct LDKWriteableScore MultiThreadedLockableScore_as_WriteableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg);
30779
30780 /**
30781  * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
30782  */
30783 MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score);
30784
30785 /**
30786  * Frees any resources used by the ChannelUsage, if is_owned is set and inner is non-NULL.
30787  */
30788 void ChannelUsage_free(struct LDKChannelUsage this_obj);
30789
30790 /**
30791  * The amount to send through the channel, denominated in millisatoshis.
30792  */
30793 uint64_t ChannelUsage_get_amount_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
30794
30795 /**
30796  * The amount to send through the channel, denominated in millisatoshis.
30797  */
30798 void ChannelUsage_set_amount_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
30799
30800 /**
30801  * Total amount, denominated in millisatoshis, already allocated to send through the channel
30802  * as part of a multi-path payment.
30803  */
30804 uint64_t ChannelUsage_get_inflight_htlc_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
30805
30806 /**
30807  * Total amount, denominated in millisatoshis, already allocated to send through the channel
30808  * as part of a multi-path payment.
30809  */
30810 void ChannelUsage_set_inflight_htlc_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
30811
30812 /**
30813  * The effective capacity of the channel.
30814  */
30815 struct LDKEffectiveCapacity ChannelUsage_get_effective_capacity(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
30816
30817 /**
30818  * The effective capacity of the channel.
30819  */
30820 void ChannelUsage_set_effective_capacity(struct LDKChannelUsage *NONNULL_PTR this_ptr, struct LDKEffectiveCapacity val);
30821
30822 /**
30823  * Constructs a new ChannelUsage given each field
30824  */
30825 MUST_USE_RES struct LDKChannelUsage ChannelUsage_new(uint64_t amount_msat_arg, uint64_t inflight_htlc_msat_arg, struct LDKEffectiveCapacity effective_capacity_arg);
30826
30827 /**
30828  * Creates a copy of the ChannelUsage
30829  */
30830 struct LDKChannelUsage ChannelUsage_clone(const struct LDKChannelUsage *NONNULL_PTR orig);
30831
30832 /**
30833  * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL.
30834  */
30835 void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj);
30836
30837 /**
30838  * Creates a copy of the FixedPenaltyScorer
30839  */
30840 struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig);
30841
30842 /**
30843  * Creates a new scorer using `penalty_msat`.
30844  */
30845 MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat);
30846
30847 /**
30848  * Constructs a new Score which calls the relevant methods on this_arg.
30849  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
30850  */
30851 struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg);
30852
30853 /**
30854  * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
30855  */
30856 struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj);
30857
30858 /**
30859  * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
30860  */
30861 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg);
30862
30863 /**
30864  * Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL.
30865  */
30866 void ProbabilisticScorer_free(struct LDKProbabilisticScorer this_obj);
30867
30868 /**
30869  * Frees any resources used by the ProbabilisticScoringParameters, if is_owned is set and inner is non-NULL.
30870  */
30871 void ProbabilisticScoringParameters_free(struct LDKProbabilisticScoringParameters this_obj);
30872
30873 /**
30874  * A fixed penalty in msats to apply to each channel.
30875  *
30876  * Default value: 500 msat
30877  */
30878 uint64_t ProbabilisticScoringParameters_get_base_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
30879
30880 /**
30881  * A fixed penalty in msats to apply to each channel.
30882  *
30883  * Default value: 500 msat
30884  */
30885 void ProbabilisticScoringParameters_set_base_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
30886
30887 /**
30888  * A multiplier used with the payment amount to calculate a fixed penalty applied to each
30889  * channel, in excess of the [`base_penalty_msat`].
30890  *
30891  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
30892  * fees plus penalty) for large payments. The penalty is computed as the product of this
30893  * multiplier and `2^30`ths of the payment amount.
30894  *
30895  * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30`
30896  *
30897  * Default value: 8,192 msat
30898  *
30899  * [`base_penalty_msat`]: Self::base_penalty_msat
30900  */
30901 uint64_t ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
30902
30903 /**
30904  * A multiplier used with the payment amount to calculate a fixed penalty applied to each
30905  * channel, in excess of the [`base_penalty_msat`].
30906  *
30907  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
30908  * fees plus penalty) for large payments. The penalty is computed as the product of this
30909  * multiplier and `2^30`ths of the payment amount.
30910  *
30911  * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30`
30912  *
30913  * Default value: 8,192 msat
30914  *
30915  * [`base_penalty_msat`]: Self::base_penalty_msat
30916  */
30917 void ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
30918
30919 /**
30920  * A multiplier used in conjunction with the negative `log10` of the channel's success
30921  * probability for a payment, as determined by our latest estimates of the channel's
30922  * liquidity, to determine the liquidity penalty.
30923  *
30924  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
30925  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
30926  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
30927  * lower bounding the success probability to `0.01`) when the amount falls within the
30928  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
30929  * result in a `u64::max_value` penalty, however.
30930  *
30931  * `-log10(success_probability) * liquidity_penalty_multiplier_msat`
30932  *
30933  * Default value: 30,000 msat
30934  *
30935  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
30936  */
30937 uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
30938
30939 /**
30940  * A multiplier used in conjunction with the negative `log10` of the channel's success
30941  * probability for a payment, as determined by our latest estimates of the channel's
30942  * liquidity, to determine the liquidity penalty.
30943  *
30944  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
30945  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
30946  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
30947  * lower bounding the success probability to `0.01`) when the amount falls within the
30948  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
30949  * result in a `u64::max_value` penalty, however.
30950  *
30951  * `-log10(success_probability) * liquidity_penalty_multiplier_msat`
30952  *
30953  * Default value: 30,000 msat
30954  *
30955  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
30956  */
30957 void ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
30958
30959 /**
30960  * Whenever this amount of time elapses since the last update to a channel's liquidity bounds,
30961  * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on
30962  * the available liquidity is halved and the upper-bound moves half-way to the channel's total
30963  * capacity.
30964  *
30965  * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity,
30966  * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`]
30967  * struct documentation for more info on the way the liquidity bounds are used.
30968  *
30969  * For example, if the channel's capacity is 1 million sats, and the current upper and lower
30970  * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper
30971  * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats.
30972  *
30973  * Default value: 6 hours
30974  *
30975  * # Note
30976  *
30977  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
30978  * liquidity knowledge will never decay except when the bounds cross.
30979  */
30980 uint64_t ProbabilisticScoringParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
30981
30982 /**
30983  * Whenever this amount of time elapses since the last update to a channel's liquidity bounds,
30984  * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on
30985  * the available liquidity is halved and the upper-bound moves half-way to the channel's total
30986  * capacity.
30987  *
30988  * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity,
30989  * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`]
30990  * struct documentation for more info on the way the liquidity bounds are used.
30991  *
30992  * For example, if the channel's capacity is 1 million sats, and the current upper and lower
30993  * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper
30994  * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats.
30995  *
30996  * Default value: 6 hours
30997  *
30998  * # Note
30999  *
31000  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
31001  * liquidity knowledge will never decay except when the bounds cross.
31002  */
31003 void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
31004
31005 /**
31006  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
31007  * channel's success probability for the payment, as determined by our latest estimates of the
31008  * channel's liquidity, to determine the amount penalty.
31009  *
31010  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
31011  * fees plus penalty) for large payments. The penalty is computed as the product of this
31012  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
31013  * success probability.
31014  *
31015  * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20`
31016  *
31017  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
31018  * the amount will result in a penalty of the multiplier. And, as the success probability
31019  * decreases, the negative `log10` weighting will increase dramatically. For higher success
31020  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
31021  * fall below `1`.
31022  *
31023  * Default value: 192 msat
31024  */
31025 uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
31026
31027 /**
31028  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
31029  * channel's success probability for the payment, as determined by our latest estimates of the
31030  * channel's liquidity, to determine the amount penalty.
31031  *
31032  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
31033  * fees plus penalty) for large payments. The penalty is computed as the product of this
31034  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
31035  * success probability.
31036  *
31037  * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20`
31038  *
31039  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
31040  * the amount will result in a penalty of the multiplier. And, as the success probability
31041  * decreases, the negative `log10` weighting will increase dramatically. For higher success
31042  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
31043  * fall below `1`.
31044  *
31045  * Default value: 192 msat
31046  */
31047 void ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
31048
31049 /**
31050  * A multiplier used in conjunction with the negative `log10` of the channel's success
31051  * probability for the payment, as determined based on the history of our estimates of the
31052  * channel's available liquidity, to determine a penalty.
31053  *
31054  * This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using
31055  * only our latest estimate for the current liquidity available in the channel, it estimates
31056  * success probability based on the estimated liquidity available in the channel through
31057  * history. Specifically, every time we update our liquidity bounds on a given channel, we
31058  * track which of several buckets those bounds fall into, exponentially decaying the
31059  * probability of each bucket as new samples are added.
31060  *
31061  * Default value: 10,000 msat
31062  *
31063  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
31064  */
31065 uint64_t ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
31066
31067 /**
31068  * A multiplier used in conjunction with the negative `log10` of the channel's success
31069  * probability for the payment, as determined based on the history of our estimates of the
31070  * channel's available liquidity, to determine a penalty.
31071  *
31072  * This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using
31073  * only our latest estimate for the current liquidity available in the channel, it estimates
31074  * success probability based on the estimated liquidity available in the channel through
31075  * history. Specifically, every time we update our liquidity bounds on a given channel, we
31076  * track which of several buckets those bounds fall into, exponentially decaying the
31077  * probability of each bucket as new samples are added.
31078  *
31079  * Default value: 10,000 msat
31080  *
31081  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
31082  */
31083 void ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
31084
31085 /**
31086  * A multiplier used in conjunction with the payment amount and the negative `log10` of the
31087  * channel's success probability for the payment, as determined based on the history of our
31088  * estimates of the channel's available liquidity, to determine a penalty.
31089  *
31090  * The purpose of the amount penalty is to avoid having fees dominate the channel cost for
31091  * large payments. The penalty is computed as the product of this multiplier and the `2^20`ths
31092  * of the payment amount, weighted by the negative `log10` of the success probability.
31093  *
31094  * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead
31095  * of using only our latest estimate for the current liquidity available in the channel, it
31096  * estimates success probability based on the estimated liquidity available in the channel
31097  * through history. Specifically, every time we update our liquidity bounds on a given
31098  * channel, we track which of several buckets those bounds fall into, exponentially decaying
31099  * the probability of each bucket as new samples are added.
31100  *
31101  * Default value: 64 msat
31102  *
31103  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
31104  */
31105 uint64_t ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
31106
31107 /**
31108  * A multiplier used in conjunction with the payment amount and the negative `log10` of the
31109  * channel's success probability for the payment, as determined based on the history of our
31110  * estimates of the channel's available liquidity, to determine a penalty.
31111  *
31112  * The purpose of the amount penalty is to avoid having fees dominate the channel cost for
31113  * large payments. The penalty is computed as the product of this multiplier and the `2^20`ths
31114  * of the payment amount, weighted by the negative `log10` of the success probability.
31115  *
31116  * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead
31117  * of using only our latest estimate for the current liquidity available in the channel, it
31118  * estimates success probability based on the estimated liquidity available in the channel
31119  * through history. Specifically, every time we update our liquidity bounds on a given
31120  * channel, we track which of several buckets those bounds fall into, exponentially decaying
31121  * the probability of each bucket as new samples are added.
31122  *
31123  * Default value: 64 msat
31124  *
31125  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
31126  */
31127 void ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
31128
31129 /**
31130  * If we aren't learning any new datapoints for a channel, the historical liquidity bounds
31131  * tracking can simply live on with increasingly stale data. Instead, when a channel has not
31132  * seen a liquidity estimate update for this amount of time, the historical datapoints are
31133  * decayed by half.
31134  *
31135  * Note that after 16 or more half lives all historical data will be completely gone.
31136  *
31137  * Default value: 14 days
31138  */
31139 uint64_t ProbabilisticScoringParameters_get_historical_no_updates_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
31140
31141 /**
31142  * If we aren't learning any new datapoints for a channel, the historical liquidity bounds
31143  * tracking can simply live on with increasingly stale data. Instead, when a channel has not
31144  * seen a liquidity estimate update for this amount of time, the historical datapoints are
31145  * decayed by half.
31146  *
31147  * Note that after 16 or more half lives all historical data will be completely gone.
31148  *
31149  * Default value: 14 days
31150  */
31151 void ProbabilisticScoringParameters_set_historical_no_updates_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
31152
31153 /**
31154  * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the
31155  * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We
31156  * treat such nodes preferentially as this makes balance discovery attacks harder to execute,
31157  * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy.
31158  *
31159  * Default value: 250 msat
31160  */
31161 uint64_t ProbabilisticScoringParameters_get_anti_probing_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
31162
31163 /**
31164  * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the
31165  * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We
31166  * treat such nodes preferentially as this makes balance discovery attacks harder to execute,
31167  * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy.
31168  *
31169  * Default value: 250 msat
31170  */
31171 void ProbabilisticScoringParameters_set_anti_probing_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
31172
31173 /**
31174  * This penalty is applied when the amount we're attempting to send over a channel exceeds our
31175  * current estimate of the channel's available liquidity.
31176  *
31177  * Note that in this case all other penalties, including the
31178  * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based
31179  * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if
31180  * applicable, are still included in the overall penalty.
31181  *
31182  * If you wish to avoid creating paths with such channels entirely, setting this to a value of
31183  * `u64::max_value()` will guarantee that.
31184  *
31185  * Default value: 1_0000_0000_000 msat (1 Bitcoin)
31186  *
31187  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
31188  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
31189  * [`base_penalty_msat`]: Self::base_penalty_msat
31190  * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat
31191  */
31192 uint64_t ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
31193
31194 /**
31195  * This penalty is applied when the amount we're attempting to send over a channel exceeds our
31196  * current estimate of the channel's available liquidity.
31197  *
31198  * Note that in this case all other penalties, including the
31199  * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based
31200  * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if
31201  * applicable, are still included in the overall penalty.
31202  *
31203  * If you wish to avoid creating paths with such channels entirely, setting this to a value of
31204  * `u64::max_value()` will guarantee that.
31205  *
31206  * Default value: 1_0000_0000_000 msat (1 Bitcoin)
31207  *
31208  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
31209  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
31210  * [`base_penalty_msat`]: Self::base_penalty_msat
31211  * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat
31212  */
31213 void ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
31214
31215 /**
31216  * Creates a copy of the ProbabilisticScoringParameters
31217  */
31218 struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_clone(const struct LDKProbabilisticScoringParameters *NONNULL_PTR orig);
31219
31220 /**
31221  * Creates a new scorer using the given scoring parameters for sending payments from a node
31222  * through a network graph.
31223  */
31224 MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringParameters params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
31225
31226 /**
31227  * Dump the contents of this scorer into the configured logger.
31228  *
31229  * Note that this writes roughly one line per channel for which we have a liquidity estimate,
31230  * which may be a substantial amount of log output.
31231  */
31232 void ProbabilisticScorer_debug_log_liquidity_stats(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
31233
31234 /**
31235  * Query the estimated minimum and maximum liquidity available for sending a payment over the
31236  * channel with `scid` towards the given `target` node.
31237  */
31238 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);
31239
31240 /**
31241  * Marks the node with the given `node_id` as banned, i.e.,
31242  * it will be avoided during path finding.
31243  */
31244 void ProbabilisticScorer_add_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
31245
31246 /**
31247  * Removes the node with the given `node_id` from the list of nodes to avoid.
31248  */
31249 void ProbabilisticScorer_remove_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
31250
31251 /**
31252  * Sets a manual penalty for the given node.
31253  */
31254 void ProbabilisticScorer_set_manual_penalty(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id, uint64_t penalty);
31255
31256 /**
31257  * Removes the node with the given `node_id` from the list of manual penalties.
31258  */
31259 void ProbabilisticScorer_remove_manual_penalty(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
31260
31261 /**
31262  * Clears the list of manual penalties that are applied during path finding.
31263  */
31264 void ProbabilisticScorer_clear_manual_penalties(struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
31265
31266 /**
31267  * Marks all nodes in the given list as banned, i.e.,
31268  * they will be avoided during path finding.
31269  */
31270 void ProbabilisticScoringParameters_add_banned_from_list(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_arg, struct LDKCVec_NodeIdZ node_ids);
31271
31272 /**
31273  * Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used.
31274  */
31275 MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_default(void);
31276
31277 /**
31278  * Constructs a new Score which calls the relevant methods on this_arg.
31279  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
31280  */
31281 struct LDKScore ProbabilisticScorer_as_Score(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
31282
31283 /**
31284  * Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read
31285  */
31286 struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj);
31287
31288 /**
31289  * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write
31290  */
31291 struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b, struct LDKLogger arg_c);
31292
31293 /**
31294  * Frees any resources used by the BlindedPath, if is_owned is set and inner is non-NULL.
31295  */
31296 void BlindedPath_free(struct LDKBlindedPath this_obj);
31297
31298 /**
31299  * Creates a copy of the BlindedPath
31300  */
31301 struct LDKBlindedPath BlindedPath_clone(const struct LDKBlindedPath *NONNULL_PTR orig);
31302
31303 /**
31304  * Frees any resources used by the BlindedHop, if is_owned is set and inner is non-NULL.
31305  */
31306 void BlindedHop_free(struct LDKBlindedHop this_obj);
31307
31308 /**
31309  * Creates a copy of the BlindedHop
31310  */
31311 struct LDKBlindedHop BlindedHop_clone(const struct LDKBlindedHop *NONNULL_PTR orig);
31312
31313 /**
31314  * Create a blinded path to be forwarded along `node_pks`. The last node pubkey in `node_pks`
31315  * will be the destination node.
31316  *
31317  * Errors if less than two hops are provided or if `node_pk`(s) are invalid.
31318  */
31319 MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_new(struct LDKCVec_PublicKeyZ node_pks, const struct LDKKeysInterface *NONNULL_PTR keys_manager);
31320
31321 /**
31322  * Serialize the BlindedPath object into a byte array which can be read by BlindedPath_read
31323  */
31324 struct LDKCVec_u8Z BlindedPath_write(const struct LDKBlindedPath *NONNULL_PTR obj);
31325
31326 /**
31327  * Read a BlindedPath from a byte array, created by BlindedPath_write
31328  */
31329 struct LDKCResult_BlindedPathDecodeErrorZ BlindedPath_read(struct LDKu8slice ser);
31330
31331 /**
31332  * Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read
31333  */
31334 struct LDKCVec_u8Z BlindedHop_write(const struct LDKBlindedHop *NONNULL_PTR obj);
31335
31336 /**
31337  * Read a BlindedHop from a byte array, created by BlindedHop_write
31338  */
31339 struct LDKCResult_BlindedHopDecodeErrorZ BlindedHop_read(struct LDKu8slice ser);
31340
31341 /**
31342  * Frees any resources used by the OnionMessenger, if is_owned is set and inner is non-NULL.
31343  */
31344 void OnionMessenger_free(struct LDKOnionMessenger this_obj);
31345
31346 /**
31347  * Frees any resources used by the Destination
31348  */
31349 void Destination_free(struct LDKDestination this_ptr);
31350
31351 /**
31352  * Creates a copy of the Destination
31353  */
31354 struct LDKDestination Destination_clone(const struct LDKDestination *NONNULL_PTR orig);
31355
31356 /**
31357  * Utility method to constructs a new Node-variant Destination
31358  */
31359 struct LDKDestination Destination_node(struct LDKPublicKey a);
31360
31361 /**
31362  * Utility method to constructs a new BlindedPath-variant Destination
31363  */
31364 struct LDKDestination Destination_blinded_path(struct LDKBlindedPath a);
31365
31366 /**
31367  * Frees any resources used by the SendError
31368  */
31369 void SendError_free(struct LDKSendError this_ptr);
31370
31371 /**
31372  * Creates a copy of the SendError
31373  */
31374 struct LDKSendError SendError_clone(const struct LDKSendError *NONNULL_PTR orig);
31375
31376 /**
31377  * Utility method to constructs a new Secp256k1-variant SendError
31378  */
31379 struct LDKSendError SendError_secp256k1(enum LDKSecp256k1Error a);
31380
31381 /**
31382  * Utility method to constructs a new TooBigPacket-variant SendError
31383  */
31384 struct LDKSendError SendError_too_big_packet(void);
31385
31386 /**
31387  * Utility method to constructs a new TooFewBlindedHops-variant SendError
31388  */
31389 struct LDKSendError SendError_too_few_blinded_hops(void);
31390
31391 /**
31392  * Utility method to constructs a new InvalidFirstHop-variant SendError
31393  */
31394 struct LDKSendError SendError_invalid_first_hop(void);
31395
31396 /**
31397  * Utility method to constructs a new InvalidMessage-variant SendError
31398  */
31399 struct LDKSendError SendError_invalid_message(void);
31400
31401 /**
31402  * Utility method to constructs a new BufferFull-variant SendError
31403  */
31404 struct LDKSendError SendError_buffer_full(void);
31405
31406 /**
31407  * Utility method to constructs a new GetNodeIdFailed-variant SendError
31408  */
31409 struct LDKSendError SendError_get_node_id_failed(void);
31410
31411 /**
31412  * Utility method to constructs a new BlindedPathAdvanceFailed-variant SendError
31413  */
31414 struct LDKSendError SendError_blinded_path_advance_failed(void);
31415
31416 /**
31417  * Checks if two SendErrors contain equal inner contents.
31418  * This ignores pointers and is_owned flags and looks at the values in fields.
31419  */
31420 bool SendError_eq(const struct LDKSendError *NONNULL_PTR a, const struct LDKSendError *NONNULL_PTR b);
31421
31422 /**
31423  * Calls the free function if one is set
31424  */
31425 void CustomOnionMessageHandler_free(struct LDKCustomOnionMessageHandler this_ptr);
31426
31427 /**
31428  * Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to
31429  * their respective handlers.
31430  */
31431 MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKKeysInterface keys_manager, struct LDKLogger logger, struct LDKCustomOnionMessageHandler custom_handler);
31432
31433 /**
31434  * Send an onion message with contents `message` to `destination`, routing it through `intermediate_nodes`.
31435  * See [`OnionMessenger`] for example usage.
31436  *
31437  * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None
31438  */
31439 MUST_USE_RES struct LDKCResult_NoneSendErrorZ OnionMessenger_send_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKCVec_PublicKeyZ intermediate_nodes, struct LDKDestination destination, struct LDKOnionMessageContents message, struct LDKBlindedPath reply_path);
31440
31441 /**
31442  * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg.
31443  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is
31444  */
31445 struct LDKOnionMessageHandler OnionMessenger_as_OnionMessageHandler(const struct LDKOnionMessenger *NONNULL_PTR this_arg);
31446
31447 /**
31448  * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg.
31449  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is
31450  */
31451 struct LDKOnionMessageProvider OnionMessenger_as_OnionMessageProvider(const struct LDKOnionMessenger *NONNULL_PTR this_arg);
31452
31453 /**
31454  * Frees any resources used by the OnionMessageContents
31455  */
31456 void OnionMessageContents_free(struct LDKOnionMessageContents this_ptr);
31457
31458 /**
31459  * Utility method to constructs a new Custom-variant OnionMessageContents
31460  */
31461 struct LDKOnionMessageContents OnionMessageContents_custom(struct LDKCustomOnionMessageContents a);
31462
31463 /**
31464  * Calls the free function if one is set
31465  */
31466 void CustomOnionMessageContents_free(struct LDKCustomOnionMessageContents this_ptr);
31467
31468 /**
31469  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
31470  */
31471 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
31472
31473 /**
31474  * Initialize a new FilesystemPersister and set the path to the individual channels'
31475  * files.
31476  */
31477 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
31478
31479 /**
31480  * Get the directory which was provided when this persister was initialized.
31481  */
31482 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
31483
31484 /**
31485  * Read `ChannelMonitor`s from disk.
31486  */
31487 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
31488
31489 /**
31490  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
31491  */
31492 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
31493
31494 /**
31495  * Frees any resources used by the GossipSync
31496  */
31497 void GossipSync_free(struct LDKGossipSync this_ptr);
31498
31499 /**
31500  * Utility method to constructs a new P2P-variant GossipSync
31501  */
31502 struct LDKGossipSync GossipSync_p2_p(const struct LDKP2PGossipSync *NONNULL_PTR a);
31503
31504 /**
31505  * Utility method to constructs a new Rapid-variant GossipSync
31506  */
31507 struct LDKGossipSync GossipSync_rapid(const struct LDKRapidGossipSync *NONNULL_PTR a);
31508
31509 /**
31510  * Utility method to constructs a new None-variant GossipSync
31511  */
31512 struct LDKGossipSync GossipSync_none(void);
31513
31514 /**
31515  * Start a background thread that takes care of responsibilities enumerated in the [top-level
31516  * documentation].
31517  *
31518  * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
31519  * [`Persister::persist_manager`] returns an error. In case of an error, the error is retrieved by calling
31520  * either [`join`] or [`stop`].
31521  *
31522  * # Data Persistence
31523  *
31524  * [`Persister::persist_manager`] is responsible for writing out the [`ChannelManager`] to disk, and/or
31525  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
31526  * [`ChannelManager`]. See the `lightning-persister` crate for LDK's
31527  * provided implementation.
31528  *
31529  * [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk, if
31530  * [`GossipSync`] is supplied. See [`NetworkGraph::write`] for writing out a [`NetworkGraph`].
31531  * See the `lightning-persister` crate for LDK's provided implementation.
31532  *
31533  * Typically, users should either implement [`Persister::persist_manager`] to never return an
31534  * error or call [`join`] and handle any error that may arise. For the latter case,
31535  * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
31536  *
31537  * # Event Handling
31538  *
31539  * `event_handler` is responsible for handling events that users should be notified of (e.g.,
31540  * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
31541  * functionality implemented by other handlers.
31542  * * [`P2PGossipSync`] if given will update the [`NetworkGraph`] based on payment failures.
31543  *
31544  * # Rapid Gossip Sync
31545  *
31546  * If rapid gossip sync is meant to run at startup, pass [`RapidGossipSync`] via `gossip_sync`
31547  * to indicate that the [`BackgroundProcessor`] should not prune the [`NetworkGraph`] instance
31548  * until the [`RapidGossipSync`] instance completes its first sync.
31549  *
31550  * [top-level documentation]: BackgroundProcessor
31551  * [`join`]: Self::join
31552  * [`stop`]: Self::stop
31553  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
31554  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
31555  * [`Persister::persist_manager`]: lightning::util::persist::Persister::persist_manager
31556  * [`Persister::persist_graph`]: lightning::util::persist::Persister::persist_graph
31557  * [`NetworkGraph`]: lightning::routing::gossip::NetworkGraph
31558  * [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable
31559  */
31560 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);
31561
31562 /**
31563  * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
31564  * [`ChannelManager`].
31565  *
31566  * # Panics
31567  *
31568  * This function panics if the background thread has panicked such as while persisting or
31569  * handling events.
31570  *
31571  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
31572  */
31573 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
31574
31575 /**
31576  * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
31577  * [`ChannelManager`].
31578  *
31579  * # Panics
31580  *
31581  * This function panics if the background thread has panicked such as while persisting or
31582  * handling events.
31583  *
31584  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
31585  */
31586 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
31587
31588 /**
31589  * Frees any resources used by the ParseError
31590  */
31591 void ParseError_free(struct LDKParseError this_ptr);
31592
31593 /**
31594  * Creates a copy of the ParseError
31595  */
31596 struct LDKParseError ParseError_clone(const struct LDKParseError *NONNULL_PTR orig);
31597
31598 /**
31599  * Utility method to constructs a new Bech32Error-variant ParseError
31600  */
31601 struct LDKParseError ParseError_bech32_error(struct LDKBech32Error a);
31602
31603 /**
31604  * Utility method to constructs a new ParseAmountError-variant ParseError
31605  */
31606 struct LDKParseError ParseError_parse_amount_error(struct LDKError a);
31607
31608 /**
31609  * Utility method to constructs a new MalformedSignature-variant ParseError
31610  */
31611 struct LDKParseError ParseError_malformed_signature(enum LDKSecp256k1Error a);
31612
31613 /**
31614  * Utility method to constructs a new BadPrefix-variant ParseError
31615  */
31616 struct LDKParseError ParseError_bad_prefix(void);
31617
31618 /**
31619  * Utility method to constructs a new UnknownCurrency-variant ParseError
31620  */
31621 struct LDKParseError ParseError_unknown_currency(void);
31622
31623 /**
31624  * Utility method to constructs a new UnknownSiPrefix-variant ParseError
31625  */
31626 struct LDKParseError ParseError_unknown_si_prefix(void);
31627
31628 /**
31629  * Utility method to constructs a new MalformedHRP-variant ParseError
31630  */
31631 struct LDKParseError ParseError_malformed_hrp(void);
31632
31633 /**
31634  * Utility method to constructs a new TooShortDataPart-variant ParseError
31635  */
31636 struct LDKParseError ParseError_too_short_data_part(void);
31637
31638 /**
31639  * Utility method to constructs a new UnexpectedEndOfTaggedFields-variant ParseError
31640  */
31641 struct LDKParseError ParseError_unexpected_end_of_tagged_fields(void);
31642
31643 /**
31644  * Utility method to constructs a new DescriptionDecodeError-variant ParseError
31645  */
31646 struct LDKParseError ParseError_description_decode_error(struct LDKError a);
31647
31648 /**
31649  * Utility method to constructs a new PaddingError-variant ParseError
31650  */
31651 struct LDKParseError ParseError_padding_error(void);
31652
31653 /**
31654  * Utility method to constructs a new IntegerOverflowError-variant ParseError
31655  */
31656 struct LDKParseError ParseError_integer_overflow_error(void);
31657
31658 /**
31659  * Utility method to constructs a new InvalidSegWitProgramLength-variant ParseError
31660  */
31661 struct LDKParseError ParseError_invalid_seg_wit_program_length(void);
31662
31663 /**
31664  * Utility method to constructs a new InvalidPubKeyHashLength-variant ParseError
31665  */
31666 struct LDKParseError ParseError_invalid_pub_key_hash_length(void);
31667
31668 /**
31669  * Utility method to constructs a new InvalidScriptHashLength-variant ParseError
31670  */
31671 struct LDKParseError ParseError_invalid_script_hash_length(void);
31672
31673 /**
31674  * Utility method to constructs a new InvalidRecoveryId-variant ParseError
31675  */
31676 struct LDKParseError ParseError_invalid_recovery_id(void);
31677
31678 /**
31679  * Utility method to constructs a new InvalidSliceLength-variant ParseError
31680  */
31681 struct LDKParseError ParseError_invalid_slice_length(struct LDKStr a);
31682
31683 /**
31684  * Utility method to constructs a new Skip-variant ParseError
31685  */
31686 struct LDKParseError ParseError_skip(void);
31687
31688 /**
31689  * Checks if two ParseErrors contain equal inner contents.
31690  * This ignores pointers and is_owned flags and looks at the values in fields.
31691  */
31692 bool ParseError_eq(const struct LDKParseError *NONNULL_PTR a, const struct LDKParseError *NONNULL_PTR b);
31693
31694 /**
31695  * Frees any resources used by the ParseOrSemanticError
31696  */
31697 void ParseOrSemanticError_free(struct LDKParseOrSemanticError this_ptr);
31698
31699 /**
31700  * Creates a copy of the ParseOrSemanticError
31701  */
31702 struct LDKParseOrSemanticError ParseOrSemanticError_clone(const struct LDKParseOrSemanticError *NONNULL_PTR orig);
31703
31704 /**
31705  * Utility method to constructs a new ParseError-variant ParseOrSemanticError
31706  */
31707 struct LDKParseOrSemanticError ParseOrSemanticError_parse_error(struct LDKParseError a);
31708
31709 /**
31710  * Utility method to constructs a new SemanticError-variant ParseOrSemanticError
31711  */
31712 struct LDKParseOrSemanticError ParseOrSemanticError_semantic_error(enum LDKSemanticError a);
31713
31714 /**
31715  * Checks if two ParseOrSemanticErrors contain equal inner contents.
31716  * This ignores pointers and is_owned flags and looks at the values in fields.
31717  */
31718 bool ParseOrSemanticError_eq(const struct LDKParseOrSemanticError *NONNULL_PTR a, const struct LDKParseOrSemanticError *NONNULL_PTR b);
31719
31720 /**
31721  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
31722  */
31723 void Invoice_free(struct LDKInvoice this_obj);
31724
31725 /**
31726  * Checks if two Invoices contain equal inner contents.
31727  * This ignores pointers and is_owned flags and looks at the values in fields.
31728  * Two objects with NULL inner values will be considered "equal" here.
31729  */
31730 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
31731
31732 /**
31733  * Creates a copy of the Invoice
31734  */
31735 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
31736
31737 /**
31738  * Checks if two Invoices contain equal inner contents.
31739  */
31740 uint64_t Invoice_hash(const struct LDKInvoice *NONNULL_PTR o);
31741
31742 /**
31743  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
31744  */
31745 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
31746
31747 /**
31748  * Checks if two SignedRawInvoices contain equal inner contents.
31749  * This ignores pointers and is_owned flags and looks at the values in fields.
31750  * Two objects with NULL inner values will be considered "equal" here.
31751  */
31752 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
31753
31754 /**
31755  * Creates a copy of the SignedRawInvoice
31756  */
31757 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
31758
31759 /**
31760  * Checks if two SignedRawInvoices contain equal inner contents.
31761  */
31762 uint64_t SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR o);
31763
31764 /**
31765  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
31766  */
31767 void RawInvoice_free(struct LDKRawInvoice this_obj);
31768
31769 /**
31770  * data part
31771  */
31772 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
31773
31774 /**
31775  * data part
31776  */
31777 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
31778
31779 /**
31780  * Checks if two RawInvoices contain equal inner contents.
31781  * This ignores pointers and is_owned flags and looks at the values in fields.
31782  * Two objects with NULL inner values will be considered "equal" here.
31783  */
31784 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
31785
31786 /**
31787  * Creates a copy of the RawInvoice
31788  */
31789 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
31790
31791 /**
31792  * Checks if two RawInvoices contain equal inner contents.
31793  */
31794 uint64_t RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR o);
31795
31796 /**
31797  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
31798  */
31799 void RawDataPart_free(struct LDKRawDataPart this_obj);
31800
31801 /**
31802  * generation time of the invoice
31803  */
31804 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
31805
31806 /**
31807  * generation time of the invoice
31808  */
31809 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
31810
31811 /**
31812  * Checks if two RawDataParts contain equal inner contents.
31813  * This ignores pointers and is_owned flags and looks at the values in fields.
31814  * Two objects with NULL inner values will be considered "equal" here.
31815  */
31816 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
31817
31818 /**
31819  * Creates a copy of the RawDataPart
31820  */
31821 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
31822
31823 /**
31824  * Checks if two RawDataParts contain equal inner contents.
31825  */
31826 uint64_t RawDataPart_hash(const struct LDKRawDataPart *NONNULL_PTR o);
31827
31828 /**
31829  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
31830  */
31831 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
31832
31833 /**
31834  * Checks if two PositiveTimestamps contain equal inner contents.
31835  * This ignores pointers and is_owned flags and looks at the values in fields.
31836  * Two objects with NULL inner values will be considered "equal" here.
31837  */
31838 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
31839
31840 /**
31841  * Creates a copy of the PositiveTimestamp
31842  */
31843 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
31844
31845 /**
31846  * Checks if two PositiveTimestamps contain equal inner contents.
31847  */
31848 uint64_t PositiveTimestamp_hash(const struct LDKPositiveTimestamp *NONNULL_PTR o);
31849
31850 /**
31851  * Creates a copy of the SiPrefix
31852  */
31853 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
31854
31855 /**
31856  * Utility method to constructs a new Milli-variant SiPrefix
31857  */
31858 enum LDKSiPrefix SiPrefix_milli(void);
31859
31860 /**
31861  * Utility method to constructs a new Micro-variant SiPrefix
31862  */
31863 enum LDKSiPrefix SiPrefix_micro(void);
31864
31865 /**
31866  * Utility method to constructs a new Nano-variant SiPrefix
31867  */
31868 enum LDKSiPrefix SiPrefix_nano(void);
31869
31870 /**
31871  * Utility method to constructs a new Pico-variant SiPrefix
31872  */
31873 enum LDKSiPrefix SiPrefix_pico(void);
31874
31875 /**
31876  * Checks if two SiPrefixs contain equal inner contents.
31877  * This ignores pointers and is_owned flags and looks at the values in fields.
31878  */
31879 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
31880
31881 /**
31882  * Checks if two SiPrefixs contain equal inner contents.
31883  */
31884 uint64_t SiPrefix_hash(const enum LDKSiPrefix *NONNULL_PTR o);
31885
31886 /**
31887  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
31888  * This is effectively 10^12 * the prefix multiplier
31889  */
31890 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
31891
31892 /**
31893  * Creates a copy of the Currency
31894  */
31895 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
31896
31897 /**
31898  * Utility method to constructs a new Bitcoin-variant Currency
31899  */
31900 enum LDKCurrency Currency_bitcoin(void);
31901
31902 /**
31903  * Utility method to constructs a new BitcoinTestnet-variant Currency
31904  */
31905 enum LDKCurrency Currency_bitcoin_testnet(void);
31906
31907 /**
31908  * Utility method to constructs a new Regtest-variant Currency
31909  */
31910 enum LDKCurrency Currency_regtest(void);
31911
31912 /**
31913  * Utility method to constructs a new Simnet-variant Currency
31914  */
31915 enum LDKCurrency Currency_simnet(void);
31916
31917 /**
31918  * Utility method to constructs a new Signet-variant Currency
31919  */
31920 enum LDKCurrency Currency_signet(void);
31921
31922 /**
31923  * Checks if two Currencys contain equal inner contents.
31924  */
31925 uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
31926
31927 /**
31928  * Checks if two Currencys contain equal inner contents.
31929  * This ignores pointers and is_owned flags and looks at the values in fields.
31930  */
31931 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
31932
31933 /**
31934  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
31935  */
31936 void Sha256_free(struct LDKSha256 this_obj);
31937
31938 /**
31939  * Creates a copy of the Sha256
31940  */
31941 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
31942
31943 /**
31944  * Checks if two Sha256s contain equal inner contents.
31945  */
31946 uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
31947
31948 /**
31949  * Checks if two Sha256s contain equal inner contents.
31950  * This ignores pointers and is_owned flags and looks at the values in fields.
31951  * Two objects with NULL inner values will be considered "equal" here.
31952  */
31953 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
31954
31955 /**
31956  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
31957  */
31958 void Description_free(struct LDKDescription this_obj);
31959
31960 /**
31961  * Creates a copy of the Description
31962  */
31963 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
31964
31965 /**
31966  * Checks if two Descriptions contain equal inner contents.
31967  */
31968 uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
31969
31970 /**
31971  * Checks if two Descriptions contain equal inner contents.
31972  * This ignores pointers and is_owned flags and looks at the values in fields.
31973  * Two objects with NULL inner values will be considered "equal" here.
31974  */
31975 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
31976
31977 /**
31978  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
31979  */
31980 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
31981
31982 struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr);
31983
31984 void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
31985
31986 /**
31987  * Constructs a new PayeePubKey given each field
31988  */
31989 MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg);
31990
31991 /**
31992  * Creates a copy of the PayeePubKey
31993  */
31994 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
31995
31996 /**
31997  * Checks if two PayeePubKeys contain equal inner contents.
31998  */
31999 uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
32000
32001 /**
32002  * Checks if two PayeePubKeys contain equal inner contents.
32003  * This ignores pointers and is_owned flags and looks at the values in fields.
32004  * Two objects with NULL inner values will be considered "equal" here.
32005  */
32006 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
32007
32008 /**
32009  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
32010  */
32011 void ExpiryTime_free(struct LDKExpiryTime this_obj);
32012
32013 /**
32014  * Creates a copy of the ExpiryTime
32015  */
32016 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
32017
32018 /**
32019  * Checks if two ExpiryTimes contain equal inner contents.
32020  */
32021 uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
32022
32023 /**
32024  * Checks if two ExpiryTimes contain equal inner contents.
32025  * This ignores pointers and is_owned flags and looks at the values in fields.
32026  * Two objects with NULL inner values will be considered "equal" here.
32027  */
32028 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
32029
32030 /**
32031  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
32032  */
32033 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
32034
32035 uint64_t MinFinalCltvExpiry_get_a(const struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr);
32036
32037 void MinFinalCltvExpiry_set_a(struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr, uint64_t val);
32038
32039 /**
32040  * Constructs a new MinFinalCltvExpiry given each field
32041  */
32042 MUST_USE_RES struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_new(uint64_t a_arg);
32043
32044 /**
32045  * Creates a copy of the MinFinalCltvExpiry
32046  */
32047 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
32048
32049 /**
32050  * Checks if two MinFinalCltvExpirys contain equal inner contents.
32051  */
32052 uint64_t MinFinalCltvExpiry_hash(const struct LDKMinFinalCltvExpiry *NONNULL_PTR o);
32053
32054 /**
32055  * Checks if two MinFinalCltvExpirys contain equal inner contents.
32056  * This ignores pointers and is_owned flags and looks at the values in fields.
32057  * Two objects with NULL inner values will be considered "equal" here.
32058  */
32059 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
32060
32061 /**
32062  * Frees any resources used by the Fallback
32063  */
32064 void Fallback_free(struct LDKFallback this_ptr);
32065
32066 /**
32067  * Creates a copy of the Fallback
32068  */
32069 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
32070
32071 /**
32072  * Utility method to constructs a new SegWitProgram-variant Fallback
32073  */
32074 struct LDKFallback Fallback_seg_wit_program(struct LDKU5 version, struct LDKCVec_u8Z program);
32075
32076 /**
32077  * Utility method to constructs a new PubKeyHash-variant Fallback
32078  */
32079 struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a);
32080
32081 /**
32082  * Utility method to constructs a new ScriptHash-variant Fallback
32083  */
32084 struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
32085
32086 /**
32087  * Checks if two Fallbacks contain equal inner contents.
32088  */
32089 uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
32090
32091 /**
32092  * Checks if two Fallbacks contain equal inner contents.
32093  * This ignores pointers and is_owned flags and looks at the values in fields.
32094  */
32095 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
32096
32097 /**
32098  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
32099  */
32100 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
32101
32102 /**
32103  * Creates a copy of the InvoiceSignature
32104  */
32105 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
32106
32107 /**
32108  * Checks if two InvoiceSignatures contain equal inner contents.
32109  */
32110 uint64_t InvoiceSignature_hash(const struct LDKInvoiceSignature *NONNULL_PTR o);
32111
32112 /**
32113  * Checks if two InvoiceSignatures contain equal inner contents.
32114  * This ignores pointers and is_owned flags and looks at the values in fields.
32115  * Two objects with NULL inner values will be considered "equal" here.
32116  */
32117 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
32118
32119 /**
32120  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
32121  */
32122 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
32123
32124 /**
32125  * Creates a copy of the PrivateRoute
32126  */
32127 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
32128
32129 /**
32130  * Checks if two PrivateRoutes contain equal inner contents.
32131  */
32132 uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
32133
32134 /**
32135  * Checks if two PrivateRoutes contain equal inner contents.
32136  * This ignores pointers and is_owned flags and looks at the values in fields.
32137  * Two objects with NULL inner values will be considered "equal" here.
32138  */
32139 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
32140
32141 /**
32142  * Disassembles the `SignedRawInvoice` into its three parts:
32143  *  1. raw invoice
32144  *  2. hash of the raw invoice
32145  *  3. signature
32146  */
32147 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
32148
32149 /**
32150  * The `RawInvoice` which was signed.
32151  */
32152 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
32153
32154 /**
32155  * The hash of the `RawInvoice` that was signed.
32156  */
32157 MUST_USE_RES const uint8_t (*SignedRawInvoice_signable_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
32158
32159 /**
32160  * InvoiceSignature for the invoice.
32161  */
32162 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
32163
32164 /**
32165  * Recovers the public key used for signing the invoice from the recoverable signature.
32166  */
32167 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
32168
32169 /**
32170  * Checks if the signature is valid for the included payee public key or if none exists if it's
32171  * valid for the recovered signature (which should always be true?).
32172  */
32173 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
32174
32175 /**
32176  * Calculate the hash of the encoded `RawInvoice` which should be signed.
32177  */
32178 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_signable_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
32179
32180 /**
32181  *
32182  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
32183  */
32184 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
32185
32186 /**
32187  *
32188  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
32189  */
32190 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
32191
32192 /**
32193  *
32194  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
32195  */
32196 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
32197
32198 /**
32199  *
32200  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
32201  */
32202 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
32203
32204 /**
32205  *
32206  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
32207  */
32208 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
32209
32210 /**
32211  *
32212  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
32213  */
32214 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
32215
32216 /**
32217  *
32218  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
32219  */
32220 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
32221
32222 /**
32223  *
32224  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
32225  */
32226 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
32227
32228 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
32229
32230 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
32231
32232 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
32233
32234 /**
32235  * Creates a `PositiveTimestamp` from a Unix timestamp in the range `0..=MAX_TIMESTAMP`.
32236  *
32237  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
32238  */
32239 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
32240
32241 /**
32242  * Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding Unix timestamp in
32243  * the range `0..=MAX_TIMESTAMP`.
32244  *
32245  * Note that the subsecond part is dropped as it is not representable in BOLT 11 invoices.
32246  *
32247  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
32248  */
32249 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
32250
32251 /**
32252  * Creates a `PositiveTimestamp` from a [`Duration`] since the Unix epoch in the range
32253  * `0..=MAX_TIMESTAMP`.
32254  *
32255  * Note that the subsecond part is dropped as it is not representable in BOLT 11 invoices.
32256  *
32257  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
32258  */
32259 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_duration_since_epoch(uint64_t duration);
32260
32261 /**
32262  * Returns the Unix timestamp representing the stored time
32263  */
32264 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
32265
32266 /**
32267  * Returns the duration of the stored time since the Unix epoch
32268  */
32269 MUST_USE_RES uint64_t PositiveTimestamp_as_duration_since_epoch(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
32270
32271 /**
32272  * Returns the [`SystemTime`] representing the stored time
32273  */
32274 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
32275
32276 /**
32277  * Transform the `Invoice` into it's unchecked version
32278  */
32279 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
32280
32281 /**
32282  * Check that the invoice is signed correctly and that key recovery works
32283  */
32284 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
32285
32286 /**
32287  * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
32288  * ```
32289  * use lightning_invoice::*;
32290  *
32291  * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\
32292  * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\
32293  * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\
32294  * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\
32295  * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\
32296  * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\
32297  * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\
32298  * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\
32299  * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\
32300  * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\
32301  * j5r6drg6k6zcqj0fcwg\";
32302  *
32303  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
32304  *
32305  * assert!(Invoice::from_signed(signed).is_ok());
32306  * ```
32307  */
32308 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
32309
32310 /**
32311  * Returns the `Invoice`'s timestamp (should equal its creation time)
32312  */
32313 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
32314
32315 /**
32316  * Returns the `Invoice`'s timestamp as a duration since the Unix epoch
32317  */
32318 MUST_USE_RES uint64_t Invoice_duration_since_epoch(const struct LDKInvoice *NONNULL_PTR this_arg);
32319
32320 /**
32321  * Returns the hash to which we will receive the preimage on completion of the payment
32322  */
32323 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
32324
32325 /**
32326  * Get the payee's public key if one was included in the invoice
32327  *
32328  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
32329  */
32330 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
32331
32332 /**
32333  * Get the payment secret if one was included in the invoice
32334  */
32335 MUST_USE_RES const uint8_t (*Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
32336
32337 /**
32338  * Get the invoice features if they were included in the invoice
32339  *
32340  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
32341  */
32342 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
32343
32344 /**
32345  * Recover the payee's public key (only to be used if none was included in the invoice)
32346  */
32347 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
32348
32349 /**
32350  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
32351  */
32352 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
32353
32354 /**
32355  * Returns whether the invoice has expired.
32356  */
32357 MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg);
32358
32359 /**
32360  * Returns whether the expiry time would pass at the given point in time.
32361  * `at_time` is the timestamp as a duration since the Unix epoch.
32362  */
32363 MUST_USE_RES bool Invoice_would_expire(const struct LDKInvoice *NONNULL_PTR this_arg, uint64_t at_time);
32364
32365 /**
32366  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
32367  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
32368  */
32369 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
32370
32371 /**
32372  * Returns a list of all routes included in the invoice
32373  */
32374 MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
32375
32376 /**
32377  * Returns a list of all routes included in the invoice as the underlying hints
32378  */
32379 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
32380
32381 /**
32382  * Returns the currency for which the invoice was issued
32383  */
32384 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
32385
32386 /**
32387  * Returns the amount if specified in the invoice as millisatoshis.
32388  */
32389 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_milli_satoshis(const struct LDKInvoice *NONNULL_PTR this_arg);
32390
32391 /**
32392  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
32393  * returns `CreationError::DescriptionTooLong` otherwise
32394  *
32395  * Please note that single characters may use more than one byte due to UTF8 encoding.
32396  */
32397 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
32398
32399 /**
32400  * Returns the underlying description `String`
32401  */
32402 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
32403
32404 /**
32405  * Construct an `ExpiryTime` from seconds.
32406  */
32407 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_seconds(uint64_t seconds);
32408
32409 /**
32410  * Construct an `ExpiryTime` from a `Duration`, dropping the sub-second part.
32411  */
32412 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_duration(uint64_t duration);
32413
32414 /**
32415  * Returns the expiry time in seconds
32416  */
32417 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
32418
32419 /**
32420  * Returns a reference to the underlying `Duration` (=expiry time)
32421  */
32422 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
32423
32424 /**
32425  * Creates a new (partial) route from a list of hops
32426  */
32427 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
32428
32429 /**
32430  * Returns the underlying list of hops
32431  */
32432 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
32433
32434 /**
32435  * Creates a copy of the CreationError
32436  */
32437 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
32438
32439 /**
32440  * Utility method to constructs a new DescriptionTooLong-variant CreationError
32441  */
32442 enum LDKCreationError CreationError_description_too_long(void);
32443
32444 /**
32445  * Utility method to constructs a new RouteTooLong-variant CreationError
32446  */
32447 enum LDKCreationError CreationError_route_too_long(void);
32448
32449 /**
32450  * Utility method to constructs a new TimestampOutOfBounds-variant CreationError
32451  */
32452 enum LDKCreationError CreationError_timestamp_out_of_bounds(void);
32453
32454 /**
32455  * Utility method to constructs a new InvalidAmount-variant CreationError
32456  */
32457 enum LDKCreationError CreationError_invalid_amount(void);
32458
32459 /**
32460  * Utility method to constructs a new MissingRouteHints-variant CreationError
32461  */
32462 enum LDKCreationError CreationError_missing_route_hints(void);
32463
32464 /**
32465  * Checks if two CreationErrors contain equal inner contents.
32466  * This ignores pointers and is_owned flags and looks at the values in fields.
32467  */
32468 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
32469
32470 /**
32471  * Get the string representation of a CreationError object
32472  */
32473 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
32474
32475 /**
32476  * Creates a copy of the SemanticError
32477  */
32478 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
32479
32480 /**
32481  * Utility method to constructs a new NoPaymentHash-variant SemanticError
32482  */
32483 enum LDKSemanticError SemanticError_no_payment_hash(void);
32484
32485 /**
32486  * Utility method to constructs a new MultiplePaymentHashes-variant SemanticError
32487  */
32488 enum LDKSemanticError SemanticError_multiple_payment_hashes(void);
32489
32490 /**
32491  * Utility method to constructs a new NoDescription-variant SemanticError
32492  */
32493 enum LDKSemanticError SemanticError_no_description(void);
32494
32495 /**
32496  * Utility method to constructs a new MultipleDescriptions-variant SemanticError
32497  */
32498 enum LDKSemanticError SemanticError_multiple_descriptions(void);
32499
32500 /**
32501  * Utility method to constructs a new NoPaymentSecret-variant SemanticError
32502  */
32503 enum LDKSemanticError SemanticError_no_payment_secret(void);
32504
32505 /**
32506  * Utility method to constructs a new MultiplePaymentSecrets-variant SemanticError
32507  */
32508 enum LDKSemanticError SemanticError_multiple_payment_secrets(void);
32509
32510 /**
32511  * Utility method to constructs a new InvalidFeatures-variant SemanticError
32512  */
32513 enum LDKSemanticError SemanticError_invalid_features(void);
32514
32515 /**
32516  * Utility method to constructs a new InvalidRecoveryId-variant SemanticError
32517  */
32518 enum LDKSemanticError SemanticError_invalid_recovery_id(void);
32519
32520 /**
32521  * Utility method to constructs a new InvalidSignature-variant SemanticError
32522  */
32523 enum LDKSemanticError SemanticError_invalid_signature(void);
32524
32525 /**
32526  * Utility method to constructs a new ImpreciseAmount-variant SemanticError
32527  */
32528 enum LDKSemanticError SemanticError_imprecise_amount(void);
32529
32530 /**
32531  * Checks if two SemanticErrors contain equal inner contents.
32532  * This ignores pointers and is_owned flags and looks at the values in fields.
32533  */
32534 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
32535
32536 /**
32537  * Get the string representation of a SemanticError object
32538  */
32539 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
32540
32541 /**
32542  * Frees any resources used by the SignOrCreationError
32543  */
32544 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
32545
32546 /**
32547  * Creates a copy of the SignOrCreationError
32548  */
32549 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
32550
32551 /**
32552  * Utility method to constructs a new SignError-variant SignOrCreationError
32553  */
32554 struct LDKSignOrCreationError SignOrCreationError_sign_error(void);
32555
32556 /**
32557  * Utility method to constructs a new CreationError-variant SignOrCreationError
32558  */
32559 struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a);
32560
32561 /**
32562  * Checks if two SignOrCreationErrors contain equal inner contents.
32563  * This ignores pointers and is_owned flags and looks at the values in fields.
32564  */
32565 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
32566
32567 /**
32568  * Get the string representation of a SignOrCreationError object
32569  */
32570 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
32571
32572 /**
32573  * Frees any resources used by the InvoicePayer, if is_owned is set and inner is non-NULL.
32574  */
32575 void InvoicePayer_free(struct LDKInvoicePayer this_obj);
32576
32577 /**
32578  * Calls the free function if one is set
32579  */
32580 void Payer_free(struct LDKPayer this_ptr);
32581
32582 /**
32583  * Frees any resources used by the Retry
32584  */
32585 void Retry_free(struct LDKRetry this_ptr);
32586
32587 /**
32588  * Creates a copy of the Retry
32589  */
32590 struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig);
32591
32592 /**
32593  * Utility method to constructs a new Attempts-variant Retry
32594  */
32595 struct LDKRetry Retry_attempts(uintptr_t a);
32596
32597 /**
32598  * Utility method to constructs a new Timeout-variant Retry
32599  */
32600 struct LDKRetry Retry_timeout(uint64_t a);
32601
32602 /**
32603  * Checks if two Retrys contain equal inner contents.
32604  * This ignores pointers and is_owned flags and looks at the values in fields.
32605  */
32606 bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b);
32607
32608 /**
32609  * Checks if two Retrys contain equal inner contents.
32610  */
32611 uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o);
32612
32613 /**
32614  * Frees any resources used by the PaymentError
32615  */
32616 void PaymentError_free(struct LDKPaymentError this_ptr);
32617
32618 /**
32619  * Creates a copy of the PaymentError
32620  */
32621 struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig);
32622
32623 /**
32624  * Utility method to constructs a new Invoice-variant PaymentError
32625  */
32626 struct LDKPaymentError PaymentError_invoice(struct LDKStr a);
32627
32628 /**
32629  * Utility method to constructs a new Routing-variant PaymentError
32630  */
32631 struct LDKPaymentError PaymentError_routing(struct LDKLightningError a);
32632
32633 /**
32634  * Utility method to constructs a new Sending-variant PaymentError
32635  */
32636 struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a);
32637
32638 /**
32639  * Creates an invoice payer that retries failed payment paths.
32640  *
32641  * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once
32642  * `retry` has been exceeded for a given [`Invoice`].
32643  */
32644 MUST_USE_RES struct LDKInvoicePayer InvoicePayer_new(struct LDKPayer payer, struct LDKRouter router, struct LDKLogger logger, struct LDKEventHandler event_handler, struct LDKRetry retry);
32645
32646 /**
32647  * Pays the given [`Invoice`], caching it for later use in case a retry is needed.
32648  *
32649  * [`Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long
32650  * as the payment is still pending. Once the payment completes or fails, you must ensure that
32651  * a second payment with the same [`PaymentHash`] is never sent.
32652  *
32653  * If you wish to use a different payment idempotency token, see
32654  * [`Self::pay_invoice_with_id`].
32655  */
32656 MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice);
32657
32658 /**
32659  * Pays the given [`Invoice`] with a custom idempotency key, caching the invoice for later use
32660  * in case a retry is needed.
32661  *
32662  * Note that idempotency is only guaranteed as long as the payment is still pending. Once the
32663  * payment completes or fails, no idempotency guarantees are made.
32664  *
32665  * You should ensure that the [`Invoice::payment_hash`] is unique and the same [`PaymentHash`]
32666  * has never been paid before.
32667  *
32668  * See [`Self::pay_invoice`] for a variant which uses the [`PaymentHash`] for the idempotency
32669  * token.
32670  */
32671 MUST_USE_RES struct LDKCResult_NonePaymentErrorZ InvoicePayer_pay_invoice_with_id(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice, struct LDKThirtyTwoBytes payment_id);
32672
32673 /**
32674  * Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in
32675  * case a retry is needed.
32676  *
32677  * [`Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long
32678  * as the payment is still pending. Once the payment completes or fails, you must ensure that
32679  * a second payment with the same [`PaymentHash`] is never sent.
32680  *
32681  * If you wish to use a different payment idempotency token, see
32682  * [`Self::pay_zero_value_invoice_with_id`].
32683  */
32684 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);
32685
32686 /**
32687  * Pays the given zero-value [`Invoice`] using the given amount and custom idempotency key,
32688  * caching the invoice for later use in case a retry is needed.
32689  *
32690  * Note that idempotency is only guaranteed as long as the payment is still pending. Once the
32691  * payment completes or fails, no idempotency guarantees are made.
32692  *
32693  * You should ensure that the [`Invoice::payment_hash`] is unique and the same [`PaymentHash`]
32694  * has never been paid before.
32695  *
32696  * See [`Self::pay_zero_value_invoice`] for a variant which uses the [`PaymentHash`] for the
32697  * idempotency token.
32698  */
32699 MUST_USE_RES struct LDKCResult_NonePaymentErrorZ InvoicePayer_pay_zero_value_invoice_with_id(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_id);
32700
32701 /**
32702  * Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in
32703  * case a retry is needed.
32704  *
32705  * The hash of the [`PaymentPreimage`] is used as the [`PaymentId`], which ensures idempotency
32706  * as long as the payment is still pending. Once the payment completes or fails, you must
32707  * ensure that a second payment with the same [`PaymentPreimage`] is never sent.
32708  */
32709 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);
32710
32711 /**
32712  * Pays `pubkey` an amount using the hash of the given preimage and a custom idempotency key,
32713  * caching the invoice for later use in case a retry is needed.
32714  *
32715  * Note that idempotency is only guaranteed as long as the payment is still pending. Once the
32716  * payment completes or fails, no idempotency guarantees are made.
32717  *
32718  * You should ensure that the [`PaymentPreimage`] is unique and the corresponding
32719  * [`PaymentHash`] has never been paid before.
32720  */
32721 MUST_USE_RES struct LDKCResult_NonePaymentErrorZ InvoicePayer_pay_pubkey_with_id(const struct LDKInvoicePayer *NONNULL_PTR this_arg, struct LDKPublicKey pubkey, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_id, uint64_t amount_msats, uint32_t final_cltv_expiry_delta);
32722
32723 /**
32724  * Removes the payment cached by the given payment hash.
32725  *
32726  * Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an
32727  * [`EventHandler`]. Otherwise, calling this method is unnecessary.
32728  */
32729 void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
32730
32731 /**
32732  * Constructs a new EventHandler which calls the relevant methods on this_arg.
32733  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
32734  */
32735 struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg);
32736
32737 /**
32738  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
32739  * See [`PhantomKeysManager`] for more information on phantom node payments.
32740  *
32741  * `phantom_route_hints` parameter:
32742  * * Contains channel info for all nodes participating in the phantom invoice
32743  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
32744  *   participating node
32745  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
32746  *   updated when a channel becomes disabled or closes
32747  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
32748  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
32749  *   down
32750  *
32751  * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
32752  * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
32753  * If `None` is provided for `payment_hash`, then one will be created.
32754  *
32755  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
32756  * in excess of the current time.
32757  *
32758  * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
32759  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
32760  * requirement).
32761  *
32762  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
32763  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
32764  * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
32765  * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
32766  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
32767  *
32768  * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
32769  */
32770 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);
32771
32772 /**
32773  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
32774  * See [`PhantomKeysManager`] for more information on phantom node payments.
32775  *
32776  * `phantom_route_hints` parameter:
32777  * * Contains channel info for all nodes participating in the phantom invoice
32778  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
32779  *   participating node
32780  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
32781  *   updated when a channel becomes disabled or closes
32782  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
32783  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
32784  *   down
32785  *
32786  * `description_hash` is a SHA-256 hash of the description text
32787  *
32788  * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
32789  * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
32790  * If `None` is provided for `payment_hash`, then one will be created.
32791  *
32792  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
32793  * in excess of the current time.
32794  *
32795  * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
32796  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
32797  * requirement).
32798  *
32799  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
32800  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
32801  * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
32802  * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
32803  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
32804  *
32805  * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
32806  */
32807 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);
32808
32809 /**
32810  * Utility to construct an invoice. Generally, unless you want to do something like a custom
32811  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
32812  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
32813  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
32814  * that the payment secret is valid when the invoice is paid.
32815  *
32816  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
32817  * in excess of the current time.
32818  */
32819 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);
32820
32821 /**
32822  * Utility to construct an invoice. Generally, unless you want to do something like a custom
32823  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
32824  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
32825  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
32826  * that the payment secret is valid when the invoice is paid.
32827  * Use this variant if you want to pass the `description_hash` to the invoice.
32828  *
32829  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
32830  * in excess of the current time.
32831  */
32832 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);
32833
32834 /**
32835  * See [`create_invoice_from_channelmanager_with_description_hash`]
32836  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
32837  * available and the current time is supplied by the caller.
32838  */
32839 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);
32840
32841 /**
32842  * See [`create_invoice_from_channelmanager`]
32843  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
32844  * available and the current time is supplied by the caller.
32845  */
32846 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);
32847
32848 /**
32849  * See [`create_invoice_from_channelmanager_and_duration_since_epoch`]
32850  * This version allows for providing a custom [`PaymentHash`] for the invoice.
32851  * This may be useful if you're building an on-chain swap or involving another protocol where
32852  * the payment hash is also involved outside the scope of lightning.
32853  */
32854 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(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, struct LDKThirtyTwoBytes payment_hash);
32855
32856 /**
32857  * Constructs a new Payer which calls the relevant methods on this_arg.
32858  * This copies the `inner` pointer in this_arg and thus the returned Payer must be freed before this_arg is
32859  */
32860 struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_PTR this_arg);
32861
32862 /**
32863  * Read a SiPrefix object from a string
32864  */
32865 struct LDKCResult_SiPrefixParseErrorZ SiPrefix_from_str(struct LDKStr s);
32866
32867 /**
32868  * Read a Invoice object from a string
32869  */
32870 struct LDKCResult_InvoiceParseOrSemanticErrorZ Invoice_from_str(struct LDKStr s);
32871
32872 /**
32873  * Read a SignedRawInvoice object from a string
32874  */
32875 struct LDKCResult_SignedRawInvoiceParseErrorZ SignedRawInvoice_from_str(struct LDKStr s);
32876
32877 /**
32878  * Get the string representation of a ParseError object
32879  */
32880 struct LDKStr ParseError_to_str(const struct LDKParseError *NONNULL_PTR o);
32881
32882 /**
32883  * Get the string representation of a ParseOrSemanticError object
32884  */
32885 struct LDKStr ParseOrSemanticError_to_str(const struct LDKParseOrSemanticError *NONNULL_PTR o);
32886
32887 /**
32888  * Get the string representation of a Invoice object
32889  */
32890 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
32891
32892 /**
32893  * Get the string representation of a SignedRawInvoice object
32894  */
32895 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
32896
32897 /**
32898  * Get the string representation of a Currency object
32899  */
32900 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
32901
32902 /**
32903  * Get the string representation of a SiPrefix object
32904  */
32905 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
32906
32907 /**
32908  * Frees any resources used by the RapidGossipSync, if is_owned is set and inner is non-NULL.
32909  */
32910 void RapidGossipSync_free(struct LDKRapidGossipSync this_obj);
32911
32912 /**
32913  * Instantiate a new [`RapidGossipSync`] instance.
32914  */
32915 MUST_USE_RES struct LDKRapidGossipSync RapidGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph);
32916
32917 /**
32918  * Update network graph from binary data.
32919  * Returns the last sync timestamp to be used the next time rapid sync data is queried.
32920  *
32921  * `network_graph`: network graph to be updated
32922  *
32923  * `update_data`: `&[u8]` binary stream that comprises the update data
32924  */
32925 MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data);
32926
32927 /**
32928  * Returns whether a rapid gossip sync has completed at least once.
32929  */
32930 MUST_USE_RES bool RapidGossipSync_is_initial_sync_complete(const struct LDKRapidGossipSync *NONNULL_PTR this_arg);
32931
32932 /**
32933  * Frees any resources used by the GraphSyncError
32934  */
32935 void GraphSyncError_free(struct LDKGraphSyncError this_ptr);
32936
32937 /**
32938  * Creates a copy of the GraphSyncError
32939  */
32940 struct LDKGraphSyncError GraphSyncError_clone(const struct LDKGraphSyncError *NONNULL_PTR orig);
32941
32942 /**
32943  * Utility method to constructs a new DecodeError-variant GraphSyncError
32944  */
32945 struct LDKGraphSyncError GraphSyncError_decode_error(struct LDKDecodeError a);
32946
32947 /**
32948  * Utility method to constructs a new LightningError-variant GraphSyncError
32949  */
32950 struct LDKGraphSyncError GraphSyncError_lightning_error(struct LDKLightningError a);
32951
32952 #endif /* LDK_C_BINDINGS_H */
32953
32954 #include "ldk_ver.h"