401ba8d4df0fed0d80860c4669a490818756a079
[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 enum which can either contain a  or not
15  */
16 typedef enum LDKCOption_NoneZ {
17    /**
18     * When we're in this state, this COption_NoneZ contains a
19     */
20    LDKCOption_NoneZ_Some,
21    /**
22     * When we're in this state, this COption_NoneZ contains nothing
23     */
24    LDKCOption_NoneZ_None,
25    /**
26     * Must be last for serialization purposes
27     */
28    LDKCOption_NoneZ_Sentinel,
29 } LDKCOption_NoneZ;
30
31 /**
32  * An enum representing the status of a channel monitor update persistence.
33  */
34 typedef enum LDKChannelMonitorUpdateStatus {
35    /**
36     * The update has been durably persisted and all copies of the relevant [`ChannelMonitor`]
37     * have been updated.
38     *
39     * This includes performing any `fsync()` calls required to ensure the update is guaranteed to
40     * be available on restart even if the application crashes.
41     */
42    LDKChannelMonitorUpdateStatus_Completed,
43    /**
44     * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
45     * our state failed, but is expected to succeed at some point in the future).
46     *
47     * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
48     * submitting new commitment transactions to the counterparty. Once the update(s) which failed
49     * have been successfully applied, a [`MonitorEvent::Completed`] can be used to restore the
50     * channel to an operational state.
51     *
52     * Note that a given [`ChannelManager`] will *never* re-generate a [`ChannelMonitorUpdate`].
53     * If you return this error you must ensure that it is written to disk safely before writing
54     * the latest [`ChannelManager`] state, or you should return [`PermanentFailure`] instead.
55     *
56     * Even when a channel has been \"frozen\", updates to the [`ChannelMonitor`] can continue to
57     * occur (e.g. if an inbound HTLC which we forwarded was claimed upstream, resulting in us
58     * attempting to claim it on this channel) and those updates must still be persisted.
59     *
60     * No updates to the channel will be made which could invalidate other [`ChannelMonitor`]s
61     * until a [`MonitorEvent::Completed`] is provided, even if you return no error on a later
62     * monitor update for the same channel.
63     *
64     * For deployments where a copy of ChannelMonitors and other local state are backed up in a
65     * remote location (with local copies persisted immediately), it is anticipated that all
66     * updates will return [`InProgress`] until the remote copies could be updated.
67     *
68     * [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure
69     * [`InProgress`]: ChannelMonitorUpdateStatus::InProgress
70     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
71     */
72    LDKChannelMonitorUpdateStatus_InProgress,
73    /**
74     * Used to indicate no further channel monitor updates will be allowed (likely a disk failure
75     * or a remote copy of this [`ChannelMonitor`] is no longer reachable and thus not updatable).
76     *
77     * When this is returned, [`ChannelManager`] will force-close the channel but *not* broadcast
78     * our current commitment transaction. This avoids a dangerous case where a local disk failure
79     * (e.g. the Linux-default remounting of the disk as read-only) causes [`PermanentFailure`]s
80     * for all monitor updates. If we were to broadcast our latest commitment transaction and then
81     * restart, we could end up reading a previous [`ChannelMonitor`] and [`ChannelManager`],
82     * revoking our now-broadcasted state before seeing it confirm and losing all our funds.
83     *
84     * Note that this is somewhat of a tradeoff - if the disk is really gone and we may have lost
85     * the data permanently, we really should broadcast immediately. If the data can be recovered
86     * with manual intervention, we'd rather close the channel, rejecting future updates to it,
87     * and broadcast the latest state only if we have HTLCs to claim which are timing out (which
88     * we do as long as blocks are connected).
89     *
90     * In order to broadcast the latest local commitment transaction, you'll need to call
91     * [`ChannelMonitor::get_latest_holder_commitment_txn`] and broadcast the resulting
92     * transactions once you've safely ensured no further channel updates can be generated by your
93     * [`ChannelManager`].
94     *
95     * Note that at least one final [`ChannelMonitorUpdate`] may still be provided, which must
96     * still be processed by a running [`ChannelMonitor`]. This final update will mark the
97     * [`ChannelMonitor`] as finalized, ensuring no further updates (e.g. revocation of the latest
98     * commitment transaction) are allowed.
99     *
100     * Note that even if you return a [`PermanentFailure`] due to unavailability of secondary
101     * [`ChannelMonitor`] copies, you should still make an attempt to store the update where
102     * possible to ensure you can claim HTLC outputs on the latest commitment transaction
103     * broadcasted later.
104     *
105     * In case of distributed watchtowers deployment, the new version must be written to disk, as
106     * state may have been stored but rejected due to a block forcing a commitment broadcast. This
107     * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
108     * lagging behind on block processing.
109     *
110     * [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure
111     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
112     */
113    LDKChannelMonitorUpdateStatus_PermanentFailure,
114    /**
115     * Must be last for serialization purposes
116     */
117    LDKChannelMonitorUpdateStatus_Sentinel,
118 } LDKChannelMonitorUpdateStatus;
119
120 /**
121  * An enum that represents the speed at which we want a transaction to confirm used for feerate
122  * estimation.
123  */
124 typedef enum LDKConfirmationTarget {
125    /**
126     * We are happy with this transaction confirming slowly when feerate drops some.
127     */
128    LDKConfirmationTarget_Background,
129    /**
130     * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
131     */
132    LDKConfirmationTarget_Normal,
133    /**
134     * We'd like this transaction to confirm in the next few blocks.
135     */
136    LDKConfirmationTarget_HighPriority,
137    /**
138     * Must be last for serialization purposes
139     */
140    LDKConfirmationTarget_Sentinel,
141 } LDKConfirmationTarget;
142
143 /**
144  * Errors that may occur when constructing a new `RawInvoice` or `Invoice`
145  */
146 typedef enum LDKCreationError {
147    /**
148     * The supplied description string was longer than 639 __bytes__ (see [`Description::new(…)`](./struct.Description.html#method.new))
149     */
150    LDKCreationError_DescriptionTooLong,
151    /**
152     * The specified route has too many hops and can't be encoded
153     */
154    LDKCreationError_RouteTooLong,
155    /**
156     * The Unix timestamp of the supplied date is less than zero or greater than 35-bits
157     */
158    LDKCreationError_TimestampOutOfBounds,
159    /**
160     * The supplied millisatoshi amount was greater than the total bitcoin supply.
161     */
162    LDKCreationError_InvalidAmount,
163    /**
164     * Route hints were required for this invoice and were missing. Applies to
165     * [phantom invoices].
166     *
167     * [phantom invoices]: crate::utils::create_phantom_invoice
168     */
169    LDKCreationError_MissingRouteHints,
170    /**
171     * The provided `min_final_cltv_expiry_delta` was less than [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
172     *
173     * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
174     */
175    LDKCreationError_MinFinalCltvExpiryDeltaTooShort,
176    /**
177     * Must be last for serialization purposes
178     */
179    LDKCreationError_Sentinel,
180 } LDKCreationError;
181
182 /**
183  * Enum representing the crypto currencies (or networks) supported by this library
184  */
185 typedef enum LDKCurrency {
186    /**
187     * Bitcoin mainnet
188     */
189    LDKCurrency_Bitcoin,
190    /**
191     * Bitcoin testnet
192     */
193    LDKCurrency_BitcoinTestnet,
194    /**
195     * Bitcoin regtest
196     */
197    LDKCurrency_Regtest,
198    /**
199     * Bitcoin simnet
200     */
201    LDKCurrency_Simnet,
202    /**
203     * Bitcoin signet
204     */
205    LDKCurrency_Signet,
206    /**
207     * Must be last for serialization purposes
208     */
209    LDKCurrency_Sentinel,
210 } LDKCurrency;
211
212 /**
213  * This enum is used to specify which error data to send to peers when failing back an HTLC
214  * using [`ChannelManager::fail_htlc_backwards_with_reason`].
215  *
216  * For more info on failure codes, see <https://github.com/lightning/bolts/blob/master/04-onion-routing.md#failure-messages>.
217  */
218 typedef enum LDKFailureCode {
219    /**
220     * We had a temporary error processing the payment. Useful if no other error codes fit
221     * and you want to indicate that the payer may want to retry.
222     */
223    LDKFailureCode_TemporaryNodeFailure,
224    /**
225     * We have a required feature which was not in this onion. For example, you may require
226     * some additional metadata that was not provided with this payment.
227     */
228    LDKFailureCode_RequiredNodeFeatureMissing,
229    /**
230     * You may wish to use this when a `payment_preimage` is unknown, or the CLTV expiry of
231     * the HTLC is too close to the current block height for safe handling.
232     * Using this failure code in [`ChannelManager::fail_htlc_backwards_with_reason`] is
233     * equivalent to calling [`ChannelManager::fail_htlc_backwards`].
234     */
235    LDKFailureCode_IncorrectOrUnknownPaymentDetails,
236    /**
237     * Must be last for serialization purposes
238     */
239    LDKFailureCode_Sentinel,
240 } LDKFailureCode;
241
242 /**
243  * Describes the type of HTLC claim as determined by analyzing the witness.
244  */
245 typedef enum LDKHTLCClaim {
246    /**
247     * Claims an offered output on a commitment transaction through the timeout path.
248     */
249    LDKHTLCClaim_OfferedTimeout,
250    /**
251     * Claims an offered output on a commitment transaction through the success path.
252     */
253    LDKHTLCClaim_OfferedPreimage,
254    /**
255     * Claims an accepted output on a commitment transaction through the timeout path.
256     */
257    LDKHTLCClaim_AcceptedTimeout,
258    /**
259     * Claims an accepted output on a commitment transaction through the success path.
260     */
261    LDKHTLCClaim_AcceptedPreimage,
262    /**
263     * Claims an offered/accepted output on a commitment transaction through the revocation path.
264     */
265    LDKHTLCClaim_Revocation,
266    /**
267     * Must be last for serialization purposes
268     */
269    LDKHTLCClaim_Sentinel,
270 } LDKHTLCClaim;
271
272 /**
273  * Represents an IO Error. Note that some information is lost in the conversion from Rust.
274  */
275 typedef enum LDKIOError {
276    LDKIOError_NotFound,
277    LDKIOError_PermissionDenied,
278    LDKIOError_ConnectionRefused,
279    LDKIOError_ConnectionReset,
280    LDKIOError_ConnectionAborted,
281    LDKIOError_NotConnected,
282    LDKIOError_AddrInUse,
283    LDKIOError_AddrNotAvailable,
284    LDKIOError_BrokenPipe,
285    LDKIOError_AlreadyExists,
286    LDKIOError_WouldBlock,
287    LDKIOError_InvalidInput,
288    LDKIOError_InvalidData,
289    LDKIOError_TimedOut,
290    LDKIOError_WriteZero,
291    LDKIOError_Interrupted,
292    LDKIOError_Other,
293    LDKIOError_UnexpectedEof,
294    /**
295     * Must be last for serialization purposes
296     */
297    LDKIOError_Sentinel,
298 } LDKIOError;
299
300 /**
301  * An enum representing the available verbosity levels of the logger.
302  */
303 typedef enum LDKLevel {
304    /**
305     * Designates extremely verbose information, including gossip-induced messages
306     */
307    LDKLevel_Gossip,
308    /**
309     * Designates very low priority, often extremely verbose, information
310     */
311    LDKLevel_Trace,
312    /**
313     * Designates lower priority information
314     */
315    LDKLevel_Debug,
316    /**
317     * Designates useful information
318     */
319    LDKLevel_Info,
320    /**
321     * Designates hazardous situations
322     */
323    LDKLevel_Warn,
324    /**
325     * Designates very serious errors
326     */
327    LDKLevel_Error,
328    /**
329     * Must be last for serialization purposes
330     */
331    LDKLevel_Sentinel,
332 } LDKLevel;
333
334 /**
335  * An enum representing the possible Bitcoin or test networks which we can run on
336  */
337 typedef enum LDKNetwork {
338    /**
339     * The main Bitcoin blockchain.
340     */
341    LDKNetwork_Bitcoin,
342    /**
343     * The testnet3 blockchain.
344     */
345    LDKNetwork_Testnet,
346    /**
347     * A local test blockchain.
348     */
349    LDKNetwork_Regtest,
350    /**
351     * A blockchain on which blocks are signed instead of mined.
352     */
353    LDKNetwork_Signet,
354    /**
355     * Must be last for serialization purposes
356     */
357    LDKNetwork_Sentinel,
358 } LDKNetwork;
359
360 /**
361  * Specifies the recipient of an invoice.
362  *
363  * This indicates to [`NodeSigner::sign_invoice`] what node secret key should be used to sign
364  * the invoice.
365  */
366 typedef enum LDKRecipient {
367    /**
368     * The invoice should be signed with the local node secret key.
369     */
370    LDKRecipient_Node,
371    /**
372     * The invoice should be signed with the phantom node secret key. This secret key must be the
373     * same for all nodes participating in the [phantom node payment].
374     *
375     * [phantom node payment]: PhantomKeysManager
376     */
377    LDKRecipient_PhantomNode,
378    /**
379     * Must be last for serialization purposes
380     */
381    LDKRecipient_Sentinel,
382 } LDKRecipient;
383
384 /**
385  * Indicates an immediate error on [`ChannelManager::send_payment_with_retry`]. Further errors
386  * may be surfaced later via [`Event::PaymentPathFailed`] and [`Event::PaymentFailed`].
387  *
388  * [`ChannelManager::send_payment_with_retry`]: crate::ln::channelmanager::ChannelManager::send_payment_with_retry
389  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
390  * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed
391  */
392 typedef enum LDKRetryableSendFailure {
393    /**
394     * The provided [`PaymentParameters::expiry_time`] indicated that the payment has expired. Note
395     * that this error is *not* caused by [`Retry::Timeout`].
396     *
397     * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time
398     */
399    LDKRetryableSendFailure_PaymentExpired,
400    /**
401     * We were unable to find a route to the destination.
402     */
403    LDKRetryableSendFailure_RouteNotFound,
404    /**
405     * Indicates that a payment for the provided [`PaymentId`] is already in-flight and has not
406     * yet completed (i.e. generated an [`Event::PaymentSent`] or [`Event::PaymentFailed`]).
407     *
408     * [`PaymentId`]: crate::ln::channelmanager::PaymentId
409     * [`Event::PaymentSent`]: crate::util::events::Event::PaymentSent
410     * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed
411     */
412    LDKRetryableSendFailure_DuplicatePayment,
413    /**
414     * Must be last for serialization purposes
415     */
416    LDKRetryableSendFailure_Sentinel,
417 } LDKRetryableSendFailure;
418
419 /**
420  * Represents an error returned from libsecp256k1 during validation of some secp256k1 data
421  */
422 typedef enum LDKSecp256k1Error {
423    /**
424     * Signature failed verification
425     */
426    LDKSecp256k1Error_IncorrectSignature,
427    /**
428     * Badly sized message ("messages" are actually fixed-sized digests; see the MESSAGE_SIZE constant)
429     */
430    LDKSecp256k1Error_InvalidMessage,
431    /**
432     * Bad public key
433     */
434    LDKSecp256k1Error_InvalidPublicKey,
435    /**
436     * Bad signature
437     */
438    LDKSecp256k1Error_InvalidSignature,
439    /**
440     * Bad secret key
441     */
442    LDKSecp256k1Error_InvalidSecretKey,
443    /**
444     * Bad shared secret.
445     */
446    LDKSecp256k1Error_InvalidSharedSecret,
447    /**
448     * Bad recovery id
449     */
450    LDKSecp256k1Error_InvalidRecoveryId,
451    /**
452     * Invalid tweak for add_assign or mul_assign
453     */
454    LDKSecp256k1Error_InvalidTweak,
455    /**
456     * Didn't pass enough memory to context creation with preallocated memory
457     */
458    LDKSecp256k1Error_NotEnoughMemory,
459    /**
460     * Bad set of public keys.
461     */
462    LDKSecp256k1Error_InvalidPublicKeySum,
463    /**
464     * The only valid parity values are 0 or 1.
465     */
466    LDKSecp256k1Error_InvalidParityValue,
467    /**
468     * Must be last for serialization purposes
469     */
470    LDKSecp256k1Error_Sentinel,
471 } LDKSecp256k1Error;
472
473 /**
474  * Errors that may occur when converting a `RawInvoice` to an `Invoice`. They relate to the
475  * requirements sections in BOLT #11
476  */
477 typedef enum LDKSemanticError {
478    /**
479     * The invoice is missing the mandatory payment hash
480     */
481    LDKSemanticError_NoPaymentHash,
482    /**
483     * The invoice has multiple payment hashes which isn't allowed
484     */
485    LDKSemanticError_MultiplePaymentHashes,
486    /**
487     * No description or description hash are part of the invoice
488     */
489    LDKSemanticError_NoDescription,
490    /**
491     * The invoice contains multiple descriptions and/or description hashes which isn't allowed
492     */
493    LDKSemanticError_MultipleDescriptions,
494    /**
495     * The invoice is missing the mandatory payment secret, which all modern lightning nodes
496     * should provide.
497     */
498    LDKSemanticError_NoPaymentSecret,
499    /**
500     * The invoice contains multiple payment secrets
501     */
502    LDKSemanticError_MultiplePaymentSecrets,
503    /**
504     * The invoice's features are invalid
505     */
506    LDKSemanticError_InvalidFeatures,
507    /**
508     * The recovery id doesn't fit the signature/pub key
509     */
510    LDKSemanticError_InvalidRecoveryId,
511    /**
512     * The invoice's signature is invalid
513     */
514    LDKSemanticError_InvalidSignature,
515    /**
516     * The invoice's amount was not a whole number of millisatoshis
517     */
518    LDKSemanticError_ImpreciseAmount,
519    /**
520     * Must be last for serialization purposes
521     */
522    LDKSemanticError_Sentinel,
523 } LDKSemanticError;
524
525 /**
526  * SI prefixes for the human readable part
527  */
528 typedef enum LDKSiPrefix {
529    /**
530     * 10^-3
531     */
532    LDKSiPrefix_Milli,
533    /**
534     * 10^-6
535     */
536    LDKSiPrefix_Micro,
537    /**
538     * 10^-9
539     */
540    LDKSiPrefix_Nano,
541    /**
542     * 10^-12
543     */
544    LDKSiPrefix_Pico,
545    /**
546     * Must be last for serialization purposes
547     */
548    LDKSiPrefix_Sentinel,
549 } LDKSiPrefix;
550
551 /**
552  * An error when accessing the chain via [`UtxoLookup`].
553  */
554 typedef enum LDKUtxoLookupError {
555    /**
556     * The requested chain is unknown.
557     */
558    LDKUtxoLookupError_UnknownChain,
559    /**
560     * The requested transaction doesn't exist or hasn't confirmed.
561     */
562    LDKUtxoLookupError_UnknownTx,
563    /**
564     * Must be last for serialization purposes
565     */
566    LDKUtxoLookupError_Sentinel,
567 } LDKUtxoLookupError;
568
569 /**
570  * A Rust str object, ie a reference to a UTF8-valid string.
571  * This is *not* null-terminated so cannot be used directly as a C string!
572  */
573 typedef struct LDKStr {
574    /**
575     * A pointer to the string's bytes, in UTF8 encoding
576     */
577    const uint8_t *chars;
578    /**
579     * The number of bytes (not characters!) pointed to by `chars`
580     */
581    uintptr_t len;
582    /**
583     * Whether the data pointed to by `chars` should be freed or not.
584     */
585    bool chars_is_owned;
586 } LDKStr;
587
588 /**
589  * A 16-byte byte array.
590  */
591 typedef struct LDKSixteenBytes {
592    /**
593     * The sixteen bytes
594     */
595    uint8_t data[16];
596 } LDKSixteenBytes;
597
598 /**
599  * Unsigned, 128-bit integer.
600  *
601  * Because LLVM implements an incorrect ABI for 128-bit integers, a wrapper type is defined here.
602  * See https://github.com/rust-lang/rust/issues/54341 for more details.
603  */
604 typedef struct LDKU128 {
605    /**
606     * The 128-bit integer, as 16 little-endian bytes
607     */
608    uint8_t le_bytes[16];
609 } LDKU128;
610
611 /**
612  * Represents a scalar value between zero and the secp256k1 curve order, in big endian.
613  */
614 typedef struct LDKBigEndianScalar {
615    /**
616     * The bytes of the scalar value.
617     */
618    uint8_t big_endian_bytes[32];
619 } LDKBigEndianScalar;
620
621 /**
622  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
623  * look up the corresponding function in rust-lightning's docs.
624  */
625 typedef struct LDKThirtyTwoBytes {
626    /**
627     * The thirty-two bytes
628     */
629    uint8_t data[32];
630 } LDKThirtyTwoBytes;
631
632 /**
633  * Represents an error returned from the bech32 library during validation of some bech32 data
634  */
635 typedef enum LDKBech32Error_Tag {
636    /**
637     * String does not contain the separator character
638     */
639    LDKBech32Error_MissingSeparator,
640    /**
641     * The checksum does not match the rest of the data
642     */
643    LDKBech32Error_InvalidChecksum,
644    /**
645     * The data or human-readable part is too long or too short
646     */
647    LDKBech32Error_InvalidLength,
648    /**
649     * Some part of the string contains an invalid character
650     */
651    LDKBech32Error_InvalidChar,
652    /**
653     * Some part of the data has an invalid value
654     */
655    LDKBech32Error_InvalidData,
656    /**
657     * The bit conversion failed due to a padding issue
658     */
659    LDKBech32Error_InvalidPadding,
660    /**
661     * The whole string must be of one case
662     */
663    LDKBech32Error_MixedCase,
664    /**
665     * Must be last for serialization purposes
666     */
667    LDKBech32Error_Sentinel,
668 } LDKBech32Error_Tag;
669
670 typedef struct LDKBech32Error {
671    LDKBech32Error_Tag tag;
672    union {
673       struct {
674          uint32_t invalid_char;
675       };
676       struct {
677          uint8_t invalid_data;
678       };
679    };
680 } LDKBech32Error;
681
682 /**
683  * A serialized transaction, in (pointer, length) form.
684  *
685  * This type optionally owns its own memory, and thus the semantics around access change based on
686  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
687  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
688  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
689  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
690  * you would be invalid.
691  *
692  * Note that, while it may change in the future, because transactions on the Rust side are stored
693  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
694  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
695  * `data_is_owned` either set or unset at your discretion.
696  */
697 typedef struct LDKTransaction {
698    /**
699     * The serialized transaction data.
700     *
701     * This is non-const for your convenience, an object passed to Rust is never written to.
702     */
703    uint8_t *data;
704    /**
705     * The length of the serialized transaction
706     */
707    uintptr_t datalen;
708    /**
709     * Whether the data pointed to by `data` should be freed or not.
710     */
711    bool data_is_owned;
712 } LDKTransaction;
713
714 /**
715  * A serialized witness.
716  */
717 typedef struct LDKWitness {
718    /**
719     * The serialized transaction data.
720     *
721     * This is non-const for your convenience, an object passed to Rust is never written to.
722     */
723    uint8_t *data;
724    /**
725     * The length of the serialized transaction
726     */
727    uintptr_t datalen;
728    /**
729     * Whether the data pointed to by `data` should be freed or not.
730     */
731    bool data_is_owned;
732 } LDKWitness;
733
734 /**
735  * A dynamically-allocated array of u8s of arbitrary size.
736  * This corresponds to std::vector in C++
737  */
738 typedef struct LDKCVec_u8Z {
739    /**
740     * The elements in the array.
741     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
742     */
743    uint8_t *data;
744    /**
745     * The number of elements pointed to by `data`.
746     */
747    uintptr_t datalen;
748 } LDKCVec_u8Z;
749
750 /**
751  * A transaction output including a scriptPubKey and value.
752  * This type *does* own its own memory, so must be free'd appropriately.
753  */
754 typedef struct LDKTxOut {
755    /**
756     * The script_pubkey in this output
757     */
758    struct LDKCVec_u8Z script_pubkey;
759    /**
760     * The value, in satoshis, of this output
761     */
762    uint64_t value;
763 } LDKTxOut;
764
765
766
767 /**
768  * A script pubkey for shutting down a channel as defined by [BOLT #2].
769  *
770  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
771  */
772 typedef struct MUST_USE_STRUCT LDKShutdownScript {
773    /**
774     * A pointer to the opaque Rust object.
775     * Nearly everywhere, inner must be non-null, however in places where
776     * the Rust equivalent takes an Option, it may be set to null to indicate None.
777     */
778    LDKnativeShutdownScript *inner;
779    /**
780     * Indicates that this is the only struct which contains the same pointer.
781     * Rust functions which take ownership of an object provided via an argument require
782     * this to be true and invalidate the object pointed to by inner.
783     */
784    bool is_owned;
785 } LDKShutdownScript;
786
787 /**
788  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
789  * too-high values)
790  */
791 typedef enum LDKAPIError_Tag {
792    /**
793     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
794     * are documented, but generally indicates some precondition of a function was violated.
795     */
796    LDKAPIError_APIMisuseError,
797    /**
798     * Due to a high feerate, we were unable to complete the request.
799     * For example, this may be returned if the feerate implies we cannot open a channel at the
800     * requested value, but opening a larger channel would succeed.
801     */
802    LDKAPIError_FeeRateTooHigh,
803    /**
804     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
805     * too-many-hops, etc).
806     */
807    LDKAPIError_InvalidRoute,
808    /**
809     * We were unable to complete the request as the Channel required to do so is unable to
810     * complete the request (or was not found). This can take many forms, including disconnected
811     * peer, channel at capacity, channel shutting down, etc.
812     */
813    LDKAPIError_ChannelUnavailable,
814    /**
815     * An attempt to call [`chain::Watch::watch_channel`]/[`chain::Watch::update_channel`]
816     * returned a [`ChannelMonitorUpdateStatus::InProgress`] indicating the persistence of a
817     * monitor update is awaiting async resolution. Once it resolves the attempted action should
818     * complete automatically.
819     *
820     * [`chain::Watch::watch_channel`]: crate::chain::Watch::watch_channel
821     * [`chain::Watch::update_channel`]: crate::chain::Watch::update_channel
822     * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress
823     */
824    LDKAPIError_MonitorUpdateInProgress,
825    /**
826     * [`SignerProvider::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
827     * with the channel counterparty as negotiated in [`InitFeatures`].
828     *
829     * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
830     * a channel or cooperatively close one with this peer (and will have to force-close instead).
831     *
832     * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::SignerProvider::get_shutdown_scriptpubkey
833     * [`InitFeatures`]: crate::ln::features::InitFeatures
834     */
835    LDKAPIError_IncompatibleShutdownScript,
836    /**
837     * Must be last for serialization purposes
838     */
839    LDKAPIError_Sentinel,
840 } LDKAPIError_Tag;
841
842 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
843    /**
844     * A human-readable error message
845     */
846    struct LDKStr err;
847 } LDKAPIError_LDKAPIMisuseError_Body;
848
849 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
850    /**
851     * A human-readable error message
852     */
853    struct LDKStr err;
854    /**
855     * The feerate which was too high.
856     */
857    uint32_t feerate;
858 } LDKAPIError_LDKFeeRateTooHigh_Body;
859
860 typedef struct LDKAPIError_LDKInvalidRoute_Body {
861    /**
862     * A human-readable error message
863     */
864    struct LDKStr err;
865 } LDKAPIError_LDKInvalidRoute_Body;
866
867 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
868    /**
869     * A human-readable error message
870     */
871    struct LDKStr err;
872 } LDKAPIError_LDKChannelUnavailable_Body;
873
874 typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
875    /**
876     * The incompatible shutdown script.
877     */
878    struct LDKShutdownScript script;
879 } LDKAPIError_LDKIncompatibleShutdownScript_Body;
880
881 typedef struct MUST_USE_STRUCT LDKAPIError {
882    LDKAPIError_Tag tag;
883    union {
884       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
885       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
886       LDKAPIError_LDKInvalidRoute_Body invalid_route;
887       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
888       LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
889    };
890 } LDKAPIError;
891
892 /**
893  * The contents of CResult_NoneAPIErrorZ
894  */
895 typedef union LDKCResult_NoneAPIErrorZPtr {
896    /**
897     * Note that this value is always NULL, as there are no contents in the OK variant
898     */
899    void *result;
900    /**
901     * A pointer to the contents in the error state.
902     * Reading from this pointer when `result_ok` is set is undefined.
903     */
904    struct LDKAPIError *err;
905 } LDKCResult_NoneAPIErrorZPtr;
906
907 /**
908  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
909  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
910  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
911  */
912 typedef struct LDKCResult_NoneAPIErrorZ {
913    /**
914     * The contents of this CResult_NoneAPIErrorZ, accessible via either
915     * `err` or `result` depending on the state of `result_ok`.
916     */
917    union LDKCResult_NoneAPIErrorZPtr contents;
918    /**
919     * Whether this CResult_NoneAPIErrorZ represents a success state.
920     */
921    bool result_ok;
922 } LDKCResult_NoneAPIErrorZ;
923
924 /**
925  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
926  * This corresponds to std::vector in C++
927  */
928 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
929    /**
930     * The elements in the array.
931     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
932     */
933    struct LDKCResult_NoneAPIErrorZ *data;
934    /**
935     * The number of elements pointed to by `data`.
936     */
937    uintptr_t datalen;
938 } LDKCVec_CResult_NoneAPIErrorZZ;
939
940 /**
941  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
942  * This corresponds to std::vector in C++
943  */
944 typedef struct LDKCVec_APIErrorZ {
945    /**
946     * The elements in the array.
947     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
948     */
949    struct LDKAPIError *data;
950    /**
951     * The number of elements pointed to by `data`.
952     */
953    uintptr_t datalen;
954 } LDKCVec_APIErrorZ;
955
956 /**
957  * An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
958  */
959 typedef enum LDKCOption_HTLCClaimZ_Tag {
960    /**
961     * When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
962     */
963    LDKCOption_HTLCClaimZ_Some,
964    /**
965     * When we're in this state, this COption_HTLCClaimZ contains nothing
966     */
967    LDKCOption_HTLCClaimZ_None,
968    /**
969     * Must be last for serialization purposes
970     */
971    LDKCOption_HTLCClaimZ_Sentinel,
972 } LDKCOption_HTLCClaimZ_Tag;
973
974 typedef struct LDKCOption_HTLCClaimZ {
975    LDKCOption_HTLCClaimZ_Tag tag;
976    union {
977       struct {
978          enum LDKHTLCClaim some;
979       };
980    };
981 } LDKCOption_HTLCClaimZ;
982
983 /**
984  * The contents of CResult_NoneNoneZ
985  */
986 typedef union LDKCResult_NoneNoneZPtr {
987    /**
988     * Note that this value is always NULL, as there are no contents in the OK variant
989     */
990    void *result;
991    /**
992     * Note that this value is always NULL, as there are no contents in the Err variant
993     */
994    void *err;
995 } LDKCResult_NoneNoneZPtr;
996
997 /**
998  * A CResult_NoneNoneZ represents the result of a fallible operation,
999  * containing a () on success and a () on failure.
1000  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1001  */
1002 typedef struct LDKCResult_NoneNoneZ {
1003    /**
1004     * The contents of this CResult_NoneNoneZ, accessible via either
1005     * `err` or `result` depending on the state of `result_ok`.
1006     */
1007    union LDKCResult_NoneNoneZPtr contents;
1008    /**
1009     * Whether this CResult_NoneNoneZ represents a success state.
1010     */
1011    bool result_ok;
1012 } LDKCResult_NoneNoneZ;
1013
1014
1015
1016 /**
1017  * Implements the per-commitment secret storage scheme from
1018  * [BOLT 3](https://github.com/lightning/bolts/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage).
1019  *
1020  * Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes
1021  * or so.
1022  */
1023 typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets {
1024    /**
1025     * A pointer to the opaque Rust object.
1026     * Nearly everywhere, inner must be non-null, however in places where
1027     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1028     */
1029    LDKnativeCounterpartyCommitmentSecrets *inner;
1030    /**
1031     * Indicates that this is the only struct which contains the same pointer.
1032     * Rust functions which take ownership of an object provided via an argument require
1033     * this to be true and invalidate the object pointed to by inner.
1034     */
1035    bool is_owned;
1036 } LDKCounterpartyCommitmentSecrets;
1037
1038 /**
1039  * An error in decoding a message or struct.
1040  */
1041 typedef enum LDKDecodeError_Tag {
1042    /**
1043     * A version byte specified something we don't know how to handle.
1044     *
1045     * Includes unknown realm byte in an onion hop data packet.
1046     */
1047    LDKDecodeError_UnknownVersion,
1048    /**
1049     * Unknown feature mandating we fail to parse message (e.g., TLV with an even, unknown type)
1050     */
1051    LDKDecodeError_UnknownRequiredFeature,
1052    /**
1053     * Value was invalid.
1054     *
1055     * For example, a byte which was supposed to be a bool was something other than a 0
1056     * or 1, a public key/private key/signature was invalid, text wasn't UTF-8, TLV was
1057     * syntactically incorrect, etc.
1058     */
1059    LDKDecodeError_InvalidValue,
1060    /**
1061     * The buffer to be read was too short.
1062     */
1063    LDKDecodeError_ShortRead,
1064    /**
1065     * A length descriptor in the packet didn't describe the later data correctly.
1066     */
1067    LDKDecodeError_BadLengthDescriptor,
1068    /**
1069     * Error from [`std::io`].
1070     */
1071    LDKDecodeError_Io,
1072    /**
1073     * The message included zlib-compressed values, which we don't support.
1074     */
1075    LDKDecodeError_UnsupportedCompression,
1076    /**
1077     * Must be last for serialization purposes
1078     */
1079    LDKDecodeError_Sentinel,
1080 } LDKDecodeError_Tag;
1081
1082 typedef struct MUST_USE_STRUCT LDKDecodeError {
1083    LDKDecodeError_Tag tag;
1084    union {
1085       struct {
1086          enum LDKIOError io;
1087       };
1088    };
1089 } LDKDecodeError;
1090
1091 /**
1092  * The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
1093  */
1094 typedef union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
1095    /**
1096     * A pointer to the contents in the success state.
1097     * Reading from this pointer when `result_ok` is not set is undefined.
1098     */
1099    struct LDKCounterpartyCommitmentSecrets *result;
1100    /**
1101     * A pointer to the contents in the error state.
1102     * Reading from this pointer when `result_ok` is set is undefined.
1103     */
1104    struct LDKDecodeError *err;
1105 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr;
1106
1107 /**
1108  * A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
1109  * containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
1110  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1111  */
1112 typedef struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ {
1113    /**
1114     * The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
1115     * `err` or `result` depending on the state of `result_ok`.
1116     */
1117    union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr contents;
1118    /**
1119     * Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
1120     */
1121    bool result_ok;
1122 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ;
1123
1124
1125
1126 /**
1127  * The set of public keys which are used in the creation of one commitment transaction.
1128  * These are derived from the channel base keys and per-commitment data.
1129  *
1130  * A broadcaster key is provided from potential broadcaster of the computed transaction.
1131  * A countersignatory key is coming from a protocol participant unable to broadcast the
1132  * transaction.
1133  *
1134  * These keys are assumed to be good, either because the code derived them from
1135  * channel basepoints via the new function, or they were obtained via
1136  * CommitmentTransaction.trust().keys() because we trusted the source of the
1137  * pre-calculated keys.
1138  */
1139 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
1140    /**
1141     * A pointer to the opaque Rust object.
1142     * Nearly everywhere, inner must be non-null, however in places where
1143     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1144     */
1145    LDKnativeTxCreationKeys *inner;
1146    /**
1147     * Indicates that this is the only struct which contains the same pointer.
1148     * Rust functions which take ownership of an object provided via an argument require
1149     * this to be true and invalidate the object pointed to by inner.
1150     */
1151    bool is_owned;
1152 } LDKTxCreationKeys;
1153
1154 /**
1155  * The contents of CResult_TxCreationKeysDecodeErrorZ
1156  */
1157 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
1158    /**
1159     * A pointer to the contents in the success state.
1160     * Reading from this pointer when `result_ok` is not set is undefined.
1161     */
1162    struct LDKTxCreationKeys *result;
1163    /**
1164     * A pointer to the contents in the error state.
1165     * Reading from this pointer when `result_ok` is set is undefined.
1166     */
1167    struct LDKDecodeError *err;
1168 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
1169
1170 /**
1171  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
1172  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
1173  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1174  */
1175 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
1176    /**
1177     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
1178     * `err` or `result` depending on the state of `result_ok`.
1179     */
1180    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
1181    /**
1182     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
1183     */
1184    bool result_ok;
1185 } LDKCResult_TxCreationKeysDecodeErrorZ;
1186
1187
1188
1189 /**
1190  * One counterparty's public keys which do not change over the life of a channel.
1191  */
1192 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
1193    /**
1194     * A pointer to the opaque Rust object.
1195     * Nearly everywhere, inner must be non-null, however in places where
1196     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1197     */
1198    LDKnativeChannelPublicKeys *inner;
1199    /**
1200     * Indicates that this is the only struct which contains the same pointer.
1201     * Rust functions which take ownership of an object provided via an argument require
1202     * this to be true and invalidate the object pointed to by inner.
1203     */
1204    bool is_owned;
1205 } LDKChannelPublicKeys;
1206
1207 /**
1208  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
1209  */
1210 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
1211    /**
1212     * A pointer to the contents in the success state.
1213     * Reading from this pointer when `result_ok` is not set is undefined.
1214     */
1215    struct LDKChannelPublicKeys *result;
1216    /**
1217     * A pointer to the contents in the error state.
1218     * Reading from this pointer when `result_ok` is set is undefined.
1219     */
1220    struct LDKDecodeError *err;
1221 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
1222
1223 /**
1224  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
1225  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
1226  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1227  */
1228 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
1229    /**
1230     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
1231     * `err` or `result` depending on the state of `result_ok`.
1232     */
1233    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
1234    /**
1235     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
1236     */
1237    bool result_ok;
1238 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
1239
1240 /**
1241  * An enum which can either contain a u32 or not
1242  */
1243 typedef enum LDKCOption_u32Z_Tag {
1244    /**
1245     * When we're in this state, this COption_u32Z contains a u32
1246     */
1247    LDKCOption_u32Z_Some,
1248    /**
1249     * When we're in this state, this COption_u32Z contains nothing
1250     */
1251    LDKCOption_u32Z_None,
1252    /**
1253     * Must be last for serialization purposes
1254     */
1255    LDKCOption_u32Z_Sentinel,
1256 } LDKCOption_u32Z_Tag;
1257
1258 typedef struct LDKCOption_u32Z {
1259    LDKCOption_u32Z_Tag tag;
1260    union {
1261       struct {
1262          uint32_t some;
1263       };
1264    };
1265 } LDKCOption_u32Z;
1266
1267
1268
1269 /**
1270  * Information about an HTLC as it appears in a commitment transaction
1271  */
1272 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
1273    /**
1274     * A pointer to the opaque Rust object.
1275     * Nearly everywhere, inner must be non-null, however in places where
1276     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1277     */
1278    LDKnativeHTLCOutputInCommitment *inner;
1279    /**
1280     * Indicates that this is the only struct which contains the same pointer.
1281     * Rust functions which take ownership of an object provided via an argument require
1282     * this to be true and invalidate the object pointed to by inner.
1283     */
1284    bool is_owned;
1285 } LDKHTLCOutputInCommitment;
1286
1287 /**
1288  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
1289  */
1290 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
1291    /**
1292     * A pointer to the contents in the success state.
1293     * Reading from this pointer when `result_ok` is not set is undefined.
1294     */
1295    struct LDKHTLCOutputInCommitment *result;
1296    /**
1297     * A pointer to the contents in the error state.
1298     * Reading from this pointer when `result_ok` is set is undefined.
1299     */
1300    struct LDKDecodeError *err;
1301 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
1302
1303 /**
1304  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
1305  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
1306  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1307  */
1308 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
1309    /**
1310     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
1311     * `err` or `result` depending on the state of `result_ok`.
1312     */
1313    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
1314    /**
1315     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
1316     */
1317    bool result_ok;
1318 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
1319
1320
1321
1322 /**
1323  * Late-bound per-channel counterparty data used to build transactions.
1324  */
1325 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
1326    /**
1327     * A pointer to the opaque Rust object.
1328     * Nearly everywhere, inner must be non-null, however in places where
1329     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1330     */
1331    LDKnativeCounterpartyChannelTransactionParameters *inner;
1332    /**
1333     * Indicates that this is the only struct which contains the same pointer.
1334     * Rust functions which take ownership of an object provided via an argument require
1335     * this to be true and invalidate the object pointed to by inner.
1336     */
1337    bool is_owned;
1338 } LDKCounterpartyChannelTransactionParameters;
1339
1340 /**
1341  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
1342  */
1343 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1344    /**
1345     * A pointer to the contents in the success state.
1346     * Reading from this pointer when `result_ok` is not set is undefined.
1347     */
1348    struct LDKCounterpartyChannelTransactionParameters *result;
1349    /**
1350     * A pointer to the contents in the error state.
1351     * Reading from this pointer when `result_ok` is set is undefined.
1352     */
1353    struct LDKDecodeError *err;
1354 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
1355
1356 /**
1357  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1358  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1359  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1360  */
1361 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1362    /**
1363     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
1364     * `err` or `result` depending on the state of `result_ok`.
1365     */
1366    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
1367    /**
1368     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
1369     */
1370    bool result_ok;
1371 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
1372
1373
1374
1375 /**
1376  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
1377  * The fields are organized by holder/counterparty.
1378  *
1379  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
1380  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
1381  */
1382 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
1383    /**
1384     * A pointer to the opaque Rust object.
1385     * Nearly everywhere, inner must be non-null, however in places where
1386     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1387     */
1388    LDKnativeChannelTransactionParameters *inner;
1389    /**
1390     * Indicates that this is the only struct which contains the same pointer.
1391     * Rust functions which take ownership of an object provided via an argument require
1392     * this to be true and invalidate the object pointed to by inner.
1393     */
1394    bool is_owned;
1395 } LDKChannelTransactionParameters;
1396
1397 /**
1398  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
1399  */
1400 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
1401    /**
1402     * A pointer to the contents in the success state.
1403     * Reading from this pointer when `result_ok` is not set is undefined.
1404     */
1405    struct LDKChannelTransactionParameters *result;
1406    /**
1407     * A pointer to the contents in the error state.
1408     * Reading from this pointer when `result_ok` is set is undefined.
1409     */
1410    struct LDKDecodeError *err;
1411 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
1412
1413 /**
1414  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1415  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1416  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1417  */
1418 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
1419    /**
1420     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
1421     * `err` or `result` depending on the state of `result_ok`.
1422     */
1423    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
1424    /**
1425     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
1426     */
1427    bool result_ok;
1428 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
1429
1430 /**
1431  * Represents a secp256k1 signature serialized as two 32-byte numbers
1432  */
1433 typedef struct LDKSignature {
1434    /**
1435     * The bytes of the signature in "compact" form
1436     */
1437    uint8_t compact_form[64];
1438 } LDKSignature;
1439
1440 /**
1441  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1442  * This corresponds to std::vector in C++
1443  */
1444 typedef struct LDKCVec_SignatureZ {
1445    /**
1446     * The elements in the array.
1447     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1448     */
1449    struct LDKSignature *data;
1450    /**
1451     * The number of elements pointed to by `data`.
1452     */
1453    uintptr_t datalen;
1454 } LDKCVec_SignatureZ;
1455
1456
1457
1458 /**
1459  * Information needed to build and sign a holder's commitment transaction.
1460  *
1461  * The transaction is only signed once we are ready to broadcast.
1462  */
1463 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
1464    /**
1465     * A pointer to the opaque Rust object.
1466     * Nearly everywhere, inner must be non-null, however in places where
1467     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1468     */
1469    LDKnativeHolderCommitmentTransaction *inner;
1470    /**
1471     * Indicates that this is the only struct which contains the same pointer.
1472     * Rust functions which take ownership of an object provided via an argument require
1473     * this to be true and invalidate the object pointed to by inner.
1474     */
1475    bool is_owned;
1476 } LDKHolderCommitmentTransaction;
1477
1478 /**
1479  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1480  */
1481 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
1482    /**
1483     * A pointer to the contents in the success state.
1484     * Reading from this pointer when `result_ok` is not set is undefined.
1485     */
1486    struct LDKHolderCommitmentTransaction *result;
1487    /**
1488     * A pointer to the contents in the error state.
1489     * Reading from this pointer when `result_ok` is set is undefined.
1490     */
1491    struct LDKDecodeError *err;
1492 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
1493
1494 /**
1495  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1496  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1497  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1498  */
1499 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
1500    /**
1501     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1502     * `err` or `result` depending on the state of `result_ok`.
1503     */
1504    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
1505    /**
1506     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1507     */
1508    bool result_ok;
1509 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
1510
1511
1512
1513 /**
1514  * A pre-built Bitcoin commitment transaction and its txid.
1515  */
1516 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
1517    /**
1518     * A pointer to the opaque Rust object.
1519     * Nearly everywhere, inner must be non-null, however in places where
1520     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1521     */
1522    LDKnativeBuiltCommitmentTransaction *inner;
1523    /**
1524     * Indicates that this is the only struct which contains the same pointer.
1525     * Rust functions which take ownership of an object provided via an argument require
1526     * this to be true and invalidate the object pointed to by inner.
1527     */
1528    bool is_owned;
1529 } LDKBuiltCommitmentTransaction;
1530
1531 /**
1532  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1533  */
1534 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1535    /**
1536     * A pointer to the contents in the success state.
1537     * Reading from this pointer when `result_ok` is not set is undefined.
1538     */
1539    struct LDKBuiltCommitmentTransaction *result;
1540    /**
1541     * A pointer to the contents in the error state.
1542     * Reading from this pointer when `result_ok` is set is undefined.
1543     */
1544    struct LDKDecodeError *err;
1545 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
1546
1547 /**
1548  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1549  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1550  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1551  */
1552 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
1553    /**
1554     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1555     * `err` or `result` depending on the state of `result_ok`.
1556     */
1557    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
1558    /**
1559     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1560     */
1561    bool result_ok;
1562 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
1563
1564
1565
1566 /**
1567  * A wrapper on ClosingTransaction indicating that the built bitcoin
1568  * transaction is trusted.
1569  *
1570  * See trust() and verify() functions on CommitmentTransaction.
1571  *
1572  * This structure implements Deref.
1573  */
1574 typedef struct MUST_USE_STRUCT LDKTrustedClosingTransaction {
1575    /**
1576     * A pointer to the opaque Rust object.
1577     * Nearly everywhere, inner must be non-null, however in places where
1578     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1579     */
1580    LDKnativeTrustedClosingTransaction *inner;
1581    /**
1582     * Indicates that this is the only struct which contains the same pointer.
1583     * Rust functions which take ownership of an object provided via an argument require
1584     * this to be true and invalidate the object pointed to by inner.
1585     */
1586    bool is_owned;
1587 } LDKTrustedClosingTransaction;
1588
1589 /**
1590  * The contents of CResult_TrustedClosingTransactionNoneZ
1591  */
1592 typedef union LDKCResult_TrustedClosingTransactionNoneZPtr {
1593    /**
1594     * A pointer to the contents in the success state.
1595     * Reading from this pointer when `result_ok` is not set is undefined.
1596     */
1597    struct LDKTrustedClosingTransaction *result;
1598    /**
1599     * Note that this value is always NULL, as there are no contents in the Err variant
1600     */
1601    void *err;
1602 } LDKCResult_TrustedClosingTransactionNoneZPtr;
1603
1604 /**
1605  * A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1606  * containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1607  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1608  */
1609 typedef struct LDKCResult_TrustedClosingTransactionNoneZ {
1610    /**
1611     * The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1612     * `err` or `result` depending on the state of `result_ok`.
1613     */
1614    union LDKCResult_TrustedClosingTransactionNoneZPtr contents;
1615    /**
1616     * Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1617     */
1618    bool result_ok;
1619 } LDKCResult_TrustedClosingTransactionNoneZ;
1620
1621
1622
1623 /**
1624  * This class tracks the per-transaction information needed to build a commitment transaction and will
1625  * actually build it and sign.  It is used for holder transactions that we sign only when needed
1626  * and for transactions we sign for the counterparty.
1627  *
1628  * This class can be used inside a signer implementation to generate a signature given the relevant
1629  * secret key.
1630  */
1631 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1632    /**
1633     * A pointer to the opaque Rust object.
1634     * Nearly everywhere, inner must be non-null, however in places where
1635     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1636     */
1637    LDKnativeCommitmentTransaction *inner;
1638    /**
1639     * Indicates that this is the only struct which contains the same pointer.
1640     * Rust functions which take ownership of an object provided via an argument require
1641     * this to be true and invalidate the object pointed to by inner.
1642     */
1643    bool is_owned;
1644 } LDKCommitmentTransaction;
1645
1646 /**
1647  * The contents of CResult_CommitmentTransactionDecodeErrorZ
1648  */
1649 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
1650    /**
1651     * A pointer to the contents in the success state.
1652     * Reading from this pointer when `result_ok` is not set is undefined.
1653     */
1654    struct LDKCommitmentTransaction *result;
1655    /**
1656     * A pointer to the contents in the error state.
1657     * Reading from this pointer when `result_ok` is set is undefined.
1658     */
1659    struct LDKDecodeError *err;
1660 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
1661
1662 /**
1663  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1664  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1665  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1666  */
1667 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
1668    /**
1669     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1670     * `err` or `result` depending on the state of `result_ok`.
1671     */
1672    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
1673    /**
1674     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1675     */
1676    bool result_ok;
1677 } LDKCResult_CommitmentTransactionDecodeErrorZ;
1678
1679
1680
1681 /**
1682  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1683  * transaction and the transaction creation keys) are trusted.
1684  *
1685  * See trust() and verify() functions on CommitmentTransaction.
1686  *
1687  * This structure implements Deref.
1688  */
1689 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
1690    /**
1691     * A pointer to the opaque Rust object.
1692     * Nearly everywhere, inner must be non-null, however in places where
1693     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1694     */
1695    LDKnativeTrustedCommitmentTransaction *inner;
1696    /**
1697     * Indicates that this is the only struct which contains the same pointer.
1698     * Rust functions which take ownership of an object provided via an argument require
1699     * this to be true and invalidate the object pointed to by inner.
1700     */
1701    bool is_owned;
1702 } LDKTrustedCommitmentTransaction;
1703
1704 /**
1705  * The contents of CResult_TrustedCommitmentTransactionNoneZ
1706  */
1707 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
1708    /**
1709     * A pointer to the contents in the success state.
1710     * Reading from this pointer when `result_ok` is not set is undefined.
1711     */
1712    struct LDKTrustedCommitmentTransaction *result;
1713    /**
1714     * Note that this value is always NULL, as there are no contents in the Err variant
1715     */
1716    void *err;
1717 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
1718
1719 /**
1720  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1721  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1722  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1723  */
1724 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
1725    /**
1726     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1727     * `err` or `result` depending on the state of `result_ok`.
1728     */
1729    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
1730    /**
1731     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1732     */
1733    bool result_ok;
1734 } LDKCResult_TrustedCommitmentTransactionNoneZ;
1735
1736 /**
1737  * The contents of CResult_CVec_SignatureZNoneZ
1738  */
1739 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
1740    /**
1741     * A pointer to the contents in the success state.
1742     * Reading from this pointer when `result_ok` is not set is undefined.
1743     */
1744    struct LDKCVec_SignatureZ *result;
1745    /**
1746     * Note that this value is always NULL, as there are no contents in the Err variant
1747     */
1748    void *err;
1749 } LDKCResult_CVec_SignatureZNoneZPtr;
1750
1751 /**
1752  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1753  * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1754  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1755  */
1756 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1757    /**
1758     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1759     * `err` or `result` depending on the state of `result_ok`.
1760     */
1761    union LDKCResult_CVec_SignatureZNoneZPtr contents;
1762    /**
1763     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1764     */
1765    bool result_ok;
1766 } LDKCResult_CVec_SignatureZNoneZ;
1767
1768 /**
1769  * The contents of CResult_ShutdownScriptDecodeErrorZ
1770  */
1771 typedef union LDKCResult_ShutdownScriptDecodeErrorZPtr {
1772    /**
1773     * A pointer to the contents in the success state.
1774     * Reading from this pointer when `result_ok` is not set is undefined.
1775     */
1776    struct LDKShutdownScript *result;
1777    /**
1778     * A pointer to the contents in the error state.
1779     * Reading from this pointer when `result_ok` is set is undefined.
1780     */
1781    struct LDKDecodeError *err;
1782 } LDKCResult_ShutdownScriptDecodeErrorZPtr;
1783
1784 /**
1785  * A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1786  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1787  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1788  */
1789 typedef struct LDKCResult_ShutdownScriptDecodeErrorZ {
1790    /**
1791     * The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1792     * `err` or `result` depending on the state of `result_ok`.
1793     */
1794    union LDKCResult_ShutdownScriptDecodeErrorZPtr contents;
1795    /**
1796     * Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1797     */
1798    bool result_ok;
1799 } LDKCResult_ShutdownScriptDecodeErrorZ;
1800
1801
1802
1803 /**
1804  * An error occurring when converting from [`Script`] to [`ShutdownScript`].
1805  */
1806 typedef struct MUST_USE_STRUCT LDKInvalidShutdownScript {
1807    /**
1808     * A pointer to the opaque Rust object.
1809     * Nearly everywhere, inner must be non-null, however in places where
1810     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1811     */
1812    LDKnativeInvalidShutdownScript *inner;
1813    /**
1814     * Indicates that this is the only struct which contains the same pointer.
1815     * Rust functions which take ownership of an object provided via an argument require
1816     * this to be true and invalidate the object pointed to by inner.
1817     */
1818    bool is_owned;
1819 } LDKInvalidShutdownScript;
1820
1821 /**
1822  * The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1823  */
1824 typedef union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr {
1825    /**
1826     * A pointer to the contents in the success state.
1827     * Reading from this pointer when `result_ok` is not set is undefined.
1828     */
1829    struct LDKShutdownScript *result;
1830    /**
1831     * A pointer to the contents in the error state.
1832     * Reading from this pointer when `result_ok` is set is undefined.
1833     */
1834    struct LDKInvalidShutdownScript *err;
1835 } LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr;
1836
1837 /**
1838  * A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1839  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1840  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1841  */
1842 typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ {
1843    /**
1844     * The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1845     * `err` or `result` depending on the state of `result_ok`.
1846     */
1847    union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr contents;
1848    /**
1849     * Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1850     */
1851    bool result_ok;
1852 } LDKCResult_ShutdownScriptInvalidShutdownScriptZ;
1853
1854 /**
1855  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
1856  */
1857 typedef struct LDKPublicKey {
1858    /**
1859     * The bytes of the public key
1860     */
1861    uint8_t compressed_form[33];
1862 } LDKPublicKey;
1863
1864 /**
1865  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
1866  * This corresponds to std::vector in C++
1867  */
1868 typedef struct LDKCVec_PublicKeyZ {
1869    /**
1870     * The elements in the array.
1871     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1872     */
1873    struct LDKPublicKey *data;
1874    /**
1875     * The number of elements pointed to by `data`.
1876     */
1877    uintptr_t datalen;
1878 } LDKCVec_PublicKeyZ;
1879
1880
1881
1882 /**
1883  * Onion messages can be sent and received to blinded paths, which serve to hide the identity of
1884  * the recipient.
1885  */
1886 typedef struct MUST_USE_STRUCT LDKBlindedPath {
1887    /**
1888     * A pointer to the opaque Rust object.
1889     * Nearly everywhere, inner must be non-null, however in places where
1890     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1891     */
1892    LDKnativeBlindedPath *inner;
1893    /**
1894     * Indicates that this is the only struct which contains the same pointer.
1895     * Rust functions which take ownership of an object provided via an argument require
1896     * this to be true and invalidate the object pointed to by inner.
1897     */
1898    bool is_owned;
1899 } LDKBlindedPath;
1900
1901 /**
1902  * The contents of CResult_BlindedPathNoneZ
1903  */
1904 typedef union LDKCResult_BlindedPathNoneZPtr {
1905    /**
1906     * A pointer to the contents in the success state.
1907     * Reading from this pointer when `result_ok` is not set is undefined.
1908     */
1909    struct LDKBlindedPath *result;
1910    /**
1911     * Note that this value is always NULL, as there are no contents in the Err variant
1912     */
1913    void *err;
1914 } LDKCResult_BlindedPathNoneZPtr;
1915
1916 /**
1917  * A CResult_BlindedPathNoneZ represents the result of a fallible operation,
1918  * containing a crate::lightning::onion_message::blinded_path::BlindedPath on success and a () on failure.
1919  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1920  */
1921 typedef struct LDKCResult_BlindedPathNoneZ {
1922    /**
1923     * The contents of this CResult_BlindedPathNoneZ, accessible via either
1924     * `err` or `result` depending on the state of `result_ok`.
1925     */
1926    union LDKCResult_BlindedPathNoneZPtr contents;
1927    /**
1928     * Whether this CResult_BlindedPathNoneZ represents a success state.
1929     */
1930    bool result_ok;
1931 } LDKCResult_BlindedPathNoneZ;
1932
1933 /**
1934  * The contents of CResult_BlindedPathDecodeErrorZ
1935  */
1936 typedef union LDKCResult_BlindedPathDecodeErrorZPtr {
1937    /**
1938     * A pointer to the contents in the success state.
1939     * Reading from this pointer when `result_ok` is not set is undefined.
1940     */
1941    struct LDKBlindedPath *result;
1942    /**
1943     * A pointer to the contents in the error state.
1944     * Reading from this pointer when `result_ok` is set is undefined.
1945     */
1946    struct LDKDecodeError *err;
1947 } LDKCResult_BlindedPathDecodeErrorZPtr;
1948
1949 /**
1950  * A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
1951  * containing a crate::lightning::onion_message::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
1952  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1953  */
1954 typedef struct LDKCResult_BlindedPathDecodeErrorZ {
1955    /**
1956     * The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
1957     * `err` or `result` depending on the state of `result_ok`.
1958     */
1959    union LDKCResult_BlindedPathDecodeErrorZPtr contents;
1960    /**
1961     * Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
1962     */
1963    bool result_ok;
1964 } LDKCResult_BlindedPathDecodeErrorZ;
1965
1966
1967
1968 /**
1969  * Used to construct the blinded hops portion of a blinded path. These hops cannot be identified
1970  * by outside observers and thus can be used to hide the identity of the recipient.
1971  */
1972 typedef struct MUST_USE_STRUCT LDKBlindedHop {
1973    /**
1974     * A pointer to the opaque Rust object.
1975     * Nearly everywhere, inner must be non-null, however in places where
1976     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1977     */
1978    LDKnativeBlindedHop *inner;
1979    /**
1980     * Indicates that this is the only struct which contains the same pointer.
1981     * Rust functions which take ownership of an object provided via an argument require
1982     * this to be true and invalidate the object pointed to by inner.
1983     */
1984    bool is_owned;
1985 } LDKBlindedHop;
1986
1987 /**
1988  * The contents of CResult_BlindedHopDecodeErrorZ
1989  */
1990 typedef union LDKCResult_BlindedHopDecodeErrorZPtr {
1991    /**
1992     * A pointer to the contents in the success state.
1993     * Reading from this pointer when `result_ok` is not set is undefined.
1994     */
1995    struct LDKBlindedHop *result;
1996    /**
1997     * A pointer to the contents in the error state.
1998     * Reading from this pointer when `result_ok` is set is undefined.
1999     */
2000    struct LDKDecodeError *err;
2001 } LDKCResult_BlindedHopDecodeErrorZPtr;
2002
2003 /**
2004  * A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
2005  * containing a crate::lightning::onion_message::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2006  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2007  */
2008 typedef struct LDKCResult_BlindedHopDecodeErrorZ {
2009    /**
2010     * The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
2011     * `err` or `result` depending on the state of `result_ok`.
2012     */
2013    union LDKCResult_BlindedHopDecodeErrorZPtr contents;
2014    /**
2015     * Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
2016     */
2017    bool result_ok;
2018 } LDKCResult_BlindedHopDecodeErrorZ;
2019
2020
2021
2022 /**
2023  * Represents the compressed public key of a node
2024  */
2025 typedef struct MUST_USE_STRUCT LDKNodeId {
2026    /**
2027     * A pointer to the opaque Rust object.
2028     * Nearly everywhere, inner must be non-null, however in places where
2029     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2030     */
2031    LDKnativeNodeId *inner;
2032    /**
2033     * Indicates that this is the only struct which contains the same pointer.
2034     * Rust functions which take ownership of an object provided via an argument require
2035     * this to be true and invalidate the object pointed to by inner.
2036     */
2037    bool is_owned;
2038 } LDKNodeId;
2039
2040
2041
2042 /**
2043  * Proposed use of a channel passed as a parameter to [`Score::channel_penalty_msat`].
2044  */
2045 typedef struct MUST_USE_STRUCT LDKChannelUsage {
2046    /**
2047     * A pointer to the opaque Rust object.
2048     * Nearly everywhere, inner must be non-null, however in places where
2049     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2050     */
2051    LDKnativeChannelUsage *inner;
2052    /**
2053     * Indicates that this is the only struct which contains the same pointer.
2054     * Rust functions which take ownership of an object provided via an argument require
2055     * this to be true and invalidate the object pointed to by inner.
2056     */
2057    bool is_owned;
2058 } LDKChannelUsage;
2059
2060
2061
2062 /**
2063  * A hop in a route
2064  */
2065 typedef struct MUST_USE_STRUCT LDKRouteHop {
2066    /**
2067     * A pointer to the opaque Rust object.
2068     * Nearly everywhere, inner must be non-null, however in places where
2069     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2070     */
2071    LDKnativeRouteHop *inner;
2072    /**
2073     * Indicates that this is the only struct which contains the same pointer.
2074     * Rust functions which take ownership of an object provided via an argument require
2075     * this to be true and invalidate the object pointed to by inner.
2076     */
2077    bool is_owned;
2078 } LDKRouteHop;
2079
2080 /**
2081  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
2082  * This corresponds to std::vector in C++
2083  */
2084 typedef struct LDKCVec_RouteHopZ {
2085    /**
2086     * The elements in the array.
2087     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2088     */
2089    struct LDKRouteHop *data;
2090    /**
2091     * The number of elements pointed to by `data`.
2092     */
2093    uintptr_t datalen;
2094 } LDKCVec_RouteHopZ;
2095
2096 /**
2097  * An interface used to score payment channels for path finding.
2098  *
2099  *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
2100  */
2101 typedef struct LDKScore {
2102    /**
2103     * An opaque pointer which is passed to your function implementations as an argument.
2104     * This has no meaning in the LDK, and can be NULL or any other value.
2105     */
2106    void *this_arg;
2107    /**
2108     * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
2109     * given channel in the direction from `source` to `target`.
2110     *
2111     * The channel's capacity (less any other MPP parts that are also being considered for use in
2112     * the same payment) is given by `capacity_msat`. It may be determined from various sources
2113     * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near
2114     * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount.
2115     * Thus, implementations should be overflow-safe.
2116     */
2117    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);
2118    /**
2119     * Handles updating channel penalties after failing to route through a channel.
2120     */
2121    void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
2122    /**
2123     * Handles updating channel penalties after successfully routing along a path.
2124     */
2125    void (*payment_path_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
2126    /**
2127     * Handles updating channel penalties after a probe over the given path failed.
2128     */
2129    void (*probe_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
2130    /**
2131     * Handles updating channel penalties after a probe over the given path succeeded.
2132     */
2133    void (*probe_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
2134    /**
2135     * Serialize the object into a byte array
2136     */
2137    struct LDKCVec_u8Z (*write)(const void *this_arg);
2138    /**
2139     * Frees any resources associated with this object given its this_arg pointer.
2140     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
2141     */
2142    void (*free)(void *this_arg);
2143 } LDKScore;
2144
2145 /**
2146  * A scorer that is accessed under a lock.
2147  *
2148  * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while
2149  * having shared ownership of a scorer but without requiring internal locking in [`Score`]
2150  * implementations. Internal locking would be detrimental to route finding performance and could
2151  * result in [`Score::channel_penalty_msat`] returning a different value for the same channel.
2152  *
2153  * [`find_route`]: crate::routing::router::find_route
2154  */
2155 typedef struct LDKLockableScore {
2156    /**
2157     * An opaque pointer which is passed to your function implementations as an argument.
2158     * This has no meaning in the LDK, and can be NULL or any other value.
2159     */
2160    void *this_arg;
2161    /**
2162     * Returns the locked scorer.
2163     */
2164    struct LDKScore (*lock)(const void *this_arg);
2165    /**
2166     * Frees any resources associated with this object given its this_arg pointer.
2167     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
2168     */
2169    void (*free)(void *this_arg);
2170 } LDKLockableScore;
2171
2172 /**
2173  * Refers to a scorer that is accessible under lock and also writeable to disk
2174  *
2175  * We need this trait to be able to pass in a scorer to `lightning-background-processor` that will enable us to
2176  * use the Persister to persist it.
2177  */
2178 typedef struct LDKWriteableScore {
2179    /**
2180     * An opaque pointer which is passed to your function implementations as an argument.
2181     * This has no meaning in the LDK, and can be NULL or any other value.
2182     */
2183    void *this_arg;
2184    /**
2185     * Implementation of LockableScore for this object.
2186     */
2187    struct LDKLockableScore LockableScore;
2188    /**
2189     * Serialize the object into a byte array
2190     */
2191    struct LDKCVec_u8Z (*write)(const void *this_arg);
2192    /**
2193     * Frees any resources associated with this object given its this_arg pointer.
2194     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
2195     */
2196    void (*free)(void *this_arg);
2197 } LDKWriteableScore;
2198
2199 /**
2200  * An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
2201  */
2202 typedef enum LDKCOption_WriteableScoreZ_Tag {
2203    /**
2204     * When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
2205     */
2206    LDKCOption_WriteableScoreZ_Some,
2207    /**
2208     * When we're in this state, this COption_WriteableScoreZ contains nothing
2209     */
2210    LDKCOption_WriteableScoreZ_None,
2211    /**
2212     * Must be last for serialization purposes
2213     */
2214    LDKCOption_WriteableScoreZ_Sentinel,
2215 } LDKCOption_WriteableScoreZ_Tag;
2216
2217 typedef struct LDKCOption_WriteableScoreZ {
2218    LDKCOption_WriteableScoreZ_Tag tag;
2219    union {
2220       struct {
2221          struct LDKWriteableScore some;
2222       };
2223    };
2224 } LDKCOption_WriteableScoreZ;
2225
2226 /**
2227  * The contents of CResult_NoneErrorZ
2228  */
2229 typedef union LDKCResult_NoneErrorZPtr {
2230    /**
2231     * Note that this value is always NULL, as there are no contents in the OK variant
2232     */
2233    void *result;
2234    /**
2235     * A pointer to the contents in the error state.
2236     * Reading from this pointer when `result_ok` is set is undefined.
2237     */
2238    enum LDKIOError *err;
2239 } LDKCResult_NoneErrorZPtr;
2240
2241 /**
2242  * A CResult_NoneErrorZ represents the result of a fallible operation,
2243  * containing a () on success and a crate::c_types::IOError on failure.
2244  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2245  */
2246 typedef struct LDKCResult_NoneErrorZ {
2247    /**
2248     * The contents of this CResult_NoneErrorZ, accessible via either
2249     * `err` or `result` depending on the state of `result_ok`.
2250     */
2251    union LDKCResult_NoneErrorZPtr contents;
2252    /**
2253     * Whether this CResult_NoneErrorZ represents a success state.
2254     */
2255    bool result_ok;
2256 } LDKCResult_NoneErrorZ;
2257
2258
2259
2260 /**
2261  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
2262  */
2263 typedef struct MUST_USE_STRUCT LDKChannelDetails {
2264    /**
2265     * A pointer to the opaque Rust object.
2266     * Nearly everywhere, inner must be non-null, however in places where
2267     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2268     */
2269    LDKnativeChannelDetails *inner;
2270    /**
2271     * Indicates that this is the only struct which contains the same pointer.
2272     * Rust functions which take ownership of an object provided via an argument require
2273     * this to be true and invalidate the object pointed to by inner.
2274     */
2275    bool is_owned;
2276 } LDKChannelDetails;
2277
2278 /**
2279  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2280  * This corresponds to std::vector in C++
2281  */
2282 typedef struct LDKCVec_ChannelDetailsZ {
2283    /**
2284     * The elements in the array.
2285     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2286     */
2287    struct LDKChannelDetails *data;
2288    /**
2289     * The number of elements pointed to by `data`.
2290     */
2291    uintptr_t datalen;
2292 } LDKCVec_ChannelDetailsZ;
2293
2294
2295
2296 /**
2297  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
2298  * it can take multiple paths. Each path is composed of one or more hops through the network.
2299  */
2300 typedef struct MUST_USE_STRUCT LDKRoute {
2301    /**
2302     * A pointer to the opaque Rust object.
2303     * Nearly everywhere, inner must be non-null, however in places where
2304     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2305     */
2306    LDKnativeRoute *inner;
2307    /**
2308     * Indicates that this is the only struct which contains the same pointer.
2309     * Rust functions which take ownership of an object provided via an argument require
2310     * this to be true and invalidate the object pointed to by inner.
2311     */
2312    bool is_owned;
2313 } LDKRoute;
2314
2315
2316
2317 /**
2318  * An Err type for failure to process messages.
2319  */
2320 typedef struct MUST_USE_STRUCT LDKLightningError {
2321    /**
2322     * A pointer to the opaque Rust object.
2323     * Nearly everywhere, inner must be non-null, however in places where
2324     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2325     */
2326    LDKnativeLightningError *inner;
2327    /**
2328     * Indicates that this is the only struct which contains the same pointer.
2329     * Rust functions which take ownership of an object provided via an argument require
2330     * this to be true and invalidate the object pointed to by inner.
2331     */
2332    bool is_owned;
2333 } LDKLightningError;
2334
2335 /**
2336  * The contents of CResult_RouteLightningErrorZ
2337  */
2338 typedef union LDKCResult_RouteLightningErrorZPtr {
2339    /**
2340     * A pointer to the contents in the success state.
2341     * Reading from this pointer when `result_ok` is not set is undefined.
2342     */
2343    struct LDKRoute *result;
2344    /**
2345     * A pointer to the contents in the error state.
2346     * Reading from this pointer when `result_ok` is set is undefined.
2347     */
2348    struct LDKLightningError *err;
2349 } LDKCResult_RouteLightningErrorZPtr;
2350
2351 /**
2352  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2353  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2354  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2355  */
2356 typedef struct LDKCResult_RouteLightningErrorZ {
2357    /**
2358     * The contents of this CResult_RouteLightningErrorZ, accessible via either
2359     * `err` or `result` depending on the state of `result_ok`.
2360     */
2361    union LDKCResult_RouteLightningErrorZPtr contents;
2362    /**
2363     * Whether this CResult_RouteLightningErrorZ represents a success state.
2364     */
2365    bool result_ok;
2366 } LDKCResult_RouteLightningErrorZ;
2367
2368 /**
2369  * An enum which can either contain a u64 or not
2370  */
2371 typedef enum LDKCOption_u64Z_Tag {
2372    /**
2373     * When we're in this state, this COption_u64Z contains a u64
2374     */
2375    LDKCOption_u64Z_Some,
2376    /**
2377     * When we're in this state, this COption_u64Z contains nothing
2378     */
2379    LDKCOption_u64Z_None,
2380    /**
2381     * Must be last for serialization purposes
2382     */
2383    LDKCOption_u64Z_Sentinel,
2384 } LDKCOption_u64Z_Tag;
2385
2386 typedef struct LDKCOption_u64Z {
2387    LDKCOption_u64Z_Tag tag;
2388    union {
2389       struct {
2390          uint64_t some;
2391       };
2392    };
2393 } LDKCOption_u64Z;
2394
2395
2396
2397 /**
2398  * A data structure for tracking in-flight HTLCs. May be used during pathfinding to account for
2399  * in-use channel liquidity.
2400  */
2401 typedef struct MUST_USE_STRUCT LDKInFlightHtlcs {
2402    /**
2403     * A pointer to the opaque Rust object.
2404     * Nearly everywhere, inner must be non-null, however in places where
2405     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2406     */
2407    LDKnativeInFlightHtlcs *inner;
2408    /**
2409     * Indicates that this is the only struct which contains the same pointer.
2410     * Rust functions which take ownership of an object provided via an argument require
2411     * this to be true and invalidate the object pointed to by inner.
2412     */
2413    bool is_owned;
2414 } LDKInFlightHtlcs;
2415
2416 /**
2417  * The contents of CResult_InFlightHtlcsDecodeErrorZ
2418  */
2419 typedef union LDKCResult_InFlightHtlcsDecodeErrorZPtr {
2420    /**
2421     * A pointer to the contents in the success state.
2422     * Reading from this pointer when `result_ok` is not set is undefined.
2423     */
2424    struct LDKInFlightHtlcs *result;
2425    /**
2426     * A pointer to the contents in the error state.
2427     * Reading from this pointer when `result_ok` is set is undefined.
2428     */
2429    struct LDKDecodeError *err;
2430 } LDKCResult_InFlightHtlcsDecodeErrorZPtr;
2431
2432 /**
2433  * A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
2434  * containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
2435  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2436  */
2437 typedef struct LDKCResult_InFlightHtlcsDecodeErrorZ {
2438    /**
2439     * The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
2440     * `err` or `result` depending on the state of `result_ok`.
2441     */
2442    union LDKCResult_InFlightHtlcsDecodeErrorZPtr contents;
2443    /**
2444     * Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
2445     */
2446    bool result_ok;
2447 } LDKCResult_InFlightHtlcsDecodeErrorZ;
2448
2449 /**
2450  * The contents of CResult_RouteHopDecodeErrorZ
2451  */
2452 typedef union LDKCResult_RouteHopDecodeErrorZPtr {
2453    /**
2454     * A pointer to the contents in the success state.
2455     * Reading from this pointer when `result_ok` is not set is undefined.
2456     */
2457    struct LDKRouteHop *result;
2458    /**
2459     * A pointer to the contents in the error state.
2460     * Reading from this pointer when `result_ok` is set is undefined.
2461     */
2462    struct LDKDecodeError *err;
2463 } LDKCResult_RouteHopDecodeErrorZPtr;
2464
2465 /**
2466  * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
2467  * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2468  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2469  */
2470 typedef struct LDKCResult_RouteHopDecodeErrorZ {
2471    /**
2472     * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
2473     * `err` or `result` depending on the state of `result_ok`.
2474     */
2475    union LDKCResult_RouteHopDecodeErrorZPtr contents;
2476    /**
2477     * Whether this CResult_RouteHopDecodeErrorZ represents a success state.
2478     */
2479    bool result_ok;
2480 } LDKCResult_RouteHopDecodeErrorZ;
2481
2482 /**
2483  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2484  * This corresponds to std::vector in C++
2485  */
2486 typedef struct LDKCVec_CVec_RouteHopZZ {
2487    /**
2488     * The elements in the array.
2489     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2490     */
2491    struct LDKCVec_RouteHopZ *data;
2492    /**
2493     * The number of elements pointed to by `data`.
2494     */
2495    uintptr_t datalen;
2496 } LDKCVec_CVec_RouteHopZZ;
2497
2498 /**
2499  * The contents of CResult_RouteDecodeErrorZ
2500  */
2501 typedef union LDKCResult_RouteDecodeErrorZPtr {
2502    /**
2503     * A pointer to the contents in the success state.
2504     * Reading from this pointer when `result_ok` is not set is undefined.
2505     */
2506    struct LDKRoute *result;
2507    /**
2508     * A pointer to the contents in the error state.
2509     * Reading from this pointer when `result_ok` is set is undefined.
2510     */
2511    struct LDKDecodeError *err;
2512 } LDKCResult_RouteDecodeErrorZPtr;
2513
2514 /**
2515  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2516  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2517  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2518  */
2519 typedef struct LDKCResult_RouteDecodeErrorZ {
2520    /**
2521     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
2522     * `err` or `result` depending on the state of `result_ok`.
2523     */
2524    union LDKCResult_RouteDecodeErrorZPtr contents;
2525    /**
2526     * Whether this CResult_RouteDecodeErrorZ represents a success state.
2527     */
2528    bool result_ok;
2529 } LDKCResult_RouteDecodeErrorZ;
2530
2531
2532
2533 /**
2534  * Parameters needed to find a [`Route`].
2535  *
2536  * Passed to [`find_route`] and [`build_route_from_hops`], but also provided in
2537  * [`Event::PaymentPathFailed`].
2538  *
2539  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
2540  */
2541 typedef struct MUST_USE_STRUCT LDKRouteParameters {
2542    /**
2543     * A pointer to the opaque Rust object.
2544     * Nearly everywhere, inner must be non-null, however in places where
2545     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2546     */
2547    LDKnativeRouteParameters *inner;
2548    /**
2549     * Indicates that this is the only struct which contains the same pointer.
2550     * Rust functions which take ownership of an object provided via an argument require
2551     * this to be true and invalidate the object pointed to by inner.
2552     */
2553    bool is_owned;
2554 } LDKRouteParameters;
2555
2556 /**
2557  * The contents of CResult_RouteParametersDecodeErrorZ
2558  */
2559 typedef union LDKCResult_RouteParametersDecodeErrorZPtr {
2560    /**
2561     * A pointer to the contents in the success state.
2562     * Reading from this pointer when `result_ok` is not set is undefined.
2563     */
2564    struct LDKRouteParameters *result;
2565    /**
2566     * A pointer to the contents in the error state.
2567     * Reading from this pointer when `result_ok` is set is undefined.
2568     */
2569    struct LDKDecodeError *err;
2570 } LDKCResult_RouteParametersDecodeErrorZPtr;
2571
2572 /**
2573  * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2574  * containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2575  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2576  */
2577 typedef struct LDKCResult_RouteParametersDecodeErrorZ {
2578    /**
2579     * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2580     * `err` or `result` depending on the state of `result_ok`.
2581     */
2582    union LDKCResult_RouteParametersDecodeErrorZPtr contents;
2583    /**
2584     * Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2585     */
2586    bool result_ok;
2587 } LDKCResult_RouteParametersDecodeErrorZ;
2588
2589
2590
2591 /**
2592  * A list of hops along a payment path terminating with a channel to the recipient.
2593  */
2594 typedef struct MUST_USE_STRUCT LDKRouteHint {
2595    /**
2596     * A pointer to the opaque Rust object.
2597     * Nearly everywhere, inner must be non-null, however in places where
2598     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2599     */
2600    LDKnativeRouteHint *inner;
2601    /**
2602     * Indicates that this is the only struct which contains the same pointer.
2603     * Rust functions which take ownership of an object provided via an argument require
2604     * this to be true and invalidate the object pointed to by inner.
2605     */
2606    bool is_owned;
2607 } LDKRouteHint;
2608
2609 /**
2610  * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2611  * This corresponds to std::vector in C++
2612  */
2613 typedef struct LDKCVec_RouteHintZ {
2614    /**
2615     * The elements in the array.
2616     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2617     */
2618    struct LDKRouteHint *data;
2619    /**
2620     * The number of elements pointed to by `data`.
2621     */
2622    uintptr_t datalen;
2623 } LDKCVec_RouteHintZ;
2624
2625 /**
2626  * A dynamically-allocated array of u64s of arbitrary size.
2627  * This corresponds to std::vector in C++
2628  */
2629 typedef struct LDKCVec_u64Z {
2630    /**
2631     * The elements in the array.
2632     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2633     */
2634    uint64_t *data;
2635    /**
2636     * The number of elements pointed to by `data`.
2637     */
2638    uintptr_t datalen;
2639 } LDKCVec_u64Z;
2640
2641
2642
2643 /**
2644  * The recipient of a payment.
2645  */
2646 typedef struct MUST_USE_STRUCT LDKPaymentParameters {
2647    /**
2648     * A pointer to the opaque Rust object.
2649     * Nearly everywhere, inner must be non-null, however in places where
2650     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2651     */
2652    LDKnativePaymentParameters *inner;
2653    /**
2654     * Indicates that this is the only struct which contains the same pointer.
2655     * Rust functions which take ownership of an object provided via an argument require
2656     * this to be true and invalidate the object pointed to by inner.
2657     */
2658    bool is_owned;
2659 } LDKPaymentParameters;
2660
2661 /**
2662  * The contents of CResult_PaymentParametersDecodeErrorZ
2663  */
2664 typedef union LDKCResult_PaymentParametersDecodeErrorZPtr {
2665    /**
2666     * A pointer to the contents in the success state.
2667     * Reading from this pointer when `result_ok` is not set is undefined.
2668     */
2669    struct LDKPaymentParameters *result;
2670    /**
2671     * A pointer to the contents in the error state.
2672     * Reading from this pointer when `result_ok` is set is undefined.
2673     */
2674    struct LDKDecodeError *err;
2675 } LDKCResult_PaymentParametersDecodeErrorZPtr;
2676
2677 /**
2678  * A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2679  * containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2680  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2681  */
2682 typedef struct LDKCResult_PaymentParametersDecodeErrorZ {
2683    /**
2684     * The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2685     * `err` or `result` depending on the state of `result_ok`.
2686     */
2687    union LDKCResult_PaymentParametersDecodeErrorZPtr contents;
2688    /**
2689     * Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2690     */
2691    bool result_ok;
2692 } LDKCResult_PaymentParametersDecodeErrorZ;
2693
2694
2695
2696 /**
2697  * A channel descriptor for a hop along a payment path.
2698  */
2699 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
2700    /**
2701     * A pointer to the opaque Rust object.
2702     * Nearly everywhere, inner must be non-null, however in places where
2703     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2704     */
2705    LDKnativeRouteHintHop *inner;
2706    /**
2707     * Indicates that this is the only struct which contains the same pointer.
2708     * Rust functions which take ownership of an object provided via an argument require
2709     * this to be true and invalidate the object pointed to by inner.
2710     */
2711    bool is_owned;
2712 } LDKRouteHintHop;
2713
2714 /**
2715  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2716  * This corresponds to std::vector in C++
2717  */
2718 typedef struct LDKCVec_RouteHintHopZ {
2719    /**
2720     * The elements in the array.
2721     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2722     */
2723    struct LDKRouteHintHop *data;
2724    /**
2725     * The number of elements pointed to by `data`.
2726     */
2727    uintptr_t datalen;
2728 } LDKCVec_RouteHintHopZ;
2729
2730 /**
2731  * The contents of CResult_RouteHintDecodeErrorZ
2732  */
2733 typedef union LDKCResult_RouteHintDecodeErrorZPtr {
2734    /**
2735     * A pointer to the contents in the success state.
2736     * Reading from this pointer when `result_ok` is not set is undefined.
2737     */
2738    struct LDKRouteHint *result;
2739    /**
2740     * A pointer to the contents in the error state.
2741     * Reading from this pointer when `result_ok` is set is undefined.
2742     */
2743    struct LDKDecodeError *err;
2744 } LDKCResult_RouteHintDecodeErrorZPtr;
2745
2746 /**
2747  * A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2748  * containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2749  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2750  */
2751 typedef struct LDKCResult_RouteHintDecodeErrorZ {
2752    /**
2753     * The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2754     * `err` or `result` depending on the state of `result_ok`.
2755     */
2756    union LDKCResult_RouteHintDecodeErrorZPtr contents;
2757    /**
2758     * Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2759     */
2760    bool result_ok;
2761 } LDKCResult_RouteHintDecodeErrorZ;
2762
2763 /**
2764  * The contents of CResult_RouteHintHopDecodeErrorZ
2765  */
2766 typedef union LDKCResult_RouteHintHopDecodeErrorZPtr {
2767    /**
2768     * A pointer to the contents in the success state.
2769     * Reading from this pointer when `result_ok` is not set is undefined.
2770     */
2771    struct LDKRouteHintHop *result;
2772    /**
2773     * A pointer to the contents in the error state.
2774     * Reading from this pointer when `result_ok` is set is undefined.
2775     */
2776    struct LDKDecodeError *err;
2777 } LDKCResult_RouteHintHopDecodeErrorZPtr;
2778
2779 /**
2780  * A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2781  * containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2782  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2783  */
2784 typedef struct LDKCResult_RouteHintHopDecodeErrorZ {
2785    /**
2786     * The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2787     * `err` or `result` depending on the state of `result_ok`.
2788     */
2789    union LDKCResult_RouteHintHopDecodeErrorZPtr contents;
2790    /**
2791     * Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2792     */
2793    bool result_ok;
2794 } LDKCResult_RouteHintHopDecodeErrorZ;
2795
2796 /**
2797  * Some information provided on receipt of payment depends on whether the payment received is a
2798  * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
2799  */
2800 typedef enum LDKPaymentPurpose_Tag {
2801    /**
2802     * Information for receiving a payment that we generated an invoice for.
2803     */
2804    LDKPaymentPurpose_InvoicePayment,
2805    /**
2806     * Because this is a spontaneous payment, the payer generated their own preimage rather than us
2807     * (the payee) providing a preimage.
2808     */
2809    LDKPaymentPurpose_SpontaneousPayment,
2810    /**
2811     * Must be last for serialization purposes
2812     */
2813    LDKPaymentPurpose_Sentinel,
2814 } LDKPaymentPurpose_Tag;
2815
2816 typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
2817    /**
2818     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
2819     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
2820     * [`ChannelManager::claim_funds`].
2821     *
2822     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2823     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2824     *
2825     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2826     */
2827    struct LDKThirtyTwoBytes payment_preimage;
2828    /**
2829     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
2830     * number of deanonymization attacks during the routing process.
2831     * It is provided here for your reference, however its accuracy is enforced directly by
2832     * [`ChannelManager`] using the values you previously provided to
2833     * [`ChannelManager::create_inbound_payment`] or
2834     * [`ChannelManager::create_inbound_payment_for_hash`].
2835     *
2836     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2837     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2838     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
2839     */
2840    struct LDKThirtyTwoBytes payment_secret;
2841 } LDKPaymentPurpose_LDKInvoicePayment_Body;
2842
2843 typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
2844    LDKPaymentPurpose_Tag tag;
2845    union {
2846       LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
2847       struct {
2848          struct LDKThirtyTwoBytes spontaneous_payment;
2849       };
2850    };
2851 } LDKPaymentPurpose;
2852
2853 /**
2854  * The contents of CResult_PaymentPurposeDecodeErrorZ
2855  */
2856 typedef union LDKCResult_PaymentPurposeDecodeErrorZPtr {
2857    /**
2858     * A pointer to the contents in the success state.
2859     * Reading from this pointer when `result_ok` is not set is undefined.
2860     */
2861    struct LDKPaymentPurpose *result;
2862    /**
2863     * A pointer to the contents in the error state.
2864     * Reading from this pointer when `result_ok` is set is undefined.
2865     */
2866    struct LDKDecodeError *err;
2867 } LDKCResult_PaymentPurposeDecodeErrorZPtr;
2868
2869 /**
2870  * A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
2871  * containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
2872  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2873  */
2874 typedef struct LDKCResult_PaymentPurposeDecodeErrorZ {
2875    /**
2876     * The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
2877     * `err` or `result` depending on the state of `result_ok`.
2878     */
2879    union LDKCResult_PaymentPurposeDecodeErrorZPtr contents;
2880    /**
2881     * Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
2882     */
2883    bool result_ok;
2884 } LDKCResult_PaymentPurposeDecodeErrorZ;
2885
2886
2887
2888 /**
2889  * A [`channel_update`] message to be sent to or received from a peer.
2890  *
2891  * [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message
2892  */
2893 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
2894    /**
2895     * A pointer to the opaque Rust object.
2896     * Nearly everywhere, inner must be non-null, however in places where
2897     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2898     */
2899    LDKnativeChannelUpdate *inner;
2900    /**
2901     * Indicates that this is the only struct which contains the same pointer.
2902     * Rust functions which take ownership of an object provided via an argument require
2903     * this to be true and invalidate the object pointed to by inner.
2904     */
2905    bool is_owned;
2906 } LDKChannelUpdate;
2907
2908 /**
2909  * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
2910  * return packet by a node along the route. See [BOLT #4] for details.
2911  *
2912  * [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md
2913  */
2914 typedef enum LDKNetworkUpdate_Tag {
2915    /**
2916     * An error indicating a `channel_update` messages should be applied via
2917     * [`NetworkGraph::update_channel`].
2918     */
2919    LDKNetworkUpdate_ChannelUpdateMessage,
2920    /**
2921     * An error indicating that a channel failed to route a payment, which should be applied via
2922     * [`NetworkGraph::channel_failed`].
2923     */
2924    LDKNetworkUpdate_ChannelFailure,
2925    /**
2926     * An error indicating that a node failed to route a payment, which should be applied via
2927     * [`NetworkGraph::node_failed_permanent`] if permanent.
2928     */
2929    LDKNetworkUpdate_NodeFailure,
2930    /**
2931     * Must be last for serialization purposes
2932     */
2933    LDKNetworkUpdate_Sentinel,
2934 } LDKNetworkUpdate_Tag;
2935
2936 typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body {
2937    /**
2938     * The update to apply via [`NetworkGraph::update_channel`].
2939     */
2940    struct LDKChannelUpdate msg;
2941 } LDKNetworkUpdate_LDKChannelUpdateMessage_Body;
2942
2943 typedef struct LDKNetworkUpdate_LDKChannelFailure_Body {
2944    /**
2945     * The short channel id of the closed channel.
2946     */
2947    uint64_t short_channel_id;
2948    /**
2949     * Whether the channel should be permanently removed or temporarily disabled until a new
2950     * `channel_update` message is received.
2951     */
2952    bool is_permanent;
2953 } LDKNetworkUpdate_LDKChannelFailure_Body;
2954
2955 typedef struct LDKNetworkUpdate_LDKNodeFailure_Body {
2956    /**
2957     * The node id of the failed node.
2958     */
2959    struct LDKPublicKey node_id;
2960    /**
2961     * Whether the node should be permanently removed from consideration or can be restored
2962     * when a new `channel_update` message is received.
2963     */
2964    bool is_permanent;
2965 } LDKNetworkUpdate_LDKNodeFailure_Body;
2966
2967 typedef struct MUST_USE_STRUCT LDKNetworkUpdate {
2968    LDKNetworkUpdate_Tag tag;
2969    union {
2970       LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message;
2971       LDKNetworkUpdate_LDKChannelFailure_Body channel_failure;
2972       LDKNetworkUpdate_LDKNodeFailure_Body node_failure;
2973    };
2974 } LDKNetworkUpdate;
2975
2976 /**
2977  * An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
2978  */
2979 typedef enum LDKCOption_NetworkUpdateZ_Tag {
2980    /**
2981     * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
2982     */
2983    LDKCOption_NetworkUpdateZ_Some,
2984    /**
2985     * When we're in this state, this COption_NetworkUpdateZ contains nothing
2986     */
2987    LDKCOption_NetworkUpdateZ_None,
2988    /**
2989     * Must be last for serialization purposes
2990     */
2991    LDKCOption_NetworkUpdateZ_Sentinel,
2992 } LDKCOption_NetworkUpdateZ_Tag;
2993
2994 typedef struct LDKCOption_NetworkUpdateZ {
2995    LDKCOption_NetworkUpdateZ_Tag tag;
2996    union {
2997       struct {
2998          struct LDKNetworkUpdate some;
2999       };
3000    };
3001 } LDKCOption_NetworkUpdateZ;
3002
3003 /**
3004  * When the payment path failure took place and extra details about it. [`PathFailure::OnPath`] may
3005  * contain a [`NetworkUpdate`] that needs to be applied to the [`NetworkGraph`].
3006  *
3007  * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate
3008  * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
3009  */
3010 typedef enum LDKPathFailure_Tag {
3011    /**
3012     * We failed to initially send the payment and no HTLC was committed to. Contains the relevant
3013     * error.
3014     */
3015    LDKPathFailure_InitialSend,
3016    /**
3017     * A hop on the path failed to forward our payment.
3018     */
3019    LDKPathFailure_OnPath,
3020    /**
3021     * Must be last for serialization purposes
3022     */
3023    LDKPathFailure_Sentinel,
3024 } LDKPathFailure_Tag;
3025
3026 typedef struct LDKPathFailure_LDKInitialSend_Body {
3027    /**
3028     * The error surfaced from initial send.
3029     */
3030    struct LDKAPIError err;
3031 } LDKPathFailure_LDKInitialSend_Body;
3032
3033 typedef struct LDKPathFailure_LDKOnPath_Body {
3034    /**
3035     * If present, this [`NetworkUpdate`] should be applied to the [`NetworkGraph`] so that routing
3036     * decisions can take into account the update.
3037     *
3038     * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate
3039     * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
3040     */
3041    struct LDKCOption_NetworkUpdateZ network_update;
3042 } LDKPathFailure_LDKOnPath_Body;
3043
3044 typedef struct MUST_USE_STRUCT LDKPathFailure {
3045    LDKPathFailure_Tag tag;
3046    union {
3047       LDKPathFailure_LDKInitialSend_Body initial_send;
3048       LDKPathFailure_LDKOnPath_Body on_path;
3049    };
3050 } LDKPathFailure;
3051
3052 /**
3053  * An enum which can either contain a crate::lightning::util::events::PathFailure or not
3054  */
3055 typedef enum LDKCOption_PathFailureZ_Tag {
3056    /**
3057     * When we're in this state, this COption_PathFailureZ contains a crate::lightning::util::events::PathFailure
3058     */
3059    LDKCOption_PathFailureZ_Some,
3060    /**
3061     * When we're in this state, this COption_PathFailureZ contains nothing
3062     */
3063    LDKCOption_PathFailureZ_None,
3064    /**
3065     * Must be last for serialization purposes
3066     */
3067    LDKCOption_PathFailureZ_Sentinel,
3068 } LDKCOption_PathFailureZ_Tag;
3069
3070 typedef struct LDKCOption_PathFailureZ {
3071    LDKCOption_PathFailureZ_Tag tag;
3072    union {
3073       struct {
3074          struct LDKPathFailure some;
3075       };
3076    };
3077 } LDKCOption_PathFailureZ;
3078
3079 /**
3080  * The contents of CResult_COption_PathFailureZDecodeErrorZ
3081  */
3082 typedef union LDKCResult_COption_PathFailureZDecodeErrorZPtr {
3083    /**
3084     * A pointer to the contents in the success state.
3085     * Reading from this pointer when `result_ok` is not set is undefined.
3086     */
3087    struct LDKCOption_PathFailureZ *result;
3088    /**
3089     * A pointer to the contents in the error state.
3090     * Reading from this pointer when `result_ok` is set is undefined.
3091     */
3092    struct LDKDecodeError *err;
3093 } LDKCResult_COption_PathFailureZDecodeErrorZPtr;
3094
3095 /**
3096  * A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
3097  * containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3098  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3099  */
3100 typedef struct LDKCResult_COption_PathFailureZDecodeErrorZ {
3101    /**
3102     * The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
3103     * `err` or `result` depending on the state of `result_ok`.
3104     */
3105    union LDKCResult_COption_PathFailureZDecodeErrorZPtr contents;
3106    /**
3107     * Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
3108     */
3109    bool result_ok;
3110 } LDKCResult_COption_PathFailureZDecodeErrorZ;
3111
3112 /**
3113  * The reason the channel was closed. See individual variants more details.
3114  */
3115 typedef enum LDKClosureReason_Tag {
3116    /**
3117     * Closure generated from receiving a peer error message.
3118     *
3119     * Our counterparty may have broadcasted their latest commitment state, and we have
3120     * as well.
3121     */
3122    LDKClosureReason_CounterpartyForceClosed,
3123    /**
3124     * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
3125     *
3126     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
3127     */
3128    LDKClosureReason_HolderForceClosed,
3129    /**
3130     * The channel was closed after negotiating a cooperative close and we've now broadcasted
3131     * the cooperative close transaction. Note the shutdown may have been initiated by us.
3132     */
3133    LDKClosureReason_CooperativeClosure,
3134    /**
3135     * A commitment transaction was confirmed on chain, closing the channel. Most likely this
3136     * commitment transaction came from our counterparty, but it may also have come from
3137     * a copy of our own `ChannelMonitor`.
3138     */
3139    LDKClosureReason_CommitmentTxConfirmed,
3140    /**
3141     * The funding transaction failed to confirm in a timely manner on an inbound channel.
3142     */
3143    LDKClosureReason_FundingTimedOut,
3144    /**
3145     * Closure generated from processing an event, likely a HTLC forward/relay/reception.
3146     */
3147    LDKClosureReason_ProcessingError,
3148    /**
3149     * The peer disconnected prior to funding completing. In this case the spec mandates that we
3150     * forget the channel entirely - we can attempt again if the peer reconnects.
3151     *
3152     * This includes cases where we restarted prior to funding completion, including prior to the
3153     * initial [`ChannelMonitor`] persistence completing.
3154     *
3155     * In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the
3156     * peer because of mutual incompatibility between us and our channel counterparty.
3157     *
3158     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
3159     */
3160    LDKClosureReason_DisconnectedPeer,
3161    /**
3162     * Closure generated from `ChannelManager::read` if the [`ChannelMonitor`] is newer than
3163     * the [`ChannelManager`] deserialized.
3164     *
3165     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
3166     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
3167     */
3168    LDKClosureReason_OutdatedChannelManager,
3169    /**
3170     * Must be last for serialization purposes
3171     */
3172    LDKClosureReason_Sentinel,
3173 } LDKClosureReason_Tag;
3174
3175 typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
3176    /**
3177     * The error which the peer sent us.
3178     *
3179     * The string should be sanitized before it is used (e.g emitted to logs
3180     * or printed to stdout). Otherwise, a well crafted error message may exploit
3181     * a security vulnerability in the terminal emulator or the logging subsystem.
3182     */
3183    struct LDKStr peer_msg;
3184 } LDKClosureReason_LDKCounterpartyForceClosed_Body;
3185
3186 typedef struct LDKClosureReason_LDKProcessingError_Body {
3187    /**
3188     * A developer-readable error message which we generated.
3189     */
3190    struct LDKStr err;
3191 } LDKClosureReason_LDKProcessingError_Body;
3192
3193 typedef struct MUST_USE_STRUCT LDKClosureReason {
3194    LDKClosureReason_Tag tag;
3195    union {
3196       LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
3197       LDKClosureReason_LDKProcessingError_Body processing_error;
3198    };
3199 } LDKClosureReason;
3200
3201 /**
3202  * An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3203  */
3204 typedef enum LDKCOption_ClosureReasonZ_Tag {
3205    /**
3206     * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3207     */
3208    LDKCOption_ClosureReasonZ_Some,
3209    /**
3210     * When we're in this state, this COption_ClosureReasonZ contains nothing
3211     */
3212    LDKCOption_ClosureReasonZ_None,
3213    /**
3214     * Must be last for serialization purposes
3215     */
3216    LDKCOption_ClosureReasonZ_Sentinel,
3217 } LDKCOption_ClosureReasonZ_Tag;
3218
3219 typedef struct LDKCOption_ClosureReasonZ {
3220    LDKCOption_ClosureReasonZ_Tag tag;
3221    union {
3222       struct {
3223          struct LDKClosureReason some;
3224       };
3225    };
3226 } LDKCOption_ClosureReasonZ;
3227
3228 /**
3229  * The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3230  */
3231 typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr {
3232    /**
3233     * A pointer to the contents in the success state.
3234     * Reading from this pointer when `result_ok` is not set is undefined.
3235     */
3236    struct LDKCOption_ClosureReasonZ *result;
3237    /**
3238     * A pointer to the contents in the error state.
3239     * Reading from this pointer when `result_ok` is set is undefined.
3240     */
3241    struct LDKDecodeError *err;
3242 } LDKCResult_COption_ClosureReasonZDecodeErrorZPtr;
3243
3244 /**
3245  * A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3246  * containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3247  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3248  */
3249 typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ {
3250    /**
3251     * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3252     * `err` or `result` depending on the state of `result_ok`.
3253     */
3254    union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents;
3255    /**
3256     * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3257     */
3258    bool result_ok;
3259 } LDKCResult_COption_ClosureReasonZDecodeErrorZ;
3260
3261 /**
3262  * Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`].
3263  */
3264 typedef enum LDKHTLCDestination_Tag {
3265    /**
3266     * We tried forwarding to a channel but failed to do so. An example of such an instance is when
3267     * there is insufficient capacity in our outbound channel.
3268     */
3269    LDKHTLCDestination_NextHopChannel,
3270    /**
3271     * Scenario where we are unsure of the next node to forward the HTLC to.
3272     */
3273    LDKHTLCDestination_UnknownNextHop,
3274    /**
3275     * We couldn't forward to the outgoing scid. An example would be attempting to send a duplicate
3276     * intercept HTLC.
3277     */
3278    LDKHTLCDestination_InvalidForward,
3279    /**
3280     * Failure scenario where an HTLC may have been forwarded to be intended for us,
3281     * but is invalid for some reason, so we reject it.
3282     *
3283     * Some of the reasons may include:
3284     * * HTLC Timeouts
3285     * * Expected MPP amount to claim does not equal HTLC total
3286     * * Claimable amount does not match expected amount
3287     */
3288    LDKHTLCDestination_FailedPayment,
3289    /**
3290     * Must be last for serialization purposes
3291     */
3292    LDKHTLCDestination_Sentinel,
3293 } LDKHTLCDestination_Tag;
3294
3295 typedef struct LDKHTLCDestination_LDKNextHopChannel_Body {
3296    /**
3297     * The `node_id` of the next node. For backwards compatibility, this field is
3298     * marked as optional, versions prior to 0.0.110 may not always be able to provide
3299     * counterparty node information.
3300     *
3301     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3302     */
3303    struct LDKPublicKey node_id;
3304    /**
3305     * The outgoing `channel_id` between us and the next node.
3306     */
3307    struct LDKThirtyTwoBytes channel_id;
3308 } LDKHTLCDestination_LDKNextHopChannel_Body;
3309
3310 typedef struct LDKHTLCDestination_LDKUnknownNextHop_Body {
3311    /**
3312     * Short channel id we are requesting to forward an HTLC to.
3313     */
3314    uint64_t requested_forward_scid;
3315 } LDKHTLCDestination_LDKUnknownNextHop_Body;
3316
3317 typedef struct LDKHTLCDestination_LDKInvalidForward_Body {
3318    /**
3319     * Short channel id we are requesting to forward an HTLC to.
3320     */
3321    uint64_t requested_forward_scid;
3322 } LDKHTLCDestination_LDKInvalidForward_Body;
3323
3324 typedef struct LDKHTLCDestination_LDKFailedPayment_Body {
3325    /**
3326     * The payment hash of the payment we attempted to process.
3327     */
3328    struct LDKThirtyTwoBytes payment_hash;
3329 } LDKHTLCDestination_LDKFailedPayment_Body;
3330
3331 typedef struct MUST_USE_STRUCT LDKHTLCDestination {
3332    LDKHTLCDestination_Tag tag;
3333    union {
3334       LDKHTLCDestination_LDKNextHopChannel_Body next_hop_channel;
3335       LDKHTLCDestination_LDKUnknownNextHop_Body unknown_next_hop;
3336       LDKHTLCDestination_LDKInvalidForward_Body invalid_forward;
3337       LDKHTLCDestination_LDKFailedPayment_Body failed_payment;
3338    };
3339 } LDKHTLCDestination;
3340
3341 /**
3342  * An enum which can either contain a crate::lightning::util::events::HTLCDestination or not
3343  */
3344 typedef enum LDKCOption_HTLCDestinationZ_Tag {
3345    /**
3346     * When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::util::events::HTLCDestination
3347     */
3348    LDKCOption_HTLCDestinationZ_Some,
3349    /**
3350     * When we're in this state, this COption_HTLCDestinationZ contains nothing
3351     */
3352    LDKCOption_HTLCDestinationZ_None,
3353    /**
3354     * Must be last for serialization purposes
3355     */
3356    LDKCOption_HTLCDestinationZ_Sentinel,
3357 } LDKCOption_HTLCDestinationZ_Tag;
3358
3359 typedef struct LDKCOption_HTLCDestinationZ {
3360    LDKCOption_HTLCDestinationZ_Tag tag;
3361    union {
3362       struct {
3363          struct LDKHTLCDestination some;
3364       };
3365    };
3366 } LDKCOption_HTLCDestinationZ;
3367
3368 /**
3369  * The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
3370  */
3371 typedef union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr {
3372    /**
3373     * A pointer to the contents in the success state.
3374     * Reading from this pointer when `result_ok` is not set is undefined.
3375     */
3376    struct LDKCOption_HTLCDestinationZ *result;
3377    /**
3378     * A pointer to the contents in the error state.
3379     * Reading from this pointer when `result_ok` is set is undefined.
3380     */
3381    struct LDKDecodeError *err;
3382 } LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr;
3383
3384 /**
3385  * A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
3386  * containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3387  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3388  */
3389 typedef struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ {
3390    /**
3391     * The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
3392     * `err` or `result` depending on the state of `result_ok`.
3393     */
3394    union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr contents;
3395    /**
3396     * Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
3397     */
3398    bool result_ok;
3399 } LDKCResult_COption_HTLCDestinationZDecodeErrorZ;
3400
3401 /**
3402  * An enum which can either contain a crate::c_types::U128 or not
3403  */
3404 typedef enum LDKCOption_u128Z_Tag {
3405    /**
3406     * When we're in this state, this COption_u128Z contains a crate::c_types::U128
3407     */
3408    LDKCOption_u128Z_Some,
3409    /**
3410     * When we're in this state, this COption_u128Z contains nothing
3411     */
3412    LDKCOption_u128Z_None,
3413    /**
3414     * Must be last for serialization purposes
3415     */
3416    LDKCOption_u128Z_Sentinel,
3417 } LDKCOption_u128Z_Tag;
3418
3419 typedef struct LDKCOption_u128Z {
3420    LDKCOption_u128Z_Tag tag;
3421    union {
3422       struct {
3423          struct LDKU128 some;
3424       };
3425    };
3426 } LDKCOption_u128Z;
3427
3428
3429
3430 /**
3431  * A reference to a transaction output.
3432  *
3433  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
3434  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
3435  */
3436 typedef struct MUST_USE_STRUCT LDKOutPoint {
3437    /**
3438     * A pointer to the opaque Rust object.
3439     * Nearly everywhere, inner must be non-null, however in places where
3440     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3441     */
3442    LDKnativeOutPoint *inner;
3443    /**
3444     * Indicates that this is the only struct which contains the same pointer.
3445     * Rust functions which take ownership of an object provided via an argument require
3446     * this to be true and invalidate the object pointed to by inner.
3447     */
3448    bool is_owned;
3449 } LDKOutPoint;
3450
3451
3452
3453 /**
3454  * Information about a spendable output to a P2WSH script.
3455  *
3456  * See [`SpendableOutputDescriptor::DelayedPaymentOutput`] for more details on how to spend this.
3457  */
3458 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
3459    /**
3460     * A pointer to the opaque Rust object.
3461     * Nearly everywhere, inner must be non-null, however in places where
3462     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3463     */
3464    LDKnativeDelayedPaymentOutputDescriptor *inner;
3465    /**
3466     * Indicates that this is the only struct which contains the same pointer.
3467     * Rust functions which take ownership of an object provided via an argument require
3468     * this to be true and invalidate the object pointed to by inner.
3469     */
3470    bool is_owned;
3471 } LDKDelayedPaymentOutputDescriptor;
3472
3473
3474
3475 /**
3476  * Information about a spendable output to our \"payment key\".
3477  *
3478  * See [`SpendableOutputDescriptor::StaticPaymentOutput`] for more details on how to spend this.
3479  */
3480 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
3481    /**
3482     * A pointer to the opaque Rust object.
3483     * Nearly everywhere, inner must be non-null, however in places where
3484     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3485     */
3486    LDKnativeStaticPaymentOutputDescriptor *inner;
3487    /**
3488     * Indicates that this is the only struct which contains the same pointer.
3489     * Rust functions which take ownership of an object provided via an argument require
3490     * this to be true and invalidate the object pointed to by inner.
3491     */
3492    bool is_owned;
3493 } LDKStaticPaymentOutputDescriptor;
3494
3495 /**
3496  * Describes the necessary information to spend a spendable output.
3497  *
3498  * When on-chain outputs are created by LDK (which our counterparty is not able to claim at any
3499  * point in the future) a [`SpendableOutputs`] event is generated which you must track and be able
3500  * to spend on-chain. The information needed to do this is provided in this enum, including the
3501  * outpoint describing which `txid` and output `index` is available, the full output which exists
3502  * at that `txid`/`index`, and any keys or other information required to sign.
3503  *
3504  * [`SpendableOutputs`]: crate::util::events::Event::SpendableOutputs
3505  */
3506 typedef enum LDKSpendableOutputDescriptor_Tag {
3507    /**
3508     * An output to a script which was provided via [`SignerProvider`] directly, either from
3509     * [`get_destination_script`] or [`get_shutdown_scriptpubkey`], thus you should already
3510     * know how to spend it. No secret keys are provided as LDK was never given any key.
3511     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
3512     * on-chain using the payment preimage or after it has timed out.
3513     *
3514     * [`get_shutdown_scriptpubkey`]: SignerProvider::get_shutdown_scriptpubkey
3515     * [`get_destination_script`]: SignerProvider::get_shutdown_scriptpubkey
3516     */
3517    LDKSpendableOutputDescriptor_StaticOutput,
3518    /**
3519     * An output to a P2WSH script which can be spent with a single signature after an `OP_CSV`
3520     * delay.
3521     *
3522     * The witness in the spending input should be:
3523     * ```bitcoin
3524     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
3525     * ```
3526     *
3527     * Note that the `nSequence` field in the spending input must be set to
3528     * [`DelayedPaymentOutputDescriptor::to_self_delay`] (which means the transaction is not
3529     * broadcastable until at least [`DelayedPaymentOutputDescriptor::to_self_delay`] blocks after
3530     * the outpoint confirms, see [BIP
3531     * 68](https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki)). Also note that LDK
3532     * won't generate a [`SpendableOutputDescriptor`] until the corresponding block height
3533     * is reached.
3534     *
3535     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
3536     * it is an output from an old state which we broadcast (which should never happen).
3537     *
3538     * To derive the delayed payment key which is used to sign this input, you must pass the
3539     * holder [`InMemorySigner::delayed_payment_base_key`] (i.e., the private key which corresponds to the
3540     * [`ChannelPublicKeys::delayed_payment_basepoint`] in [`ChannelSigner::pubkeys`]) and the provided
3541     * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to [`chan_utils::derive_private_key`]. The public key can be
3542     * generated without the secret key using [`chan_utils::derive_public_key`] and only the
3543     * [`ChannelPublicKeys::delayed_payment_basepoint`] which appears in [`ChannelSigner::pubkeys`].
3544     *
3545     * To derive the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] provided here (which is
3546     * used in the witness script generation), you must pass the counterparty
3547     * [`ChannelPublicKeys::revocation_basepoint`] (which appears in the call to
3548     * [`ChannelSigner::provide_channel_parameters`]) and the provided
3549     * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to
3550     * [`chan_utils::derive_public_revocation_key`].
3551     *
3552     * The witness script which is hashed and included in the output `script_pubkey` may be
3553     * regenerated by passing the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] (derived
3554     * as explained above), our delayed payment pubkey (derived as explained above), and the
3555     * [`DelayedPaymentOutputDescriptor::to_self_delay`] contained here to
3556     * [`chan_utils::get_revokeable_redeemscript`].
3557     */
3558    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
3559    /**
3560     * An output to a P2WPKH, spendable exclusively by our payment key (i.e., the private key
3561     * which corresponds to the `payment_point` in [`ChannelSigner::pubkeys`]). The witness
3562     * in the spending input is, thus, simply:
3563     * ```bitcoin
3564     * <BIP 143 signature> <payment key>
3565     * ```
3566     *
3567     * These are generally the result of our counterparty having broadcast the current state,
3568     * allowing us to claim the non-HTLC-encumbered outputs immediately.
3569     */
3570    LDKSpendableOutputDescriptor_StaticPaymentOutput,
3571    /**
3572     * Must be last for serialization purposes
3573     */
3574    LDKSpendableOutputDescriptor_Sentinel,
3575 } LDKSpendableOutputDescriptor_Tag;
3576
3577 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
3578    /**
3579     * The outpoint which is spendable.
3580     */
3581    struct LDKOutPoint outpoint;
3582    /**
3583     * The output which is referenced by the given outpoint.
3584     */
3585    struct LDKTxOut output;
3586 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
3587
3588 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
3589    LDKSpendableOutputDescriptor_Tag tag;
3590    union {
3591       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
3592       struct {
3593          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
3594       };
3595       struct {
3596          struct LDKStaticPaymentOutputDescriptor static_payment_output;
3597       };
3598    };
3599 } LDKSpendableOutputDescriptor;
3600
3601 /**
3602  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3603  * This corresponds to std::vector in C++
3604  */
3605 typedef struct LDKCVec_SpendableOutputDescriptorZ {
3606    /**
3607     * The elements in the array.
3608     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3609     */
3610    struct LDKSpendableOutputDescriptor *data;
3611    /**
3612     * The number of elements pointed to by `data`.
3613     */
3614    uintptr_t datalen;
3615 } LDKCVec_SpendableOutputDescriptorZ;
3616
3617
3618
3619 /**
3620  * Features used within the channel_type field in an OpenChannel message.
3621  *
3622  * A channel is always of some known \"type\", describing the transaction formats used and the exact
3623  * semantics of our interaction with our peer.
3624  *
3625  * Note that because a channel is a specific type which is proposed by the opener and accepted by
3626  * the counterparty, only required features are allowed here.
3627  *
3628  * This is serialized differently from other feature types - it is not prefixed by a length, and
3629  * thus must only appear inside a TLV where its length is known in advance.
3630  */
3631 typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures {
3632    /**
3633     * A pointer to the opaque Rust object.
3634     * Nearly everywhere, inner must be non-null, however in places where
3635     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3636     */
3637    LDKnativeChannelTypeFeatures *inner;
3638    /**
3639     * Indicates that this is the only struct which contains the same pointer.
3640     * Rust functions which take ownership of an object provided via an argument require
3641     * this to be true and invalidate the object pointed to by inner.
3642     */
3643    bool is_owned;
3644 } LDKChannelTypeFeatures;
3645
3646 /**
3647  * An Event which you should probably take some action in response to.
3648  *
3649  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
3650  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
3651  * written as it makes no sense to respond to it after reconnecting to peers).
3652  */
3653 typedef enum LDKEvent_Tag {
3654    /**
3655     * Used to indicate that the client should generate a funding transaction with the given
3656     * parameters and then call [`ChannelManager::funding_transaction_generated`].
3657     * Generated in [`ChannelManager`] message handling.
3658     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
3659     * counterparty can steal your funds!
3660     *
3661     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
3662     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
3663     */
3664    LDKEvent_FundingGenerationReady,
3665    /**
3666     * Indicates that we've been offered a payment and it needs to be claimed via calling
3667     * [`ChannelManager::claim_funds`] with the preimage given in [`PaymentPurpose`].
3668     *
3669     * Note that if the preimage is not known, you should call
3670     * [`ChannelManager::fail_htlc_backwards`] or [`ChannelManager::fail_htlc_backwards_with_reason`]
3671     * to free up resources for this HTLC and avoid network congestion.
3672     * If you fail to call either [`ChannelManager::claim_funds`], [`ChannelManager::fail_htlc_backwards`],
3673     * or [`ChannelManager::fail_htlc_backwards_with_reason`] within the HTLC's timeout, the HTLC will be
3674     * automatically failed.
3675     *
3676     * # Note
3677     * LDK will not stop an inbound payment from being paid multiple times, so multiple
3678     * `PaymentClaimable` events may be generated for the same payment.
3679     *
3680     * # Note
3681     * This event used to be called `PaymentReceived` in LDK versions 0.0.112 and earlier.
3682     *
3683     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
3684     * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
3685     * [`ChannelManager::fail_htlc_backwards_with_reason`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards_with_reason
3686     */
3687    LDKEvent_PaymentClaimable,
3688    /**
3689     * Indicates a payment has been claimed and we've received money!
3690     *
3691     * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response
3692     * to an [`Event::PaymentClaimable`]. However, if we previously crashed during a
3693     * [`ChannelManager::claim_funds`] call you may see this event without a corresponding
3694     * [`Event::PaymentClaimable`] event.
3695     *
3696     * # Note
3697     * LDK will not stop an inbound payment from being paid multiple times, so multiple
3698     * `PaymentClaimable` events may be generated for the same payment. If you then call
3699     * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentClaimable`] you may get
3700     * multiple `PaymentClaimed` events.
3701     *
3702     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
3703     */
3704    LDKEvent_PaymentClaimed,
3705    /**
3706     * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
3707     * and we got back the payment preimage for it).
3708     *
3709     * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
3710     * event. In this situation, you SHOULD treat this payment as having succeeded.
3711     */
3712    LDKEvent_PaymentSent,
3713    /**
3714     * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
3715     * provide failure information for each path attempt in the payment, including retries.
3716     *
3717     * This event is provided once there are no further pending HTLCs for the payment and the
3718     * payment is no longer retryable, due either to the [`Retry`] provided or
3719     * [`ChannelManager::abandon_payment`] having been called for the corresponding payment.
3720     *
3721     * [`Retry`]: crate::ln::channelmanager::Retry
3722     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3723     */
3724    LDKEvent_PaymentFailed,
3725    /**
3726     * Indicates that a path for an outbound payment was successful.
3727     *
3728     * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
3729     * [`Event::PaymentSent`] for obtaining the payment preimage.
3730     */
3731    LDKEvent_PaymentPathSuccessful,
3732    /**
3733     * Indicates an outbound HTLC we sent failed, likely due to an intermediary node being unable to
3734     * handle the HTLC.
3735     *
3736     * Note that this does *not* indicate that all paths for an MPP payment have failed, see
3737     * [`Event::PaymentFailed`].
3738     *
3739     * See [`ChannelManager::abandon_payment`] for giving up on this payment before its retries have
3740     * been exhausted.
3741     *
3742     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3743     */
3744    LDKEvent_PaymentPathFailed,
3745    /**
3746     * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination.
3747     */
3748    LDKEvent_ProbeSuccessful,
3749    /**
3750     * Indicates that a probe payment we sent failed at an intermediary node on the path.
3751     */
3752    LDKEvent_ProbeFailed,
3753    /**
3754     * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
3755     * a time in the future.
3756     *
3757     * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
3758     */
3759    LDKEvent_PendingHTLCsForwardable,
3760    /**
3761     * Used to indicate that we've intercepted an HTLC forward. This event will only be generated if
3762     * you've encoded an intercept scid in the receiver's invoice route hints using
3763     * [`ChannelManager::get_intercept_scid`] and have set [`UserConfig::accept_intercept_htlcs`].
3764     *
3765     * [`ChannelManager::forward_intercepted_htlc`] or
3766     * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to this event. See
3767     * their docs for more information.
3768     *
3769     * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
3770     * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
3771     * [`ChannelManager::forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
3772     * [`ChannelManager::fail_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::fail_intercepted_htlc
3773     */
3774    LDKEvent_HTLCIntercepted,
3775    /**
3776     * Used to indicate that an output which you should know how to spend was confirmed on chain
3777     * and is now spendable.
3778     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
3779     * counterparty spending them due to some kind of timeout. Thus, you need to store them
3780     * somewhere and spend them when you create on-chain transactions.
3781     */
3782    LDKEvent_SpendableOutputs,
3783    /**
3784     * This event is generated when a payment has been successfully forwarded through us and a
3785     * forwarding fee earned.
3786     */
3787    LDKEvent_PaymentForwarded,
3788    /**
3789     * Used to indicate that a channel with the given `channel_id` is ready to
3790     * be used. This event is emitted either when the funding transaction has been confirmed
3791     * on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel
3792     * establishment.
3793     */
3794    LDKEvent_ChannelReady,
3795    /**
3796     * Used to indicate that a previously opened channel with the given `channel_id` is in the
3797     * process of closure.
3798     */
3799    LDKEvent_ChannelClosed,
3800    /**
3801     * Used to indicate to the user that they can abandon the funding transaction and recycle the
3802     * inputs for another purpose.
3803     */
3804    LDKEvent_DiscardFunding,
3805    /**
3806     * Indicates a request to open a new channel by a peer.
3807     *
3808     * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the
3809     * request, call [`ChannelManager::force_close_without_broadcasting_txn`].
3810     *
3811     * The event is only triggered when a new open channel request is received and the
3812     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
3813     *
3814     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3815     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
3816     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
3817     */
3818    LDKEvent_OpenChannelRequest,
3819    /**
3820     * Indicates that the HTLC was accepted, but could not be processed when or after attempting to
3821     * forward it.
3822     *
3823     * Some scenarios where this event may be sent include:
3824     * * Insufficient capacity in the outbound channel
3825     * * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes
3826     * * When an unknown SCID is requested for forwarding a payment.
3827     * * Claiming an amount for an MPP payment that exceeds the HTLC total
3828     * * The HTLC has timed out
3829     *
3830     * This event, however, does not get generated if an HTLC fails to meet the forwarding
3831     * requirements (i.e. insufficient fees paid, or a CLTV that is too soon).
3832     */
3833    LDKEvent_HTLCHandlingFailed,
3834    /**
3835     * Must be last for serialization purposes
3836     */
3837    LDKEvent_Sentinel,
3838 } LDKEvent_Tag;
3839
3840 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
3841    /**
3842     * The random channel_id we picked which you'll need to pass into
3843     * [`ChannelManager::funding_transaction_generated`].
3844     *
3845     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
3846     */
3847    struct LDKThirtyTwoBytes temporary_channel_id;
3848    /**
3849     * The counterparty's node_id, which you'll need to pass back into
3850     * [`ChannelManager::funding_transaction_generated`].
3851     *
3852     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
3853     */
3854    struct LDKPublicKey counterparty_node_id;
3855    /**
3856     * The value, in satoshis, that the output should have.
3857     */
3858    uint64_t channel_value_satoshis;
3859    /**
3860     * The script which should be used in the transaction output.
3861     */
3862    struct LDKCVec_u8Z output_script;
3863    /**
3864     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or a
3865     * random value for an inbound channel. This may be zero for objects serialized with LDK
3866     * versions prior to 0.0.113.
3867     *
3868     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
3869     */
3870    struct LDKU128 user_channel_id;
3871 } LDKEvent_LDKFundingGenerationReady_Body;
3872
3873 typedef struct LDKEvent_LDKPaymentClaimable_Body {
3874    /**
3875     * The node that will receive the payment after it has been claimed.
3876     * This is useful to identify payments received via [phantom nodes].
3877     * This field will always be filled in when the event was generated by LDK versions
3878     * 0.0.113 and above.
3879     *
3880     * [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager
3881     *
3882     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3883     */
3884    struct LDKPublicKey receiver_node_id;
3885    /**
3886     * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
3887     * not stop you from registering duplicate payment hashes for inbound payments.
3888     */
3889    struct LDKThirtyTwoBytes payment_hash;
3890    /**
3891     * The value, in thousandths of a satoshi, that this payment is for.
3892     */
3893    uint64_t amount_msat;
3894    /**
3895     * Information for claiming this received payment, based on whether the purpose of the
3896     * payment is to pay an invoice or to send a spontaneous payment.
3897     */
3898    struct LDKPaymentPurpose purpose;
3899    /**
3900     * The `channel_id` indicating over which channel we received the payment.
3901     *
3902     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3903     */
3904    struct LDKThirtyTwoBytes via_channel_id;
3905    /**
3906     * The `user_channel_id` indicating over which channel we received the payment.
3907     */
3908    struct LDKCOption_u128Z via_user_channel_id;
3909 } LDKEvent_LDKPaymentClaimable_Body;
3910
3911 typedef struct LDKEvent_LDKPaymentClaimed_Body {
3912    /**
3913     * The node that received the payment.
3914     * This is useful to identify payments which were received via [phantom nodes].
3915     * This field will always be filled in when the event was generated by LDK versions
3916     * 0.0.113 and above.
3917     *
3918     * [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager
3919     *
3920     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3921     */
3922    struct LDKPublicKey receiver_node_id;
3923    /**
3924     * The payment hash of the claimed payment. Note that LDK will not stop you from
3925     * registering duplicate payment hashes for inbound payments.
3926     */
3927    struct LDKThirtyTwoBytes payment_hash;
3928    /**
3929     * The value, in thousandths of a satoshi, that this payment is for.
3930     */
3931    uint64_t amount_msat;
3932    /**
3933     * The purpose of the claimed payment, i.e. whether the payment was for an invoice or a
3934     * spontaneous payment.
3935     */
3936    struct LDKPaymentPurpose purpose;
3937 } LDKEvent_LDKPaymentClaimed_Body;
3938
3939 typedef struct LDKEvent_LDKPaymentSent_Body {
3940    /**
3941     * The id returned by [`ChannelManager::send_payment`].
3942     *
3943     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3944     *
3945     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3946     */
3947    struct LDKThirtyTwoBytes payment_id;
3948    /**
3949     * The preimage to the hash given to ChannelManager::send_payment.
3950     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
3951     * store it somehow!
3952     */
3953    struct LDKThirtyTwoBytes payment_preimage;
3954    /**
3955     * The hash that was given to [`ChannelManager::send_payment`].
3956     *
3957     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3958     */
3959    struct LDKThirtyTwoBytes payment_hash;
3960    /**
3961     * The total fee which was spent at intermediate hops in this payment, across all paths.
3962     *
3963     * Note that, like [`Route::get_total_fees`] this does *not* include any potential
3964     * overpayment to the recipient node.
3965     *
3966     * If the recipient or an intermediate node misbehaves and gives us free money, this may
3967     * overstate the amount paid, though this is unlikely.
3968     *
3969     * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
3970     */
3971    struct LDKCOption_u64Z fee_paid_msat;
3972 } LDKEvent_LDKPaymentSent_Body;
3973
3974 typedef struct LDKEvent_LDKPaymentFailed_Body {
3975    /**
3976     * The id returned by [`ChannelManager::send_payment`] and used with
3977     * [`ChannelManager::abandon_payment`].
3978     *
3979     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3980     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3981     */
3982    struct LDKThirtyTwoBytes payment_id;
3983    /**
3984     * The hash that was given to [`ChannelManager::send_payment`].
3985     *
3986     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3987     */
3988    struct LDKThirtyTwoBytes payment_hash;
3989 } LDKEvent_LDKPaymentFailed_Body;
3990
3991 typedef struct LDKEvent_LDKPaymentPathSuccessful_Body {
3992    /**
3993     * The id returned by [`ChannelManager::send_payment`].
3994     *
3995     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3996     */
3997    struct LDKThirtyTwoBytes payment_id;
3998    /**
3999     * The hash that was given to [`ChannelManager::send_payment`].
4000     *
4001     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
4002     *
4003     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
4004     */
4005    struct LDKThirtyTwoBytes payment_hash;
4006    /**
4007     * The payment path that was successful.
4008     *
4009     * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
4010     */
4011    struct LDKCVec_RouteHopZ path;
4012 } LDKEvent_LDKPaymentPathSuccessful_Body;
4013
4014 typedef struct LDKEvent_LDKPaymentPathFailed_Body {
4015    /**
4016     * The id returned by [`ChannelManager::send_payment`] and used with
4017     * [`ChannelManager::abandon_payment`].
4018     *
4019     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
4020     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
4021     *
4022     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
4023     */
4024    struct LDKThirtyTwoBytes payment_id;
4025    /**
4026     * The hash that was given to [`ChannelManager::send_payment`].
4027     *
4028     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
4029     */
4030    struct LDKThirtyTwoBytes payment_hash;
4031    /**
4032     * Indicates the payment was rejected for some reason by the recipient. This implies that
4033     * the payment has failed, not just the route in question. If this is not set, the payment may
4034     * be retried via a different route.
4035     */
4036    bool payment_failed_permanently;
4037    /**
4038     * Extra error details based on the failure type. May contain an update that needs to be
4039     * applied to the [`NetworkGraph`].
4040     *
4041     * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
4042     */
4043    struct LDKPathFailure failure;
4044    /**
4045     * The payment path that failed.
4046     */
4047    struct LDKCVec_RouteHopZ path;
4048    /**
4049     * The channel responsible for the failed payment path.
4050     *
4051     * Note that for route hints or for the first hop in a path this may be an SCID alias and
4052     * may not refer to a channel in the public network graph. These aliases may also collide
4053     * with channels in the public network graph.
4054     *
4055     * If this is `Some`, then the corresponding channel should be avoided when the payment is
4056     * retried. May be `None` for older [`Event`] serializations.
4057     */
4058    struct LDKCOption_u64Z short_channel_id;
4059    /**
4060     * Parameters used by LDK to compute a new [`Route`] when retrying the failed payment path.
4061     *
4062     * [`Route`]: crate::routing::router::Route
4063     *
4064     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
4065     */
4066    struct LDKRouteParameters retry;
4067 } LDKEvent_LDKPaymentPathFailed_Body;
4068
4069 typedef struct LDKEvent_LDKProbeSuccessful_Body {
4070    /**
4071     * The id returned by [`ChannelManager::send_probe`].
4072     *
4073     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
4074     */
4075    struct LDKThirtyTwoBytes payment_id;
4076    /**
4077     * The hash generated by [`ChannelManager::send_probe`].
4078     *
4079     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
4080     */
4081    struct LDKThirtyTwoBytes payment_hash;
4082    /**
4083     * The payment path that was successful.
4084     */
4085    struct LDKCVec_RouteHopZ path;
4086 } LDKEvent_LDKProbeSuccessful_Body;
4087
4088 typedef struct LDKEvent_LDKProbeFailed_Body {
4089    /**
4090     * The id returned by [`ChannelManager::send_probe`].
4091     *
4092     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
4093     */
4094    struct LDKThirtyTwoBytes payment_id;
4095    /**
4096     * The hash generated by [`ChannelManager::send_probe`].
4097     *
4098     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
4099     */
4100    struct LDKThirtyTwoBytes payment_hash;
4101    /**
4102     * The payment path that failed.
4103     */
4104    struct LDKCVec_RouteHopZ path;
4105    /**
4106     * The channel responsible for the failed probe.
4107     *
4108     * Note that for route hints or for the first hop in a path this may be an SCID alias and
4109     * may not refer to a channel in the public network graph. These aliases may also collide
4110     * with channels in the public network graph.
4111     */
4112    struct LDKCOption_u64Z short_channel_id;
4113 } LDKEvent_LDKProbeFailed_Body;
4114
4115 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
4116    /**
4117     * The minimum amount of time that should be waited prior to calling
4118     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
4119     * you should wait a random amount of time in roughly the range (now + time_forwardable,
4120     * now + 5*time_forwardable).
4121     */
4122    uint64_t time_forwardable;
4123 } LDKEvent_LDKPendingHTLCsForwardable_Body;
4124
4125 typedef struct LDKEvent_LDKHTLCIntercepted_Body {
4126    /**
4127     * An id to help LDK identify which HTLC is being forwarded or failed.
4128     */
4129    struct LDKThirtyTwoBytes intercept_id;
4130    /**
4131     * The fake scid that was programmed as the next hop's scid, generated using
4132     * [`ChannelManager::get_intercept_scid`].
4133     *
4134     * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
4135     */
4136    uint64_t requested_next_hop_scid;
4137    /**
4138     * The payment hash used for this HTLC.
4139     */
4140    struct LDKThirtyTwoBytes payment_hash;
4141    /**
4142     * How many msats were received on the inbound edge of this HTLC.
4143     */
4144    uint64_t inbound_amount_msat;
4145    /**
4146     * How many msats the payer intended to route to the next node. Depending on the reason you are
4147     * intercepting this payment, you might take a fee by forwarding less than this amount.
4148     *
4149     * Note that LDK will NOT check that expected fees were factored into this value. You MUST
4150     * check that whatever fee you want has been included here or subtract it as required. Further,
4151     * LDK will not stop you from forwarding more than you received.
4152     */
4153    uint64_t expected_outbound_amount_msat;
4154 } LDKEvent_LDKHTLCIntercepted_Body;
4155
4156 typedef struct LDKEvent_LDKSpendableOutputs_Body {
4157    /**
4158     * The outputs which you should store as spendable by you.
4159     */
4160    struct LDKCVec_SpendableOutputDescriptorZ outputs;
4161 } LDKEvent_LDKSpendableOutputs_Body;
4162
4163 typedef struct LDKEvent_LDKPaymentForwarded_Body {
4164    /**
4165     * The incoming channel between the previous node and us. This is only `None` for events
4166     * generated or serialized by versions prior to 0.0.107.
4167     *
4168     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
4169     */
4170    struct LDKThirtyTwoBytes prev_channel_id;
4171    /**
4172     * The outgoing channel between the next node and us. This is only `None` for events
4173     * generated or serialized by versions prior to 0.0.107.
4174     *
4175     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
4176     */
4177    struct LDKThirtyTwoBytes next_channel_id;
4178    /**
4179     * The fee, in milli-satoshis, which was earned as a result of the payment.
4180     *
4181     * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
4182     * was pending, the amount the next hop claimed will have been rounded down to the nearest
4183     * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
4184     * claimed the full value in millisatoshis from the source. In this case,
4185     * `claim_from_onchain_tx` will be set.
4186     *
4187     * If the channel which sent us the payment has been force-closed, we will claim the funds
4188     * via an on-chain transaction. In that case we do not yet know the on-chain transaction
4189     * fees which we will spend and will instead set this to `None`. It is possible duplicate
4190     * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
4191     * `None`.
4192     */
4193    struct LDKCOption_u64Z fee_earned_msat;
4194    /**
4195     * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
4196     * transaction.
4197     */
4198    bool claim_from_onchain_tx;
4199 } LDKEvent_LDKPaymentForwarded_Body;
4200
4201 typedef struct LDKEvent_LDKChannelReady_Body {
4202    /**
4203     * The channel_id of the channel that is ready.
4204     */
4205    struct LDKThirtyTwoBytes channel_id;
4206    /**
4207     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
4208     * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
4209     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
4210     * `user_channel_id` will be randomized for an inbound channel.
4211     *
4212     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
4213     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
4214     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
4215     */
4216    struct LDKU128 user_channel_id;
4217    /**
4218     * The node_id of the channel counterparty.
4219     */
4220    struct LDKPublicKey counterparty_node_id;
4221    /**
4222     * The features that this channel will operate with.
4223     */
4224    struct LDKChannelTypeFeatures channel_type;
4225 } LDKEvent_LDKChannelReady_Body;
4226
4227 typedef struct LDKEvent_LDKChannelClosed_Body {
4228    /**
4229     * The channel_id of the channel which has been closed. Note that on-chain transactions
4230     * resolving the channel are likely still awaiting confirmation.
4231     */
4232    struct LDKThirtyTwoBytes channel_id;
4233    /**
4234     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
4235     * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
4236     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
4237     * `user_channel_id` will be randomized for inbound channels.
4238     * This may be zero for inbound channels serialized prior to 0.0.113 and will always be
4239     * zero for objects serialized with LDK versions prior to 0.0.102.
4240     *
4241     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
4242     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
4243     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
4244     */
4245    struct LDKU128 user_channel_id;
4246    /**
4247     * The reason the channel was closed.
4248     */
4249    struct LDKClosureReason reason;
4250 } LDKEvent_LDKChannelClosed_Body;
4251
4252 typedef struct LDKEvent_LDKDiscardFunding_Body {
4253    /**
4254     * The channel_id of the channel which has been closed.
4255     */
4256    struct LDKThirtyTwoBytes channel_id;
4257    /**
4258     * The full transaction received from the user
4259     */
4260    struct LDKTransaction transaction;
4261 } LDKEvent_LDKDiscardFunding_Body;
4262
4263 typedef struct LDKEvent_LDKOpenChannelRequest_Body {
4264    /**
4265     * The temporary channel ID of the channel requested to be opened.
4266     *
4267     * When responding to the request, the `temporary_channel_id` should be passed
4268     * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
4269     * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject.
4270     *
4271     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
4272     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
4273     */
4274    struct LDKThirtyTwoBytes temporary_channel_id;
4275    /**
4276     * The node_id of the counterparty requesting to open the channel.
4277     *
4278     * When responding to the request, the `counterparty_node_id` should be passed
4279     * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
4280     * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
4281     * request.
4282     *
4283     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
4284     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
4285     */
4286    struct LDKPublicKey counterparty_node_id;
4287    /**
4288     * The channel value of the requested channel.
4289     */
4290    uint64_t funding_satoshis;
4291    /**
4292     * Our starting balance in the channel if the request is accepted, in milli-satoshi.
4293     */
4294    uint64_t push_msat;
4295    /**
4296     * The features that this channel will operate with. If you reject the channel, a
4297     * well-behaved counterparty may automatically re-attempt the channel with a new set of
4298     * feature flags.
4299     *
4300     * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
4301     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
4302     * 0.0.106.
4303     *
4304     * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
4305     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
4306     * 0.0.107. Channels setting this type also need to get manually accepted via
4307     * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
4308     * or will be rejected otherwise.
4309     *
4310     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
4311     */
4312    struct LDKChannelTypeFeatures channel_type;
4313 } LDKEvent_LDKOpenChannelRequest_Body;
4314
4315 typedef struct LDKEvent_LDKHTLCHandlingFailed_Body {
4316    /**
4317     * The channel over which the HTLC was received.
4318     */
4319    struct LDKThirtyTwoBytes prev_channel_id;
4320    /**
4321     * Destination of the HTLC that failed to be processed.
4322     */
4323    struct LDKHTLCDestination failed_next_destination;
4324 } LDKEvent_LDKHTLCHandlingFailed_Body;
4325
4326 typedef struct MUST_USE_STRUCT LDKEvent {
4327    LDKEvent_Tag tag;
4328    union {
4329       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
4330       LDKEvent_LDKPaymentClaimable_Body payment_claimable;
4331       LDKEvent_LDKPaymentClaimed_Body payment_claimed;
4332       LDKEvent_LDKPaymentSent_Body payment_sent;
4333       LDKEvent_LDKPaymentFailed_Body payment_failed;
4334       LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful;
4335       LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
4336       LDKEvent_LDKProbeSuccessful_Body probe_successful;
4337       LDKEvent_LDKProbeFailed_Body probe_failed;
4338       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
4339       LDKEvent_LDKHTLCIntercepted_Body htlc_intercepted;
4340       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
4341       LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
4342       LDKEvent_LDKChannelReady_Body channel_ready;
4343       LDKEvent_LDKChannelClosed_Body channel_closed;
4344       LDKEvent_LDKDiscardFunding_Body discard_funding;
4345       LDKEvent_LDKOpenChannelRequest_Body open_channel_request;
4346       LDKEvent_LDKHTLCHandlingFailed_Body htlc_handling_failed;
4347    };
4348 } LDKEvent;
4349
4350 /**
4351  * An enum which can either contain a crate::lightning::util::events::Event or not
4352  */
4353 typedef enum LDKCOption_EventZ_Tag {
4354    /**
4355     * When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
4356     */
4357    LDKCOption_EventZ_Some,
4358    /**
4359     * When we're in this state, this COption_EventZ contains nothing
4360     */
4361    LDKCOption_EventZ_None,
4362    /**
4363     * Must be last for serialization purposes
4364     */
4365    LDKCOption_EventZ_Sentinel,
4366 } LDKCOption_EventZ_Tag;
4367
4368 typedef struct LDKCOption_EventZ {
4369    LDKCOption_EventZ_Tag tag;
4370    union {
4371       struct {
4372          struct LDKEvent some;
4373       };
4374    };
4375 } LDKCOption_EventZ;
4376
4377 /**
4378  * The contents of CResult_COption_EventZDecodeErrorZ
4379  */
4380 typedef union LDKCResult_COption_EventZDecodeErrorZPtr {
4381    /**
4382     * A pointer to the contents in the success state.
4383     * Reading from this pointer when `result_ok` is not set is undefined.
4384     */
4385    struct LDKCOption_EventZ *result;
4386    /**
4387     * A pointer to the contents in the error state.
4388     * Reading from this pointer when `result_ok` is set is undefined.
4389     */
4390    struct LDKDecodeError *err;
4391 } LDKCResult_COption_EventZDecodeErrorZPtr;
4392
4393 /**
4394  * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
4395  * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4396  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4397  */
4398 typedef struct LDKCResult_COption_EventZDecodeErrorZ {
4399    /**
4400     * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
4401     * `err` or `result` depending on the state of `result_ok`.
4402     */
4403    union LDKCResult_COption_EventZDecodeErrorZPtr contents;
4404    /**
4405     * Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
4406     */
4407    bool result_ok;
4408 } LDKCResult_COption_EventZDecodeErrorZ;
4409
4410
4411
4412 /**
4413  * An [`accept_channel`] message to be sent to or received from a peer.
4414  *
4415  * [`accept_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel-message
4416  */
4417 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
4418    /**
4419     * A pointer to the opaque Rust object.
4420     * Nearly everywhere, inner must be non-null, however in places where
4421     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4422     */
4423    LDKnativeAcceptChannel *inner;
4424    /**
4425     * Indicates that this is the only struct which contains the same pointer.
4426     * Rust functions which take ownership of an object provided via an argument require
4427     * this to be true and invalidate the object pointed to by inner.
4428     */
4429    bool is_owned;
4430 } LDKAcceptChannel;
4431
4432
4433
4434 /**
4435  * An [`open_channel`] message to be sent to or received from a peer.
4436  *
4437  * [`open_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message
4438  */
4439 typedef struct MUST_USE_STRUCT LDKOpenChannel {
4440    /**
4441     * A pointer to the opaque Rust object.
4442     * Nearly everywhere, inner must be non-null, however in places where
4443     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4444     */
4445    LDKnativeOpenChannel *inner;
4446    /**
4447     * Indicates that this is the only struct which contains the same pointer.
4448     * Rust functions which take ownership of an object provided via an argument require
4449     * this to be true and invalidate the object pointed to by inner.
4450     */
4451    bool is_owned;
4452 } LDKOpenChannel;
4453
4454
4455
4456 /**
4457  * A [`funding_created`] message to be sent to or received from a peer.
4458  *
4459  * [`funding_created`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_created-message
4460  */
4461 typedef struct MUST_USE_STRUCT LDKFundingCreated {
4462    /**
4463     * A pointer to the opaque Rust object.
4464     * Nearly everywhere, inner must be non-null, however in places where
4465     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4466     */
4467    LDKnativeFundingCreated *inner;
4468    /**
4469     * Indicates that this is the only struct which contains the same pointer.
4470     * Rust functions which take ownership of an object provided via an argument require
4471     * this to be true and invalidate the object pointed to by inner.
4472     */
4473    bool is_owned;
4474 } LDKFundingCreated;
4475
4476
4477
4478 /**
4479  * A [`funding_signed`] message to be sent to or received from a peer.
4480  *
4481  * [`funding_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_signed-message
4482  */
4483 typedef struct MUST_USE_STRUCT LDKFundingSigned {
4484    /**
4485     * A pointer to the opaque Rust object.
4486     * Nearly everywhere, inner must be non-null, however in places where
4487     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4488     */
4489    LDKnativeFundingSigned *inner;
4490    /**
4491     * Indicates that this is the only struct which contains the same pointer.
4492     * Rust functions which take ownership of an object provided via an argument require
4493     * this to be true and invalidate the object pointed to by inner.
4494     */
4495    bool is_owned;
4496 } LDKFundingSigned;
4497
4498
4499
4500 /**
4501  * A [`channel_ready`] message to be sent to or received from a peer.
4502  *
4503  * [`channel_ready`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-channel_ready-message
4504  */
4505 typedef struct MUST_USE_STRUCT LDKChannelReady {
4506    /**
4507     * A pointer to the opaque Rust object.
4508     * Nearly everywhere, inner must be non-null, however in places where
4509     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4510     */
4511    LDKnativeChannelReady *inner;
4512    /**
4513     * Indicates that this is the only struct which contains the same pointer.
4514     * Rust functions which take ownership of an object provided via an argument require
4515     * this to be true and invalidate the object pointed to by inner.
4516     */
4517    bool is_owned;
4518 } LDKChannelReady;
4519
4520
4521
4522 /**
4523  * An [`announcement_signatures`] message to be sent to or received from a peer.
4524  *
4525  * [`announcement_signatures`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-announcement_signatures-message
4526  */
4527 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
4528    /**
4529     * A pointer to the opaque Rust object.
4530     * Nearly everywhere, inner must be non-null, however in places where
4531     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4532     */
4533    LDKnativeAnnouncementSignatures *inner;
4534    /**
4535     * Indicates that this is the only struct which contains the same pointer.
4536     * Rust functions which take ownership of an object provided via an argument require
4537     * this to be true and invalidate the object pointed to by inner.
4538     */
4539    bool is_owned;
4540 } LDKAnnouncementSignatures;
4541
4542
4543
4544 /**
4545  * Struct used to return values from [`RevokeAndACK`] messages, containing a bunch of commitment
4546  * transaction updates if they were pending.
4547  */
4548 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
4549    /**
4550     * A pointer to the opaque Rust object.
4551     * Nearly everywhere, inner must be non-null, however in places where
4552     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4553     */
4554    LDKnativeCommitmentUpdate *inner;
4555    /**
4556     * Indicates that this is the only struct which contains the same pointer.
4557     * Rust functions which take ownership of an object provided via an argument require
4558     * this to be true and invalidate the object pointed to by inner.
4559     */
4560    bool is_owned;
4561 } LDKCommitmentUpdate;
4562
4563
4564
4565 /**
4566  * A [`revoke_and_ack`] message to be sent to or received from a peer.
4567  *
4568  * [`revoke_and_ack`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#completing-the-transition-to-the-updated-state-revoke_and_ack
4569  */
4570 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
4571    /**
4572     * A pointer to the opaque Rust object.
4573     * Nearly everywhere, inner must be non-null, however in places where
4574     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4575     */
4576    LDKnativeRevokeAndACK *inner;
4577    /**
4578     * Indicates that this is the only struct which contains the same pointer.
4579     * Rust functions which take ownership of an object provided via an argument require
4580     * this to be true and invalidate the object pointed to by inner.
4581     */
4582    bool is_owned;
4583 } LDKRevokeAndACK;
4584
4585
4586
4587 /**
4588  * A [`closing_signed`] message to be sent to or received from a peer.
4589  *
4590  * [`closing_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-negotiation-closing_signed
4591  */
4592 typedef struct MUST_USE_STRUCT LDKClosingSigned {
4593    /**
4594     * A pointer to the opaque Rust object.
4595     * Nearly everywhere, inner must be non-null, however in places where
4596     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4597     */
4598    LDKnativeClosingSigned *inner;
4599    /**
4600     * Indicates that this is the only struct which contains the same pointer.
4601     * Rust functions which take ownership of an object provided via an argument require
4602     * this to be true and invalidate the object pointed to by inner.
4603     */
4604    bool is_owned;
4605 } LDKClosingSigned;
4606
4607
4608
4609 /**
4610  * A [`shutdown`] message to be sent to or received from a peer.
4611  *
4612  * [`shutdown`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-initiation-shutdown
4613  */
4614 typedef struct MUST_USE_STRUCT LDKShutdown {
4615    /**
4616     * A pointer to the opaque Rust object.
4617     * Nearly everywhere, inner must be non-null, however in places where
4618     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4619     */
4620    LDKnativeShutdown *inner;
4621    /**
4622     * Indicates that this is the only struct which contains the same pointer.
4623     * Rust functions which take ownership of an object provided via an argument require
4624     * this to be true and invalidate the object pointed to by inner.
4625     */
4626    bool is_owned;
4627 } LDKShutdown;
4628
4629
4630
4631 /**
4632  * A [`channel_reestablish`] message to be sent to or received from a peer.
4633  *
4634  * [`channel_reestablish`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#message-retransmission
4635  */
4636 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
4637    /**
4638     * A pointer to the opaque Rust object.
4639     * Nearly everywhere, inner must be non-null, however in places where
4640     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4641     */
4642    LDKnativeChannelReestablish *inner;
4643    /**
4644     * Indicates that this is the only struct which contains the same pointer.
4645     * Rust functions which take ownership of an object provided via an argument require
4646     * this to be true and invalidate the object pointed to by inner.
4647     */
4648    bool is_owned;
4649 } LDKChannelReestablish;
4650
4651
4652
4653 /**
4654  * A [`channel_announcement`] message to be sent to or received from a peer.
4655  *
4656  * [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message
4657  */
4658 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
4659    /**
4660     * A pointer to the opaque Rust object.
4661     * Nearly everywhere, inner must be non-null, however in places where
4662     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4663     */
4664    LDKnativeChannelAnnouncement *inner;
4665    /**
4666     * Indicates that this is the only struct which contains the same pointer.
4667     * Rust functions which take ownership of an object provided via an argument require
4668     * this to be true and invalidate the object pointed to by inner.
4669     */
4670    bool is_owned;
4671 } LDKChannelAnnouncement;
4672
4673
4674
4675 /**
4676  * A [`node_announcement`] message to be sent to or received from a peer.
4677  *
4678  * [`node_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-node_announcement-message
4679  */
4680 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
4681    /**
4682     * A pointer to the opaque Rust object.
4683     * Nearly everywhere, inner must be non-null, however in places where
4684     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4685     */
4686    LDKnativeNodeAnnouncement *inner;
4687    /**
4688     * Indicates that this is the only struct which contains the same pointer.
4689     * Rust functions which take ownership of an object provided via an argument require
4690     * this to be true and invalidate the object pointed to by inner.
4691     */
4692    bool is_owned;
4693 } LDKNodeAnnouncement;
4694
4695
4696
4697 /**
4698  * An [`error`] message to be sent to or received from a peer.
4699  *
4700  * [`error`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-error-and-warning-messages
4701  */
4702 typedef struct MUST_USE_STRUCT LDKErrorMessage {
4703    /**
4704     * A pointer to the opaque Rust object.
4705     * Nearly everywhere, inner must be non-null, however in places where
4706     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4707     */
4708    LDKnativeErrorMessage *inner;
4709    /**
4710     * Indicates that this is the only struct which contains the same pointer.
4711     * Rust functions which take ownership of an object provided via an argument require
4712     * this to be true and invalidate the object pointed to by inner.
4713     */
4714    bool is_owned;
4715 } LDKErrorMessage;
4716
4717
4718
4719 /**
4720  * A [`warning`] message to be sent to or received from a peer.
4721  *
4722  * [`warning`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-error-and-warning-messages
4723  */
4724 typedef struct MUST_USE_STRUCT LDKWarningMessage {
4725    /**
4726     * A pointer to the opaque Rust object.
4727     * Nearly everywhere, inner must be non-null, however in places where
4728     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4729     */
4730    LDKnativeWarningMessage *inner;
4731    /**
4732     * Indicates that this is the only struct which contains the same pointer.
4733     * Rust functions which take ownership of an object provided via an argument require
4734     * this to be true and invalidate the object pointed to by inner.
4735     */
4736    bool is_owned;
4737 } LDKWarningMessage;
4738
4739 /**
4740  * Used to put an error message in a [`LightningError`].
4741  */
4742 typedef enum LDKErrorAction_Tag {
4743    /**
4744     * The peer took some action which made us think they were useless. Disconnect them.
4745     */
4746    LDKErrorAction_DisconnectPeer,
4747    /**
4748     * The peer did something harmless that we weren't able to process, just log and ignore
4749     */
4750    LDKErrorAction_IgnoreError,
4751    /**
4752     * The peer did something harmless that we weren't able to meaningfully process.
4753     * If the error is logged, log it at the given level.
4754     */
4755    LDKErrorAction_IgnoreAndLog,
4756    /**
4757     * The peer provided us with a gossip message which we'd already seen. In most cases this
4758     * should be ignored, but it may result in the message being forwarded if it is a duplicate of
4759     * our own channel announcements.
4760     */
4761    LDKErrorAction_IgnoreDuplicateGossip,
4762    /**
4763     * The peer did something incorrect. Tell them.
4764     */
4765    LDKErrorAction_SendErrorMessage,
4766    /**
4767     * The peer did something incorrect. Tell them without closing any channels.
4768     */
4769    LDKErrorAction_SendWarningMessage,
4770    /**
4771     * Must be last for serialization purposes
4772     */
4773    LDKErrorAction_Sentinel,
4774 } LDKErrorAction_Tag;
4775
4776 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
4777    /**
4778     * An error message which we should make an effort to send before we disconnect.
4779     *
4780     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
4781     */
4782    struct LDKErrorMessage msg;
4783 } LDKErrorAction_LDKDisconnectPeer_Body;
4784
4785 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
4786    /**
4787     * The message to send.
4788     */
4789    struct LDKErrorMessage msg;
4790 } LDKErrorAction_LDKSendErrorMessage_Body;
4791
4792 typedef struct LDKErrorAction_LDKSendWarningMessage_Body {
4793    /**
4794     * The message to send.
4795     */
4796    struct LDKWarningMessage msg;
4797    /**
4798     * The peer may have done something harmless that we weren't able to meaningfully process,
4799     * though we should still tell them about it.
4800     * If this event is logged, log it at the given level.
4801     */
4802    enum LDKLevel log_level;
4803 } LDKErrorAction_LDKSendWarningMessage_Body;
4804
4805 typedef struct MUST_USE_STRUCT LDKErrorAction {
4806    LDKErrorAction_Tag tag;
4807    union {
4808       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
4809       struct {
4810          enum LDKLevel ignore_and_log;
4811       };
4812       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
4813       LDKErrorAction_LDKSendWarningMessage_Body send_warning_message;
4814    };
4815 } LDKErrorAction;
4816
4817
4818
4819 /**
4820  * A [`query_channel_range`] message is used to query a peer for channel
4821  * UTXOs in a range of blocks. The recipient of a query makes a best
4822  * effort to reply to the query using one or more [`ReplyChannelRange`]
4823  * messages.
4824  *
4825  * [`query_channel_range`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_channel_range-and-reply_channel_range-messages
4826  */
4827 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
4828    /**
4829     * A pointer to the opaque Rust object.
4830     * Nearly everywhere, inner must be non-null, however in places where
4831     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4832     */
4833    LDKnativeQueryChannelRange *inner;
4834    /**
4835     * Indicates that this is the only struct which contains the same pointer.
4836     * Rust functions which take ownership of an object provided via an argument require
4837     * this to be true and invalidate the object pointed to by inner.
4838     */
4839    bool is_owned;
4840 } LDKQueryChannelRange;
4841
4842
4843
4844 /**
4845  * A [`query_short_channel_ids`] message is used to query a peer for
4846  * routing gossip messages related to one or more `short_channel_id`s.
4847  *
4848  * The query recipient will reply with the latest, if available,
4849  * [`ChannelAnnouncement`], [`ChannelUpdate`] and [`NodeAnnouncement`] messages
4850  * it maintains for the requested `short_channel_id`s followed by a
4851  * [`ReplyShortChannelIdsEnd`] message. The `short_channel_id`s sent in
4852  * this query are encoded. We only support `encoding_type=0` uncompressed
4853  * serialization and do not support `encoding_type=1` zlib serialization.
4854  *
4855  * [`query_short_channel_ids`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_short_channel_idsreply_short_channel_ids_end-messages
4856  */
4857 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
4858    /**
4859     * A pointer to the opaque Rust object.
4860     * Nearly everywhere, inner must be non-null, however in places where
4861     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4862     */
4863    LDKnativeQueryShortChannelIds *inner;
4864    /**
4865     * Indicates that this is the only struct which contains the same pointer.
4866     * Rust functions which take ownership of an object provided via an argument require
4867     * this to be true and invalidate the object pointed to by inner.
4868     */
4869    bool is_owned;
4870 } LDKQueryShortChannelIds;
4871
4872
4873
4874 /**
4875  * A [`reply_channel_range`] message is a reply to a [`QueryChannelRange`]
4876  * message.
4877  *
4878  * Multiple `reply_channel_range` messages can be sent in reply
4879  * to a single [`QueryChannelRange`] message. The query recipient makes a
4880  * best effort to respond based on their local network view which may
4881  * not be a perfect view of the network. The `short_channel_id`s in the
4882  * reply are encoded. We only support `encoding_type=0` uncompressed
4883  * serialization and do not support `encoding_type=1` zlib serialization.
4884  *
4885  * [`reply_channel_range`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_channel_range-and-reply_channel_range-messages
4886  */
4887 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
4888    /**
4889     * A pointer to the opaque Rust object.
4890     * Nearly everywhere, inner must be non-null, however in places where
4891     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4892     */
4893    LDKnativeReplyChannelRange *inner;
4894    /**
4895     * Indicates that this is the only struct which contains the same pointer.
4896     * Rust functions which take ownership of an object provided via an argument require
4897     * this to be true and invalidate the object pointed to by inner.
4898     */
4899    bool is_owned;
4900 } LDKReplyChannelRange;
4901
4902
4903
4904 /**
4905  * A [`gossip_timestamp_filter`] message is used by a node to request
4906  * gossip relay for messages in the requested time range when the
4907  * `gossip_queries` feature has been negotiated.
4908  *
4909  * [`gossip_timestamp_filter`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-gossip_timestamp_filter-message
4910  */
4911 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
4912    /**
4913     * A pointer to the opaque Rust object.
4914     * Nearly everywhere, inner must be non-null, however in places where
4915     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4916     */
4917    LDKnativeGossipTimestampFilter *inner;
4918    /**
4919     * Indicates that this is the only struct which contains the same pointer.
4920     * Rust functions which take ownership of an object provided via an argument require
4921     * this to be true and invalidate the object pointed to by inner.
4922     */
4923    bool is_owned;
4924 } LDKGossipTimestampFilter;
4925
4926 /**
4927  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
4928  * broadcast to most peers).
4929  * These events are handled by PeerManager::process_events if you are using a PeerManager.
4930  */
4931 typedef enum LDKMessageSendEvent_Tag {
4932    /**
4933     * Used to indicate that we've accepted a channel open and should send the accept_channel
4934     * message provided to the given peer.
4935     */
4936    LDKMessageSendEvent_SendAcceptChannel,
4937    /**
4938     * Used to indicate that we've initiated a channel open and should send the open_channel
4939     * message provided to the given peer.
4940     */
4941    LDKMessageSendEvent_SendOpenChannel,
4942    /**
4943     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
4944     */
4945    LDKMessageSendEvent_SendFundingCreated,
4946    /**
4947     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
4948     */
4949    LDKMessageSendEvent_SendFundingSigned,
4950    /**
4951     * Used to indicate that a channel_ready message should be sent to the peer with the given node_id.
4952     */
4953    LDKMessageSendEvent_SendChannelReady,
4954    /**
4955     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
4956     */
4957    LDKMessageSendEvent_SendAnnouncementSignatures,
4958    /**
4959     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
4960     * message should be sent to the peer with the given node_id.
4961     */
4962    LDKMessageSendEvent_UpdateHTLCs,
4963    /**
4964     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
4965     */
4966    LDKMessageSendEvent_SendRevokeAndACK,
4967    /**
4968     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
4969     */
4970    LDKMessageSendEvent_SendClosingSigned,
4971    /**
4972     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
4973     */
4974    LDKMessageSendEvent_SendShutdown,
4975    /**
4976     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
4977     */
4978    LDKMessageSendEvent_SendChannelReestablish,
4979    /**
4980     * Used to send a channel_announcement and channel_update to a specific peer, likely on
4981     * initial connection to ensure our peers know about our channels.
4982     */
4983    LDKMessageSendEvent_SendChannelAnnouncement,
4984    /**
4985     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
4986     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
4987     *
4988     * Note that after doing so, you very likely (unless you did so very recently) want to
4989     * broadcast a node_announcement (e.g. via [`PeerManager::broadcast_node_announcement`]). This
4990     * ensures that any nodes which see our channel_announcement also have a relevant
4991     * node_announcement, including relevant feature flags which may be important for routing
4992     * through or to us.
4993     *
4994     * [`PeerManager::broadcast_node_announcement`]: crate::ln::peer_handler::PeerManager::broadcast_node_announcement
4995     */
4996    LDKMessageSendEvent_BroadcastChannelAnnouncement,
4997    /**
4998     * Used to indicate that a channel_update should be broadcast to all peers.
4999     */
5000    LDKMessageSendEvent_BroadcastChannelUpdate,
5001    /**
5002     * Used to indicate that a node_announcement should be broadcast to all peers.
5003     */
5004    LDKMessageSendEvent_BroadcastNodeAnnouncement,
5005    /**
5006     * Used to indicate that a channel_update should be sent to a single peer.
5007     * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
5008     * private channel and we shouldn't be informing all of our peers of channel parameters.
5009     */
5010    LDKMessageSendEvent_SendChannelUpdate,
5011    /**
5012     * Broadcast an error downstream to be handled
5013     */
5014    LDKMessageSendEvent_HandleError,
5015    /**
5016     * Query a peer for channels with funding transaction UTXOs in a block range.
5017     */
5018    LDKMessageSendEvent_SendChannelRangeQuery,
5019    /**
5020     * Request routing gossip messages from a peer for a list of channels identified by
5021     * their short_channel_ids.
5022     */
5023    LDKMessageSendEvent_SendShortIdsQuery,
5024    /**
5025     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
5026     * emitted during processing of the query.
5027     */
5028    LDKMessageSendEvent_SendReplyChannelRange,
5029    /**
5030     * Sends a timestamp filter for inbound gossip. This should be sent on each new connection to
5031     * enable receiving gossip messages from the peer.
5032     */
5033    LDKMessageSendEvent_SendGossipTimestampFilter,
5034    /**
5035     * Must be last for serialization purposes
5036     */
5037    LDKMessageSendEvent_Sentinel,
5038 } LDKMessageSendEvent_Tag;
5039
5040 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
5041    /**
5042     * The node_id of the node which should receive this message
5043     */
5044    struct LDKPublicKey node_id;
5045    /**
5046     * The message which should be sent.
5047     */
5048    struct LDKAcceptChannel msg;
5049 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
5050
5051 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
5052    /**
5053     * The node_id of the node which should receive this message
5054     */
5055    struct LDKPublicKey node_id;
5056    /**
5057     * The message which should be sent.
5058     */
5059    struct LDKOpenChannel msg;
5060 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
5061
5062 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
5063    /**
5064     * The node_id of the node which should receive this message
5065     */
5066    struct LDKPublicKey node_id;
5067    /**
5068     * The message which should be sent.
5069     */
5070    struct LDKFundingCreated msg;
5071 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
5072
5073 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
5074    /**
5075     * The node_id of the node which should receive this message
5076     */
5077    struct LDKPublicKey node_id;
5078    /**
5079     * The message which should be sent.
5080     */
5081    struct LDKFundingSigned msg;
5082 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
5083
5084 typedef struct LDKMessageSendEvent_LDKSendChannelReady_Body {
5085    /**
5086     * The node_id of the node which should receive these message(s)
5087     */
5088    struct LDKPublicKey node_id;
5089    /**
5090     * The channel_ready message which should be sent.
5091     */
5092    struct LDKChannelReady msg;
5093 } LDKMessageSendEvent_LDKSendChannelReady_Body;
5094
5095 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
5096    /**
5097     * The node_id of the node which should receive these message(s)
5098     */
5099    struct LDKPublicKey node_id;
5100    /**
5101     * The announcement_signatures message which should be sent.
5102     */
5103    struct LDKAnnouncementSignatures msg;
5104 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
5105
5106 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
5107    /**
5108     * The node_id of the node which should receive these message(s)
5109     */
5110    struct LDKPublicKey node_id;
5111    /**
5112     * The update messages which should be sent. ALL messages in the struct should be sent!
5113     */
5114    struct LDKCommitmentUpdate updates;
5115 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
5116
5117 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
5118    /**
5119     * The node_id of the node which should receive this message
5120     */
5121    struct LDKPublicKey node_id;
5122    /**
5123     * The message which should be sent.
5124     */
5125    struct LDKRevokeAndACK msg;
5126 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
5127
5128 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
5129    /**
5130     * The node_id of the node which should receive this message
5131     */
5132    struct LDKPublicKey node_id;
5133    /**
5134     * The message which should be sent.
5135     */
5136    struct LDKClosingSigned msg;
5137 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
5138
5139 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
5140    /**
5141     * The node_id of the node which should receive this message
5142     */
5143    struct LDKPublicKey node_id;
5144    /**
5145     * The message which should be sent.
5146     */
5147    struct LDKShutdown msg;
5148 } LDKMessageSendEvent_LDKSendShutdown_Body;
5149
5150 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
5151    /**
5152     * The node_id of the node which should receive this message
5153     */
5154    struct LDKPublicKey node_id;
5155    /**
5156     * The message which should be sent.
5157     */
5158    struct LDKChannelReestablish msg;
5159 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
5160
5161 typedef struct LDKMessageSendEvent_LDKSendChannelAnnouncement_Body {
5162    /**
5163     * The node_id of the node which should receive this message
5164     */
5165    struct LDKPublicKey node_id;
5166    /**
5167     * The channel_announcement which should be sent.
5168     */
5169    struct LDKChannelAnnouncement msg;
5170    /**
5171     * The followup channel_update which should be sent.
5172     */
5173    struct LDKChannelUpdate update_msg;
5174 } LDKMessageSendEvent_LDKSendChannelAnnouncement_Body;
5175
5176 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
5177    /**
5178     * The channel_announcement which should be sent.
5179     */
5180    struct LDKChannelAnnouncement msg;
5181    /**
5182     * The followup channel_update which should be sent.
5183     *
5184     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
5185     */
5186    struct LDKChannelUpdate update_msg;
5187 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
5188
5189 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
5190    /**
5191     * The channel_update which should be sent.
5192     */
5193    struct LDKChannelUpdate msg;
5194 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
5195
5196 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
5197    /**
5198     * The node_announcement which should be sent.
5199     */
5200    struct LDKNodeAnnouncement msg;
5201 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
5202
5203 typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
5204    /**
5205     * The node_id of the node which should receive this message
5206     */
5207    struct LDKPublicKey node_id;
5208    /**
5209     * The channel_update which should be sent.
5210     */
5211    struct LDKChannelUpdate msg;
5212 } LDKMessageSendEvent_LDKSendChannelUpdate_Body;
5213
5214 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
5215    /**
5216     * The node_id of the node which should receive this message
5217     */
5218    struct LDKPublicKey node_id;
5219    /**
5220     * The action which should be taken.
5221     */
5222    struct LDKErrorAction action;
5223 } LDKMessageSendEvent_LDKHandleError_Body;
5224
5225 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
5226    /**
5227     * The node_id of this message recipient
5228     */
5229    struct LDKPublicKey node_id;
5230    /**
5231     * The query_channel_range which should be sent.
5232     */
5233    struct LDKQueryChannelRange msg;
5234 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
5235
5236 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
5237    /**
5238     * The node_id of this message recipient
5239     */
5240    struct LDKPublicKey node_id;
5241    /**
5242     * The query_short_channel_ids which should be sent.
5243     */
5244    struct LDKQueryShortChannelIds msg;
5245 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
5246
5247 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
5248    /**
5249     * The node_id of this message recipient
5250     */
5251    struct LDKPublicKey node_id;
5252    /**
5253     * The reply_channel_range which should be sent.
5254     */
5255    struct LDKReplyChannelRange msg;
5256 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
5257
5258 typedef struct LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body {
5259    /**
5260     * The node_id of this message recipient
5261     */
5262    struct LDKPublicKey node_id;
5263    /**
5264     * The gossip_timestamp_filter which should be sent.
5265     */
5266    struct LDKGossipTimestampFilter msg;
5267 } LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body;
5268
5269 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
5270    LDKMessageSendEvent_Tag tag;
5271    union {
5272       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
5273       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
5274       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
5275       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
5276       LDKMessageSendEvent_LDKSendChannelReady_Body send_channel_ready;
5277       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
5278       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
5279       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
5280       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
5281       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
5282       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
5283       LDKMessageSendEvent_LDKSendChannelAnnouncement_Body send_channel_announcement;
5284       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
5285       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
5286       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
5287       LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
5288       LDKMessageSendEvent_LDKHandleError_Body handle_error;
5289       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
5290       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
5291       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
5292       LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body send_gossip_timestamp_filter;
5293    };
5294 } LDKMessageSendEvent;
5295
5296 /**
5297  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
5298  * This corresponds to std::vector in C++
5299  */
5300 typedef struct LDKCVec_MessageSendEventZ {
5301    /**
5302     * The elements in the array.
5303     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5304     */
5305    struct LDKMessageSendEvent *data;
5306    /**
5307     * The number of elements pointed to by `data`.
5308     */
5309    uintptr_t datalen;
5310 } LDKCVec_MessageSendEventZ;
5311
5312 /**
5313  * A tuple of 2 elements. See the individual fields for the types contained.
5314  */
5315 typedef struct LDKC2Tuple_usizeTransactionZ {
5316    /**
5317     * The element at position 0
5318     */
5319    uintptr_t a;
5320    /**
5321     * The element at position 1
5322     */
5323    struct LDKTransaction b;
5324 } LDKC2Tuple_usizeTransactionZ;
5325
5326 /**
5327  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
5328  * This corresponds to std::vector in C++
5329  */
5330 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
5331    /**
5332     * The elements in the array.
5333     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5334     */
5335    struct LDKC2Tuple_usizeTransactionZ *data;
5336    /**
5337     * The number of elements pointed to by `data`.
5338     */
5339    uintptr_t datalen;
5340 } LDKCVec_C2Tuple_usizeTransactionZZ;
5341
5342 /**
5343  * A tuple of 2 elements. See the individual fields for the types contained.
5344  */
5345 typedef struct LDKC2Tuple_TxidBlockHashZ {
5346    /**
5347     * The element at position 0
5348     */
5349    struct LDKThirtyTwoBytes a;
5350    /**
5351     * The element at position 1
5352     */
5353    struct LDKThirtyTwoBytes b;
5354 } LDKC2Tuple_TxidBlockHashZ;
5355
5356 /**
5357  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidBlockHashZs of arbitrary size.
5358  * This corresponds to std::vector in C++
5359  */
5360 typedef struct LDKCVec_C2Tuple_TxidBlockHashZZ {
5361    /**
5362     * The elements in the array.
5363     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5364     */
5365    struct LDKC2Tuple_TxidBlockHashZ *data;
5366    /**
5367     * The number of elements pointed to by `data`.
5368     */
5369    uintptr_t datalen;
5370 } LDKCVec_C2Tuple_TxidBlockHashZZ;
5371
5372
5373
5374 /**
5375  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
5376  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
5377  * preimage claim backward will lead to loss of funds.
5378  */
5379 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
5380    /**
5381     * A pointer to the opaque Rust object.
5382     * Nearly everywhere, inner must be non-null, however in places where
5383     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5384     */
5385    LDKnativeHTLCUpdate *inner;
5386    /**
5387     * Indicates that this is the only struct which contains the same pointer.
5388     * Rust functions which take ownership of an object provided via an argument require
5389     * this to be true and invalidate the object pointed to by inner.
5390     */
5391    bool is_owned;
5392 } LDKHTLCUpdate;
5393
5394 /**
5395  * An event to be processed by the ChannelManager.
5396  */
5397 typedef enum LDKMonitorEvent_Tag {
5398    /**
5399     * A monitor event containing an HTLCUpdate.
5400     */
5401    LDKMonitorEvent_HTLCEvent,
5402    /**
5403     * A monitor event that the Channel's commitment transaction was confirmed.
5404     */
5405    LDKMonitorEvent_CommitmentTxConfirmed,
5406    /**
5407     * Indicates a [`ChannelMonitor`] update has completed. See
5408     * [`ChannelMonitorUpdateStatus::InProgress`] for more information on how this is used.
5409     *
5410     * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
5411     */
5412    LDKMonitorEvent_Completed,
5413    /**
5414     * Indicates a [`ChannelMonitor`] update has failed. See
5415     * [`ChannelMonitorUpdateStatus::PermanentFailure`] for more information on how this is used.
5416     *
5417     * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure
5418     */
5419    LDKMonitorEvent_UpdateFailed,
5420    /**
5421     * Must be last for serialization purposes
5422     */
5423    LDKMonitorEvent_Sentinel,
5424 } LDKMonitorEvent_Tag;
5425
5426 typedef struct LDKMonitorEvent_LDKCompleted_Body {
5427    /**
5428     * The funding outpoint of the [`ChannelMonitor`] that was updated
5429     */
5430    struct LDKOutPoint funding_txo;
5431    /**
5432     * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
5433     * [`ChannelMonitor::get_latest_update_id`].
5434     *
5435     * Note that this should only be set to a given update's ID if all previous updates for the
5436     * same [`ChannelMonitor`] have been applied and persisted.
5437     */
5438    uint64_t monitor_update_id;
5439 } LDKMonitorEvent_LDKCompleted_Body;
5440
5441 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
5442    LDKMonitorEvent_Tag tag;
5443    union {
5444       struct {
5445          struct LDKHTLCUpdate htlc_event;
5446       };
5447       struct {
5448          struct LDKOutPoint commitment_tx_confirmed;
5449       };
5450       LDKMonitorEvent_LDKCompleted_Body completed;
5451       struct {
5452          struct LDKOutPoint update_failed;
5453       };
5454    };
5455 } LDKMonitorEvent;
5456
5457 /**
5458  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
5459  * This corresponds to std::vector in C++
5460  */
5461 typedef struct LDKCVec_MonitorEventZ {
5462    /**
5463     * The elements in the array.
5464     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5465     */
5466    struct LDKMonitorEvent *data;
5467    /**
5468     * The number of elements pointed to by `data`.
5469     */
5470    uintptr_t datalen;
5471 } LDKCVec_MonitorEventZ;
5472
5473 /**
5474  * A tuple of 3 elements. See the individual fields for the types contained.
5475  */
5476 typedef struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
5477    /**
5478     * The element at position 0
5479     */
5480    struct LDKOutPoint a;
5481    /**
5482     * The element at position 1
5483     */
5484    struct LDKCVec_MonitorEventZ b;
5485    /**
5486     * The element at position 2
5487     */
5488    struct LDKPublicKey c;
5489 } LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ;
5490
5491 /**
5492  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
5493  * This corresponds to std::vector in C++
5494  */
5495 typedef struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
5496    /**
5497     * The elements in the array.
5498     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5499     */
5500    struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *data;
5501    /**
5502     * The number of elements pointed to by `data`.
5503     */
5504    uintptr_t datalen;
5505 } LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ;
5506
5507
5508
5509 /**
5510  * [`Score`] implementation that uses a fixed penalty.
5511  */
5512 typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer {
5513    /**
5514     * A pointer to the opaque Rust object.
5515     * Nearly everywhere, inner must be non-null, however in places where
5516     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5517     */
5518    LDKnativeFixedPenaltyScorer *inner;
5519    /**
5520     * Indicates that this is the only struct which contains the same pointer.
5521     * Rust functions which take ownership of an object provided via an argument require
5522     * this to be true and invalidate the object pointed to by inner.
5523     */
5524    bool is_owned;
5525 } LDKFixedPenaltyScorer;
5526
5527 /**
5528  * The contents of CResult_FixedPenaltyScorerDecodeErrorZ
5529  */
5530 typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr {
5531    /**
5532     * A pointer to the contents in the success state.
5533     * Reading from this pointer when `result_ok` is not set is undefined.
5534     */
5535    struct LDKFixedPenaltyScorer *result;
5536    /**
5537     * A pointer to the contents in the error state.
5538     * Reading from this pointer when `result_ok` is set is undefined.
5539     */
5540    struct LDKDecodeError *err;
5541 } LDKCResult_FixedPenaltyScorerDecodeErrorZPtr;
5542
5543 /**
5544  * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
5545  * containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
5546  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5547  */
5548 typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ {
5549    /**
5550     * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
5551     * `err` or `result` depending on the state of `result_ok`.
5552     */
5553    union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents;
5554    /**
5555     * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
5556     */
5557    bool result_ok;
5558 } LDKCResult_FixedPenaltyScorerDecodeErrorZ;
5559
5560 /**
5561  * A tuple of 2 elements. See the individual fields for the types contained.
5562  */
5563 typedef struct LDKC2Tuple_u64u64Z {
5564    /**
5565     * The element at position 0
5566     */
5567    uint64_t a;
5568    /**
5569     * The element at position 1
5570     */
5571    uint64_t b;
5572 } LDKC2Tuple_u64u64Z;
5573
5574 /**
5575  * An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
5576  */
5577 typedef enum LDKCOption_C2Tuple_u64u64ZZ_Tag {
5578    /**
5579     * When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
5580     */
5581    LDKCOption_C2Tuple_u64u64ZZ_Some,
5582    /**
5583     * When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
5584     */
5585    LDKCOption_C2Tuple_u64u64ZZ_None,
5586    /**
5587     * Must be last for serialization purposes
5588     */
5589    LDKCOption_C2Tuple_u64u64ZZ_Sentinel,
5590 } LDKCOption_C2Tuple_u64u64ZZ_Tag;
5591
5592 typedef struct LDKCOption_C2Tuple_u64u64ZZ {
5593    LDKCOption_C2Tuple_u64u64ZZ_Tag tag;
5594    union {
5595       struct {
5596          struct LDKC2Tuple_u64u64Z some;
5597       };
5598    };
5599 } LDKCOption_C2Tuple_u64u64ZZ;
5600
5601 /**
5602  * 8 u16s
5603  */
5604 typedef struct LDKEightU16s {
5605    /**
5606     * The eight 16-bit integers
5607     */
5608    uint16_t data[8];
5609 } LDKEightU16s;
5610
5611 /**
5612  * A tuple of 2 elements. See the individual fields for the types contained.
5613  */
5614 typedef struct LDKC2Tuple_Z {
5615    /**
5616     * The element at position 0
5617     */
5618    struct LDKEightU16s a;
5619    /**
5620     * The element at position 1
5621     */
5622    struct LDKEightU16s b;
5623 } LDKC2Tuple_Z;
5624
5625 /**
5626  * A tuple of 2 elements. See the individual fields for the types contained.
5627  */
5628 typedef struct LDKC2Tuple__u168_u168Z {
5629    /**
5630     * The element at position 0
5631     */
5632    struct LDKEightU16s a;
5633    /**
5634     * The element at position 1
5635     */
5636    struct LDKEightU16s b;
5637 } LDKC2Tuple__u168_u168Z;
5638
5639 /**
5640  * An enum which can either contain a crate::c_types::derived::C2Tuple__u168_u168Z or not
5641  */
5642 typedef enum LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag {
5643    /**
5644     * When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains a crate::c_types::derived::C2Tuple__u168_u168Z
5645     */
5646    LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some,
5647    /**
5648     * When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains nothing
5649     */
5650    LDKCOption_C2Tuple_EightU16sEightU16sZZ_None,
5651    /**
5652     * Must be last for serialization purposes
5653     */
5654    LDKCOption_C2Tuple_EightU16sEightU16sZZ_Sentinel,
5655 } LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag;
5656
5657 typedef struct LDKCOption_C2Tuple_EightU16sEightU16sZZ {
5658    LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag tag;
5659    union {
5660       struct {
5661          struct LDKC2Tuple__u168_u168Z some;
5662       };
5663    };
5664 } LDKCOption_C2Tuple_EightU16sEightU16sZZ;
5665
5666 /**
5667  * A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
5668  * This corresponds to std::vector in C++
5669  */
5670 typedef struct LDKCVec_NodeIdZ {
5671    /**
5672     * The elements in the array.
5673     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5674     */
5675    struct LDKNodeId *data;
5676    /**
5677     * The number of elements pointed to by `data`.
5678     */
5679    uintptr_t datalen;
5680 } LDKCVec_NodeIdZ;
5681
5682
5683
5684 /**
5685  * A Record, unit of logging output with Metadata to enable filtering
5686  * Module_path, file, line to inform on log's source
5687  */
5688 typedef struct MUST_USE_STRUCT LDKRecord {
5689    /**
5690     * A pointer to the opaque Rust object.
5691     * Nearly everywhere, inner must be non-null, however in places where
5692     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5693     */
5694    LDKnativeRecord *inner;
5695    /**
5696     * Indicates that this is the only struct which contains the same pointer.
5697     * Rust functions which take ownership of an object provided via an argument require
5698     * this to be true and invalidate the object pointed to by inner.
5699     */
5700    bool is_owned;
5701 } LDKRecord;
5702
5703 /**
5704  * A trait encapsulating the operations required of a logger
5705  */
5706 typedef struct LDKLogger {
5707    /**
5708     * An opaque pointer which is passed to your function implementations as an argument.
5709     * This has no meaning in the LDK, and can be NULL or any other value.
5710     */
5711    void *this_arg;
5712    /**
5713     * Logs the `Record`
5714     */
5715    void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record);
5716    /**
5717     * Frees any resources associated with this object given its this_arg pointer.
5718     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5719     */
5720    void (*free)(void *this_arg);
5721 } LDKLogger;
5722
5723
5724
5725 /**
5726  * Represents the network as nodes and channels between them
5727  */
5728 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
5729    /**
5730     * A pointer to the opaque Rust object.
5731     * Nearly everywhere, inner must be non-null, however in places where
5732     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5733     */
5734    LDKnativeNetworkGraph *inner;
5735    /**
5736     * Indicates that this is the only struct which contains the same pointer.
5737     * Rust functions which take ownership of an object provided via an argument require
5738     * this to be true and invalidate the object pointed to by inner.
5739     */
5740    bool is_owned;
5741 } LDKNetworkGraph;
5742
5743
5744
5745 /**
5746  * [`Score`] implementation using channel success probability distributions.
5747  *
5748  * Channels are tracked with upper and lower liquidity bounds - when an HTLC fails at a channel,
5749  * we learn that the upper-bound on the available liquidity is lower than the amount of the HTLC.
5750  * When a payment is forwarded through a channel (but fails later in the route), we learn the
5751  * lower-bound on the channel's available liquidity must be at least the value of the HTLC.
5752  *
5753  * These bounds are then used to determine a success probability using the formula from
5754  * *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
5755  * and Stefan Richter [[1]] (i.e. `(upper_bound - payment_amount) / (upper_bound - lower_bound)`).
5756  *
5757  * This probability is combined with the [`liquidity_penalty_multiplier_msat`] and
5758  * [`liquidity_penalty_amount_multiplier_msat`] parameters to calculate a concrete penalty in
5759  * milli-satoshis. The penalties, when added across all hops, have the property of being linear in
5760  * terms of the entire path's success probability. This allows the router to directly compare
5761  * penalties for different paths. See the documentation of those parameters for the exact formulas.
5762  *
5763  * The liquidity bounds are decayed by halving them every [`liquidity_offset_half_life`].
5764  *
5765  * Further, we track the history of our upper and lower liquidity bounds for each channel,
5766  * allowing us to assign a second penalty (using [`historical_liquidity_penalty_multiplier_msat`]
5767  * and [`historical_liquidity_penalty_amount_multiplier_msat`]) based on the same probability
5768  * formula, but using the history of a channel rather than our latest estimates for the liquidity
5769  * bounds.
5770  *
5771  * # Note
5772  *
5773  * Mixing the `no-std` feature between serialization and deserialization results in undefined
5774  * behavior.
5775  *
5776  * [1]: https://arxiv.org/abs/2107.05322
5777  * [`liquidity_penalty_multiplier_msat`]: ProbabilisticScoringParameters::liquidity_penalty_multiplier_msat
5778  * [`liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringParameters::liquidity_penalty_amount_multiplier_msat
5779  * [`liquidity_offset_half_life`]: ProbabilisticScoringParameters::liquidity_offset_half_life
5780  * [`historical_liquidity_penalty_multiplier_msat`]: ProbabilisticScoringParameters::historical_liquidity_penalty_multiplier_msat
5781  * [`historical_liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringParameters::historical_liquidity_penalty_amount_multiplier_msat
5782  */
5783 typedef struct MUST_USE_STRUCT LDKProbabilisticScorer {
5784    /**
5785     * A pointer to the opaque Rust object.
5786     * Nearly everywhere, inner must be non-null, however in places where
5787     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5788     */
5789    LDKnativeProbabilisticScorer *inner;
5790    /**
5791     * Indicates that this is the only struct which contains the same pointer.
5792     * Rust functions which take ownership of an object provided via an argument require
5793     * this to be true and invalidate the object pointed to by inner.
5794     */
5795    bool is_owned;
5796 } LDKProbabilisticScorer;
5797
5798 /**
5799  * The contents of CResult_ProbabilisticScorerDecodeErrorZ
5800  */
5801 typedef union LDKCResult_ProbabilisticScorerDecodeErrorZPtr {
5802    /**
5803     * A pointer to the contents in the success state.
5804     * Reading from this pointer when `result_ok` is not set is undefined.
5805     */
5806    struct LDKProbabilisticScorer *result;
5807    /**
5808     * A pointer to the contents in the error state.
5809     * Reading from this pointer when `result_ok` is set is undefined.
5810     */
5811    struct LDKDecodeError *err;
5812 } LDKCResult_ProbabilisticScorerDecodeErrorZPtr;
5813
5814 /**
5815  * A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
5816  * containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
5817  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5818  */
5819 typedef struct LDKCResult_ProbabilisticScorerDecodeErrorZ {
5820    /**
5821     * The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
5822     * `err` or `result` depending on the state of `result_ok`.
5823     */
5824    union LDKCResult_ProbabilisticScorerDecodeErrorZPtr contents;
5825    /**
5826     * Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
5827     */
5828    bool result_ok;
5829 } LDKCResult_ProbabilisticScorerDecodeErrorZ;
5830
5831
5832
5833 /**
5834  * Features used within an `init` message.
5835  */
5836 typedef struct MUST_USE_STRUCT LDKInitFeatures {
5837    /**
5838     * A pointer to the opaque Rust object.
5839     * Nearly everywhere, inner must be non-null, however in places where
5840     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5841     */
5842    LDKnativeInitFeatures *inner;
5843    /**
5844     * Indicates that this is the only struct which contains the same pointer.
5845     * Rust functions which take ownership of an object provided via an argument require
5846     * this to be true and invalidate the object pointed to by inner.
5847     */
5848    bool is_owned;
5849 } LDKInitFeatures;
5850
5851 /**
5852  * The contents of CResult_InitFeaturesDecodeErrorZ
5853  */
5854 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
5855    /**
5856     * A pointer to the contents in the success state.
5857     * Reading from this pointer when `result_ok` is not set is undefined.
5858     */
5859    struct LDKInitFeatures *result;
5860    /**
5861     * A pointer to the contents in the error state.
5862     * Reading from this pointer when `result_ok` is set is undefined.
5863     */
5864    struct LDKDecodeError *err;
5865 } LDKCResult_InitFeaturesDecodeErrorZPtr;
5866
5867 /**
5868  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
5869  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5870  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5871  */
5872 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
5873    /**
5874     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
5875     * `err` or `result` depending on the state of `result_ok`.
5876     */
5877    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
5878    /**
5879     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
5880     */
5881    bool result_ok;
5882 } LDKCResult_InitFeaturesDecodeErrorZ;
5883
5884
5885
5886 /**
5887  * Features used within a `channel_announcement` message.
5888  */
5889 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
5890    /**
5891     * A pointer to the opaque Rust object.
5892     * Nearly everywhere, inner must be non-null, however in places where
5893     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5894     */
5895    LDKnativeChannelFeatures *inner;
5896    /**
5897     * Indicates that this is the only struct which contains the same pointer.
5898     * Rust functions which take ownership of an object provided via an argument require
5899     * this to be true and invalidate the object pointed to by inner.
5900     */
5901    bool is_owned;
5902 } LDKChannelFeatures;
5903
5904 /**
5905  * The contents of CResult_ChannelFeaturesDecodeErrorZ
5906  */
5907 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
5908    /**
5909     * A pointer to the contents in the success state.
5910     * Reading from this pointer when `result_ok` is not set is undefined.
5911     */
5912    struct LDKChannelFeatures *result;
5913    /**
5914     * A pointer to the contents in the error state.
5915     * Reading from this pointer when `result_ok` is set is undefined.
5916     */
5917    struct LDKDecodeError *err;
5918 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
5919
5920 /**
5921  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
5922  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5923  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5924  */
5925 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
5926    /**
5927     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
5928     * `err` or `result` depending on the state of `result_ok`.
5929     */
5930    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
5931    /**
5932     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
5933     */
5934    bool result_ok;
5935 } LDKCResult_ChannelFeaturesDecodeErrorZ;
5936
5937
5938
5939 /**
5940  * Features used within a `node_announcement` message.
5941  */
5942 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
5943    /**
5944     * A pointer to the opaque Rust object.
5945     * Nearly everywhere, inner must be non-null, however in places where
5946     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5947     */
5948    LDKnativeNodeFeatures *inner;
5949    /**
5950     * Indicates that this is the only struct which contains the same pointer.
5951     * Rust functions which take ownership of an object provided via an argument require
5952     * this to be true and invalidate the object pointed to by inner.
5953     */
5954    bool is_owned;
5955 } LDKNodeFeatures;
5956
5957 /**
5958  * The contents of CResult_NodeFeaturesDecodeErrorZ
5959  */
5960 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
5961    /**
5962     * A pointer to the contents in the success state.
5963     * Reading from this pointer when `result_ok` is not set is undefined.
5964     */
5965    struct LDKNodeFeatures *result;
5966    /**
5967     * A pointer to the contents in the error state.
5968     * Reading from this pointer when `result_ok` is set is undefined.
5969     */
5970    struct LDKDecodeError *err;
5971 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
5972
5973 /**
5974  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5975  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5976  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5977  */
5978 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
5979    /**
5980     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
5981     * `err` or `result` depending on the state of `result_ok`.
5982     */
5983    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
5984    /**
5985     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
5986     */
5987    bool result_ok;
5988 } LDKCResult_NodeFeaturesDecodeErrorZ;
5989
5990
5991
5992 /**
5993  * Features used within an invoice.
5994  */
5995 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
5996    /**
5997     * A pointer to the opaque Rust object.
5998     * Nearly everywhere, inner must be non-null, however in places where
5999     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6000     */
6001    LDKnativeInvoiceFeatures *inner;
6002    /**
6003     * Indicates that this is the only struct which contains the same pointer.
6004     * Rust functions which take ownership of an object provided via an argument require
6005     * this to be true and invalidate the object pointed to by inner.
6006     */
6007    bool is_owned;
6008 } LDKInvoiceFeatures;
6009
6010 /**
6011  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
6012  */
6013 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
6014    /**
6015     * A pointer to the contents in the success state.
6016     * Reading from this pointer when `result_ok` is not set is undefined.
6017     */
6018    struct LDKInvoiceFeatures *result;
6019    /**
6020     * A pointer to the contents in the error state.
6021     * Reading from this pointer when `result_ok` is set is undefined.
6022     */
6023    struct LDKDecodeError *err;
6024 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
6025
6026 /**
6027  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
6028  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6029  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6030  */
6031 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
6032    /**
6033     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
6034     * `err` or `result` depending on the state of `result_ok`.
6035     */
6036    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
6037    /**
6038     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
6039     */
6040    bool result_ok;
6041 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
6042
6043
6044
6045 /**
6046  * Features used within BOLT 4 encrypted_data_tlv and BOLT 12 blinded_payinfo
6047  */
6048 typedef struct MUST_USE_STRUCT LDKBlindedHopFeatures {
6049    /**
6050     * A pointer to the opaque Rust object.
6051     * Nearly everywhere, inner must be non-null, however in places where
6052     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6053     */
6054    LDKnativeBlindedHopFeatures *inner;
6055    /**
6056     * Indicates that this is the only struct which contains the same pointer.
6057     * Rust functions which take ownership of an object provided via an argument require
6058     * this to be true and invalidate the object pointed to by inner.
6059     */
6060    bool is_owned;
6061 } LDKBlindedHopFeatures;
6062
6063 /**
6064  * The contents of CResult_BlindedHopFeaturesDecodeErrorZ
6065  */
6066 typedef union LDKCResult_BlindedHopFeaturesDecodeErrorZPtr {
6067    /**
6068     * A pointer to the contents in the success state.
6069     * Reading from this pointer when `result_ok` is not set is undefined.
6070     */
6071    struct LDKBlindedHopFeatures *result;
6072    /**
6073     * A pointer to the contents in the error state.
6074     * Reading from this pointer when `result_ok` is set is undefined.
6075     */
6076    struct LDKDecodeError *err;
6077 } LDKCResult_BlindedHopFeaturesDecodeErrorZPtr;
6078
6079 /**
6080  * A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
6081  * containing a crate::lightning::ln::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6082  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6083  */
6084 typedef struct LDKCResult_BlindedHopFeaturesDecodeErrorZ {
6085    /**
6086     * The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
6087     * `err` or `result` depending on the state of `result_ok`.
6088     */
6089    union LDKCResult_BlindedHopFeaturesDecodeErrorZPtr contents;
6090    /**
6091     * Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
6092     */
6093    bool result_ok;
6094 } LDKCResult_BlindedHopFeaturesDecodeErrorZ;
6095
6096 /**
6097  * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
6098  */
6099 typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr {
6100    /**
6101     * A pointer to the contents in the success state.
6102     * Reading from this pointer when `result_ok` is not set is undefined.
6103     */
6104    struct LDKChannelTypeFeatures *result;
6105    /**
6106     * A pointer to the contents in the error state.
6107     * Reading from this pointer when `result_ok` is set is undefined.
6108     */
6109    struct LDKDecodeError *err;
6110 } LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr;
6111
6112 /**
6113  * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
6114  * containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6115  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6116  */
6117 typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ {
6118    /**
6119     * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
6120     * `err` or `result` depending on the state of `result_ok`.
6121     */
6122    union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents;
6123    /**
6124     * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
6125     */
6126    bool result_ok;
6127 } LDKCResult_ChannelTypeFeaturesDecodeErrorZ;
6128
6129 /**
6130  * The contents of CResult_NodeIdDecodeErrorZ
6131  */
6132 typedef union LDKCResult_NodeIdDecodeErrorZPtr {
6133    /**
6134     * A pointer to the contents in the success state.
6135     * Reading from this pointer when `result_ok` is not set is undefined.
6136     */
6137    struct LDKNodeId *result;
6138    /**
6139     * A pointer to the contents in the error state.
6140     * Reading from this pointer when `result_ok` is set is undefined.
6141     */
6142    struct LDKDecodeError *err;
6143 } LDKCResult_NodeIdDecodeErrorZPtr;
6144
6145 /**
6146  * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
6147  * containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
6148  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6149  */
6150 typedef struct LDKCResult_NodeIdDecodeErrorZ {
6151    /**
6152     * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
6153     * `err` or `result` depending on the state of `result_ok`.
6154     */
6155    union LDKCResult_NodeIdDecodeErrorZPtr contents;
6156    /**
6157     * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
6158     */
6159    bool result_ok;
6160 } LDKCResult_NodeIdDecodeErrorZ;
6161
6162 /**
6163  * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
6164  */
6165 typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr {
6166    /**
6167     * A pointer to the contents in the success state.
6168     * Reading from this pointer when `result_ok` is not set is undefined.
6169     */
6170    struct LDKCOption_NetworkUpdateZ *result;
6171    /**
6172     * A pointer to the contents in the error state.
6173     * Reading from this pointer when `result_ok` is set is undefined.
6174     */
6175    struct LDKDecodeError *err;
6176 } LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr;
6177
6178 /**
6179  * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
6180  * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6181  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6182  */
6183 typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ {
6184    /**
6185     * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
6186     * `err` or `result` depending on the state of `result_ok`.
6187     */
6188    union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents;
6189    /**
6190     * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
6191     */
6192    bool result_ok;
6193 } LDKCResult_COption_NetworkUpdateZDecodeErrorZ;
6194
6195 /**
6196  * The contents of CResult_TxOutUtxoLookupErrorZ
6197  */
6198 typedef union LDKCResult_TxOutUtxoLookupErrorZPtr {
6199    /**
6200     * A pointer to the contents in the success state.
6201     * Reading from this pointer when `result_ok` is not set is undefined.
6202     */
6203    struct LDKTxOut *result;
6204    /**
6205     * A pointer to the contents in the error state.
6206     * Reading from this pointer when `result_ok` is set is undefined.
6207     */
6208    enum LDKUtxoLookupError *err;
6209 } LDKCResult_TxOutUtxoLookupErrorZPtr;
6210
6211 /**
6212  * A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
6213  * containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
6214  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6215  */
6216 typedef struct LDKCResult_TxOutUtxoLookupErrorZ {
6217    /**
6218     * The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
6219     * `err` or `result` depending on the state of `result_ok`.
6220     */
6221    union LDKCResult_TxOutUtxoLookupErrorZPtr contents;
6222    /**
6223     * Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
6224     */
6225    bool result_ok;
6226 } LDKCResult_TxOutUtxoLookupErrorZ;
6227
6228
6229
6230 /**
6231  * Represents a future resolution of a [`UtxoLookup::get_utxo`] query resolving async.
6232  *
6233  * See [`UtxoResult::Async`] and [`UtxoFuture::resolve`] for more info.
6234  */
6235 typedef struct MUST_USE_STRUCT LDKUtxoFuture {
6236    /**
6237     * A pointer to the opaque Rust object.
6238     * Nearly everywhere, inner must be non-null, however in places where
6239     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6240     */
6241    LDKnativeUtxoFuture *inner;
6242    /**
6243     * Indicates that this is the only struct which contains the same pointer.
6244     * Rust functions which take ownership of an object provided via an argument require
6245     * this to be true and invalidate the object pointed to by inner.
6246     */
6247    bool is_owned;
6248 } LDKUtxoFuture;
6249
6250 /**
6251  * The result of a [`UtxoLookup::get_utxo`] call. A call may resolve either synchronously,
6252  * returning the `Sync` variant, or asynchronously, returning an [`UtxoFuture`] in the `Async`
6253  * variant.
6254  */
6255 typedef enum LDKUtxoResult_Tag {
6256    /**
6257     * A result which was resolved synchronously. It either includes a [`TxOut`] for the output
6258     * requested or a [`UtxoLookupError`].
6259     */
6260    LDKUtxoResult_Sync,
6261    /**
6262     * A result which will be resolved asynchronously. It includes a [`UtxoFuture`], a `clone` of
6263     * which you must keep locally and call [`UtxoFuture::resolve`] on once the lookup completes.
6264     *
6265     * Note that in order to avoid runaway memory usage, the number of parallel checks is limited,
6266     * but only fairly loosely. Because a pending checks block all message processing, leaving
6267     * checks pending for an extended time may cause DoS of other functions. It is recommended you
6268     * keep a tight timeout on lookups, on the order of a few seconds.
6269     */
6270    LDKUtxoResult_Async,
6271    /**
6272     * Must be last for serialization purposes
6273     */
6274    LDKUtxoResult_Sentinel,
6275 } LDKUtxoResult_Tag;
6276
6277 typedef struct MUST_USE_STRUCT LDKUtxoResult {
6278    LDKUtxoResult_Tag tag;
6279    union {
6280       struct {
6281          struct LDKCResult_TxOutUtxoLookupErrorZ sync;
6282       };
6283       struct {
6284          struct LDKUtxoFuture async;
6285       };
6286    };
6287 } LDKUtxoResult;
6288
6289 /**
6290  * The `UtxoLookup` trait defines behavior for accessing on-chain UTXOs.
6291  */
6292 typedef struct LDKUtxoLookup {
6293    /**
6294     * An opaque pointer which is passed to your function implementations as an argument.
6295     * This has no meaning in the LDK, and can be NULL or any other value.
6296     */
6297    void *this_arg;
6298    /**
6299     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
6300     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
6301     * is unknown.
6302     *
6303     * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id
6304     */
6305    struct LDKUtxoResult (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
6306    /**
6307     * Frees any resources associated with this object given its this_arg pointer.
6308     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6309     */
6310    void (*free)(void *this_arg);
6311 } LDKUtxoLookup;
6312
6313 /**
6314  * An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not
6315  */
6316 typedef enum LDKCOption_UtxoLookupZ_Tag {
6317    /**
6318     * When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup
6319     */
6320    LDKCOption_UtxoLookupZ_Some,
6321    /**
6322     * When we're in this state, this COption_UtxoLookupZ contains nothing
6323     */
6324    LDKCOption_UtxoLookupZ_None,
6325    /**
6326     * Must be last for serialization purposes
6327     */
6328    LDKCOption_UtxoLookupZ_Sentinel,
6329 } LDKCOption_UtxoLookupZ_Tag;
6330
6331 typedef struct LDKCOption_UtxoLookupZ {
6332    LDKCOption_UtxoLookupZ_Tag tag;
6333    union {
6334       struct {
6335          struct LDKUtxoLookup some;
6336       };
6337    };
6338 } LDKCOption_UtxoLookupZ;
6339
6340 /**
6341  * The contents of CResult_boolLightningErrorZ
6342  */
6343 typedef union LDKCResult_boolLightningErrorZPtr {
6344    /**
6345     * A pointer to the contents in the success state.
6346     * Reading from this pointer when `result_ok` is not set is undefined.
6347     */
6348    bool *result;
6349    /**
6350     * A pointer to the contents in the error state.
6351     * Reading from this pointer when `result_ok` is set is undefined.
6352     */
6353    struct LDKLightningError *err;
6354 } LDKCResult_boolLightningErrorZPtr;
6355
6356 /**
6357  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
6358  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
6359  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6360  */
6361 typedef struct LDKCResult_boolLightningErrorZ {
6362    /**
6363     * The contents of this CResult_boolLightningErrorZ, accessible via either
6364     * `err` or `result` depending on the state of `result_ok`.
6365     */
6366    union LDKCResult_boolLightningErrorZPtr contents;
6367    /**
6368     * Whether this CResult_boolLightningErrorZ represents a success state.
6369     */
6370    bool result_ok;
6371 } LDKCResult_boolLightningErrorZ;
6372
6373 /**
6374  * A tuple of 3 elements. See the individual fields for the types contained.
6375  */
6376 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6377    /**
6378     * The element at position 0
6379     */
6380    struct LDKChannelAnnouncement a;
6381    /**
6382     * The element at position 1
6383     */
6384    struct LDKChannelUpdate b;
6385    /**
6386     * The element at position 2
6387     */
6388    struct LDKChannelUpdate c;
6389 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
6390
6391 /**
6392  * An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
6393  */
6394 typedef enum LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag {
6395    /**
6396     * When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
6397     */
6398    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some,
6399    /**
6400     * When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
6401     */
6402    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None,
6403    /**
6404     * Must be last for serialization purposes
6405     */
6406    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Sentinel,
6407 } LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag;
6408
6409 typedef struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6410    LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag tag;
6411    union {
6412       struct {
6413          struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ some;
6414       };
6415    };
6416 } LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
6417
6418 /**
6419  * The contents of CResult_NoneLightningErrorZ
6420  */
6421 typedef union LDKCResult_NoneLightningErrorZPtr {
6422    /**
6423     * Note that this value is always NULL, as there are no contents in the OK variant
6424     */
6425    void *result;
6426    /**
6427     * A pointer to the contents in the error state.
6428     * Reading from this pointer when `result_ok` is set is undefined.
6429     */
6430    struct LDKLightningError *err;
6431 } LDKCResult_NoneLightningErrorZPtr;
6432
6433 /**
6434  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6435  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6436  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6437  */
6438 typedef struct LDKCResult_NoneLightningErrorZ {
6439    /**
6440     * The contents of this CResult_NoneLightningErrorZ, accessible via either
6441     * `err` or `result` depending on the state of `result_ok`.
6442     */
6443    union LDKCResult_NoneLightningErrorZPtr contents;
6444    /**
6445     * Whether this CResult_NoneLightningErrorZ represents a success state.
6446     */
6447    bool result_ok;
6448 } LDKCResult_NoneLightningErrorZ;
6449
6450
6451
6452 /**
6453  * Details about one direction of a channel as received within a [`ChannelUpdate`].
6454  */
6455 typedef struct MUST_USE_STRUCT LDKChannelUpdateInfo {
6456    /**
6457     * A pointer to the opaque Rust object.
6458     * Nearly everywhere, inner must be non-null, however in places where
6459     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6460     */
6461    LDKnativeChannelUpdateInfo *inner;
6462    /**
6463     * Indicates that this is the only struct which contains the same pointer.
6464     * Rust functions which take ownership of an object provided via an argument require
6465     * this to be true and invalidate the object pointed to by inner.
6466     */
6467    bool is_owned;
6468 } LDKChannelUpdateInfo;
6469
6470 /**
6471  * The contents of CResult_ChannelUpdateInfoDecodeErrorZ
6472  */
6473 typedef union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr {
6474    /**
6475     * A pointer to the contents in the success state.
6476     * Reading from this pointer when `result_ok` is not set is undefined.
6477     */
6478    struct LDKChannelUpdateInfo *result;
6479    /**
6480     * A pointer to the contents in the error state.
6481     * Reading from this pointer when `result_ok` is set is undefined.
6482     */
6483    struct LDKDecodeError *err;
6484 } LDKCResult_ChannelUpdateInfoDecodeErrorZPtr;
6485
6486 /**
6487  * A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
6488  * containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6489  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6490  */
6491 typedef struct LDKCResult_ChannelUpdateInfoDecodeErrorZ {
6492    /**
6493     * The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
6494     * `err` or `result` depending on the state of `result_ok`.
6495     */
6496    union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr contents;
6497    /**
6498     * Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
6499     */
6500    bool result_ok;
6501 } LDKCResult_ChannelUpdateInfoDecodeErrorZ;
6502
6503
6504
6505 /**
6506  * Details about a channel (both directions).
6507  * Received within a channel announcement.
6508  */
6509 typedef struct MUST_USE_STRUCT LDKChannelInfo {
6510    /**
6511     * A pointer to the opaque Rust object.
6512     * Nearly everywhere, inner must be non-null, however in places where
6513     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6514     */
6515    LDKnativeChannelInfo *inner;
6516    /**
6517     * Indicates that this is the only struct which contains the same pointer.
6518     * Rust functions which take ownership of an object provided via an argument require
6519     * this to be true and invalidate the object pointed to by inner.
6520     */
6521    bool is_owned;
6522 } LDKChannelInfo;
6523
6524 /**
6525  * The contents of CResult_ChannelInfoDecodeErrorZ
6526  */
6527 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
6528    /**
6529     * A pointer to the contents in the success state.
6530     * Reading from this pointer when `result_ok` is not set is undefined.
6531     */
6532    struct LDKChannelInfo *result;
6533    /**
6534     * A pointer to the contents in the error state.
6535     * Reading from this pointer when `result_ok` is set is undefined.
6536     */
6537    struct LDKDecodeError *err;
6538 } LDKCResult_ChannelInfoDecodeErrorZPtr;
6539
6540 /**
6541  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
6542  * containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6543  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6544  */
6545 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
6546    /**
6547     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
6548     * `err` or `result` depending on the state of `result_ok`.
6549     */
6550    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
6551    /**
6552     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
6553     */
6554    bool result_ok;
6555 } LDKCResult_ChannelInfoDecodeErrorZ;
6556
6557
6558
6559 /**
6560  * Fees for routing via a given channel or a node
6561  */
6562 typedef struct MUST_USE_STRUCT LDKRoutingFees {
6563    /**
6564     * A pointer to the opaque Rust object.
6565     * Nearly everywhere, inner must be non-null, however in places where
6566     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6567     */
6568    LDKnativeRoutingFees *inner;
6569    /**
6570     * Indicates that this is the only struct which contains the same pointer.
6571     * Rust functions which take ownership of an object provided via an argument require
6572     * this to be true and invalidate the object pointed to by inner.
6573     */
6574    bool is_owned;
6575 } LDKRoutingFees;
6576
6577 /**
6578  * The contents of CResult_RoutingFeesDecodeErrorZ
6579  */
6580 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
6581    /**
6582     * A pointer to the contents in the success state.
6583     * Reading from this pointer when `result_ok` is not set is undefined.
6584     */
6585    struct LDKRoutingFees *result;
6586    /**
6587     * A pointer to the contents in the error state.
6588     * Reading from this pointer when `result_ok` is set is undefined.
6589     */
6590    struct LDKDecodeError *err;
6591 } LDKCResult_RoutingFeesDecodeErrorZPtr;
6592
6593 /**
6594  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
6595  * containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
6596  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6597  */
6598 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
6599    /**
6600     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
6601     * `err` or `result` depending on the state of `result_ok`.
6602     */
6603    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
6604    /**
6605     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
6606     */
6607    bool result_ok;
6608 } LDKCResult_RoutingFeesDecodeErrorZ;
6609
6610 /**
6611  * A 4-byte byte array.
6612  */
6613 typedef struct LDKFourBytes {
6614    /**
6615     * The four bytes
6616     */
6617    uint8_t data[4];
6618 } LDKFourBytes;
6619
6620 /**
6621  * A 12-byte byte array.
6622  */
6623 typedef struct LDKTwelveBytes {
6624    /**
6625     * The twelve bytes
6626     */
6627    uint8_t data[12];
6628 } LDKTwelveBytes;
6629
6630
6631
6632 /**
6633  * Represents a hostname for serialization purposes.
6634  * Only the character set and length will be validated.
6635  * The character set consists of ASCII alphanumeric characters, hyphens, and periods.
6636  * Its length is guaranteed to be representable by a single byte.
6637  * This serialization is used by [`BOLT 7`] hostnames.
6638  *
6639  * [`BOLT 7`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md
6640  */
6641 typedef struct MUST_USE_STRUCT LDKHostname {
6642    /**
6643     * A pointer to the opaque Rust object.
6644     * Nearly everywhere, inner must be non-null, however in places where
6645     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6646     */
6647    LDKnativeHostname *inner;
6648    /**
6649     * Indicates that this is the only struct which contains the same pointer.
6650     * Rust functions which take ownership of an object provided via an argument require
6651     * this to be true and invalidate the object pointed to by inner.
6652     */
6653    bool is_owned;
6654 } LDKHostname;
6655
6656 /**
6657  * An address which can be used to connect to a remote peer.
6658  */
6659 typedef enum LDKNetAddress_Tag {
6660    /**
6661     * An IPv4 address/port on which the peer is listening.
6662     */
6663    LDKNetAddress_IPv4,
6664    /**
6665     * An IPv6 address/port on which the peer is listening.
6666     */
6667    LDKNetAddress_IPv6,
6668    /**
6669     * An old-style Tor onion address/port on which the peer is listening.
6670     *
6671     * This field is deprecated and the Tor network generally no longer supports V2 Onion
6672     * addresses. Thus, the details are not parsed here.
6673     */
6674    LDKNetAddress_OnionV2,
6675    /**
6676     * A new-style Tor onion address/port on which the peer is listening.
6677     *
6678     * To create the human-readable \"hostname\", concatenate the ED25519 pubkey, checksum, and version,
6679     * wrap as base32 and append \".onion\".
6680     */
6681    LDKNetAddress_OnionV3,
6682    /**
6683     * A hostname/port on which the peer is listening.
6684     */
6685    LDKNetAddress_Hostname,
6686    /**
6687     * Must be last for serialization purposes
6688     */
6689    LDKNetAddress_Sentinel,
6690 } LDKNetAddress_Tag;
6691
6692 typedef struct LDKNetAddress_LDKIPv4_Body {
6693    /**
6694     * The 4-byte IPv4 address
6695     */
6696    struct LDKFourBytes addr;
6697    /**
6698     * The port on which the node is listening
6699     */
6700    uint16_t port;
6701 } LDKNetAddress_LDKIPv4_Body;
6702
6703 typedef struct LDKNetAddress_LDKIPv6_Body {
6704    /**
6705     * The 16-byte IPv6 address
6706     */
6707    struct LDKSixteenBytes addr;
6708    /**
6709     * The port on which the node is listening
6710     */
6711    uint16_t port;
6712 } LDKNetAddress_LDKIPv6_Body;
6713
6714 typedef struct LDKNetAddress_LDKOnionV3_Body {
6715    /**
6716     * The ed25519 long-term public key of the peer
6717     */
6718    struct LDKThirtyTwoBytes ed25519_pubkey;
6719    /**
6720     * The checksum of the pubkey and version, as included in the onion address
6721     */
6722    uint16_t checksum;
6723    /**
6724     * The version byte, as defined by the Tor Onion v3 spec.
6725     */
6726    uint8_t version;
6727    /**
6728     * The port on which the node is listening
6729     */
6730    uint16_t port;
6731 } LDKNetAddress_LDKOnionV3_Body;
6732
6733 typedef struct LDKNetAddress_LDKHostname_Body {
6734    /**
6735     * The hostname on which the node is listening.
6736     */
6737    struct LDKHostname hostname;
6738    /**
6739     * The port on which the node is listening.
6740     */
6741    uint16_t port;
6742 } LDKNetAddress_LDKHostname_Body;
6743
6744 typedef struct MUST_USE_STRUCT LDKNetAddress {
6745    LDKNetAddress_Tag tag;
6746    union {
6747       LDKNetAddress_LDKIPv4_Body i_pv4;
6748       LDKNetAddress_LDKIPv6_Body i_pv6;
6749       struct {
6750          struct LDKTwelveBytes onion_v2;
6751       };
6752       LDKNetAddress_LDKOnionV3_Body onion_v3;
6753       LDKNetAddress_LDKHostname_Body hostname;
6754    };
6755 } LDKNetAddress;
6756
6757 /**
6758  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6759  * This corresponds to std::vector in C++
6760  */
6761 typedef struct LDKCVec_NetAddressZ {
6762    /**
6763     * The elements in the array.
6764     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6765     */
6766    struct LDKNetAddress *data;
6767    /**
6768     * The number of elements pointed to by `data`.
6769     */
6770    uintptr_t datalen;
6771 } LDKCVec_NetAddressZ;
6772
6773
6774
6775 /**
6776  * Information received in the latest node_announcement from this node.
6777  */
6778 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
6779    /**
6780     * A pointer to the opaque Rust object.
6781     * Nearly everywhere, inner must be non-null, however in places where
6782     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6783     */
6784    LDKnativeNodeAnnouncementInfo *inner;
6785    /**
6786     * Indicates that this is the only struct which contains the same pointer.
6787     * Rust functions which take ownership of an object provided via an argument require
6788     * this to be true and invalidate the object pointed to by inner.
6789     */
6790    bool is_owned;
6791 } LDKNodeAnnouncementInfo;
6792
6793 /**
6794  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
6795  */
6796 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
6797    /**
6798     * A pointer to the contents in the success state.
6799     * Reading from this pointer when `result_ok` is not set is undefined.
6800     */
6801    struct LDKNodeAnnouncementInfo *result;
6802    /**
6803     * A pointer to the contents in the error state.
6804     * Reading from this pointer when `result_ok` is set is undefined.
6805     */
6806    struct LDKDecodeError *err;
6807 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
6808
6809 /**
6810  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
6811  * containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6812  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6813  */
6814 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
6815    /**
6816     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
6817     * `err` or `result` depending on the state of `result_ok`.
6818     */
6819    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
6820    /**
6821     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
6822     */
6823    bool result_ok;
6824 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
6825
6826
6827
6828 /**
6829  * A user-defined name for a node, which may be used when displaying the node in a graph.
6830  *
6831  * Since node aliases are provided by third parties, they are a potential avenue for injection
6832  * attacks. Care must be taken when processing.
6833  */
6834 typedef struct MUST_USE_STRUCT LDKNodeAlias {
6835    /**
6836     * A pointer to the opaque Rust object.
6837     * Nearly everywhere, inner must be non-null, however in places where
6838     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6839     */
6840    LDKnativeNodeAlias *inner;
6841    /**
6842     * Indicates that this is the only struct which contains the same pointer.
6843     * Rust functions which take ownership of an object provided via an argument require
6844     * this to be true and invalidate the object pointed to by inner.
6845     */
6846    bool is_owned;
6847 } LDKNodeAlias;
6848
6849 /**
6850  * The contents of CResult_NodeAliasDecodeErrorZ
6851  */
6852 typedef union LDKCResult_NodeAliasDecodeErrorZPtr {
6853    /**
6854     * A pointer to the contents in the success state.
6855     * Reading from this pointer when `result_ok` is not set is undefined.
6856     */
6857    struct LDKNodeAlias *result;
6858    /**
6859     * A pointer to the contents in the error state.
6860     * Reading from this pointer when `result_ok` is set is undefined.
6861     */
6862    struct LDKDecodeError *err;
6863 } LDKCResult_NodeAliasDecodeErrorZPtr;
6864
6865 /**
6866  * A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
6867  * containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
6868  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6869  */
6870 typedef struct LDKCResult_NodeAliasDecodeErrorZ {
6871    /**
6872     * The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
6873     * `err` or `result` depending on the state of `result_ok`.
6874     */
6875    union LDKCResult_NodeAliasDecodeErrorZPtr contents;
6876    /**
6877     * Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
6878     */
6879    bool result_ok;
6880 } LDKCResult_NodeAliasDecodeErrorZ;
6881
6882
6883
6884 /**
6885  * Details about a node in the network, known from the network announcement.
6886  */
6887 typedef struct MUST_USE_STRUCT LDKNodeInfo {
6888    /**
6889     * A pointer to the opaque Rust object.
6890     * Nearly everywhere, inner must be non-null, however in places where
6891     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6892     */
6893    LDKnativeNodeInfo *inner;
6894    /**
6895     * Indicates that this is the only struct which contains the same pointer.
6896     * Rust functions which take ownership of an object provided via an argument require
6897     * this to be true and invalidate the object pointed to by inner.
6898     */
6899    bool is_owned;
6900 } LDKNodeInfo;
6901
6902 /**
6903  * The contents of CResult_NodeInfoDecodeErrorZ
6904  */
6905 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
6906    /**
6907     * A pointer to the contents in the success state.
6908     * Reading from this pointer when `result_ok` is not set is undefined.
6909     */
6910    struct LDKNodeInfo *result;
6911    /**
6912     * A pointer to the contents in the error state.
6913     * Reading from this pointer when `result_ok` is set is undefined.
6914     */
6915    struct LDKDecodeError *err;
6916 } LDKCResult_NodeInfoDecodeErrorZPtr;
6917
6918 /**
6919  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
6920  * containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6921  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6922  */
6923 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
6924    /**
6925     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
6926     * `err` or `result` depending on the state of `result_ok`.
6927     */
6928    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
6929    /**
6930     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
6931     */
6932    bool result_ok;
6933 } LDKCResult_NodeInfoDecodeErrorZ;
6934
6935 /**
6936  * The contents of CResult_NetworkGraphDecodeErrorZ
6937  */
6938 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
6939    /**
6940     * A pointer to the contents in the success state.
6941     * Reading from this pointer when `result_ok` is not set is undefined.
6942     */
6943    struct LDKNetworkGraph *result;
6944    /**
6945     * A pointer to the contents in the error state.
6946     * Reading from this pointer when `result_ok` is set is undefined.
6947     */
6948    struct LDKDecodeError *err;
6949 } LDKCResult_NetworkGraphDecodeErrorZPtr;
6950
6951 /**
6952  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
6953  * containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
6954  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6955  */
6956 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
6957    /**
6958     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
6959     * `err` or `result` depending on the state of `result_ok`.
6960     */
6961    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
6962    /**
6963     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
6964     */
6965    bool result_ok;
6966 } LDKCResult_NetworkGraphDecodeErrorZ;
6967
6968 /**
6969  * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
6970  */
6971 typedef enum LDKCOption_CVec_NetAddressZZ_Tag {
6972    /**
6973     * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
6974     */
6975    LDKCOption_CVec_NetAddressZZ_Some,
6976    /**
6977     * When we're in this state, this COption_CVec_NetAddressZZ contains nothing
6978     */
6979    LDKCOption_CVec_NetAddressZZ_None,
6980    /**
6981     * Must be last for serialization purposes
6982     */
6983    LDKCOption_CVec_NetAddressZZ_Sentinel,
6984 } LDKCOption_CVec_NetAddressZZ_Tag;
6985
6986 typedef struct LDKCOption_CVec_NetAddressZZ {
6987    LDKCOption_CVec_NetAddressZZ_Tag tag;
6988    union {
6989       struct {
6990          struct LDKCVec_NetAddressZ some;
6991       };
6992    };
6993 } LDKCOption_CVec_NetAddressZZ;
6994
6995 /**
6996  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
6997  */
6998 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6999    /**
7000     * A pointer to the contents in the success state.
7001     * Reading from this pointer when `result_ok` is not set is undefined.
7002     */
7003    struct LDKDelayedPaymentOutputDescriptor *result;
7004    /**
7005     * A pointer to the contents in the error state.
7006     * Reading from this pointer when `result_ok` is set is undefined.
7007     */
7008    struct LDKDecodeError *err;
7009 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
7010
7011 /**
7012  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
7013  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
7014  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7015  */
7016 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7017    /**
7018     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
7019     * `err` or `result` depending on the state of `result_ok`.
7020     */
7021    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
7022    /**
7023     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
7024     */
7025    bool result_ok;
7026 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
7027
7028 /**
7029  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
7030  */
7031 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
7032    /**
7033     * A pointer to the contents in the success state.
7034     * Reading from this pointer when `result_ok` is not set is undefined.
7035     */
7036    struct LDKStaticPaymentOutputDescriptor *result;
7037    /**
7038     * A pointer to the contents in the error state.
7039     * Reading from this pointer when `result_ok` is set is undefined.
7040     */
7041    struct LDKDecodeError *err;
7042 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
7043
7044 /**
7045  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
7046  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
7047  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7048  */
7049 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7050    /**
7051     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
7052     * `err` or `result` depending on the state of `result_ok`.
7053     */
7054    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
7055    /**
7056     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
7057     */
7058    bool result_ok;
7059 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
7060
7061 /**
7062  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
7063  */
7064 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
7065    /**
7066     * A pointer to the contents in the success state.
7067     * Reading from this pointer when `result_ok` is not set is undefined.
7068     */
7069    struct LDKSpendableOutputDescriptor *result;
7070    /**
7071     * A pointer to the contents in the error state.
7072     * Reading from this pointer when `result_ok` is set is undefined.
7073     */
7074    struct LDKDecodeError *err;
7075 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
7076
7077 /**
7078  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
7079  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
7080  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7081  */
7082 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
7083    /**
7084     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
7085     * `err` or `result` depending on the state of `result_ok`.
7086     */
7087    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
7088    /**
7089     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
7090     */
7091    bool result_ok;
7092 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
7093
7094 /**
7095  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
7096  * This corresponds to std::vector in C++
7097  */
7098 typedef struct LDKCVec_PaymentPreimageZ {
7099    /**
7100     * The elements in the array.
7101     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7102     */
7103    struct LDKThirtyTwoBytes *data;
7104    /**
7105     * The number of elements pointed to by `data`.
7106     */
7107    uintptr_t datalen;
7108 } LDKCVec_PaymentPreimageZ;
7109
7110 /**
7111  * A tuple of 2 elements. See the individual fields for the types contained.
7112  */
7113 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
7114    /**
7115     * The element at position 0
7116     */
7117    struct LDKSignature a;
7118    /**
7119     * The element at position 1
7120     */
7121    struct LDKCVec_SignatureZ b;
7122 } LDKC2Tuple_SignatureCVec_SignatureZZ;
7123
7124 /**
7125  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
7126  */
7127 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7128    /**
7129     * A pointer to the contents in the success state.
7130     * Reading from this pointer when `result_ok` is not set is undefined.
7131     */
7132    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
7133    /**
7134     * Note that this value is always NULL, as there are no contents in the Err variant
7135     */
7136    void *err;
7137 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
7138
7139 /**
7140  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
7141  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
7142  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7143  */
7144 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7145    /**
7146     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
7147     * `err` or `result` depending on the state of `result_ok`.
7148     */
7149    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
7150    /**
7151     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
7152     */
7153    bool result_ok;
7154 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
7155
7156 /**
7157  * The contents of CResult_SignatureNoneZ
7158  */
7159 typedef union LDKCResult_SignatureNoneZPtr {
7160    /**
7161     * A pointer to the contents in the success state.
7162     * Reading from this pointer when `result_ok` is not set is undefined.
7163     */
7164    struct LDKSignature *result;
7165    /**
7166     * Note that this value is always NULL, as there are no contents in the Err variant
7167     */
7168    void *err;
7169 } LDKCResult_SignatureNoneZPtr;
7170
7171 /**
7172  * A CResult_SignatureNoneZ represents the result of a fallible operation,
7173  * containing a crate::c_types::Signature on success and a () on failure.
7174  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7175  */
7176 typedef struct LDKCResult_SignatureNoneZ {
7177    /**
7178     * The contents of this CResult_SignatureNoneZ, accessible via either
7179     * `err` or `result` depending on the state of `result_ok`.
7180     */
7181    union LDKCResult_SignatureNoneZPtr contents;
7182    /**
7183     * Whether this CResult_SignatureNoneZ represents a success state.
7184     */
7185    bool result_ok;
7186 } LDKCResult_SignatureNoneZ;
7187
7188 /**
7189  * The contents of CResult_PublicKeyNoneZ
7190  */
7191 typedef union LDKCResult_PublicKeyNoneZPtr {
7192    /**
7193     * A pointer to the contents in the success state.
7194     * Reading from this pointer when `result_ok` is not set is undefined.
7195     */
7196    struct LDKPublicKey *result;
7197    /**
7198     * Note that this value is always NULL, as there are no contents in the Err variant
7199     */
7200    void *err;
7201 } LDKCResult_PublicKeyNoneZPtr;
7202
7203 /**
7204  * A CResult_PublicKeyNoneZ represents the result of a fallible operation,
7205  * containing a crate::c_types::PublicKey on success and a () on failure.
7206  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7207  */
7208 typedef struct LDKCResult_PublicKeyNoneZ {
7209    /**
7210     * The contents of this CResult_PublicKeyNoneZ, accessible via either
7211     * `err` or `result` depending on the state of `result_ok`.
7212     */
7213    union LDKCResult_PublicKeyNoneZPtr contents;
7214    /**
7215     * Whether this CResult_PublicKeyNoneZ represents a success state.
7216     */
7217    bool result_ok;
7218 } LDKCResult_PublicKeyNoneZ;
7219
7220 /**
7221  * An enum which can either contain a crate::c_types::BigEndianScalar or not
7222  */
7223 typedef enum LDKCOption_ScalarZ_Tag {
7224    /**
7225     * When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar
7226     */
7227    LDKCOption_ScalarZ_Some,
7228    /**
7229     * When we're in this state, this COption_ScalarZ contains nothing
7230     */
7231    LDKCOption_ScalarZ_None,
7232    /**
7233     * Must be last for serialization purposes
7234     */
7235    LDKCOption_ScalarZ_Sentinel,
7236 } LDKCOption_ScalarZ_Tag;
7237
7238 typedef struct LDKCOption_ScalarZ {
7239    LDKCOption_ScalarZ_Tag tag;
7240    union {
7241       struct {
7242          struct LDKBigEndianScalar some;
7243       };
7244    };
7245 } LDKCOption_ScalarZ;
7246
7247 /**
7248  * The contents of CResult_SharedSecretNoneZ
7249  */
7250 typedef union LDKCResult_SharedSecretNoneZPtr {
7251    /**
7252     * A pointer to the contents in the success state.
7253     * Reading from this pointer when `result_ok` is not set is undefined.
7254     */
7255    struct LDKThirtyTwoBytes *result;
7256    /**
7257     * Note that this value is always NULL, as there are no contents in the Err variant
7258     */
7259    void *err;
7260 } LDKCResult_SharedSecretNoneZPtr;
7261
7262 /**
7263  * A CResult_SharedSecretNoneZ represents the result of a fallible operation,
7264  * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
7265  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7266  */
7267 typedef struct LDKCResult_SharedSecretNoneZ {
7268    /**
7269     * The contents of this CResult_SharedSecretNoneZ, accessible via either
7270     * `err` or `result` depending on the state of `result_ok`.
7271     */
7272    union LDKCResult_SharedSecretNoneZPtr contents;
7273    /**
7274     * Whether this CResult_SharedSecretNoneZ represents a success state.
7275     */
7276    bool result_ok;
7277 } LDKCResult_SharedSecretNoneZ;
7278
7279 /**
7280  * Integer in the range `0..32`
7281  */
7282 typedef struct LDKU5 {
7283    uint8_t _0;
7284 } LDKU5;
7285
7286 /**
7287  * A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
7288  * This corresponds to std::vector in C++
7289  */
7290 typedef struct LDKCVec_U5Z {
7291    /**
7292     * The elements in the array.
7293     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7294     */
7295    struct LDKU5 *data;
7296    /**
7297     * The number of elements pointed to by `data`.
7298     */
7299    uintptr_t datalen;
7300 } LDKCVec_U5Z;
7301
7302 /**
7303  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
7304  * allows recovering the exact public key which created the signature given the message.
7305  */
7306 typedef struct LDKRecoverableSignature {
7307    /**
7308     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
7309     * recovery.
7310     */
7311    uint8_t serialized_form[68];
7312 } LDKRecoverableSignature;
7313
7314 /**
7315  * The contents of CResult_RecoverableSignatureNoneZ
7316  */
7317 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
7318    /**
7319     * A pointer to the contents in the success state.
7320     * Reading from this pointer when `result_ok` is not set is undefined.
7321     */
7322    struct LDKRecoverableSignature *result;
7323    /**
7324     * Note that this value is always NULL, as there are no contents in the Err variant
7325     */
7326    void *err;
7327 } LDKCResult_RecoverableSignatureNoneZPtr;
7328
7329 /**
7330  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
7331  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
7332  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7333  */
7334 typedef struct LDKCResult_RecoverableSignatureNoneZ {
7335    /**
7336     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
7337     * `err` or `result` depending on the state of `result_ok`.
7338     */
7339    union LDKCResult_RecoverableSignatureNoneZPtr contents;
7340    /**
7341     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
7342     */
7343    bool result_ok;
7344 } LDKCResult_RecoverableSignatureNoneZ;
7345
7346
7347
7348 /**
7349  * This class tracks the per-transaction information needed to build a closing transaction and will
7350  * actually build it and sign.
7351  *
7352  * This class can be used inside a signer implementation to generate a signature given the relevant
7353  * secret key.
7354  */
7355 typedef struct MUST_USE_STRUCT LDKClosingTransaction {
7356    /**
7357     * A pointer to the opaque Rust object.
7358     * Nearly everywhere, inner must be non-null, however in places where
7359     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7360     */
7361    LDKnativeClosingTransaction *inner;
7362    /**
7363     * Indicates that this is the only struct which contains the same pointer.
7364     * Rust functions which take ownership of an object provided via an argument require
7365     * this to be true and invalidate the object pointed to by inner.
7366     */
7367    bool is_owned;
7368 } LDKClosingTransaction;
7369
7370
7371
7372 /**
7373  * The unsigned part of a [`channel_announcement`] message.
7374  *
7375  * [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message
7376  */
7377 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
7378    /**
7379     * A pointer to the opaque Rust object.
7380     * Nearly everywhere, inner must be non-null, however in places where
7381     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7382     */
7383    LDKnativeUnsignedChannelAnnouncement *inner;
7384    /**
7385     * Indicates that this is the only struct which contains the same pointer.
7386     * Rust functions which take ownership of an object provided via an argument require
7387     * this to be true and invalidate the object pointed to by inner.
7388     */
7389    bool is_owned;
7390 } LDKUnsignedChannelAnnouncement;
7391
7392 /**
7393  * A trait to handle Lightning channel key material without concretizing the channel type or
7394  * the signature mechanism.
7395  */
7396 typedef struct LDKChannelSigner {
7397    /**
7398     * An opaque pointer which is passed to your function implementations as an argument.
7399     * This has no meaning in the LDK, and can be NULL or any other value.
7400     */
7401    void *this_arg;
7402    /**
7403     * Gets the per-commitment point for a specific commitment number
7404     *
7405     * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards.
7406     */
7407    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
7408    /**
7409     * Gets the commitment secret for a specific commitment number as part of the revocation process
7410     *
7411     * An external signer implementation should error here if the commitment was already signed
7412     * and should refuse to sign it in the future.
7413     *
7414     * May be called more than once for the same index.
7415     *
7416     * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards.
7417     */
7418    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
7419    /**
7420     * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
7421     *
7422     * This is required in order for the signer to make sure that releasing a commitment
7423     * secret won't leave us without a broadcastable holder transaction.
7424     * Policy checks should be implemented in this function, including checking the amount
7425     * sent to us and checking the HTLCs.
7426     *
7427     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
7428     * A validating signer should ensure that an HTLC output is removed only when the matching
7429     * preimage is provided, or when the value to holder is restored.
7430     *
7431     * Note that all the relevant preimages will be provided, but there may also be additional
7432     * irrelevant or duplicate preimages.
7433     */
7434    struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages);
7435    /**
7436     * Returns the holder's channel public keys and basepoints.
7437     */
7438    struct LDKChannelPublicKeys pubkeys;
7439    /**
7440     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
7441     * Note that this takes a pointer to this object, not the this_ptr like other methods do
7442     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
7443     */
7444    void (*set_pubkeys)(const struct LDKChannelSigner*NONNULL_PTR );
7445    /**
7446     * Returns an arbitrary identifier describing the set of keys which are provided back to you in
7447     * some [`SpendableOutputDescriptor`] types. This should be sufficient to identify this
7448     * [`EcdsaChannelSigner`] object uniquely and lookup or re-derive its keys.
7449     */
7450    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
7451    /**
7452     * Set the counterparty static channel data, including basepoints,
7453     * `counterparty_selected`/`holder_selected_contest_delay` and funding outpoint.
7454     *
7455     * This data is static, and will never change for a channel once set. For a given [`ChannelSigner`]
7456     * instance, LDK will call this method exactly once - either immediately after construction
7457     * (not including if done via [`SignerProvider::read_chan_signer`]) or when the funding
7458     * information has been generated.
7459     *
7460     * channel_parameters.is_populated() MUST be true.
7461     */
7462    void (*provide_channel_parameters)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
7463    /**
7464     * Frees any resources associated with this object given its this_arg pointer.
7465     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7466     */
7467    void (*free)(void *this_arg);
7468 } LDKChannelSigner;
7469
7470 /**
7471  * A trait to sign Lightning channel transactions as described in
7472  * [BOLT 3](https://github.com/lightning/bolts/blob/master/03-transactions.md).
7473  *
7474  * Signing services could be implemented on a hardware wallet and should implement signing
7475  * policies in order to be secure. Please refer to the [VLS Policy
7476  * Controls](https://gitlab.com/lightning-signer/validating-lightning-signer/-/blob/main/docs/policy-controls.md)
7477  * for an example of such policies.
7478  */
7479 typedef struct LDKEcdsaChannelSigner {
7480    /**
7481     * An opaque pointer which is passed to your function implementations as an argument.
7482     * This has no meaning in the LDK, and can be NULL or any other value.
7483     */
7484    void *this_arg;
7485    /**
7486     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
7487     *
7488     * Note that if signing fails or is rejected, the channel will be force-closed.
7489     *
7490     * Policy checks should be implemented in this function, including checking the amount
7491     * sent to us and checking the HTLCs.
7492     *
7493     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
7494     * A validating signer should ensure that an HTLC output is removed only when the matching
7495     * preimage is provided, or when the value to holder is restored.
7496     *
7497     * Note that all the relevant preimages will be provided, but there may also be additional
7498     * irrelevant or duplicate preimages.
7499     */
7500    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages);
7501    /**
7502     * Validate the counterparty's revocation.
7503     *
7504     * This is required in order for the signer to make sure that the state has moved
7505     * forward and it is safe to sign the next counterparty commitment.
7506     */
7507    struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
7508    /**
7509     * Creates a signature for a holder's commitment transaction and its claiming HTLC transactions.
7510     *
7511     * This will be called
7512     * - with a non-revoked `commitment_tx`.
7513     * - with the latest `commitment_tx` when we initiate a force-close.
7514     * - with the previous `commitment_tx`, just to get claiming HTLC
7515     *   signatures, if we are reacting to a [`ChannelMonitor`]
7516     *   [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas)
7517     *   that decided to broadcast before it had been updated to the latest `commitment_tx`.
7518     *
7519     * This may be called multiple times for the same transaction.
7520     *
7521     * An external signer implementation should check that the commitment has not been revoked.
7522     *
7523     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
7524     */
7525    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
7526    /**
7527     * Create a signature for the given input in a transaction spending an HTLC transaction output
7528     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
7529     *
7530     * A justice transaction may claim multiple outputs at the same time if timelocks are
7531     * similar, but only a signature for the input at index `input` should be signed for here.
7532     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
7533     * to an upcoming timelock expiration.
7534     *
7535     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
7536     *
7537     * `per_commitment_key` is revocation secret which was provided by our counterparty when they
7538     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
7539     * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do
7540     * so).
7541     */
7542    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]);
7543    /**
7544     * Create a signature for the given input in a transaction spending a commitment transaction
7545     * HTLC output when our counterparty broadcasts an old state.
7546     *
7547     * A justice transaction may claim multiple outputs at the same time if timelocks are
7548     * similar, but only a signature for the input at index `input` should be signed for here.
7549     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
7550     * to an upcoming timelock expiration.
7551     *
7552     * `amount` is the value of the output spent by this input, committed to in the BIP 143
7553     * signature.
7554     *
7555     * `per_commitment_key` is revocation secret which was provided by our counterparty when they
7556     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
7557     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
7558     * so).
7559     *
7560     * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script
7561     * (which is committed to in the BIP 143 signatures).
7562     */
7563    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);
7564    /**
7565     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
7566     * transaction, either offered or received.
7567     *
7568     * Such a transaction may claim multiples offered outputs at same time if we know the
7569     * preimage for each when we create it, but only the input at index `input` should be
7570     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
7571     * needed with regards to an upcoming timelock expiration.
7572     *
7573     * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC
7574     * outputs.
7575     *
7576     * `amount` is value of the output spent by this input, committed to in the BIP 143 signature.
7577     *
7578     * `per_commitment_point` is the dynamic point corresponding to the channel state
7579     * detected onchain. It has been generated by our counterparty and is used to derive
7580     * channel state keys, which are then included in the witness script and committed to in the
7581     * BIP 143 signature.
7582     */
7583    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);
7584    /**
7585     * Create a signature for a (proposed) closing transaction.
7586     *
7587     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
7588     * chosen to forgo their output as dust.
7589     */
7590    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
7591    /**
7592     * Computes the signature for a commitment transaction's anchor output used as an
7593     * input within `anchor_tx`, which spends the commitment transaction, at index `input`.
7594     */
7595    struct LDKCResult_SignatureNoneZ (*sign_holder_anchor_input)(const void *this_arg, struct LDKTransaction anchor_tx, uintptr_t input);
7596    /**
7597     * Signs a channel announcement message with our funding key proving it comes from one of the
7598     * channel participants.
7599     *
7600     * Channel announcements also require a signature from each node's network key. Our node
7601     * signature is computed through [`NodeSigner::sign_gossip_message`].
7602     *
7603     * Note that if this fails or is rejected, the channel will not be publicly announced and
7604     * our counterparty may (though likely will not) close the channel on us for violating the
7605     * protocol.
7606     */
7607    struct LDKCResult_SignatureNoneZ (*sign_channel_announcement_with_funding_key)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
7608    /**
7609     * Implementation of ChannelSigner for this object.
7610     */
7611    struct LDKChannelSigner ChannelSigner;
7612    /**
7613     * Frees any resources associated with this object given its this_arg pointer.
7614     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7615     */
7616    void (*free)(void *this_arg);
7617 } LDKEcdsaChannelSigner;
7618
7619 /**
7620  * A writeable signer.
7621  *
7622  * There will always be two instances of a signer per channel, one occupied by the
7623  * [`ChannelManager`] and another by the channel's [`ChannelMonitor`].
7624  *
7625  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
7626  * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
7627  */
7628 typedef struct LDKWriteableEcdsaChannelSigner {
7629    /**
7630     * An opaque pointer which is passed to your function implementations as an argument.
7631     * This has no meaning in the LDK, and can be NULL or any other value.
7632     */
7633    void *this_arg;
7634    /**
7635     * Implementation of EcdsaChannelSigner for this object.
7636     */
7637    struct LDKEcdsaChannelSigner EcdsaChannelSigner;
7638    /**
7639     * Serialize the object into a byte array
7640     */
7641    struct LDKCVec_u8Z (*write)(const void *this_arg);
7642    /**
7643     * Frees any resources associated with this object given its this_arg pointer.
7644     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7645     */
7646    void (*free)(void *this_arg);
7647 } LDKWriteableEcdsaChannelSigner;
7648
7649 /**
7650  * The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ
7651  */
7652 typedef union LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
7653    /**
7654     * A pointer to the contents in the success state.
7655     * Reading from this pointer when `result_ok` is not set is undefined.
7656     */
7657    struct LDKWriteableEcdsaChannelSigner *result;
7658    /**
7659     * A pointer to the contents in the error state.
7660     * Reading from this pointer when `result_ok` is set is undefined.
7661     */
7662    struct LDKDecodeError *err;
7663 } LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZPtr;
7664
7665 /**
7666  * A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation,
7667  * containing a crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
7668  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7669  */
7670 typedef struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ {
7671    /**
7672     * The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either
7673     * `err` or `result` depending on the state of `result_ok`.
7674     */
7675    union LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZPtr contents;
7676    /**
7677     * Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state.
7678     */
7679    bool result_ok;
7680 } LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ;
7681
7682 /**
7683  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
7684  * This corresponds to std::vector in C++
7685  */
7686 typedef struct LDKCVec_CVec_u8ZZ {
7687    /**
7688     * The elements in the array.
7689     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7690     */
7691    struct LDKCVec_u8Z *data;
7692    /**
7693     * The number of elements pointed to by `data`.
7694     */
7695    uintptr_t datalen;
7696 } LDKCVec_CVec_u8ZZ;
7697
7698 /**
7699  * The contents of CResult_CVec_CVec_u8ZZNoneZ
7700  */
7701 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
7702    /**
7703     * A pointer to the contents in the success state.
7704     * Reading from this pointer when `result_ok` is not set is undefined.
7705     */
7706    struct LDKCVec_CVec_u8ZZ *result;
7707    /**
7708     * Note that this value is always NULL, as there are no contents in the Err variant
7709     */
7710    void *err;
7711 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
7712
7713 /**
7714  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
7715  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
7716  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7717  */
7718 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
7719    /**
7720     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
7721     * `err` or `result` depending on the state of `result_ok`.
7722     */
7723    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
7724    /**
7725     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
7726     */
7727    bool result_ok;
7728 } LDKCResult_CVec_CVec_u8ZZNoneZ;
7729
7730
7731
7732 /**
7733  * A simple implementation of [`WriteableEcdsaChannelSigner`] that just keeps the private keys in memory.
7734  *
7735  * This implementation performs no policy checks and is insufficient by itself as
7736  * a secure external signer.
7737  */
7738 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
7739    /**
7740     * A pointer to the opaque Rust object.
7741     * Nearly everywhere, inner must be non-null, however in places where
7742     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7743     */
7744    LDKnativeInMemorySigner *inner;
7745    /**
7746     * Indicates that this is the only struct which contains the same pointer.
7747     * Rust functions which take ownership of an object provided via an argument require
7748     * this to be true and invalidate the object pointed to by inner.
7749     */
7750    bool is_owned;
7751 } LDKInMemorySigner;
7752
7753 /**
7754  * The contents of CResult_InMemorySignerDecodeErrorZ
7755  */
7756 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
7757    /**
7758     * A pointer to the contents in the success state.
7759     * Reading from this pointer when `result_ok` is not set is undefined.
7760     */
7761    struct LDKInMemorySigner *result;
7762    /**
7763     * A pointer to the contents in the error state.
7764     * Reading from this pointer when `result_ok` is set is undefined.
7765     */
7766    struct LDKDecodeError *err;
7767 } LDKCResult_InMemorySignerDecodeErrorZPtr;
7768
7769 /**
7770  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
7771  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
7772  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7773  */
7774 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
7775    /**
7776     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
7777     * `err` or `result` depending on the state of `result_ok`.
7778     */
7779    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
7780    /**
7781     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
7782     */
7783    bool result_ok;
7784 } LDKCResult_InMemorySignerDecodeErrorZ;
7785
7786 /**
7787  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
7788  * This corresponds to std::vector in C++
7789  */
7790 typedef struct LDKCVec_TxOutZ {
7791    /**
7792     * The elements in the array.
7793     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7794     */
7795    struct LDKTxOut *data;
7796    /**
7797     * The number of elements pointed to by `data`.
7798     */
7799    uintptr_t datalen;
7800 } LDKCVec_TxOutZ;
7801
7802 /**
7803  * The contents of CResult_TransactionNoneZ
7804  */
7805 typedef union LDKCResult_TransactionNoneZPtr {
7806    /**
7807     * A pointer to the contents in the success state.
7808     * Reading from this pointer when `result_ok` is not set is undefined.
7809     */
7810    struct LDKTransaction *result;
7811    /**
7812     * Note that this value is always NULL, as there are no contents in the Err variant
7813     */
7814    void *err;
7815 } LDKCResult_TransactionNoneZPtr;
7816
7817 /**
7818  * A CResult_TransactionNoneZ represents the result of a fallible operation,
7819  * containing a crate::c_types::Transaction on success and a () on failure.
7820  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7821  */
7822 typedef struct LDKCResult_TransactionNoneZ {
7823    /**
7824     * The contents of this CResult_TransactionNoneZ, accessible via either
7825     * `err` or `result` depending on the state of `result_ok`.
7826     */
7827    union LDKCResult_TransactionNoneZPtr contents;
7828    /**
7829     * Whether this CResult_TransactionNoneZ represents a success state.
7830     */
7831    bool result_ok;
7832 } LDKCResult_TransactionNoneZ;
7833
7834
7835
7836 /**
7837  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
7838  * on-chain transactions to ensure no loss of funds occurs.
7839  *
7840  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
7841  * information and are actively monitoring the chain.
7842  *
7843  * Pending Events or updated HTLCs which have not yet been read out by
7844  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
7845  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
7846  * gotten are fully handled before re-serializing the new state.
7847  *
7848  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
7849  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
7850  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
7851  * returned block hash and the the current chain and then reconnecting blocks to get to the
7852  * best chain) upon deserializing the object!
7853  */
7854 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
7855    /**
7856     * A pointer to the opaque Rust object.
7857     * Nearly everywhere, inner must be non-null, however in places where
7858     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7859     */
7860    LDKnativeChannelMonitor *inner;
7861    /**
7862     * Indicates that this is the only struct which contains the same pointer.
7863     * Rust functions which take ownership of an object provided via an argument require
7864     * this to be true and invalidate the object pointed to by inner.
7865     */
7866    bool is_owned;
7867 } LDKChannelMonitor;
7868
7869 /**
7870  * A tuple of 2 elements. See the individual fields for the types contained.
7871  */
7872 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
7873    /**
7874     * The element at position 0
7875     */
7876    struct LDKThirtyTwoBytes a;
7877    /**
7878     * The element at position 1
7879     */
7880    struct LDKChannelMonitor b;
7881 } LDKC2Tuple_BlockHashChannelMonitorZ;
7882
7883 /**
7884  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
7885  * This corresponds to std::vector in C++
7886  */
7887 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
7888    /**
7889     * The elements in the array.
7890     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7891     */
7892    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
7893    /**
7894     * The number of elements pointed to by `data`.
7895     */
7896    uintptr_t datalen;
7897 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
7898
7899 /**
7900  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
7901  */
7902 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7903    /**
7904     * A pointer to the contents in the success state.
7905     * Reading from this pointer when `result_ok` is not set is undefined.
7906     */
7907    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
7908    /**
7909     * A pointer to the contents in the error state.
7910     * Reading from this pointer when `result_ok` is set is undefined.
7911     */
7912    enum LDKIOError *err;
7913 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
7914
7915 /**
7916  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
7917  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
7918  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7919  */
7920 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7921    /**
7922     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
7923     * `err` or `result` depending on the state of `result_ok`.
7924     */
7925    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
7926    /**
7927     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
7928     */
7929    bool result_ok;
7930 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
7931
7932 /**
7933  * An enum which can either contain a u16 or not
7934  */
7935 typedef enum LDKCOption_u16Z_Tag {
7936    /**
7937     * When we're in this state, this COption_u16Z contains a u16
7938     */
7939    LDKCOption_u16Z_Some,
7940    /**
7941     * When we're in this state, this COption_u16Z contains nothing
7942     */
7943    LDKCOption_u16Z_None,
7944    /**
7945     * Must be last for serialization purposes
7946     */
7947    LDKCOption_u16Z_Sentinel,
7948 } LDKCOption_u16Z_Tag;
7949
7950 typedef struct LDKCOption_u16Z {
7951    LDKCOption_u16Z_Tag tag;
7952    union {
7953       struct {
7954          uint16_t some;
7955       };
7956    };
7957 } LDKCOption_u16Z;
7958
7959 /**
7960  * The contents of CResult__u832APIErrorZ
7961  */
7962 typedef union LDKCResult__u832APIErrorZPtr {
7963    /**
7964     * A pointer to the contents in the success state.
7965     * Reading from this pointer when `result_ok` is not set is undefined.
7966     */
7967    struct LDKThirtyTwoBytes *result;
7968    /**
7969     * A pointer to the contents in the error state.
7970     * Reading from this pointer when `result_ok` is set is undefined.
7971     */
7972    struct LDKAPIError *err;
7973 } LDKCResult__u832APIErrorZPtr;
7974
7975 /**
7976  * A CResult__u832APIErrorZ represents the result of a fallible operation,
7977  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7978  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7979  */
7980 typedef struct LDKCResult__u832APIErrorZ {
7981    /**
7982     * The contents of this CResult__u832APIErrorZ, accessible via either
7983     * `err` or `result` depending on the state of `result_ok`.
7984     */
7985    union LDKCResult__u832APIErrorZPtr contents;
7986    /**
7987     * Whether this CResult__u832APIErrorZ represents a success state.
7988     */
7989    bool result_ok;
7990 } LDKCResult__u832APIErrorZ;
7991
7992 /**
7993  * Used by [`ChannelManager::list_recent_payments`] to express the status of recent payments.
7994  * These include payments that have yet to find a successful path, or have unresolved HTLCs.
7995  */
7996 typedef enum LDKRecentPaymentDetails_Tag {
7997    /**
7998     * When a payment is still being sent and awaiting successful delivery.
7999     */
8000    LDKRecentPaymentDetails_Pending,
8001    /**
8002     * When a pending payment is fulfilled, we continue tracking it until all pending HTLCs have
8003     * been resolved. Upon receiving [`Event::PaymentSent`], we delay for a few minutes before the
8004     * payment is removed from tracking.
8005     */
8006    LDKRecentPaymentDetails_Fulfilled,
8007    /**
8008     * After a payment's retries are exhausted per the provided [`Retry`], or it is explicitly
8009     * abandoned via [`ChannelManager::abandon_payment`], it is marked as abandoned until all
8010     * pending HTLCs for this payment resolve and an [`Event::PaymentFailed`] is generated.
8011     */
8012    LDKRecentPaymentDetails_Abandoned,
8013    /**
8014     * Must be last for serialization purposes
8015     */
8016    LDKRecentPaymentDetails_Sentinel,
8017 } LDKRecentPaymentDetails_Tag;
8018
8019 typedef struct LDKRecentPaymentDetails_LDKPending_Body {
8020    /**
8021     * Hash of the payment that is currently being sent but has yet to be fulfilled or
8022     * abandoned.
8023     */
8024    struct LDKThirtyTwoBytes payment_hash;
8025    /**
8026     * Total amount (in msat, excluding fees) across all paths for this payment,
8027     * not just the amount currently inflight.
8028     */
8029    uint64_t total_msat;
8030 } LDKRecentPaymentDetails_LDKPending_Body;
8031
8032 typedef struct LDKRecentPaymentDetails_LDKFulfilled_Body {
8033    /**
8034     * Hash of the payment that was claimed. `None` for serializations of [`ChannelManager`]
8035     * made before LDK version 0.0.104.
8036     *
8037     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
8038     */
8039    struct LDKThirtyTwoBytes payment_hash;
8040 } LDKRecentPaymentDetails_LDKFulfilled_Body;
8041
8042 typedef struct LDKRecentPaymentDetails_LDKAbandoned_Body {
8043    /**
8044     * Hash of the payment that we have given up trying to send.
8045     */
8046    struct LDKThirtyTwoBytes payment_hash;
8047 } LDKRecentPaymentDetails_LDKAbandoned_Body;
8048
8049 typedef struct MUST_USE_STRUCT LDKRecentPaymentDetails {
8050    LDKRecentPaymentDetails_Tag tag;
8051    union {
8052       LDKRecentPaymentDetails_LDKPending_Body pending;
8053       LDKRecentPaymentDetails_LDKFulfilled_Body fulfilled;
8054       LDKRecentPaymentDetails_LDKAbandoned_Body abandoned;
8055    };
8056 } LDKRecentPaymentDetails;
8057
8058 /**
8059  * A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size.
8060  * This corresponds to std::vector in C++
8061  */
8062 typedef struct LDKCVec_RecentPaymentDetailsZ {
8063    /**
8064     * The elements in the array.
8065     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8066     */
8067    struct LDKRecentPaymentDetails *data;
8068    /**
8069     * The number of elements pointed to by `data`.
8070     */
8071    uintptr_t datalen;
8072 } LDKCVec_RecentPaymentDetailsZ;
8073
8074 /**
8075  * If a payment fails to send with [`ChannelManager::send_payment`], it can be in one of several
8076  * states. This enum is returned as the Err() type describing which state the payment is in, see
8077  * the description of individual enum states for more.
8078  *
8079  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
8080  */
8081 typedef enum LDKPaymentSendFailure_Tag {
8082    /**
8083     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
8084     * send the payment at all.
8085     *
8086     * You can freely resend the payment in full (with the parameter error fixed).
8087     *
8088     * Because the payment failed outright, no payment tracking is done and no
8089     * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated.
8090     *
8091     * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
8092     * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed
8093     */
8094    LDKPaymentSendFailure_ParameterError,
8095    /**
8096     * A parameter in a single path which was passed to send_payment was invalid, preventing us
8097     * from attempting to send the payment at all.
8098     *
8099     * You can freely resend the payment in full (with the parameter error fixed).
8100     *
8101     * Because the payment failed outright, no payment tracking is done and no
8102     * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated.
8103     *
8104     * The results here are ordered the same as the paths in the route object which was passed to
8105     * send_payment.
8106     *
8107     * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
8108     * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed
8109     */
8110    LDKPaymentSendFailure_PathParameterError,
8111    /**
8112     * All paths which were attempted failed to send, with no channel state change taking place.
8113     * You can freely resend the payment in full (though you probably want to do so over different
8114     * paths than the ones selected).
8115     *
8116     * Because the payment failed outright, no payment tracking is done and no
8117     * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated.
8118     *
8119     * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
8120     * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed
8121     */
8122    LDKPaymentSendFailure_AllFailedResendSafe,
8123    /**
8124     * Indicates that a payment for the provided [`PaymentId`] is already in-flight and has not
8125     * yet completed (i.e. generated an [`Event::PaymentSent`] or [`Event::PaymentFailed`]).
8126     *
8127     * [`PaymentId`]: crate::ln::channelmanager::PaymentId
8128     * [`Event::PaymentSent`]: crate::util::events::Event::PaymentSent
8129     * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed
8130     */
8131    LDKPaymentSendFailure_DuplicatePayment,
8132    /**
8133     * Some paths that were attempted failed to send, though some paths may have succeeded. At least
8134     * some paths have irrevocably committed to the HTLC.
8135     *
8136     * The results here are ordered the same as the paths in the route object that was passed to
8137     * send_payment.
8138     *
8139     * Any entries that contain `Err(APIError::MonitorUpdateInprogress)` will send once a
8140     * [`MonitorEvent::Completed`] is provided for the next-hop channel with the latest update_id.
8141     *
8142     * [`MonitorEvent::Completed`]: crate::chain::channelmonitor::MonitorEvent::Completed
8143     */
8144    LDKPaymentSendFailure_PartialFailure,
8145    /**
8146     * Must be last for serialization purposes
8147     */
8148    LDKPaymentSendFailure_Sentinel,
8149 } LDKPaymentSendFailure_Tag;
8150
8151 typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
8152    /**
8153     * The errors themselves, in the same order as the paths from the route.
8154     */
8155    struct LDKCVec_CResult_NoneAPIErrorZZ results;
8156    /**
8157     * If some paths failed without irrevocably committing to the new HTLC(s), this will
8158     * contain a [`RouteParameters`] object for the failing paths.
8159     *
8160     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
8161     */
8162    struct LDKRouteParameters failed_paths_retry;
8163    /**
8164     * The payment id for the payment, which is now at least partially pending.
8165     */
8166    struct LDKThirtyTwoBytes payment_id;
8167 } LDKPaymentSendFailure_LDKPartialFailure_Body;
8168
8169 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
8170    LDKPaymentSendFailure_Tag tag;
8171    union {
8172       struct {
8173          struct LDKAPIError parameter_error;
8174       };
8175       struct {
8176          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
8177       };
8178       struct {
8179          struct LDKCVec_APIErrorZ all_failed_resend_safe;
8180       };
8181       LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
8182    };
8183 } LDKPaymentSendFailure;
8184
8185 /**
8186  * The contents of CResult_NonePaymentSendFailureZ
8187  */
8188 typedef union LDKCResult_NonePaymentSendFailureZPtr {
8189    /**
8190     * Note that this value is always NULL, as there are no contents in the OK variant
8191     */
8192    void *result;
8193    /**
8194     * A pointer to the contents in the error state.
8195     * Reading from this pointer when `result_ok` is set is undefined.
8196     */
8197    struct LDKPaymentSendFailure *err;
8198 } LDKCResult_NonePaymentSendFailureZPtr;
8199
8200 /**
8201  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
8202  * containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8203  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8204  */
8205 typedef struct LDKCResult_NonePaymentSendFailureZ {
8206    /**
8207     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
8208     * `err` or `result` depending on the state of `result_ok`.
8209     */
8210    union LDKCResult_NonePaymentSendFailureZPtr contents;
8211    /**
8212     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
8213     */
8214    bool result_ok;
8215 } LDKCResult_NonePaymentSendFailureZ;
8216
8217 /**
8218  * The contents of CResult_NoneRetryableSendFailureZ
8219  */
8220 typedef union LDKCResult_NoneRetryableSendFailureZPtr {
8221    /**
8222     * Note that this value is always NULL, as there are no contents in the OK variant
8223     */
8224    void *result;
8225    /**
8226     * A pointer to the contents in the error state.
8227     * Reading from this pointer when `result_ok` is set is undefined.
8228     */
8229    enum LDKRetryableSendFailure *err;
8230 } LDKCResult_NoneRetryableSendFailureZPtr;
8231
8232 /**
8233  * A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation,
8234  * containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
8235  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8236  */
8237 typedef struct LDKCResult_NoneRetryableSendFailureZ {
8238    /**
8239     * The contents of this CResult_NoneRetryableSendFailureZ, accessible via either
8240     * `err` or `result` depending on the state of `result_ok`.
8241     */
8242    union LDKCResult_NoneRetryableSendFailureZPtr contents;
8243    /**
8244     * Whether this CResult_NoneRetryableSendFailureZ represents a success state.
8245     */
8246    bool result_ok;
8247 } LDKCResult_NoneRetryableSendFailureZ;
8248
8249 /**
8250  * The contents of CResult_PaymentHashPaymentSendFailureZ
8251  */
8252 typedef union LDKCResult_PaymentHashPaymentSendFailureZPtr {
8253    /**
8254     * A pointer to the contents in the success state.
8255     * Reading from this pointer when `result_ok` is not set is undefined.
8256     */
8257    struct LDKThirtyTwoBytes *result;
8258    /**
8259     * A pointer to the contents in the error state.
8260     * Reading from this pointer when `result_ok` is set is undefined.
8261     */
8262    struct LDKPaymentSendFailure *err;
8263 } LDKCResult_PaymentHashPaymentSendFailureZPtr;
8264
8265 /**
8266  * A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation,
8267  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8268  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8269  */
8270 typedef struct LDKCResult_PaymentHashPaymentSendFailureZ {
8271    /**
8272     * The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either
8273     * `err` or `result` depending on the state of `result_ok`.
8274     */
8275    union LDKCResult_PaymentHashPaymentSendFailureZPtr contents;
8276    /**
8277     * Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state.
8278     */
8279    bool result_ok;
8280 } LDKCResult_PaymentHashPaymentSendFailureZ;
8281
8282 /**
8283  * The contents of CResult_PaymentHashRetryableSendFailureZ
8284  */
8285 typedef union LDKCResult_PaymentHashRetryableSendFailureZPtr {
8286    /**
8287     * A pointer to the contents in the success state.
8288     * Reading from this pointer when `result_ok` is not set is undefined.
8289     */
8290    struct LDKThirtyTwoBytes *result;
8291    /**
8292     * A pointer to the contents in the error state.
8293     * Reading from this pointer when `result_ok` is set is undefined.
8294     */
8295    enum LDKRetryableSendFailure *err;
8296 } LDKCResult_PaymentHashRetryableSendFailureZPtr;
8297
8298 /**
8299  * A CResult_PaymentHashRetryableSendFailureZ represents the result of a fallible operation,
8300  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
8301  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8302  */
8303 typedef struct LDKCResult_PaymentHashRetryableSendFailureZ {
8304    /**
8305     * The contents of this CResult_PaymentHashRetryableSendFailureZ, accessible via either
8306     * `err` or `result` depending on the state of `result_ok`.
8307     */
8308    union LDKCResult_PaymentHashRetryableSendFailureZPtr contents;
8309    /**
8310     * Whether this CResult_PaymentHashRetryableSendFailureZ represents a success state.
8311     */
8312    bool result_ok;
8313 } LDKCResult_PaymentHashRetryableSendFailureZ;
8314
8315 /**
8316  * A tuple of 2 elements. See the individual fields for the types contained.
8317  */
8318 typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
8319    /**
8320     * The element at position 0
8321     */
8322    struct LDKThirtyTwoBytes a;
8323    /**
8324     * The element at position 1
8325     */
8326    struct LDKThirtyTwoBytes b;
8327 } LDKC2Tuple_PaymentHashPaymentIdZ;
8328
8329 /**
8330  * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
8331  */
8332 typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8333    /**
8334     * A pointer to the contents in the success state.
8335     * Reading from this pointer when `result_ok` is not set is undefined.
8336     */
8337    struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
8338    /**
8339     * A pointer to the contents in the error state.
8340     * Reading from this pointer when `result_ok` is set is undefined.
8341     */
8342    struct LDKPaymentSendFailure *err;
8343 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
8344
8345 /**
8346  * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
8347  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8348  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8349  */
8350 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8351    /**
8352     * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
8353     * `err` or `result` depending on the state of `result_ok`.
8354     */
8355    union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
8356    /**
8357     * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
8358     */
8359    bool result_ok;
8360 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
8361
8362 /**
8363  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
8364  * This corresponds to std::vector in C++
8365  */
8366 typedef struct LDKCVec_ThirtyTwoBytesZ {
8367    /**
8368     * The elements in the array.
8369     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8370     */
8371    struct LDKThirtyTwoBytes *data;
8372    /**
8373     * The number of elements pointed to by `data`.
8374     */
8375    uintptr_t datalen;
8376 } LDKCVec_ThirtyTwoBytesZ;
8377
8378 /**
8379  * A tuple of 2 elements. See the individual fields for the types contained.
8380  */
8381 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
8382    /**
8383     * The element at position 0
8384     */
8385    struct LDKThirtyTwoBytes a;
8386    /**
8387     * The element at position 1
8388     */
8389    struct LDKThirtyTwoBytes b;
8390 } LDKC2Tuple_PaymentHashPaymentSecretZ;
8391
8392 /**
8393  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
8394  */
8395 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8396    /**
8397     * A pointer to the contents in the success state.
8398     * Reading from this pointer when `result_ok` is not set is undefined.
8399     */
8400    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
8401    /**
8402     * Note that this value is always NULL, as there are no contents in the Err variant
8403     */
8404    void *err;
8405 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr;
8406
8407 /**
8408  * A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
8409  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
8410  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8411  */
8412 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8413    /**
8414     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
8415     * `err` or `result` depending on the state of `result_ok`.
8416     */
8417    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents;
8418    /**
8419     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
8420     */
8421    bool result_ok;
8422 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ;
8423
8424 /**
8425  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
8426  */
8427 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8428    /**
8429     * A pointer to the contents in the success state.
8430     * Reading from this pointer when `result_ok` is not set is undefined.
8431     */
8432    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
8433    /**
8434     * A pointer to the contents in the error state.
8435     * Reading from this pointer when `result_ok` is set is undefined.
8436     */
8437    struct LDKAPIError *err;
8438 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr;
8439
8440 /**
8441  * A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
8442  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
8443  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8444  */
8445 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8446    /**
8447     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
8448     * `err` or `result` depending on the state of `result_ok`.
8449     */
8450    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr contents;
8451    /**
8452     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
8453     */
8454    bool result_ok;
8455 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ;
8456
8457 /**
8458  * The contents of CResult_PaymentSecretNoneZ
8459  */
8460 typedef union LDKCResult_PaymentSecretNoneZPtr {
8461    /**
8462     * A pointer to the contents in the success state.
8463     * Reading from this pointer when `result_ok` is not set is undefined.
8464     */
8465    struct LDKThirtyTwoBytes *result;
8466    /**
8467     * Note that this value is always NULL, as there are no contents in the Err variant
8468     */
8469    void *err;
8470 } LDKCResult_PaymentSecretNoneZPtr;
8471
8472 /**
8473  * A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
8474  * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
8475  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8476  */
8477 typedef struct LDKCResult_PaymentSecretNoneZ {
8478    /**
8479     * The contents of this CResult_PaymentSecretNoneZ, accessible via either
8480     * `err` or `result` depending on the state of `result_ok`.
8481     */
8482    union LDKCResult_PaymentSecretNoneZPtr contents;
8483    /**
8484     * Whether this CResult_PaymentSecretNoneZ represents a success state.
8485     */
8486    bool result_ok;
8487 } LDKCResult_PaymentSecretNoneZ;
8488
8489 /**
8490  * The contents of CResult_PaymentSecretAPIErrorZ
8491  */
8492 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
8493    /**
8494     * A pointer to the contents in the success state.
8495     * Reading from this pointer when `result_ok` is not set is undefined.
8496     */
8497    struct LDKThirtyTwoBytes *result;
8498    /**
8499     * A pointer to the contents in the error state.
8500     * Reading from this pointer when `result_ok` is set is undefined.
8501     */
8502    struct LDKAPIError *err;
8503 } LDKCResult_PaymentSecretAPIErrorZPtr;
8504
8505 /**
8506  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
8507  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8508  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8509  */
8510 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
8511    /**
8512     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
8513     * `err` or `result` depending on the state of `result_ok`.
8514     */
8515    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
8516    /**
8517     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
8518     */
8519    bool result_ok;
8520 } LDKCResult_PaymentSecretAPIErrorZ;
8521
8522 /**
8523  * The contents of CResult_PaymentPreimageAPIErrorZ
8524  */
8525 typedef union LDKCResult_PaymentPreimageAPIErrorZPtr {
8526    /**
8527     * A pointer to the contents in the success state.
8528     * Reading from this pointer when `result_ok` is not set is undefined.
8529     */
8530    struct LDKThirtyTwoBytes *result;
8531    /**
8532     * A pointer to the contents in the error state.
8533     * Reading from this pointer when `result_ok` is set is undefined.
8534     */
8535    struct LDKAPIError *err;
8536 } LDKCResult_PaymentPreimageAPIErrorZPtr;
8537
8538 /**
8539  * A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
8540  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8541  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8542  */
8543 typedef struct LDKCResult_PaymentPreimageAPIErrorZ {
8544    /**
8545     * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
8546     * `err` or `result` depending on the state of `result_ok`.
8547     */
8548    union LDKCResult_PaymentPreimageAPIErrorZPtr contents;
8549    /**
8550     * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
8551     */
8552    bool result_ok;
8553 } LDKCResult_PaymentPreimageAPIErrorZ;
8554
8555
8556
8557 /**
8558  * Information needed for constructing an invoice route hint for this channel.
8559  */
8560 typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
8561    /**
8562     * A pointer to the opaque Rust object.
8563     * Nearly everywhere, inner must be non-null, however in places where
8564     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8565     */
8566    LDKnativeCounterpartyForwardingInfo *inner;
8567    /**
8568     * Indicates that this is the only struct which contains the same pointer.
8569     * Rust functions which take ownership of an object provided via an argument require
8570     * this to be true and invalidate the object pointed to by inner.
8571     */
8572    bool is_owned;
8573 } LDKCounterpartyForwardingInfo;
8574
8575 /**
8576  * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
8577  */
8578 typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8579    /**
8580     * A pointer to the contents in the success state.
8581     * Reading from this pointer when `result_ok` is not set is undefined.
8582     */
8583    struct LDKCounterpartyForwardingInfo *result;
8584    /**
8585     * A pointer to the contents in the error state.
8586     * Reading from this pointer when `result_ok` is set is undefined.
8587     */
8588    struct LDKDecodeError *err;
8589 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr;
8590
8591 /**
8592  * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
8593  * containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8594  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8595  */
8596 typedef struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ {
8597    /**
8598     * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
8599     * `err` or `result` depending on the state of `result_ok`.
8600     */
8601    union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents;
8602    /**
8603     * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
8604     */
8605    bool result_ok;
8606 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZ;
8607
8608
8609
8610 /**
8611  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
8612  * to better separate parameters.
8613  */
8614 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
8615    /**
8616     * A pointer to the opaque Rust object.
8617     * Nearly everywhere, inner must be non-null, however in places where
8618     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8619     */
8620    LDKnativeChannelCounterparty *inner;
8621    /**
8622     * Indicates that this is the only struct which contains the same pointer.
8623     * Rust functions which take ownership of an object provided via an argument require
8624     * this to be true and invalidate the object pointed to by inner.
8625     */
8626    bool is_owned;
8627 } LDKChannelCounterparty;
8628
8629 /**
8630  * The contents of CResult_ChannelCounterpartyDecodeErrorZ
8631  */
8632 typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr {
8633    /**
8634     * A pointer to the contents in the success state.
8635     * Reading from this pointer when `result_ok` is not set is undefined.
8636     */
8637    struct LDKChannelCounterparty *result;
8638    /**
8639     * A pointer to the contents in the error state.
8640     * Reading from this pointer when `result_ok` is set is undefined.
8641     */
8642    struct LDKDecodeError *err;
8643 } LDKCResult_ChannelCounterpartyDecodeErrorZPtr;
8644
8645 /**
8646  * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
8647  * containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
8648  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8649  */
8650 typedef struct LDKCResult_ChannelCounterpartyDecodeErrorZ {
8651    /**
8652     * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
8653     * `err` or `result` depending on the state of `result_ok`.
8654     */
8655    union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents;
8656    /**
8657     * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
8658     */
8659    bool result_ok;
8660 } LDKCResult_ChannelCounterpartyDecodeErrorZ;
8661
8662 /**
8663  * The contents of CResult_ChannelDetailsDecodeErrorZ
8664  */
8665 typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr {
8666    /**
8667     * A pointer to the contents in the success state.
8668     * Reading from this pointer when `result_ok` is not set is undefined.
8669     */
8670    struct LDKChannelDetails *result;
8671    /**
8672     * A pointer to the contents in the error state.
8673     * Reading from this pointer when `result_ok` is set is undefined.
8674     */
8675    struct LDKDecodeError *err;
8676 } LDKCResult_ChannelDetailsDecodeErrorZPtr;
8677
8678 /**
8679  * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
8680  * containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
8681  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8682  */
8683 typedef struct LDKCResult_ChannelDetailsDecodeErrorZ {
8684    /**
8685     * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
8686     * `err` or `result` depending on the state of `result_ok`.
8687     */
8688    union LDKCResult_ChannelDetailsDecodeErrorZPtr contents;
8689    /**
8690     * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
8691     */
8692    bool result_ok;
8693 } LDKCResult_ChannelDetailsDecodeErrorZ;
8694
8695
8696
8697 /**
8698  * Route hints used in constructing invoices for [phantom node payents].
8699  *
8700  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
8701  */
8702 typedef struct MUST_USE_STRUCT LDKPhantomRouteHints {
8703    /**
8704     * A pointer to the opaque Rust object.
8705     * Nearly everywhere, inner must be non-null, however in places where
8706     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8707     */
8708    LDKnativePhantomRouteHints *inner;
8709    /**
8710     * Indicates that this is the only struct which contains the same pointer.
8711     * Rust functions which take ownership of an object provided via an argument require
8712     * this to be true and invalidate the object pointed to by inner.
8713     */
8714    bool is_owned;
8715 } LDKPhantomRouteHints;
8716
8717 /**
8718  * The contents of CResult_PhantomRouteHintsDecodeErrorZ
8719  */
8720 typedef union LDKCResult_PhantomRouteHintsDecodeErrorZPtr {
8721    /**
8722     * A pointer to the contents in the success state.
8723     * Reading from this pointer when `result_ok` is not set is undefined.
8724     */
8725    struct LDKPhantomRouteHints *result;
8726    /**
8727     * A pointer to the contents in the error state.
8728     * Reading from this pointer when `result_ok` is set is undefined.
8729     */
8730    struct LDKDecodeError *err;
8731 } LDKCResult_PhantomRouteHintsDecodeErrorZPtr;
8732
8733 /**
8734  * A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
8735  * containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
8736  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8737  */
8738 typedef struct LDKCResult_PhantomRouteHintsDecodeErrorZ {
8739    /**
8740     * The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
8741     * `err` or `result` depending on the state of `result_ok`.
8742     */
8743    union LDKCResult_PhantomRouteHintsDecodeErrorZPtr contents;
8744    /**
8745     * Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
8746     */
8747    bool result_ok;
8748 } LDKCResult_PhantomRouteHintsDecodeErrorZ;
8749
8750 /**
8751  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
8752  * This corresponds to std::vector in C++
8753  */
8754 typedef struct LDKCVec_ChannelMonitorZ {
8755    /**
8756     * The elements in the array.
8757     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8758     */
8759    struct LDKChannelMonitor *data;
8760    /**
8761     * The number of elements pointed to by `data`.
8762     */
8763    uintptr_t datalen;
8764 } LDKCVec_ChannelMonitorZ;
8765
8766
8767
8768 /**
8769  * An update generated by the underlying channel itself which contains some new information the
8770  * [`ChannelMonitor`] should be made aware of.
8771  *
8772  * Because this represents only a small number of updates to the underlying state, it is generally
8773  * much smaller than a full [`ChannelMonitor`]. However, for large single commitment transaction
8774  * updates (e.g. ones during which there are hundreds of HTLCs pending on the commitment
8775  * transaction), a single update may reach upwards of 1 MiB in serialized size.
8776  */
8777 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
8778    /**
8779     * A pointer to the opaque Rust object.
8780     * Nearly everywhere, inner must be non-null, however in places where
8781     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8782     */
8783    LDKnativeChannelMonitorUpdate *inner;
8784    /**
8785     * Indicates that this is the only struct which contains the same pointer.
8786     * Rust functions which take ownership of an object provided via an argument require
8787     * this to be true and invalidate the object pointed to by inner.
8788     */
8789    bool is_owned;
8790 } LDKChannelMonitorUpdate;
8791
8792 /**
8793  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
8794  * blocks are connected and disconnected.
8795  *
8796  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
8797  * responsible for maintaining a set of monitors such that they can be updated accordingly as
8798  * channel state changes and HTLCs are resolved. See method documentation for specific
8799  * requirements.
8800  *
8801  * Implementations **must** ensure that updates are successfully applied and persisted upon method
8802  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
8803  * without taking any further action such as persisting the current state.
8804  *
8805  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
8806  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
8807  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
8808  * funds in the channel. See [`ChannelMonitorUpdateStatus`] for more details about how to handle
8809  * multiple instances.
8810  *
8811  * [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure
8812  */
8813 typedef struct LDKWatch {
8814    /**
8815     * An opaque pointer which is passed to your function implementations as an argument.
8816     * This has no meaning in the LDK, and can be NULL or any other value.
8817     */
8818    void *this_arg;
8819    /**
8820     * Watches a channel identified by `funding_txo` using `monitor`.
8821     *
8822     * Implementations are responsible for watching the chain for the funding transaction along
8823     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
8824     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
8825     *
8826     * Note: this interface MUST error with [`ChannelMonitorUpdateStatus::PermanentFailure`] if
8827     * the given `funding_txo` has previously been registered via `watch_channel`.
8828     *
8829     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
8830     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
8831     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
8832     */
8833    enum LDKChannelMonitorUpdateStatus (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
8834    /**
8835     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
8836     *
8837     * Implementations must call [`update_monitor`] with the given update. See
8838     * [`ChannelMonitorUpdateStatus`] for invariants around returning an error.
8839     *
8840     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
8841     */
8842    enum LDKChannelMonitorUpdateStatus (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, const struct LDKChannelMonitorUpdate *NONNULL_PTR update);
8843    /**
8844     * Returns any monitor events since the last call. Subsequent calls must only return new
8845     * events.
8846     *
8847     * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
8848     * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
8849     * to disk.
8850     *
8851     * For details on asynchronous [`ChannelMonitor`] updating and returning
8852     * [`MonitorEvent::Completed`] here, see [`ChannelMonitorUpdateStatus::InProgress`].
8853     */
8854    struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ (*release_pending_monitor_events)(const void *this_arg);
8855    /**
8856     * Frees any resources associated with this object given its this_arg pointer.
8857     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8858     */
8859    void (*free)(void *this_arg);
8860 } LDKWatch;
8861
8862 /**
8863  * An interface to send a transaction to the Bitcoin network.
8864  */
8865 typedef struct LDKBroadcasterInterface {
8866    /**
8867     * An opaque pointer which is passed to your function implementations as an argument.
8868     * This has no meaning in the LDK, and can be NULL or any other value.
8869     */
8870    void *this_arg;
8871    /**
8872     * Sends a transaction out to (hopefully) be mined.
8873     */
8874    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
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 } LDKBroadcasterInterface;
8881
8882 /**
8883  * A trait that describes a source of entropy.
8884  */
8885 typedef struct LDKEntropySource {
8886    /**
8887     * An opaque pointer which is passed to your function implementations as an argument.
8888     * This has no meaning in the LDK, and can be NULL or any other value.
8889     */
8890    void *this_arg;
8891    /**
8892     * Gets a unique, cryptographically-secure, random 32-byte value. This method must return a
8893     * different value each time it is called.
8894     */
8895    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
8896    /**
8897     * Frees any resources associated with this object given its this_arg pointer.
8898     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8899     */
8900    void (*free)(void *this_arg);
8901 } LDKEntropySource;
8902
8903 /**
8904  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
8905  * own the memory pointed to by data.
8906  */
8907 typedef struct LDKu8slice {
8908    /**
8909     * A pointer to the byte buffer
8910     */
8911    const uint8_t *data;
8912    /**
8913     * The number of bytes pointed to by `data`.
8914     */
8915    uintptr_t datalen;
8916 } LDKu8slice;
8917
8918
8919
8920 /**
8921  * The unsigned part of a [`channel_update`] message.
8922  *
8923  * [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message
8924  */
8925 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
8926    /**
8927     * A pointer to the opaque Rust object.
8928     * Nearly everywhere, inner must be non-null, however in places where
8929     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8930     */
8931    LDKnativeUnsignedChannelUpdate *inner;
8932    /**
8933     * Indicates that this is the only struct which contains the same pointer.
8934     * Rust functions which take ownership of an object provided via an argument require
8935     * this to be true and invalidate the object pointed to by inner.
8936     */
8937    bool is_owned;
8938 } LDKUnsignedChannelUpdate;
8939
8940
8941
8942 /**
8943  * The unsigned part of a [`node_announcement`] message.
8944  *
8945  * [`node_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-node_announcement-message
8946  */
8947 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
8948    /**
8949     * A pointer to the opaque Rust object.
8950     * Nearly everywhere, inner must be non-null, however in places where
8951     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8952     */
8953    LDKnativeUnsignedNodeAnnouncement *inner;
8954    /**
8955     * Indicates that this is the only struct which contains the same pointer.
8956     * Rust functions which take ownership of an object provided via an argument require
8957     * this to be true and invalidate the object pointed to by inner.
8958     */
8959    bool is_owned;
8960 } LDKUnsignedNodeAnnouncement;
8961
8962 /**
8963  * Represents the set of gossip messages that require a signature from a node's identity key.
8964  */
8965 typedef enum LDKUnsignedGossipMessage_Tag {
8966    /**
8967     * An unsigned channel announcement.
8968     */
8969    LDKUnsignedGossipMessage_ChannelAnnouncement,
8970    /**
8971     * An unsigned channel update.
8972     */
8973    LDKUnsignedGossipMessage_ChannelUpdate,
8974    /**
8975     * An unsigned node announcement.
8976     */
8977    LDKUnsignedGossipMessage_NodeAnnouncement,
8978    /**
8979     * Must be last for serialization purposes
8980     */
8981    LDKUnsignedGossipMessage_Sentinel,
8982 } LDKUnsignedGossipMessage_Tag;
8983
8984 typedef struct MUST_USE_STRUCT LDKUnsignedGossipMessage {
8985    LDKUnsignedGossipMessage_Tag tag;
8986    union {
8987       struct {
8988          struct LDKUnsignedChannelAnnouncement channel_announcement;
8989       };
8990       struct {
8991          struct LDKUnsignedChannelUpdate channel_update;
8992       };
8993       struct {
8994          struct LDKUnsignedNodeAnnouncement node_announcement;
8995       };
8996    };
8997 } LDKUnsignedGossipMessage;
8998
8999 /**
9000  * A trait that can handle cryptographic operations at the scope level of a node.
9001  */
9002 typedef struct LDKNodeSigner {
9003    /**
9004     * An opaque pointer which is passed to your function implementations as an argument.
9005     * This has no meaning in the LDK, and can be NULL or any other value.
9006     */
9007    void *this_arg;
9008    /**
9009     * Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
9010     *
9011     * If the implementor of this trait supports [phantom node payments], then every node that is
9012     * intended to be included in the phantom invoice route hints must return the same value from
9013     * this method.
9014     *
9015     * This method must return the same value each time it is called.
9016     *
9017     * [phantom node payments]: PhantomKeysManager
9018     */
9019    struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg);
9020    /**
9021     * Get node id based on the provided [`Recipient`].
9022     *
9023     * This method must return the same value each time it is called with a given [`Recipient`]
9024     * parameter.
9025     *
9026     * Errors if the [`Recipient`] variant is not supported by the implementation.
9027     */
9028    struct LDKCResult_PublicKeyNoneZ (*get_node_id)(const void *this_arg, enum LDKRecipient recipient);
9029    /**
9030     * Gets the ECDH shared secret of our node secret and `other_key`, multiplying by `tweak` if
9031     * one is provided. Note that this tweak can be applied to `other_key` instead of our node
9032     * secret, though this is less efficient.
9033     *
9034     * Note that if this fails while attempting to forward an HTLC, LDK will panic. The error
9035     * should be resolved to allow LDK to resume forwarding HTLCs.
9036     *
9037     * Errors if the [`Recipient`] variant is not supported by the implementation.
9038     */
9039    struct LDKCResult_SharedSecretNoneZ (*ecdh)(const void *this_arg, enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_ScalarZ tweak);
9040    /**
9041     * Sign an invoice.
9042     *
9043     * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of
9044     * this trait to parse the invoice and make sure they're signing what they expect, rather than
9045     * blindly signing the hash.
9046     *
9047     * The `hrp_bytes` are ASCII bytes, while the `invoice_data` is base32.
9048     *
9049     * The secret key used to sign the invoice is dependent on the [`Recipient`].
9050     *
9051     * Errors if the [`Recipient`] variant is not supported by the implementation.
9052     */
9053    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z invoice_data, enum LDKRecipient recipient);
9054    /**
9055     * Sign a gossip message.
9056     *
9057     * Note that if this fails, LDK may panic and the message will not be broadcast to the network
9058     * or a possible channel counterparty. If LDK panics, the error should be resolved to allow the
9059     * message to be broadcast, as otherwise it may prevent one from receiving funds over the
9060     * corresponding channel.
9061     */
9062    struct LDKCResult_SignatureNoneZ (*sign_gossip_message)(const void *this_arg, struct LDKUnsignedGossipMessage msg);
9063    /**
9064     * Frees any resources associated with this object given its this_arg pointer.
9065     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9066     */
9067    void (*free)(void *this_arg);
9068 } LDKNodeSigner;
9069
9070 /**
9071  * A trait that can return signer instances for individual channels.
9072  */
9073 typedef struct LDKSignerProvider {
9074    /**
9075     * An opaque pointer which is passed to your function implementations as an argument.
9076     * This has no meaning in the LDK, and can be NULL or any other value.
9077     */
9078    void *this_arg;
9079    /**
9080     * Generates a unique `channel_keys_id` that can be used to obtain a [`Self::Signer`] through
9081     * [`SignerProvider::derive_channel_signer`]. The `user_channel_id` is provided to allow
9082     * implementations of [`SignerProvider`] to maintain a mapping between itself and the generated
9083     * `channel_keys_id`.
9084     *
9085     * This method must return a different value each time it is called.
9086     */
9087    struct LDKThirtyTwoBytes (*generate_channel_keys_id)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis, struct LDKU128 user_channel_id);
9088    /**
9089     * Derives the private key material backing a `Signer`.
9090     *
9091     * To derive a new `Signer`, a fresh `channel_keys_id` should be obtained through
9092     * [`SignerProvider::generate_channel_keys_id`]. Otherwise, an existing `Signer` can be
9093     * re-derived from its `channel_keys_id`, which can be obtained through its trait method
9094     * [`ChannelSigner::channel_keys_id`].
9095     */
9096    struct LDKWriteableEcdsaChannelSigner (*derive_channel_signer)(const void *this_arg, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id);
9097    /**
9098     * Reads a [`Signer`] for this [`SignerProvider`] from the given input stream.
9099     * This is only called during deserialization of other objects which contain
9100     * [`WriteableEcdsaChannelSigner`]-implementing objects (i.e., [`ChannelMonitor`]s and [`ChannelManager`]s).
9101     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
9102     * contain no versioning scheme. You may wish to include your own version prefix and ensure
9103     * you've read all of the provided bytes to ensure no corruption occurred.
9104     *
9105     * This method is slowly being phased out -- it will only be called when reading objects
9106     * written by LDK versions prior to 0.0.113.
9107     *
9108     * [`Signer`]: Self::Signer
9109     * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
9110     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
9111     */
9112    struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
9113    /**
9114     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
9115     *
9116     * This method should return a different value each time it is called, to avoid linking
9117     * on-chain funds across channels as controlled to the same user.
9118     */
9119    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
9120    /**
9121     * Get a script pubkey which we will send funds to when closing a channel.
9122     *
9123     * This method should return a different value each time it is called, to avoid linking
9124     * on-chain funds across channels as controlled to the same user.
9125     */
9126    struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
9127    /**
9128     * Frees any resources associated with this object given its this_arg pointer.
9129     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9130     */
9131    void (*free)(void *this_arg);
9132 } LDKSignerProvider;
9133
9134 /**
9135  * A trait which should be implemented to provide feerate information on a number of time
9136  * horizons.
9137  *
9138  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
9139  * called from inside the library in response to chain events, P2P events, or timer events).
9140  */
9141 typedef struct LDKFeeEstimator {
9142    /**
9143     * An opaque pointer which is passed to your function implementations as an argument.
9144     * This has no meaning in the LDK, and can be NULL or any other value.
9145     */
9146    void *this_arg;
9147    /**
9148     * Gets estimated satoshis of fee required per 1000 Weight-Units.
9149     *
9150     * LDK will wrap this method and ensure that the value returned is no smaller than 253
9151     * (ie 1 satoshi-per-byte rounded up to ensure later round-downs don't put us below 1 satoshi-per-byte).
9152     *
9153     * The following unit conversions can be used to convert to sats/KW:
9154     *  * satoshis-per-byte * 250
9155     *  * satoshis-per-kbyte / 4
9156     */
9157    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
9158    /**
9159     * Frees any resources associated with this object given its this_arg pointer.
9160     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9161     */
9162    void (*free)(void *this_arg);
9163 } LDKFeeEstimator;
9164
9165 /**
9166  * A trait defining behavior for routing a payment.
9167  */
9168 typedef struct LDKRouter {
9169    /**
9170     * An opaque pointer which is passed to your function implementations as an argument.
9171     * This has no meaning in the LDK, and can be NULL or any other value.
9172     */
9173    void *this_arg;
9174    /**
9175     * Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
9176     *
9177     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
9178     */
9179    struct LDKCResult_RouteLightningErrorZ (*find_route)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs);
9180    /**
9181     * Finds a [`Route`] between `payer` and `payee` for a payment with the given values. Includes
9182     * `PaymentHash` and `PaymentId` to be able to correlate the request with a specific payment.
9183     *
9184     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
9185     */
9186    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, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs, struct LDKThirtyTwoBytes _payment_hash, struct LDKThirtyTwoBytes _payment_id);
9187    /**
9188     * Frees any resources associated with this object given its this_arg pointer.
9189     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9190     */
9191    void (*free)(void *this_arg);
9192 } LDKRouter;
9193
9194
9195
9196 /**
9197  * Manager which keeps track of a number of channels and sends messages to the appropriate
9198  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
9199  *
9200  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
9201  * to individual Channels.
9202  *
9203  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
9204  * all peers during write/read (though does not modify this instance, only the instance being
9205  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
9206  * called funding_transaction_generated for outbound channels).
9207  *
9208  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
9209  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
9210  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
9211  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
9212  * the serialization process). If the deserialized version is out-of-date compared to the
9213  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
9214  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
9215  *
9216  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
9217  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
9218  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
9219  * block_connected() to step towards your best block) upon deserialization before using the
9220  * object!
9221  *
9222  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
9223  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
9224  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
9225  * offline for a full minute. In order to track this, you must call
9226  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
9227  *
9228  * To avoid trivial DoS issues, ChannelManager limits the number of inbound connections and
9229  * inbound channels without confirmed funding transactions. This may result in nodes which we do
9230  * not have a channel with being unable to connect to us or open new channels with us if we have
9231  * many peers with unfunded channels.
9232  *
9233  * Because it is an indication of trust, inbound channels which we've accepted as 0conf are
9234  * exempted from the count of unfunded channels. Similarly, outbound channels and connections are
9235  * never limited. Please ensure you limit the count of such channels yourself.
9236  *
9237  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
9238  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
9239  * essentially you should default to using a SimpleRefChannelManager, and use a
9240  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
9241  * you're using lightning-net-tokio.
9242  */
9243 typedef struct MUST_USE_STRUCT LDKChannelManager {
9244    /**
9245     * A pointer to the opaque Rust object.
9246     * Nearly everywhere, inner must be non-null, however in places where
9247     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9248     */
9249    LDKnativeChannelManager *inner;
9250    /**
9251     * Indicates that this is the only struct which contains the same pointer.
9252     * Rust functions which take ownership of an object provided via an argument require
9253     * this to be true and invalidate the object pointed to by inner.
9254     */
9255    bool is_owned;
9256 } LDKChannelManager;
9257
9258 /**
9259  * A tuple of 2 elements. See the individual fields for the types contained.
9260  */
9261 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
9262    /**
9263     * The element at position 0
9264     */
9265    struct LDKThirtyTwoBytes a;
9266    /**
9267     * The element at position 1
9268     */
9269    struct LDKChannelManager b;
9270 } LDKC2Tuple_BlockHashChannelManagerZ;
9271
9272 /**
9273  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
9274  */
9275 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9276    /**
9277     * A pointer to the contents in the success state.
9278     * Reading from this pointer when `result_ok` is not set is undefined.
9279     */
9280    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
9281    /**
9282     * A pointer to the contents in the error state.
9283     * Reading from this pointer when `result_ok` is set is undefined.
9284     */
9285    struct LDKDecodeError *err;
9286 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
9287
9288 /**
9289  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
9290  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9291  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9292  */
9293 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9294    /**
9295     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
9296     * `err` or `result` depending on the state of `result_ok`.
9297     */
9298    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
9299    /**
9300     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
9301     */
9302    bool result_ok;
9303 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
9304
9305
9306
9307 /**
9308  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
9309  * with our counterparty.
9310  */
9311 typedef struct MUST_USE_STRUCT LDKChannelConfig {
9312    /**
9313     * A pointer to the opaque Rust object.
9314     * Nearly everywhere, inner must be non-null, however in places where
9315     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9316     */
9317    LDKnativeChannelConfig *inner;
9318    /**
9319     * Indicates that this is the only struct which contains the same pointer.
9320     * Rust functions which take ownership of an object provided via an argument require
9321     * this to be true and invalidate the object pointed to by inner.
9322     */
9323    bool is_owned;
9324 } LDKChannelConfig;
9325
9326 /**
9327  * The contents of CResult_ChannelConfigDecodeErrorZ
9328  */
9329 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
9330    /**
9331     * A pointer to the contents in the success state.
9332     * Reading from this pointer when `result_ok` is not set is undefined.
9333     */
9334    struct LDKChannelConfig *result;
9335    /**
9336     * A pointer to the contents in the error state.
9337     * Reading from this pointer when `result_ok` is set is undefined.
9338     */
9339    struct LDKDecodeError *err;
9340 } LDKCResult_ChannelConfigDecodeErrorZPtr;
9341
9342 /**
9343  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
9344  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
9345  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9346  */
9347 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
9348    /**
9349     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
9350     * `err` or `result` depending on the state of `result_ok`.
9351     */
9352    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
9353    /**
9354     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
9355     */
9356    bool result_ok;
9357 } LDKCResult_ChannelConfigDecodeErrorZ;
9358
9359 /**
9360  * An enum which can either contain a crate::lightning::util::errors::APIError or not
9361  */
9362 typedef enum LDKCOption_APIErrorZ_Tag {
9363    /**
9364     * When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
9365     */
9366    LDKCOption_APIErrorZ_Some,
9367    /**
9368     * When we're in this state, this COption_APIErrorZ contains nothing
9369     */
9370    LDKCOption_APIErrorZ_None,
9371    /**
9372     * Must be last for serialization purposes
9373     */
9374    LDKCOption_APIErrorZ_Sentinel,
9375 } LDKCOption_APIErrorZ_Tag;
9376
9377 typedef struct LDKCOption_APIErrorZ {
9378    LDKCOption_APIErrorZ_Tag tag;
9379    union {
9380       struct {
9381          struct LDKAPIError some;
9382       };
9383    };
9384 } LDKCOption_APIErrorZ;
9385
9386 /**
9387  * The contents of CResult_COption_APIErrorZDecodeErrorZ
9388  */
9389 typedef union LDKCResult_COption_APIErrorZDecodeErrorZPtr {
9390    /**
9391     * A pointer to the contents in the success state.
9392     * Reading from this pointer when `result_ok` is not set is undefined.
9393     */
9394    struct LDKCOption_APIErrorZ *result;
9395    /**
9396     * A pointer to the contents in the error state.
9397     * Reading from this pointer when `result_ok` is set is undefined.
9398     */
9399    struct LDKDecodeError *err;
9400 } LDKCResult_COption_APIErrorZDecodeErrorZPtr;
9401
9402 /**
9403  * A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
9404  * containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9405  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9406  */
9407 typedef struct LDKCResult_COption_APIErrorZDecodeErrorZ {
9408    /**
9409     * The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
9410     * `err` or `result` depending on the state of `result_ok`.
9411     */
9412    union LDKCResult_COption_APIErrorZDecodeErrorZPtr contents;
9413    /**
9414     * Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
9415     */
9416    bool result_ok;
9417 } LDKCResult_COption_APIErrorZDecodeErrorZ;
9418
9419 /**
9420  * The contents of CResult_OutPointDecodeErrorZ
9421  */
9422 typedef union LDKCResult_OutPointDecodeErrorZPtr {
9423    /**
9424     * A pointer to the contents in the success state.
9425     * Reading from this pointer when `result_ok` is not set is undefined.
9426     */
9427    struct LDKOutPoint *result;
9428    /**
9429     * A pointer to the contents in the error state.
9430     * Reading from this pointer when `result_ok` is set is undefined.
9431     */
9432    struct LDKDecodeError *err;
9433 } LDKCResult_OutPointDecodeErrorZPtr;
9434
9435 /**
9436  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
9437  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
9438  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9439  */
9440 typedef struct LDKCResult_OutPointDecodeErrorZ {
9441    /**
9442     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
9443     * `err` or `result` depending on the state of `result_ok`.
9444     */
9445    union LDKCResult_OutPointDecodeErrorZPtr contents;
9446    /**
9447     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
9448     */
9449    bool result_ok;
9450 } LDKCResult_OutPointDecodeErrorZ;
9451
9452 /**
9453  * Defines a type identifier for sending messages over the wire.
9454  *
9455  * Messages implementing this trait specify a type and must be [`Writeable`].
9456  */
9457 typedef struct LDKType {
9458    /**
9459     * An opaque pointer which is passed to your function implementations as an argument.
9460     * This has no meaning in the LDK, and can be NULL or any other value.
9461     */
9462    void *this_arg;
9463    /**
9464     * Returns the type identifying the message payload.
9465     */
9466    uint16_t (*type_id)(const void *this_arg);
9467    /**
9468     * Return a human-readable "debug" string describing this object
9469     */
9470    struct LDKStr (*debug_str)(const void *this_arg);
9471    /**
9472     * Serialize the object into a byte array
9473     */
9474    struct LDKCVec_u8Z (*write)(const void *this_arg);
9475    /**
9476     * Frees any resources associated with this object given its this_arg pointer.
9477     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9478     */
9479    void (*free)(void *this_arg);
9480 } LDKType;
9481
9482 /**
9483  * An enum which can either contain a crate::lightning::ln::wire::Type or not
9484  */
9485 typedef enum LDKCOption_TypeZ_Tag {
9486    /**
9487     * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
9488     */
9489    LDKCOption_TypeZ_Some,
9490    /**
9491     * When we're in this state, this COption_TypeZ contains nothing
9492     */
9493    LDKCOption_TypeZ_None,
9494    /**
9495     * Must be last for serialization purposes
9496     */
9497    LDKCOption_TypeZ_Sentinel,
9498 } LDKCOption_TypeZ_Tag;
9499
9500 typedef struct LDKCOption_TypeZ {
9501    LDKCOption_TypeZ_Tag tag;
9502    union {
9503       struct {
9504          struct LDKType some;
9505       };
9506    };
9507 } LDKCOption_TypeZ;
9508
9509 /**
9510  * The contents of CResult_COption_TypeZDecodeErrorZ
9511  */
9512 typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
9513    /**
9514     * A pointer to the contents in the success state.
9515     * Reading from this pointer when `result_ok` is not set is undefined.
9516     */
9517    struct LDKCOption_TypeZ *result;
9518    /**
9519     * A pointer to the contents in the error state.
9520     * Reading from this pointer when `result_ok` is set is undefined.
9521     */
9522    struct LDKDecodeError *err;
9523 } LDKCResult_COption_TypeZDecodeErrorZPtr;
9524
9525 /**
9526  * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
9527  * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9528  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9529  */
9530 typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
9531    /**
9532     * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
9533     * `err` or `result` depending on the state of `result_ok`.
9534     */
9535    union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
9536    /**
9537     * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
9538     */
9539    bool result_ok;
9540 } LDKCResult_COption_TypeZDecodeErrorZ;
9541
9542 /**
9543  * An error that may occur when making a payment.
9544  */
9545 typedef enum LDKPaymentError_Tag {
9546    /**
9547     * An error resulting from the provided [`Invoice`] or payment hash.
9548     */
9549    LDKPaymentError_Invoice,
9550    /**
9551     * An error occurring when sending a payment.
9552     */
9553    LDKPaymentError_Sending,
9554    /**
9555     * Must be last for serialization purposes
9556     */
9557    LDKPaymentError_Sentinel,
9558 } LDKPaymentError_Tag;
9559
9560 typedef struct MUST_USE_STRUCT LDKPaymentError {
9561    LDKPaymentError_Tag tag;
9562    union {
9563       struct {
9564          struct LDKStr invoice;
9565       };
9566       struct {
9567          enum LDKRetryableSendFailure sending;
9568       };
9569    };
9570 } LDKPaymentError;
9571
9572 /**
9573  * The contents of CResult_PaymentIdPaymentErrorZ
9574  */
9575 typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
9576    /**
9577     * A pointer to the contents in the success state.
9578     * Reading from this pointer when `result_ok` is not set is undefined.
9579     */
9580    struct LDKThirtyTwoBytes *result;
9581    /**
9582     * A pointer to the contents in the error state.
9583     * Reading from this pointer when `result_ok` is set is undefined.
9584     */
9585    struct LDKPaymentError *err;
9586 } LDKCResult_PaymentIdPaymentErrorZPtr;
9587
9588 /**
9589  * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
9590  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
9591  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9592  */
9593 typedef struct LDKCResult_PaymentIdPaymentErrorZ {
9594    /**
9595     * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
9596     * `err` or `result` depending on the state of `result_ok`.
9597     */
9598    union LDKCResult_PaymentIdPaymentErrorZPtr contents;
9599    /**
9600     * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
9601     */
9602    bool result_ok;
9603 } LDKCResult_PaymentIdPaymentErrorZ;
9604
9605 /**
9606  * The contents of CResult_NonePaymentErrorZ
9607  */
9608 typedef union LDKCResult_NonePaymentErrorZPtr {
9609    /**
9610     * Note that this value is always NULL, as there are no contents in the OK variant
9611     */
9612    void *result;
9613    /**
9614     * A pointer to the contents in the error state.
9615     * Reading from this pointer when `result_ok` is set is undefined.
9616     */
9617    struct LDKPaymentError *err;
9618 } LDKCResult_NonePaymentErrorZPtr;
9619
9620 /**
9621  * A CResult_NonePaymentErrorZ represents the result of a fallible operation,
9622  * containing a () on success and a crate::lightning_invoice::payment::PaymentError on failure.
9623  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9624  */
9625 typedef struct LDKCResult_NonePaymentErrorZ {
9626    /**
9627     * The contents of this CResult_NonePaymentErrorZ, accessible via either
9628     * `err` or `result` depending on the state of `result_ok`.
9629     */
9630    union LDKCResult_NonePaymentErrorZPtr contents;
9631    /**
9632     * Whether this CResult_NonePaymentErrorZ represents a success state.
9633     */
9634    bool result_ok;
9635 } LDKCResult_NonePaymentErrorZ;
9636
9637 /**
9638  * The contents of CResult_StringErrorZ
9639  */
9640 typedef union LDKCResult_StringErrorZPtr {
9641    /**
9642     * A pointer to the contents in the success state.
9643     * Reading from this pointer when `result_ok` is not set is undefined.
9644     */
9645    struct LDKStr *result;
9646    /**
9647     * A pointer to the contents in the error state.
9648     * Reading from this pointer when `result_ok` is set is undefined.
9649     */
9650    enum LDKSecp256k1Error *err;
9651 } LDKCResult_StringErrorZPtr;
9652
9653 /**
9654  * A CResult_StringErrorZ represents the result of a fallible operation,
9655  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
9656  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9657  */
9658 typedef struct LDKCResult_StringErrorZ {
9659    /**
9660     * The contents of this CResult_StringErrorZ, accessible via either
9661     * `err` or `result` depending on the state of `result_ok`.
9662     */
9663    union LDKCResult_StringErrorZPtr contents;
9664    /**
9665     * Whether this CResult_StringErrorZ represents a success state.
9666     */
9667    bool result_ok;
9668 } LDKCResult_StringErrorZ;
9669
9670 /**
9671  * The contents of CResult_PublicKeyErrorZ
9672  */
9673 typedef union LDKCResult_PublicKeyErrorZPtr {
9674    /**
9675     * A pointer to the contents in the success state.
9676     * Reading from this pointer when `result_ok` is not set is undefined.
9677     */
9678    struct LDKPublicKey *result;
9679    /**
9680     * A pointer to the contents in the error state.
9681     * Reading from this pointer when `result_ok` is set is undefined.
9682     */
9683    enum LDKSecp256k1Error *err;
9684 } LDKCResult_PublicKeyErrorZPtr;
9685
9686 /**
9687  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
9688  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
9689  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9690  */
9691 typedef struct LDKCResult_PublicKeyErrorZ {
9692    /**
9693     * The contents of this CResult_PublicKeyErrorZ, accessible via either
9694     * `err` or `result` depending on the state of `result_ok`.
9695     */
9696    union LDKCResult_PublicKeyErrorZPtr contents;
9697    /**
9698     * Whether this CResult_PublicKeyErrorZ represents a success state.
9699     */
9700    bool result_ok;
9701 } LDKCResult_PublicKeyErrorZ;
9702
9703 /**
9704  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
9705  */
9706 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
9707    /**
9708     * A pointer to the contents in the success state.
9709     * Reading from this pointer when `result_ok` is not set is undefined.
9710     */
9711    struct LDKChannelMonitorUpdate *result;
9712    /**
9713     * A pointer to the contents in the error state.
9714     * Reading from this pointer when `result_ok` is set is undefined.
9715     */
9716    struct LDKDecodeError *err;
9717 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
9718
9719 /**
9720  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
9721  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9722  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9723  */
9724 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
9725    /**
9726     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
9727     * `err` or `result` depending on the state of `result_ok`.
9728     */
9729    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
9730    /**
9731     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
9732     */
9733    bool result_ok;
9734 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
9735
9736 /**
9737  * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
9738  */
9739 typedef enum LDKCOption_MonitorEventZ_Tag {
9740    /**
9741     * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
9742     */
9743    LDKCOption_MonitorEventZ_Some,
9744    /**
9745     * When we're in this state, this COption_MonitorEventZ contains nothing
9746     */
9747    LDKCOption_MonitorEventZ_None,
9748    /**
9749     * Must be last for serialization purposes
9750     */
9751    LDKCOption_MonitorEventZ_Sentinel,
9752 } LDKCOption_MonitorEventZ_Tag;
9753
9754 typedef struct LDKCOption_MonitorEventZ {
9755    LDKCOption_MonitorEventZ_Tag tag;
9756    union {
9757       struct {
9758          struct LDKMonitorEvent some;
9759       };
9760    };
9761 } LDKCOption_MonitorEventZ;
9762
9763 /**
9764  * The contents of CResult_COption_MonitorEventZDecodeErrorZ
9765  */
9766 typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr {
9767    /**
9768     * A pointer to the contents in the success state.
9769     * Reading from this pointer when `result_ok` is not set is undefined.
9770     */
9771    struct LDKCOption_MonitorEventZ *result;
9772    /**
9773     * A pointer to the contents in the error state.
9774     * Reading from this pointer when `result_ok` is set is undefined.
9775     */
9776    struct LDKDecodeError *err;
9777 } LDKCResult_COption_MonitorEventZDecodeErrorZPtr;
9778
9779 /**
9780  * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
9781  * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9782  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9783  */
9784 typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ {
9785    /**
9786     * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
9787     * `err` or `result` depending on the state of `result_ok`.
9788     */
9789    union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents;
9790    /**
9791     * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
9792     */
9793    bool result_ok;
9794 } LDKCResult_COption_MonitorEventZDecodeErrorZ;
9795
9796 /**
9797  * The contents of CResult_HTLCUpdateDecodeErrorZ
9798  */
9799 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
9800    /**
9801     * A pointer to the contents in the success state.
9802     * Reading from this pointer when `result_ok` is not set is undefined.
9803     */
9804    struct LDKHTLCUpdate *result;
9805    /**
9806     * A pointer to the contents in the error state.
9807     * Reading from this pointer when `result_ok` is set is undefined.
9808     */
9809    struct LDKDecodeError *err;
9810 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
9811
9812 /**
9813  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
9814  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9815  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9816  */
9817 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
9818    /**
9819     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
9820     * `err` or `result` depending on the state of `result_ok`.
9821     */
9822    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
9823    /**
9824     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
9825     */
9826    bool result_ok;
9827 } LDKCResult_HTLCUpdateDecodeErrorZ;
9828
9829 /**
9830  * A tuple of 2 elements. See the individual fields for the types contained.
9831  */
9832 typedef struct LDKC2Tuple_OutPointScriptZ {
9833    /**
9834     * The element at position 0
9835     */
9836    struct LDKOutPoint a;
9837    /**
9838     * The element at position 1
9839     */
9840    struct LDKCVec_u8Z b;
9841 } LDKC2Tuple_OutPointScriptZ;
9842
9843 /**
9844  * A tuple of 2 elements. See the individual fields for the types contained.
9845  */
9846 typedef struct LDKC2Tuple_u32ScriptZ {
9847    /**
9848     * The element at position 0
9849     */
9850    uint32_t a;
9851    /**
9852     * The element at position 1
9853     */
9854    struct LDKCVec_u8Z b;
9855 } LDKC2Tuple_u32ScriptZ;
9856
9857 /**
9858  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
9859  * This corresponds to std::vector in C++
9860  */
9861 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
9862    /**
9863     * The elements in the array.
9864     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9865     */
9866    struct LDKC2Tuple_u32ScriptZ *data;
9867    /**
9868     * The number of elements pointed to by `data`.
9869     */
9870    uintptr_t datalen;
9871 } LDKCVec_C2Tuple_u32ScriptZZ;
9872
9873 /**
9874  * A tuple of 2 elements. See the individual fields for the types contained.
9875  */
9876 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9877    /**
9878     * The element at position 0
9879     */
9880    struct LDKThirtyTwoBytes a;
9881    /**
9882     * The element at position 1
9883     */
9884    struct LDKCVec_C2Tuple_u32ScriptZZ b;
9885 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
9886
9887 /**
9888  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
9889  * This corresponds to std::vector in C++
9890  */
9891 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9892    /**
9893     * The elements in the array.
9894     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9895     */
9896    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
9897    /**
9898     * The number of elements pointed to by `data`.
9899     */
9900    uintptr_t datalen;
9901 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
9902
9903 /**
9904  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
9905  * This corresponds to std::vector in C++
9906  */
9907 typedef struct LDKCVec_EventZ {
9908    /**
9909     * The elements in the array.
9910     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9911     */
9912    struct LDKEvent *data;
9913    /**
9914     * The number of elements pointed to by `data`.
9915     */
9916    uintptr_t datalen;
9917 } LDKCVec_EventZ;
9918
9919 /**
9920  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
9921  * This corresponds to std::vector in C++
9922  */
9923 typedef struct LDKCVec_TransactionZ {
9924    /**
9925     * The elements in the array.
9926     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9927     */
9928    struct LDKTransaction *data;
9929    /**
9930     * The number of elements pointed to by `data`.
9931     */
9932    uintptr_t datalen;
9933 } LDKCVec_TransactionZ;
9934
9935 /**
9936  * A tuple of 2 elements. See the individual fields for the types contained.
9937  */
9938 typedef struct LDKC2Tuple_u32TxOutZ {
9939    /**
9940     * The element at position 0
9941     */
9942    uint32_t a;
9943    /**
9944     * The element at position 1
9945     */
9946    struct LDKTxOut b;
9947 } LDKC2Tuple_u32TxOutZ;
9948
9949 /**
9950  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
9951  * This corresponds to std::vector in C++
9952  */
9953 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
9954    /**
9955     * The elements in the array.
9956     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9957     */
9958    struct LDKC2Tuple_u32TxOutZ *data;
9959    /**
9960     * The number of elements pointed to by `data`.
9961     */
9962    uintptr_t datalen;
9963 } LDKCVec_C2Tuple_u32TxOutZZ;
9964
9965 /**
9966  * A tuple of 2 elements. See the individual fields for the types contained.
9967  */
9968 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9969    /**
9970     * The element at position 0
9971     */
9972    struct LDKThirtyTwoBytes a;
9973    /**
9974     * The element at position 1
9975     */
9976    struct LDKCVec_C2Tuple_u32TxOutZZ b;
9977 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
9978
9979 /**
9980  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
9981  * This corresponds to std::vector in C++
9982  */
9983 typedef struct LDKCVec_TransactionOutputsZ {
9984    /**
9985     * The elements in the array.
9986     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9987     */
9988    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
9989    /**
9990     * The number of elements pointed to by `data`.
9991     */
9992    uintptr_t datalen;
9993 } LDKCVec_TransactionOutputsZ;
9994
9995 /**
9996  * Details about the balance(s) available for spending once the channel appears on chain.
9997  *
9998  * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
9999  * be provided.
10000  */
10001 typedef enum LDKBalance_Tag {
10002    /**
10003     * The channel is not yet closed (or the commitment or closing transaction has not yet
10004     * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
10005     * force-closed now.
10006     */
10007    LDKBalance_ClaimableOnChannelClose,
10008    /**
10009     * The channel has been closed, and the given balance is ours but awaiting confirmations until
10010     * we consider it spendable.
10011     */
10012    LDKBalance_ClaimableAwaitingConfirmations,
10013    /**
10014     * The channel has been closed, and the given balance should be ours but awaiting spending
10015     * transaction confirmation. If the spending transaction does not confirm in time, it is
10016     * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
10017     *
10018     * Once the spending transaction confirms, before it has reached enough confirmations to be
10019     * considered safe from chain reorganizations, the balance will instead be provided via
10020     * [`Balance::ClaimableAwaitingConfirmations`].
10021     */
10022    LDKBalance_ContentiousClaimable,
10023    /**
10024     * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
10025     * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
10026     * likely to be claimed by our counterparty before we do.
10027     */
10028    LDKBalance_MaybeTimeoutClaimableHTLC,
10029    /**
10030     * HTLCs which we received from our counterparty which are claimable with a preimage which we
10031     * do not currently have. This will only be claimable if we receive the preimage from the node
10032     * to which we forwarded this HTLC before the timeout.
10033     */
10034    LDKBalance_MaybePreimageClaimableHTLC,
10035    /**
10036     * The channel has been closed, and our counterparty broadcasted a revoked commitment
10037     * transaction.
10038     *
10039     * Thus, we're able to claim all outputs in the commitment transaction, one of which has the
10040     * following amount.
10041     */
10042    LDKBalance_CounterpartyRevokedOutputClaimable,
10043    /**
10044     * Must be last for serialization purposes
10045     */
10046    LDKBalance_Sentinel,
10047 } LDKBalance_Tag;
10048
10049 typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
10050    /**
10051     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
10052     * required to do so.
10053     */
10054    uint64_t claimable_amount_satoshis;
10055 } LDKBalance_LDKClaimableOnChannelClose_Body;
10056
10057 typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
10058    /**
10059     * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
10060     * were spent in broadcasting the transaction.
10061     */
10062    uint64_t claimable_amount_satoshis;
10063    /**
10064     * The height at which an [`Event::SpendableOutputs`] event will be generated for this
10065     * amount.
10066     */
10067    uint32_t confirmation_height;
10068 } LDKBalance_LDKClaimableAwaitingConfirmations_Body;
10069
10070 typedef struct LDKBalance_LDKContentiousClaimable_Body {
10071    /**
10072     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
10073     * required to do so.
10074     */
10075    uint64_t claimable_amount_satoshis;
10076    /**
10077     * The height at which the counterparty may be able to claim the balance if we have not
10078     * done so.
10079     */
10080    uint32_t timeout_height;
10081 } LDKBalance_LDKContentiousClaimable_Body;
10082
10083 typedef struct LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body {
10084    /**
10085     * The amount potentially available to claim, in satoshis, excluding the on-chain fees
10086     * which will be required to do so.
10087     */
10088    uint64_t claimable_amount_satoshis;
10089    /**
10090     * The height at which we will be able to claim the balance if our counterparty has not
10091     * done so.
10092     */
10093    uint32_t claimable_height;
10094 } LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body;
10095
10096 typedef struct LDKBalance_LDKMaybePreimageClaimableHTLC_Body {
10097    /**
10098     * The amount potentially available to claim, in satoshis, excluding the on-chain fees
10099     * which will be required to do so.
10100     */
10101    uint64_t claimable_amount_satoshis;
10102    /**
10103     * The height at which our counterparty will be able to claim the balance if we have not
10104     * yet received the preimage and claimed it ourselves.
10105     */
10106    uint32_t expiry_height;
10107 } LDKBalance_LDKMaybePreimageClaimableHTLC_Body;
10108
10109 typedef struct LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body {
10110    /**
10111     * The amount, in satoshis, of the output which we can claim.
10112     *
10113     * Note that for outputs from HTLC balances this may be excluding some on-chain fees that
10114     * were already spent.
10115     */
10116    uint64_t claimable_amount_satoshis;
10117 } LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body;
10118
10119 typedef struct MUST_USE_STRUCT LDKBalance {
10120    LDKBalance_Tag tag;
10121    union {
10122       LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
10123       LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
10124       LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
10125       LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body maybe_timeout_claimable_htlc;
10126       LDKBalance_LDKMaybePreimageClaimableHTLC_Body maybe_preimage_claimable_htlc;
10127       LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body counterparty_revoked_output_claimable;
10128    };
10129 } LDKBalance;
10130
10131 /**
10132  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
10133  * This corresponds to std::vector in C++
10134  */
10135 typedef struct LDKCVec_BalanceZ {
10136    /**
10137     * The elements in the array.
10138     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10139     */
10140    struct LDKBalance *data;
10141    /**
10142     * The number of elements pointed to by `data`.
10143     */
10144    uintptr_t datalen;
10145 } LDKCVec_BalanceZ;
10146
10147 /**
10148  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
10149  */
10150 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10151    /**
10152     * A pointer to the contents in the success state.
10153     * Reading from this pointer when `result_ok` is not set is undefined.
10154     */
10155    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
10156    /**
10157     * A pointer to the contents in the error state.
10158     * Reading from this pointer when `result_ok` is set is undefined.
10159     */
10160    struct LDKDecodeError *err;
10161 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
10162
10163 /**
10164  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
10165  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10166  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10167  */
10168 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10169    /**
10170     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
10171     * `err` or `result` depending on the state of `result_ok`.
10172     */
10173    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
10174    /**
10175     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
10176     */
10177    bool result_ok;
10178 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
10179
10180 /**
10181  * A tuple of 2 elements. See the individual fields for the types contained.
10182  */
10183 typedef struct LDKC2Tuple_PublicKeyTypeZ {
10184    /**
10185     * The element at position 0
10186     */
10187    struct LDKPublicKey a;
10188    /**
10189     * The element at position 1
10190     */
10191    struct LDKType b;
10192 } LDKC2Tuple_PublicKeyTypeZ;
10193
10194 /**
10195  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
10196  * This corresponds to std::vector in C++
10197  */
10198 typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
10199    /**
10200     * The elements in the array.
10201     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10202     */
10203    struct LDKC2Tuple_PublicKeyTypeZ *data;
10204    /**
10205     * The number of elements pointed to by `data`.
10206     */
10207    uintptr_t datalen;
10208 } LDKCVec_C2Tuple_PublicKeyTypeZZ;
10209
10210 /**
10211  * The contents of a custom onion message.
10212  */
10213 typedef struct LDKCustomOnionMessageContents {
10214    /**
10215     * An opaque pointer which is passed to your function implementations as an argument.
10216     * This has no meaning in the LDK, and can be NULL or any other value.
10217     */
10218    void *this_arg;
10219    /**
10220     * Returns the TLV type identifying the message contents. MUST be >= 64.
10221     */
10222    uint64_t (*tlv_type)(const void *this_arg);
10223    /**
10224     * Serialize the object into a byte array
10225     */
10226    struct LDKCVec_u8Z (*write)(const void *this_arg);
10227    /**
10228     * Frees any resources associated with this object given its this_arg pointer.
10229     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10230     */
10231    void (*free)(void *this_arg);
10232 } LDKCustomOnionMessageContents;
10233
10234 /**
10235  * An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
10236  */
10237 typedef enum LDKCOption_CustomOnionMessageContentsZ_Tag {
10238    /**
10239     * When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
10240     */
10241    LDKCOption_CustomOnionMessageContentsZ_Some,
10242    /**
10243     * When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
10244     */
10245    LDKCOption_CustomOnionMessageContentsZ_None,
10246    /**
10247     * Must be last for serialization purposes
10248     */
10249    LDKCOption_CustomOnionMessageContentsZ_Sentinel,
10250 } LDKCOption_CustomOnionMessageContentsZ_Tag;
10251
10252 typedef struct LDKCOption_CustomOnionMessageContentsZ {
10253    LDKCOption_CustomOnionMessageContentsZ_Tag tag;
10254    union {
10255       struct {
10256          struct LDKCustomOnionMessageContents some;
10257       };
10258    };
10259 } LDKCOption_CustomOnionMessageContentsZ;
10260
10261 /**
10262  * The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
10263  */
10264 typedef union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
10265    /**
10266     * A pointer to the contents in the success state.
10267     * Reading from this pointer when `result_ok` is not set is undefined.
10268     */
10269    struct LDKCOption_CustomOnionMessageContentsZ *result;
10270    /**
10271     * A pointer to the contents in the error state.
10272     * Reading from this pointer when `result_ok` is set is undefined.
10273     */
10274    struct LDKDecodeError *err;
10275 } LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr;
10276
10277 /**
10278  * A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
10279  * containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10280  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10281  */
10282 typedef struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
10283    /**
10284     * The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
10285     * `err` or `result` depending on the state of `result_ok`.
10286     */
10287    union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr contents;
10288    /**
10289     * Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
10290     */
10291    bool result_ok;
10292 } LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ;
10293
10294 /**
10295  * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
10296  */
10297 typedef enum LDKCOption_NetAddressZ_Tag {
10298    /**
10299     * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
10300     */
10301    LDKCOption_NetAddressZ_Some,
10302    /**
10303     * When we're in this state, this COption_NetAddressZ contains nothing
10304     */
10305    LDKCOption_NetAddressZ_None,
10306    /**
10307     * Must be last for serialization purposes
10308     */
10309    LDKCOption_NetAddressZ_Sentinel,
10310 } LDKCOption_NetAddressZ_Tag;
10311
10312 typedef struct LDKCOption_NetAddressZ {
10313    LDKCOption_NetAddressZ_Tag tag;
10314    union {
10315       struct {
10316          struct LDKNetAddress some;
10317       };
10318    };
10319 } LDKCOption_NetAddressZ;
10320
10321 /**
10322  * A tuple of 2 elements. See the individual fields for the types contained.
10323  */
10324 typedef struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ {
10325    /**
10326     * The element at position 0
10327     */
10328    struct LDKPublicKey a;
10329    /**
10330     * The element at position 1
10331     */
10332    struct LDKCOption_NetAddressZ b;
10333 } LDKC2Tuple_PublicKeyCOption_NetAddressZZ;
10334
10335 /**
10336  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZs of arbitrary size.
10337  * This corresponds to std::vector in C++
10338  */
10339 typedef struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
10340    /**
10341     * The elements in the array.
10342     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10343     */
10344    struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ *data;
10345    /**
10346     * The number of elements pointed to by `data`.
10347     */
10348    uintptr_t datalen;
10349 } LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ;
10350
10351
10352
10353 /**
10354  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
10355  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
10356  * descriptor.
10357  */
10358 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
10359    /**
10360     * A pointer to the opaque Rust object.
10361     * Nearly everywhere, inner must be non-null, however in places where
10362     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10363     */
10364    LDKnativePeerHandleError *inner;
10365    /**
10366     * Indicates that this is the only struct which contains the same pointer.
10367     * Rust functions which take ownership of an object provided via an argument require
10368     * this to be true and invalidate the object pointed to by inner.
10369     */
10370    bool is_owned;
10371 } LDKPeerHandleError;
10372
10373 /**
10374  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
10375  */
10376 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
10377    /**
10378     * A pointer to the contents in the success state.
10379     * Reading from this pointer when `result_ok` is not set is undefined.
10380     */
10381    struct LDKCVec_u8Z *result;
10382    /**
10383     * A pointer to the contents in the error state.
10384     * Reading from this pointer when `result_ok` is set is undefined.
10385     */
10386    struct LDKPeerHandleError *err;
10387 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
10388
10389 /**
10390  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
10391  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10392  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10393  */
10394 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
10395    /**
10396     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
10397     * `err` or `result` depending on the state of `result_ok`.
10398     */
10399    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
10400    /**
10401     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
10402     */
10403    bool result_ok;
10404 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
10405
10406 /**
10407  * The contents of CResult_NonePeerHandleErrorZ
10408  */
10409 typedef union LDKCResult_NonePeerHandleErrorZPtr {
10410    /**
10411     * Note that this value is always NULL, as there are no contents in the OK variant
10412     */
10413    void *result;
10414    /**
10415     * A pointer to the contents in the error state.
10416     * Reading from this pointer when `result_ok` is set is undefined.
10417     */
10418    struct LDKPeerHandleError *err;
10419 } LDKCResult_NonePeerHandleErrorZPtr;
10420
10421 /**
10422  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
10423  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10424  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10425  */
10426 typedef struct LDKCResult_NonePeerHandleErrorZ {
10427    /**
10428     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
10429     * `err` or `result` depending on the state of `result_ok`.
10430     */
10431    union LDKCResult_NonePeerHandleErrorZPtr contents;
10432    /**
10433     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
10434     */
10435    bool result_ok;
10436 } LDKCResult_NonePeerHandleErrorZ;
10437
10438 /**
10439  * The contents of CResult_boolPeerHandleErrorZ
10440  */
10441 typedef union LDKCResult_boolPeerHandleErrorZPtr {
10442    /**
10443     * A pointer to the contents in the success state.
10444     * Reading from this pointer when `result_ok` is not set is undefined.
10445     */
10446    bool *result;
10447    /**
10448     * A pointer to the contents in the error state.
10449     * Reading from this pointer when `result_ok` is set is undefined.
10450     */
10451    struct LDKPeerHandleError *err;
10452 } LDKCResult_boolPeerHandleErrorZPtr;
10453
10454 /**
10455  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
10456  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10457  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10458  */
10459 typedef struct LDKCResult_boolPeerHandleErrorZ {
10460    /**
10461     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
10462     * `err` or `result` depending on the state of `result_ok`.
10463     */
10464    union LDKCResult_boolPeerHandleErrorZPtr contents;
10465    /**
10466     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
10467     */
10468    bool result_ok;
10469 } LDKCResult_boolPeerHandleErrorZ;
10470
10471 /**
10472  * Errors that may occur when [sending an onion message].
10473  *
10474  * [sending an onion message]: OnionMessenger::send_onion_message
10475  */
10476 typedef enum LDKSendError_Tag {
10477    /**
10478     * Errored computing onion message packet keys.
10479     */
10480    LDKSendError_Secp256k1,
10481    /**
10482     * Because implementations such as Eclair will drop onion messages where the message packet
10483     * exceeds 32834 bytes, we refuse to send messages where the packet exceeds this size.
10484     */
10485    LDKSendError_TooBigPacket,
10486    /**
10487     * The provided [`Destination`] was an invalid [`BlindedPath`], due to having fewer than two
10488     * blinded hops.
10489     */
10490    LDKSendError_TooFewBlindedHops,
10491    /**
10492     * Our next-hop peer was offline or does not support onion message forwarding.
10493     */
10494    LDKSendError_InvalidFirstHop,
10495    /**
10496     * Onion message contents must have a TLV type >= 64.
10497     */
10498    LDKSendError_InvalidMessage,
10499    /**
10500     * Our next-hop peer's buffer was full or our total outbound buffer was full.
10501     */
10502    LDKSendError_BufferFull,
10503    /**
10504     * Failed to retrieve our node id from the provided [`NodeSigner`].
10505     *
10506     * [`NodeSigner`]: crate::chain::keysinterface::NodeSigner
10507     */
10508    LDKSendError_GetNodeIdFailed,
10509    /**
10510     * We attempted to send to a blinded path where we are the introduction node, and failed to
10511     * advance the blinded path to make the second hop the new introduction node. Either
10512     * [`NodeSigner::ecdh`] failed, we failed to tweak the current blinding point to get the
10513     * new blinding point, or we were attempting to send to ourselves.
10514     */
10515    LDKSendError_BlindedPathAdvanceFailed,
10516    /**
10517     * Must be last for serialization purposes
10518     */
10519    LDKSendError_Sentinel,
10520 } LDKSendError_Tag;
10521
10522 typedef struct MUST_USE_STRUCT LDKSendError {
10523    LDKSendError_Tag tag;
10524    union {
10525       struct {
10526          enum LDKSecp256k1Error secp256k1;
10527       };
10528    };
10529 } LDKSendError;
10530
10531 /**
10532  * The contents of CResult_NoneSendErrorZ
10533  */
10534 typedef union LDKCResult_NoneSendErrorZPtr {
10535    /**
10536     * Note that this value is always NULL, as there are no contents in the OK variant
10537     */
10538    void *result;
10539    /**
10540     * A pointer to the contents in the error state.
10541     * Reading from this pointer when `result_ok` is set is undefined.
10542     */
10543    struct LDKSendError *err;
10544 } LDKCResult_NoneSendErrorZPtr;
10545
10546 /**
10547  * A CResult_NoneSendErrorZ represents the result of a fallible operation,
10548  * containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
10549  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10550  */
10551 typedef struct LDKCResult_NoneSendErrorZ {
10552    /**
10553     * The contents of this CResult_NoneSendErrorZ, accessible via either
10554     * `err` or `result` depending on the state of `result_ok`.
10555     */
10556    union LDKCResult_NoneSendErrorZPtr contents;
10557    /**
10558     * Whether this CResult_NoneSendErrorZ represents a success state.
10559     */
10560    bool result_ok;
10561 } LDKCResult_NoneSendErrorZ;
10562
10563 /**
10564  * Sub-errors which don't have specific information in them use this type.
10565  */
10566 typedef struct LDKError {
10567    /**
10568     * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here
10569     */
10570    uint8_t _dummy;
10571 } LDKError;
10572
10573 /**
10574  * Errors that indicate what is wrong with the invoice. They have some granularity for debug
10575  * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user.
10576  */
10577 typedef enum LDKParseError_Tag {
10578    LDKParseError_Bech32Error,
10579    LDKParseError_ParseAmountError,
10580    LDKParseError_MalformedSignature,
10581    LDKParseError_BadPrefix,
10582    LDKParseError_UnknownCurrency,
10583    LDKParseError_UnknownSiPrefix,
10584    LDKParseError_MalformedHRP,
10585    LDKParseError_TooShortDataPart,
10586    LDKParseError_UnexpectedEndOfTaggedFields,
10587    LDKParseError_DescriptionDecodeError,
10588    LDKParseError_PaddingError,
10589    LDKParseError_IntegerOverflowError,
10590    LDKParseError_InvalidSegWitProgramLength,
10591    LDKParseError_InvalidPubKeyHashLength,
10592    LDKParseError_InvalidScriptHashLength,
10593    LDKParseError_InvalidRecoveryId,
10594    LDKParseError_InvalidSliceLength,
10595    /**
10596     * Not an error, but used internally to signal that a part of the invoice should be ignored
10597     * according to BOLT11
10598     */
10599    LDKParseError_Skip,
10600    /**
10601     * Must be last for serialization purposes
10602     */
10603    LDKParseError_Sentinel,
10604 } LDKParseError_Tag;
10605
10606 typedef struct MUST_USE_STRUCT LDKParseError {
10607    LDKParseError_Tag tag;
10608    union {
10609       struct {
10610          struct LDKBech32Error bech32_error;
10611       };
10612       struct {
10613          struct LDKError parse_amount_error;
10614       };
10615       struct {
10616          enum LDKSecp256k1Error malformed_signature;
10617       };
10618       struct {
10619          struct LDKError description_decode_error;
10620       };
10621       struct {
10622          struct LDKStr invalid_slice_length;
10623       };
10624    };
10625 } LDKParseError;
10626
10627 /**
10628  * The contents of CResult_SiPrefixParseErrorZ
10629  */
10630 typedef union LDKCResult_SiPrefixParseErrorZPtr {
10631    /**
10632     * A pointer to the contents in the success state.
10633     * Reading from this pointer when `result_ok` is not set is undefined.
10634     */
10635    enum LDKSiPrefix *result;
10636    /**
10637     * A pointer to the contents in the error state.
10638     * Reading from this pointer when `result_ok` is set is undefined.
10639     */
10640    struct LDKParseError *err;
10641 } LDKCResult_SiPrefixParseErrorZPtr;
10642
10643 /**
10644  * A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
10645  * containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
10646  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10647  */
10648 typedef struct LDKCResult_SiPrefixParseErrorZ {
10649    /**
10650     * The contents of this CResult_SiPrefixParseErrorZ, accessible via either
10651     * `err` or `result` depending on the state of `result_ok`.
10652     */
10653    union LDKCResult_SiPrefixParseErrorZPtr contents;
10654    /**
10655     * Whether this CResult_SiPrefixParseErrorZ represents a success state.
10656     */
10657    bool result_ok;
10658 } LDKCResult_SiPrefixParseErrorZ;
10659
10660
10661
10662 /**
10663  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
10664  *
10665  * There are three ways to construct an `Invoice`:
10666  *  1. using `InvoiceBuilder`
10667  *  2. using `Invoice::from_signed(SignedRawInvoice)`
10668  *  3. using `str::parse::<Invoice>(&str)`
10669  */
10670 typedef struct MUST_USE_STRUCT LDKInvoice {
10671    /**
10672     * A pointer to the opaque Rust object.
10673     * Nearly everywhere, inner must be non-null, however in places where
10674     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10675     */
10676    LDKnativeInvoice *inner;
10677    /**
10678     * Indicates that this is the only struct which contains the same pointer.
10679     * Rust functions which take ownership of an object provided via an argument require
10680     * this to be true and invalidate the object pointed to by inner.
10681     */
10682    bool is_owned;
10683 } LDKInvoice;
10684
10685 /**
10686  * Indicates that something went wrong while parsing or validating the invoice. Parsing errors
10687  * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors
10688  * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
10689  */
10690 typedef enum LDKParseOrSemanticError_Tag {
10691    /**
10692     * The invoice couldn't be decoded
10693     */
10694    LDKParseOrSemanticError_ParseError,
10695    /**
10696     * The invoice could be decoded but violates the BOLT11 standard
10697     */
10698    LDKParseOrSemanticError_SemanticError,
10699    /**
10700     * Must be last for serialization purposes
10701     */
10702    LDKParseOrSemanticError_Sentinel,
10703 } LDKParseOrSemanticError_Tag;
10704
10705 typedef struct MUST_USE_STRUCT LDKParseOrSemanticError {
10706    LDKParseOrSemanticError_Tag tag;
10707    union {
10708       struct {
10709          struct LDKParseError parse_error;
10710       };
10711       struct {
10712          enum LDKSemanticError semantic_error;
10713       };
10714    };
10715 } LDKParseOrSemanticError;
10716
10717 /**
10718  * The contents of CResult_InvoiceParseOrSemanticErrorZ
10719  */
10720 typedef union LDKCResult_InvoiceParseOrSemanticErrorZPtr {
10721    /**
10722     * A pointer to the contents in the success state.
10723     * Reading from this pointer when `result_ok` is not set is undefined.
10724     */
10725    struct LDKInvoice *result;
10726    /**
10727     * A pointer to the contents in the error state.
10728     * Reading from this pointer when `result_ok` is set is undefined.
10729     */
10730    struct LDKParseOrSemanticError *err;
10731 } LDKCResult_InvoiceParseOrSemanticErrorZPtr;
10732
10733 /**
10734  * A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
10735  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
10736  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10737  */
10738 typedef struct LDKCResult_InvoiceParseOrSemanticErrorZ {
10739    /**
10740     * The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
10741     * `err` or `result` depending on the state of `result_ok`.
10742     */
10743    union LDKCResult_InvoiceParseOrSemanticErrorZPtr contents;
10744    /**
10745     * Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
10746     */
10747    bool result_ok;
10748 } LDKCResult_InvoiceParseOrSemanticErrorZ;
10749
10750
10751
10752 /**
10753  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
10754  * invalid.
10755  *
10756  * # Invariants
10757  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
10758  */
10759 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
10760    /**
10761     * A pointer to the opaque Rust object.
10762     * Nearly everywhere, inner must be non-null, however in places where
10763     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10764     */
10765    LDKnativeSignedRawInvoice *inner;
10766    /**
10767     * Indicates that this is the only struct which contains the same pointer.
10768     * Rust functions which take ownership of an object provided via an argument require
10769     * this to be true and invalidate the object pointed to by inner.
10770     */
10771    bool is_owned;
10772 } LDKSignedRawInvoice;
10773
10774 /**
10775  * The contents of CResult_SignedRawInvoiceParseErrorZ
10776  */
10777 typedef union LDKCResult_SignedRawInvoiceParseErrorZPtr {
10778    /**
10779     * A pointer to the contents in the success state.
10780     * Reading from this pointer when `result_ok` is not set is undefined.
10781     */
10782    struct LDKSignedRawInvoice *result;
10783    /**
10784     * A pointer to the contents in the error state.
10785     * Reading from this pointer when `result_ok` is set is undefined.
10786     */
10787    struct LDKParseError *err;
10788 } LDKCResult_SignedRawInvoiceParseErrorZPtr;
10789
10790 /**
10791  * A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
10792  * containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
10793  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10794  */
10795 typedef struct LDKCResult_SignedRawInvoiceParseErrorZ {
10796    /**
10797     * The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
10798     * `err` or `result` depending on the state of `result_ok`.
10799     */
10800    union LDKCResult_SignedRawInvoiceParseErrorZPtr contents;
10801    /**
10802     * Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
10803     */
10804    bool result_ok;
10805 } LDKCResult_SignedRawInvoiceParseErrorZ;
10806
10807
10808
10809 /**
10810  * Represents an syntactically correct Invoice for a payment on the lightning network,
10811  * but without the signature information.
10812  * De- and encoding should not lead to information loss but may lead to different hashes.
10813  *
10814  * For methods without docs see the corresponding methods in `Invoice`.
10815  */
10816 typedef struct MUST_USE_STRUCT LDKRawInvoice {
10817    /**
10818     * A pointer to the opaque Rust object.
10819     * Nearly everywhere, inner must be non-null, however in places where
10820     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10821     */
10822    LDKnativeRawInvoice *inner;
10823    /**
10824     * Indicates that this is the only struct which contains the same pointer.
10825     * Rust functions which take ownership of an object provided via an argument require
10826     * this to be true and invalidate the object pointed to by inner.
10827     */
10828    bool is_owned;
10829 } LDKRawInvoice;
10830
10831
10832
10833 /**
10834  * Recoverable signature
10835  */
10836 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
10837    /**
10838     * A pointer to the opaque Rust object.
10839     * Nearly everywhere, inner must be non-null, however in places where
10840     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10841     */
10842    LDKnativeInvoiceSignature *inner;
10843    /**
10844     * Indicates that this is the only struct which contains the same pointer.
10845     * Rust functions which take ownership of an object provided via an argument require
10846     * this to be true and invalidate the object pointed to by inner.
10847     */
10848    bool is_owned;
10849 } LDKInvoiceSignature;
10850
10851 /**
10852  * A tuple of 3 elements. See the individual fields for the types contained.
10853  */
10854 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
10855    /**
10856     * The element at position 0
10857     */
10858    struct LDKRawInvoice a;
10859    /**
10860     * The element at position 1
10861     */
10862    struct LDKThirtyTwoBytes b;
10863    /**
10864     * The element at position 2
10865     */
10866    struct LDKInvoiceSignature c;
10867 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
10868
10869
10870
10871 /**
10872  * Payee public key
10873  */
10874 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
10875    /**
10876     * A pointer to the opaque Rust object.
10877     * Nearly everywhere, inner must be non-null, however in places where
10878     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10879     */
10880    LDKnativePayeePubKey *inner;
10881    /**
10882     * Indicates that this is the only struct which contains the same pointer.
10883     * Rust functions which take ownership of an object provided via an argument require
10884     * this to be true and invalidate the object pointed to by inner.
10885     */
10886    bool is_owned;
10887 } LDKPayeePubKey;
10888
10889 /**
10890  * The contents of CResult_PayeePubKeyErrorZ
10891  */
10892 typedef union LDKCResult_PayeePubKeyErrorZPtr {
10893    /**
10894     * A pointer to the contents in the success state.
10895     * Reading from this pointer when `result_ok` is not set is undefined.
10896     */
10897    struct LDKPayeePubKey *result;
10898    /**
10899     * A pointer to the contents in the error state.
10900     * Reading from this pointer when `result_ok` is set is undefined.
10901     */
10902    enum LDKSecp256k1Error *err;
10903 } LDKCResult_PayeePubKeyErrorZPtr;
10904
10905 /**
10906  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
10907  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
10908  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10909  */
10910 typedef struct LDKCResult_PayeePubKeyErrorZ {
10911    /**
10912     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
10913     * `err` or `result` depending on the state of `result_ok`.
10914     */
10915    union LDKCResult_PayeePubKeyErrorZPtr contents;
10916    /**
10917     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
10918     */
10919    bool result_ok;
10920 } LDKCResult_PayeePubKeyErrorZ;
10921
10922
10923
10924 /**
10925  * Private routing information
10926  *
10927  * # Invariants
10928  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
10929  *
10930  */
10931 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
10932    /**
10933     * A pointer to the opaque Rust object.
10934     * Nearly everywhere, inner must be non-null, however in places where
10935     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10936     */
10937    LDKnativePrivateRoute *inner;
10938    /**
10939     * Indicates that this is the only struct which contains the same pointer.
10940     * Rust functions which take ownership of an object provided via an argument require
10941     * this to be true and invalidate the object pointed to by inner.
10942     */
10943    bool is_owned;
10944 } LDKPrivateRoute;
10945
10946 /**
10947  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
10948  * This corresponds to std::vector in C++
10949  */
10950 typedef struct LDKCVec_PrivateRouteZ {
10951    /**
10952     * The elements in the array.
10953     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10954     */
10955    struct LDKPrivateRoute *data;
10956    /**
10957     * The number of elements pointed to by `data`.
10958     */
10959    uintptr_t datalen;
10960 } LDKCVec_PrivateRouteZ;
10961
10962
10963
10964 /**
10965  * A timestamp that refers to a date after 1 January 1970.
10966  *
10967  * # Invariants
10968  *
10969  * The Unix timestamp representing the stored time has to be positive and no greater than
10970  * [`MAX_TIMESTAMP`].
10971  */
10972 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
10973    /**
10974     * A pointer to the opaque Rust object.
10975     * Nearly everywhere, inner must be non-null, however in places where
10976     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10977     */
10978    LDKnativePositiveTimestamp *inner;
10979    /**
10980     * Indicates that this is the only struct which contains the same pointer.
10981     * Rust functions which take ownership of an object provided via an argument require
10982     * this to be true and invalidate the object pointed to by inner.
10983     */
10984    bool is_owned;
10985 } LDKPositiveTimestamp;
10986
10987 /**
10988  * The contents of CResult_PositiveTimestampCreationErrorZ
10989  */
10990 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
10991    /**
10992     * A pointer to the contents in the success state.
10993     * Reading from this pointer when `result_ok` is not set is undefined.
10994     */
10995    struct LDKPositiveTimestamp *result;
10996    /**
10997     * A pointer to the contents in the error state.
10998     * Reading from this pointer when `result_ok` is set is undefined.
10999     */
11000    enum LDKCreationError *err;
11001 } LDKCResult_PositiveTimestampCreationErrorZPtr;
11002
11003 /**
11004  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
11005  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
11006  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11007  */
11008 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
11009    /**
11010     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
11011     * `err` or `result` depending on the state of `result_ok`.
11012     */
11013    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
11014    /**
11015     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
11016     */
11017    bool result_ok;
11018 } LDKCResult_PositiveTimestampCreationErrorZ;
11019
11020 /**
11021  * The contents of CResult_NoneSemanticErrorZ
11022  */
11023 typedef union LDKCResult_NoneSemanticErrorZPtr {
11024    /**
11025     * Note that this value is always NULL, as there are no contents in the OK variant
11026     */
11027    void *result;
11028    /**
11029     * A pointer to the contents in the error state.
11030     * Reading from this pointer when `result_ok` is set is undefined.
11031     */
11032    enum LDKSemanticError *err;
11033 } LDKCResult_NoneSemanticErrorZPtr;
11034
11035 /**
11036  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
11037  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
11038  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11039  */
11040 typedef struct LDKCResult_NoneSemanticErrorZ {
11041    /**
11042     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
11043     * `err` or `result` depending on the state of `result_ok`.
11044     */
11045    union LDKCResult_NoneSemanticErrorZPtr contents;
11046    /**
11047     * Whether this CResult_NoneSemanticErrorZ represents a success state.
11048     */
11049    bool result_ok;
11050 } LDKCResult_NoneSemanticErrorZ;
11051
11052 /**
11053  * The contents of CResult_InvoiceSemanticErrorZ
11054  */
11055 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
11056    /**
11057     * A pointer to the contents in the success state.
11058     * Reading from this pointer when `result_ok` is not set is undefined.
11059     */
11060    struct LDKInvoice *result;
11061    /**
11062     * A pointer to the contents in the error state.
11063     * Reading from this pointer when `result_ok` is set is undefined.
11064     */
11065    enum LDKSemanticError *err;
11066 } LDKCResult_InvoiceSemanticErrorZPtr;
11067
11068 /**
11069  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
11070  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
11071  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11072  */
11073 typedef struct LDKCResult_InvoiceSemanticErrorZ {
11074    /**
11075     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
11076     * `err` or `result` depending on the state of `result_ok`.
11077     */
11078    union LDKCResult_InvoiceSemanticErrorZPtr contents;
11079    /**
11080     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
11081     */
11082    bool result_ok;
11083 } LDKCResult_InvoiceSemanticErrorZ;
11084
11085
11086
11087 /**
11088  * Description string
11089  *
11090  * # Invariants
11091  * The description can be at most 639 __bytes__ long
11092  */
11093 typedef struct MUST_USE_STRUCT LDKDescription {
11094    /**
11095     * A pointer to the opaque Rust object.
11096     * Nearly everywhere, inner must be non-null, however in places where
11097     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11098     */
11099    LDKnativeDescription *inner;
11100    /**
11101     * Indicates that this is the only struct which contains the same pointer.
11102     * Rust functions which take ownership of an object provided via an argument require
11103     * this to be true and invalidate the object pointed to by inner.
11104     */
11105    bool is_owned;
11106 } LDKDescription;
11107
11108 /**
11109  * The contents of CResult_DescriptionCreationErrorZ
11110  */
11111 typedef union LDKCResult_DescriptionCreationErrorZPtr {
11112    /**
11113     * A pointer to the contents in the success state.
11114     * Reading from this pointer when `result_ok` is not set is undefined.
11115     */
11116    struct LDKDescription *result;
11117    /**
11118     * A pointer to the contents in the error state.
11119     * Reading from this pointer when `result_ok` is set is undefined.
11120     */
11121    enum LDKCreationError *err;
11122 } LDKCResult_DescriptionCreationErrorZPtr;
11123
11124 /**
11125  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
11126  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
11127  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11128  */
11129 typedef struct LDKCResult_DescriptionCreationErrorZ {
11130    /**
11131     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
11132     * `err` or `result` depending on the state of `result_ok`.
11133     */
11134    union LDKCResult_DescriptionCreationErrorZPtr contents;
11135    /**
11136     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
11137     */
11138    bool result_ok;
11139 } LDKCResult_DescriptionCreationErrorZ;
11140
11141 /**
11142  * The contents of CResult_PrivateRouteCreationErrorZ
11143  */
11144 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
11145    /**
11146     * A pointer to the contents in the success state.
11147     * Reading from this pointer when `result_ok` is not set is undefined.
11148     */
11149    struct LDKPrivateRoute *result;
11150    /**
11151     * A pointer to the contents in the error state.
11152     * Reading from this pointer when `result_ok` is set is undefined.
11153     */
11154    enum LDKCreationError *err;
11155 } LDKCResult_PrivateRouteCreationErrorZPtr;
11156
11157 /**
11158  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
11159  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
11160  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11161  */
11162 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
11163    /**
11164     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
11165     * `err` or `result` depending on the state of `result_ok`.
11166     */
11167    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
11168    /**
11169     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
11170     */
11171    bool result_ok;
11172 } LDKCResult_PrivateRouteCreationErrorZ;
11173
11174 /**
11175  * All-encompassing standard error type that processing can return
11176  */
11177 typedef enum LDKGraphSyncError_Tag {
11178    /**
11179     * Error trying to read the update data, typically due to an erroneous data length indication
11180     * that is greater than the actual amount of data provided
11181     */
11182    LDKGraphSyncError_DecodeError,
11183    /**
11184     * Error applying the patch to the network graph, usually the result of updates that are too
11185     * old or missing prerequisite data to the application of updates out of order
11186     */
11187    LDKGraphSyncError_LightningError,
11188    /**
11189     * Must be last for serialization purposes
11190     */
11191    LDKGraphSyncError_Sentinel,
11192 } LDKGraphSyncError_Tag;
11193
11194 typedef struct MUST_USE_STRUCT LDKGraphSyncError {
11195    LDKGraphSyncError_Tag tag;
11196    union {
11197       struct {
11198          struct LDKDecodeError decode_error;
11199       };
11200       struct {
11201          struct LDKLightningError lightning_error;
11202       };
11203    };
11204 } LDKGraphSyncError;
11205
11206 /**
11207  * The contents of CResult_u32GraphSyncErrorZ
11208  */
11209 typedef union LDKCResult_u32GraphSyncErrorZPtr {
11210    /**
11211     * A pointer to the contents in the success state.
11212     * Reading from this pointer when `result_ok` is not set is undefined.
11213     */
11214    uint32_t *result;
11215    /**
11216     * A pointer to the contents in the error state.
11217     * Reading from this pointer when `result_ok` is set is undefined.
11218     */
11219    struct LDKGraphSyncError *err;
11220 } LDKCResult_u32GraphSyncErrorZPtr;
11221
11222 /**
11223  * A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
11224  * containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
11225  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11226  */
11227 typedef struct LDKCResult_u32GraphSyncErrorZ {
11228    /**
11229     * The contents of this CResult_u32GraphSyncErrorZ, accessible via either
11230     * `err` or `result` depending on the state of `result_ok`.
11231     */
11232    union LDKCResult_u32GraphSyncErrorZPtr contents;
11233    /**
11234     * Whether this CResult_u32GraphSyncErrorZ represents a success state.
11235     */
11236    bool result_ok;
11237 } LDKCResult_u32GraphSyncErrorZ;
11238
11239 /**
11240  * The contents of CResult_NetAddressDecodeErrorZ
11241  */
11242 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
11243    /**
11244     * A pointer to the contents in the success state.
11245     * Reading from this pointer when `result_ok` is not set is undefined.
11246     */
11247    struct LDKNetAddress *result;
11248    /**
11249     * A pointer to the contents in the error state.
11250     * Reading from this pointer when `result_ok` is set is undefined.
11251     */
11252    struct LDKDecodeError *err;
11253 } LDKCResult_NetAddressDecodeErrorZPtr;
11254
11255 /**
11256  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
11257  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
11258  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11259  */
11260 typedef struct LDKCResult_NetAddressDecodeErrorZ {
11261    /**
11262     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
11263     * `err` or `result` depending on the state of `result_ok`.
11264     */
11265    union LDKCResult_NetAddressDecodeErrorZPtr contents;
11266    /**
11267     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
11268     */
11269    bool result_ok;
11270 } LDKCResult_NetAddressDecodeErrorZ;
11271
11272
11273
11274 /**
11275  * An [`update_add_htlc`] message to be sent to or received from a peer.
11276  *
11277  * [`update_add_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#adding-an-htlc-update_add_htlc
11278  */
11279 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
11280    /**
11281     * A pointer to the opaque Rust object.
11282     * Nearly everywhere, inner must be non-null, however in places where
11283     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11284     */
11285    LDKnativeUpdateAddHTLC *inner;
11286    /**
11287     * Indicates that this is the only struct which contains the same pointer.
11288     * Rust functions which take ownership of an object provided via an argument require
11289     * this to be true and invalidate the object pointed to by inner.
11290     */
11291    bool is_owned;
11292 } LDKUpdateAddHTLC;
11293
11294 /**
11295  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
11296  * This corresponds to std::vector in C++
11297  */
11298 typedef struct LDKCVec_UpdateAddHTLCZ {
11299    /**
11300     * The elements in the array.
11301     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11302     */
11303    struct LDKUpdateAddHTLC *data;
11304    /**
11305     * The number of elements pointed to by `data`.
11306     */
11307    uintptr_t datalen;
11308 } LDKCVec_UpdateAddHTLCZ;
11309
11310
11311
11312 /**
11313  * An [`update_fulfill_htlc`] message to be sent to or received from a peer.
11314  *
11315  * [`update_fulfill_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc
11316  */
11317 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
11318    /**
11319     * A pointer to the opaque Rust object.
11320     * Nearly everywhere, inner must be non-null, however in places where
11321     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11322     */
11323    LDKnativeUpdateFulfillHTLC *inner;
11324    /**
11325     * Indicates that this is the only struct which contains the same pointer.
11326     * Rust functions which take ownership of an object provided via an argument require
11327     * this to be true and invalidate the object pointed to by inner.
11328     */
11329    bool is_owned;
11330 } LDKUpdateFulfillHTLC;
11331
11332 /**
11333  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
11334  * This corresponds to std::vector in C++
11335  */
11336 typedef struct LDKCVec_UpdateFulfillHTLCZ {
11337    /**
11338     * The elements in the array.
11339     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11340     */
11341    struct LDKUpdateFulfillHTLC *data;
11342    /**
11343     * The number of elements pointed to by `data`.
11344     */
11345    uintptr_t datalen;
11346 } LDKCVec_UpdateFulfillHTLCZ;
11347
11348
11349
11350 /**
11351  * An [`update_fail_htlc`] message to be sent to or received from a peer.
11352  *
11353  * [`update_fail_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc
11354  */
11355 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
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    LDKnativeUpdateFailHTLC *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 } LDKUpdateFailHTLC;
11369
11370 /**
11371  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
11372  * This corresponds to std::vector in C++
11373  */
11374 typedef struct LDKCVec_UpdateFailHTLCZ {
11375    /**
11376     * The elements in the array.
11377     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11378     */
11379    struct LDKUpdateFailHTLC *data;
11380    /**
11381     * The number of elements pointed to by `data`.
11382     */
11383    uintptr_t datalen;
11384 } LDKCVec_UpdateFailHTLCZ;
11385
11386
11387
11388 /**
11389  * An [`update_fail_malformed_htlc`] message to be sent to or received from a peer.
11390  *
11391  * [`update_fail_malformed_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc
11392  */
11393 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
11394    /**
11395     * A pointer to the opaque Rust object.
11396     * Nearly everywhere, inner must be non-null, however in places where
11397     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11398     */
11399    LDKnativeUpdateFailMalformedHTLC *inner;
11400    /**
11401     * Indicates that this is the only struct which contains the same pointer.
11402     * Rust functions which take ownership of an object provided via an argument require
11403     * this to be true and invalidate the object pointed to by inner.
11404     */
11405    bool is_owned;
11406 } LDKUpdateFailMalformedHTLC;
11407
11408 /**
11409  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
11410  * This corresponds to std::vector in C++
11411  */
11412 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
11413    /**
11414     * The elements in the array.
11415     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11416     */
11417    struct LDKUpdateFailMalformedHTLC *data;
11418    /**
11419     * The number of elements pointed to by `data`.
11420     */
11421    uintptr_t datalen;
11422 } LDKCVec_UpdateFailMalformedHTLCZ;
11423
11424 /**
11425  * The contents of CResult_AcceptChannelDecodeErrorZ
11426  */
11427 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
11428    /**
11429     * A pointer to the contents in the success state.
11430     * Reading from this pointer when `result_ok` is not set is undefined.
11431     */
11432    struct LDKAcceptChannel *result;
11433    /**
11434     * A pointer to the contents in the error state.
11435     * Reading from this pointer when `result_ok` is set is undefined.
11436     */
11437    struct LDKDecodeError *err;
11438 } LDKCResult_AcceptChannelDecodeErrorZPtr;
11439
11440 /**
11441  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
11442  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
11443  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11444  */
11445 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
11446    /**
11447     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
11448     * `err` or `result` depending on the state of `result_ok`.
11449     */
11450    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
11451    /**
11452     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
11453     */
11454    bool result_ok;
11455 } LDKCResult_AcceptChannelDecodeErrorZ;
11456
11457 /**
11458  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
11459  */
11460 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
11461    /**
11462     * A pointer to the contents in the success state.
11463     * Reading from this pointer when `result_ok` is not set is undefined.
11464     */
11465    struct LDKAnnouncementSignatures *result;
11466    /**
11467     * A pointer to the contents in the error state.
11468     * Reading from this pointer when `result_ok` is set is undefined.
11469     */
11470    struct LDKDecodeError *err;
11471 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
11472
11473 /**
11474  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
11475  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
11476  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11477  */
11478 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
11479    /**
11480     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
11481     * `err` or `result` depending on the state of `result_ok`.
11482     */
11483    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
11484    /**
11485     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
11486     */
11487    bool result_ok;
11488 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
11489
11490 /**
11491  * The contents of CResult_ChannelReestablishDecodeErrorZ
11492  */
11493 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
11494    /**
11495     * A pointer to the contents in the success state.
11496     * Reading from this pointer when `result_ok` is not set is undefined.
11497     */
11498    struct LDKChannelReestablish *result;
11499    /**
11500     * A pointer to the contents in the error state.
11501     * Reading from this pointer when `result_ok` is set is undefined.
11502     */
11503    struct LDKDecodeError *err;
11504 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
11505
11506 /**
11507  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
11508  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
11509  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11510  */
11511 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
11512    /**
11513     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
11514     * `err` or `result` depending on the state of `result_ok`.
11515     */
11516    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
11517    /**
11518     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
11519     */
11520    bool result_ok;
11521 } LDKCResult_ChannelReestablishDecodeErrorZ;
11522
11523 /**
11524  * The contents of CResult_ClosingSignedDecodeErrorZ
11525  */
11526 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
11527    /**
11528     * A pointer to the contents in the success state.
11529     * Reading from this pointer when `result_ok` is not set is undefined.
11530     */
11531    struct LDKClosingSigned *result;
11532    /**
11533     * A pointer to the contents in the error state.
11534     * Reading from this pointer when `result_ok` is set is undefined.
11535     */
11536    struct LDKDecodeError *err;
11537 } LDKCResult_ClosingSignedDecodeErrorZPtr;
11538
11539 /**
11540  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
11541  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11542  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11543  */
11544 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
11545    /**
11546     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
11547     * `err` or `result` depending on the state of `result_ok`.
11548     */
11549    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
11550    /**
11551     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
11552     */
11553    bool result_ok;
11554 } LDKCResult_ClosingSignedDecodeErrorZ;
11555
11556
11557
11558 /**
11559  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
11560  *
11561  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
11562  * to use.
11563  */
11564 typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
11565    /**
11566     * A pointer to the opaque Rust object.
11567     * Nearly everywhere, inner must be non-null, however in places where
11568     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11569     */
11570    LDKnativeClosingSignedFeeRange *inner;
11571    /**
11572     * Indicates that this is the only struct which contains the same pointer.
11573     * Rust functions which take ownership of an object provided via an argument require
11574     * this to be true and invalidate the object pointed to by inner.
11575     */
11576    bool is_owned;
11577 } LDKClosingSignedFeeRange;
11578
11579 /**
11580  * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
11581  */
11582 typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11583    /**
11584     * A pointer to the contents in the success state.
11585     * Reading from this pointer when `result_ok` is not set is undefined.
11586     */
11587    struct LDKClosingSignedFeeRange *result;
11588    /**
11589     * A pointer to the contents in the error state.
11590     * Reading from this pointer when `result_ok` is set is undefined.
11591     */
11592    struct LDKDecodeError *err;
11593 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr;
11594
11595 /**
11596  * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
11597  * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11598  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11599  */
11600 typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ {
11601    /**
11602     * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
11603     * `err` or `result` depending on the state of `result_ok`.
11604     */
11605    union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
11606    /**
11607     * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
11608     */
11609    bool result_ok;
11610 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
11611
11612
11613
11614 /**
11615  * A [`commitment_signed`] message to be sent to or received from a peer.
11616  *
11617  * [`commitment_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#committing-updates-so-far-commitment_signed
11618  */
11619 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
11620    /**
11621     * A pointer to the opaque Rust object.
11622     * Nearly everywhere, inner must be non-null, however in places where
11623     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11624     */
11625    LDKnativeCommitmentSigned *inner;
11626    /**
11627     * Indicates that this is the only struct which contains the same pointer.
11628     * Rust functions which take ownership of an object provided via an argument require
11629     * this to be true and invalidate the object pointed to by inner.
11630     */
11631    bool is_owned;
11632 } LDKCommitmentSigned;
11633
11634 /**
11635  * The contents of CResult_CommitmentSignedDecodeErrorZ
11636  */
11637 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
11638    /**
11639     * A pointer to the contents in the success state.
11640     * Reading from this pointer when `result_ok` is not set is undefined.
11641     */
11642    struct LDKCommitmentSigned *result;
11643    /**
11644     * A pointer to the contents in the error state.
11645     * Reading from this pointer when `result_ok` is set is undefined.
11646     */
11647    struct LDKDecodeError *err;
11648 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
11649
11650 /**
11651  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
11652  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11653  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11654  */
11655 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
11656    /**
11657     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
11658     * `err` or `result` depending on the state of `result_ok`.
11659     */
11660    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
11661    /**
11662     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
11663     */
11664    bool result_ok;
11665 } LDKCResult_CommitmentSignedDecodeErrorZ;
11666
11667 /**
11668  * The contents of CResult_FundingCreatedDecodeErrorZ
11669  */
11670 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
11671    /**
11672     * A pointer to the contents in the success state.
11673     * Reading from this pointer when `result_ok` is not set is undefined.
11674     */
11675    struct LDKFundingCreated *result;
11676    /**
11677     * A pointer to the contents in the error state.
11678     * Reading from this pointer when `result_ok` is set is undefined.
11679     */
11680    struct LDKDecodeError *err;
11681 } LDKCResult_FundingCreatedDecodeErrorZPtr;
11682
11683 /**
11684  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
11685  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
11686  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11687  */
11688 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
11689    /**
11690     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
11691     * `err` or `result` depending on the state of `result_ok`.
11692     */
11693    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
11694    /**
11695     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
11696     */
11697    bool result_ok;
11698 } LDKCResult_FundingCreatedDecodeErrorZ;
11699
11700 /**
11701  * The contents of CResult_FundingSignedDecodeErrorZ
11702  */
11703 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
11704    /**
11705     * A pointer to the contents in the success state.
11706     * Reading from this pointer when `result_ok` is not set is undefined.
11707     */
11708    struct LDKFundingSigned *result;
11709    /**
11710     * A pointer to the contents in the error state.
11711     * Reading from this pointer when `result_ok` is set is undefined.
11712     */
11713    struct LDKDecodeError *err;
11714 } LDKCResult_FundingSignedDecodeErrorZPtr;
11715
11716 /**
11717  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
11718  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11719  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11720  */
11721 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
11722    /**
11723     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
11724     * `err` or `result` depending on the state of `result_ok`.
11725     */
11726    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
11727    /**
11728     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
11729     */
11730    bool result_ok;
11731 } LDKCResult_FundingSignedDecodeErrorZ;
11732
11733 /**
11734  * The contents of CResult_ChannelReadyDecodeErrorZ
11735  */
11736 typedef union LDKCResult_ChannelReadyDecodeErrorZPtr {
11737    /**
11738     * A pointer to the contents in the success state.
11739     * Reading from this pointer when `result_ok` is not set is undefined.
11740     */
11741    struct LDKChannelReady *result;
11742    /**
11743     * A pointer to the contents in the error state.
11744     * Reading from this pointer when `result_ok` is set is undefined.
11745     */
11746    struct LDKDecodeError *err;
11747 } LDKCResult_ChannelReadyDecodeErrorZPtr;
11748
11749 /**
11750  * A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
11751  * containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
11752  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11753  */
11754 typedef struct LDKCResult_ChannelReadyDecodeErrorZ {
11755    /**
11756     * The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
11757     * `err` or `result` depending on the state of `result_ok`.
11758     */
11759    union LDKCResult_ChannelReadyDecodeErrorZPtr contents;
11760    /**
11761     * Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
11762     */
11763    bool result_ok;
11764 } LDKCResult_ChannelReadyDecodeErrorZ;
11765
11766
11767
11768 /**
11769  * An [`init`] message to be sent to or received from a peer.
11770  *
11771  * [`init`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-init-message
11772  */
11773 typedef struct MUST_USE_STRUCT LDKInit {
11774    /**
11775     * A pointer to the opaque Rust object.
11776     * Nearly everywhere, inner must be non-null, however in places where
11777     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11778     */
11779    LDKnativeInit *inner;
11780    /**
11781     * Indicates that this is the only struct which contains the same pointer.
11782     * Rust functions which take ownership of an object provided via an argument require
11783     * this to be true and invalidate the object pointed to by inner.
11784     */
11785    bool is_owned;
11786 } LDKInit;
11787
11788 /**
11789  * The contents of CResult_InitDecodeErrorZ
11790  */
11791 typedef union LDKCResult_InitDecodeErrorZPtr {
11792    /**
11793     * A pointer to the contents in the success state.
11794     * Reading from this pointer when `result_ok` is not set is undefined.
11795     */
11796    struct LDKInit *result;
11797    /**
11798     * A pointer to the contents in the error state.
11799     * Reading from this pointer when `result_ok` is set is undefined.
11800     */
11801    struct LDKDecodeError *err;
11802 } LDKCResult_InitDecodeErrorZPtr;
11803
11804 /**
11805  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
11806  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
11807  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11808  */
11809 typedef struct LDKCResult_InitDecodeErrorZ {
11810    /**
11811     * The contents of this CResult_InitDecodeErrorZ, accessible via either
11812     * `err` or `result` depending on the state of `result_ok`.
11813     */
11814    union LDKCResult_InitDecodeErrorZPtr contents;
11815    /**
11816     * Whether this CResult_InitDecodeErrorZ represents a success state.
11817     */
11818    bool result_ok;
11819 } LDKCResult_InitDecodeErrorZ;
11820
11821 /**
11822  * The contents of CResult_OpenChannelDecodeErrorZ
11823  */
11824 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
11825    /**
11826     * A pointer to the contents in the success state.
11827     * Reading from this pointer when `result_ok` is not set is undefined.
11828     */
11829    struct LDKOpenChannel *result;
11830    /**
11831     * A pointer to the contents in the error state.
11832     * Reading from this pointer when `result_ok` is set is undefined.
11833     */
11834    struct LDKDecodeError *err;
11835 } LDKCResult_OpenChannelDecodeErrorZPtr;
11836
11837 /**
11838  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
11839  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
11840  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11841  */
11842 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
11843    /**
11844     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
11845     * `err` or `result` depending on the state of `result_ok`.
11846     */
11847    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
11848    /**
11849     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
11850     */
11851    bool result_ok;
11852 } LDKCResult_OpenChannelDecodeErrorZ;
11853
11854 /**
11855  * The contents of CResult_RevokeAndACKDecodeErrorZ
11856  */
11857 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
11858    /**
11859     * A pointer to the contents in the success state.
11860     * Reading from this pointer when `result_ok` is not set is undefined.
11861     */
11862    struct LDKRevokeAndACK *result;
11863    /**
11864     * A pointer to the contents in the error state.
11865     * Reading from this pointer when `result_ok` is set is undefined.
11866     */
11867    struct LDKDecodeError *err;
11868 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
11869
11870 /**
11871  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
11872  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
11873  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11874  */
11875 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
11876    /**
11877     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
11878     * `err` or `result` depending on the state of `result_ok`.
11879     */
11880    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
11881    /**
11882     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
11883     */
11884    bool result_ok;
11885 } LDKCResult_RevokeAndACKDecodeErrorZ;
11886
11887 /**
11888  * The contents of CResult_ShutdownDecodeErrorZ
11889  */
11890 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
11891    /**
11892     * A pointer to the contents in the success state.
11893     * Reading from this pointer when `result_ok` is not set is undefined.
11894     */
11895    struct LDKShutdown *result;
11896    /**
11897     * A pointer to the contents in the error state.
11898     * Reading from this pointer when `result_ok` is set is undefined.
11899     */
11900    struct LDKDecodeError *err;
11901 } LDKCResult_ShutdownDecodeErrorZPtr;
11902
11903 /**
11904  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
11905  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
11906  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11907  */
11908 typedef struct LDKCResult_ShutdownDecodeErrorZ {
11909    /**
11910     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
11911     * `err` or `result` depending on the state of `result_ok`.
11912     */
11913    union LDKCResult_ShutdownDecodeErrorZPtr contents;
11914    /**
11915     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
11916     */
11917    bool result_ok;
11918 } LDKCResult_ShutdownDecodeErrorZ;
11919
11920 /**
11921  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
11922  */
11923 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
11924    /**
11925     * A pointer to the contents in the success state.
11926     * Reading from this pointer when `result_ok` is not set is undefined.
11927     */
11928    struct LDKUpdateFailHTLC *result;
11929    /**
11930     * A pointer to the contents in the error state.
11931     * Reading from this pointer when `result_ok` is set is undefined.
11932     */
11933    struct LDKDecodeError *err;
11934 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
11935
11936 /**
11937  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
11938  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
11939  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11940  */
11941 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
11942    /**
11943     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
11944     * `err` or `result` depending on the state of `result_ok`.
11945     */
11946    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
11947    /**
11948     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
11949     */
11950    bool result_ok;
11951 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
11952
11953 /**
11954  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
11955  */
11956 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
11957    /**
11958     * A pointer to the contents in the success state.
11959     * Reading from this pointer when `result_ok` is not set is undefined.
11960     */
11961    struct LDKUpdateFailMalformedHTLC *result;
11962    /**
11963     * A pointer to the contents in the error state.
11964     * Reading from this pointer when `result_ok` is set is undefined.
11965     */
11966    struct LDKDecodeError *err;
11967 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
11968
11969 /**
11970  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
11971  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
11972  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11973  */
11974 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
11975    /**
11976     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
11977     * `err` or `result` depending on the state of `result_ok`.
11978     */
11979    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
11980    /**
11981     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
11982     */
11983    bool result_ok;
11984 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
11985
11986
11987
11988 /**
11989  * An [`update_fee`] message to be sent to or received from a peer
11990  *
11991  * [`update_fee`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#updating-fees-update_fee
11992  */
11993 typedef struct MUST_USE_STRUCT LDKUpdateFee {
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    LDKnativeUpdateFee *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 } LDKUpdateFee;
12007
12008 /**
12009  * The contents of CResult_UpdateFeeDecodeErrorZ
12010  */
12011 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
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 LDKUpdateFee *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_UpdateFeeDecodeErrorZPtr;
12023
12024 /**
12025  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
12026  * containing a crate::lightning::ln::msgs::UpdateFee 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_UpdateFeeDecodeErrorZ {
12030    /**
12031     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
12032     * `err` or `result` depending on the state of `result_ok`.
12033     */
12034    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
12035    /**
12036     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
12037     */
12038    bool result_ok;
12039 } LDKCResult_UpdateFeeDecodeErrorZ;
12040
12041 /**
12042  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
12043  */
12044 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
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 LDKUpdateFulfillHTLC *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_UpdateFulfillHTLCDecodeErrorZPtr;
12056
12057 /**
12058  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
12059  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC 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_UpdateFulfillHTLCDecodeErrorZ {
12063    /**
12064     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
12065     * `err` or `result` depending on the state of `result_ok`.
12066     */
12067    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
12068    /**
12069     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
12070     */
12071    bool result_ok;
12072 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
12073
12074 /**
12075  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
12076  */
12077 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
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 LDKUpdateAddHTLC *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_UpdateAddHTLCDecodeErrorZPtr;
12089
12090 /**
12091  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
12092  * containing a crate::lightning::ln::msgs::UpdateAddHTLC 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_UpdateAddHTLCDecodeErrorZ {
12096    /**
12097     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
12098     * `err` or `result` depending on the state of `result_ok`.
12099     */
12100    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
12101    /**
12102     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
12103     */
12104    bool result_ok;
12105 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
12106
12107
12108
12109 /**
12110  * An onion message to be sent to or received from a peer.
12111  *
12112  */
12113 typedef struct MUST_USE_STRUCT LDKOnionMessage {
12114    /**
12115     * A pointer to the opaque Rust object.
12116     * Nearly everywhere, inner must be non-null, however in places where
12117     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12118     */
12119    LDKnativeOnionMessage *inner;
12120    /**
12121     * Indicates that this is the only struct which contains the same pointer.
12122     * Rust functions which take ownership of an object provided via an argument require
12123     * this to be true and invalidate the object pointed to by inner.
12124     */
12125    bool is_owned;
12126 } LDKOnionMessage;
12127
12128 /**
12129  * The contents of CResult_OnionMessageDecodeErrorZ
12130  */
12131 typedef union LDKCResult_OnionMessageDecodeErrorZPtr {
12132    /**
12133     * A pointer to the contents in the success state.
12134     * Reading from this pointer when `result_ok` is not set is undefined.
12135     */
12136    struct LDKOnionMessage *result;
12137    /**
12138     * A pointer to the contents in the error state.
12139     * Reading from this pointer when `result_ok` is set is undefined.
12140     */
12141    struct LDKDecodeError *err;
12142 } LDKCResult_OnionMessageDecodeErrorZPtr;
12143
12144 /**
12145  * A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
12146  * containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
12147  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12148  */
12149 typedef struct LDKCResult_OnionMessageDecodeErrorZ {
12150    /**
12151     * The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
12152     * `err` or `result` depending on the state of `result_ok`.
12153     */
12154    union LDKCResult_OnionMessageDecodeErrorZPtr contents;
12155    /**
12156     * Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
12157     */
12158    bool result_ok;
12159 } LDKCResult_OnionMessageDecodeErrorZ;
12160
12161
12162
12163 /**
12164  * A [`ping`] message to be sent to or received from a peer.
12165  *
12166  * [`ping`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-ping-and-pong-messages
12167  */
12168 typedef struct MUST_USE_STRUCT LDKPing {
12169    /**
12170     * A pointer to the opaque Rust object.
12171     * Nearly everywhere, inner must be non-null, however in places where
12172     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12173     */
12174    LDKnativePing *inner;
12175    /**
12176     * Indicates that this is the only struct which contains the same pointer.
12177     * Rust functions which take ownership of an object provided via an argument require
12178     * this to be true and invalidate the object pointed to by inner.
12179     */
12180    bool is_owned;
12181 } LDKPing;
12182
12183 /**
12184  * The contents of CResult_PingDecodeErrorZ
12185  */
12186 typedef union LDKCResult_PingDecodeErrorZPtr {
12187    /**
12188     * A pointer to the contents in the success state.
12189     * Reading from this pointer when `result_ok` is not set is undefined.
12190     */
12191    struct LDKPing *result;
12192    /**
12193     * A pointer to the contents in the error state.
12194     * Reading from this pointer when `result_ok` is set is undefined.
12195     */
12196    struct LDKDecodeError *err;
12197 } LDKCResult_PingDecodeErrorZPtr;
12198
12199 /**
12200  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
12201  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
12202  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12203  */
12204 typedef struct LDKCResult_PingDecodeErrorZ {
12205    /**
12206     * The contents of this CResult_PingDecodeErrorZ, accessible via either
12207     * `err` or `result` depending on the state of `result_ok`.
12208     */
12209    union LDKCResult_PingDecodeErrorZPtr contents;
12210    /**
12211     * Whether this CResult_PingDecodeErrorZ represents a success state.
12212     */
12213    bool result_ok;
12214 } LDKCResult_PingDecodeErrorZ;
12215
12216
12217
12218 /**
12219  * A [`pong`] message to be sent to or received from a peer.
12220  *
12221  * [`pong`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-ping-and-pong-messages
12222  */
12223 typedef struct MUST_USE_STRUCT LDKPong {
12224    /**
12225     * A pointer to the opaque Rust object.
12226     * Nearly everywhere, inner must be non-null, however in places where
12227     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12228     */
12229    LDKnativePong *inner;
12230    /**
12231     * Indicates that this is the only struct which contains the same pointer.
12232     * Rust functions which take ownership of an object provided via an argument require
12233     * this to be true and invalidate the object pointed to by inner.
12234     */
12235    bool is_owned;
12236 } LDKPong;
12237
12238 /**
12239  * The contents of CResult_PongDecodeErrorZ
12240  */
12241 typedef union LDKCResult_PongDecodeErrorZPtr {
12242    /**
12243     * A pointer to the contents in the success state.
12244     * Reading from this pointer when `result_ok` is not set is undefined.
12245     */
12246    struct LDKPong *result;
12247    /**
12248     * A pointer to the contents in the error state.
12249     * Reading from this pointer when `result_ok` is set is undefined.
12250     */
12251    struct LDKDecodeError *err;
12252 } LDKCResult_PongDecodeErrorZPtr;
12253
12254 /**
12255  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
12256  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
12257  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12258  */
12259 typedef struct LDKCResult_PongDecodeErrorZ {
12260    /**
12261     * The contents of this CResult_PongDecodeErrorZ, accessible via either
12262     * `err` or `result` depending on the state of `result_ok`.
12263     */
12264    union LDKCResult_PongDecodeErrorZPtr contents;
12265    /**
12266     * Whether this CResult_PongDecodeErrorZ represents a success state.
12267     */
12268    bool result_ok;
12269 } LDKCResult_PongDecodeErrorZ;
12270
12271 /**
12272  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
12273  */
12274 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12275    /**
12276     * A pointer to the contents in the success state.
12277     * Reading from this pointer when `result_ok` is not set is undefined.
12278     */
12279    struct LDKUnsignedChannelAnnouncement *result;
12280    /**
12281     * A pointer to the contents in the error state.
12282     * Reading from this pointer when `result_ok` is set is undefined.
12283     */
12284    struct LDKDecodeError *err;
12285 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
12286
12287 /**
12288  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
12289  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
12290  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12291  */
12292 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
12293    /**
12294     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
12295     * `err` or `result` depending on the state of `result_ok`.
12296     */
12297    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
12298    /**
12299     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
12300     */
12301    bool result_ok;
12302 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
12303
12304 /**
12305  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
12306  */
12307 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
12308    /**
12309     * A pointer to the contents in the success state.
12310     * Reading from this pointer when `result_ok` is not set is undefined.
12311     */
12312    struct LDKChannelAnnouncement *result;
12313    /**
12314     * A pointer to the contents in the error state.
12315     * Reading from this pointer when `result_ok` is set is undefined.
12316     */
12317    struct LDKDecodeError *err;
12318 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
12319
12320 /**
12321  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
12322  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
12323  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12324  */
12325 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
12326    /**
12327     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
12328     * `err` or `result` depending on the state of `result_ok`.
12329     */
12330    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
12331    /**
12332     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
12333     */
12334    bool result_ok;
12335 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
12336
12337 /**
12338  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
12339  */
12340 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
12341    /**
12342     * A pointer to the contents in the success state.
12343     * Reading from this pointer when `result_ok` is not set is undefined.
12344     */
12345    struct LDKUnsignedChannelUpdate *result;
12346    /**
12347     * A pointer to the contents in the error state.
12348     * Reading from this pointer when `result_ok` is set is undefined.
12349     */
12350    struct LDKDecodeError *err;
12351 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
12352
12353 /**
12354  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
12355  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12356  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12357  */
12358 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
12359    /**
12360     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
12361     * `err` or `result` depending on the state of `result_ok`.
12362     */
12363    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
12364    /**
12365     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
12366     */
12367    bool result_ok;
12368 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
12369
12370 /**
12371  * The contents of CResult_ChannelUpdateDecodeErrorZ
12372  */
12373 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
12374    /**
12375     * A pointer to the contents in the success state.
12376     * Reading from this pointer when `result_ok` is not set is undefined.
12377     */
12378    struct LDKChannelUpdate *result;
12379    /**
12380     * A pointer to the contents in the error state.
12381     * Reading from this pointer when `result_ok` is set is undefined.
12382     */
12383    struct LDKDecodeError *err;
12384 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
12385
12386 /**
12387  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
12388  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12389  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12390  */
12391 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
12392    /**
12393     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
12394     * `err` or `result` depending on the state of `result_ok`.
12395     */
12396    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
12397    /**
12398     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
12399     */
12400    bool result_ok;
12401 } LDKCResult_ChannelUpdateDecodeErrorZ;
12402
12403 /**
12404  * The contents of CResult_ErrorMessageDecodeErrorZ
12405  */
12406 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
12407    /**
12408     * A pointer to the contents in the success state.
12409     * Reading from this pointer when `result_ok` is not set is undefined.
12410     */
12411    struct LDKErrorMessage *result;
12412    /**
12413     * A pointer to the contents in the error state.
12414     * Reading from this pointer when `result_ok` is set is undefined.
12415     */
12416    struct LDKDecodeError *err;
12417 } LDKCResult_ErrorMessageDecodeErrorZPtr;
12418
12419 /**
12420  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
12421  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
12422  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12423  */
12424 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
12425    /**
12426     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
12427     * `err` or `result` depending on the state of `result_ok`.
12428     */
12429    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
12430    /**
12431     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
12432     */
12433    bool result_ok;
12434 } LDKCResult_ErrorMessageDecodeErrorZ;
12435
12436 /**
12437  * The contents of CResult_WarningMessageDecodeErrorZ
12438  */
12439 typedef union LDKCResult_WarningMessageDecodeErrorZPtr {
12440    /**
12441     * A pointer to the contents in the success state.
12442     * Reading from this pointer when `result_ok` is not set is undefined.
12443     */
12444    struct LDKWarningMessage *result;
12445    /**
12446     * A pointer to the contents in the error state.
12447     * Reading from this pointer when `result_ok` is set is undefined.
12448     */
12449    struct LDKDecodeError *err;
12450 } LDKCResult_WarningMessageDecodeErrorZPtr;
12451
12452 /**
12453  * A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
12454  * containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
12455  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12456  */
12457 typedef struct LDKCResult_WarningMessageDecodeErrorZ {
12458    /**
12459     * The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
12460     * `err` or `result` depending on the state of `result_ok`.
12461     */
12462    union LDKCResult_WarningMessageDecodeErrorZPtr contents;
12463    /**
12464     * Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
12465     */
12466    bool result_ok;
12467 } LDKCResult_WarningMessageDecodeErrorZ;
12468
12469 /**
12470  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
12471  */
12472 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
12473    /**
12474     * A pointer to the contents in the success state.
12475     * Reading from this pointer when `result_ok` is not set is undefined.
12476     */
12477    struct LDKUnsignedNodeAnnouncement *result;
12478    /**
12479     * A pointer to the contents in the error state.
12480     * Reading from this pointer when `result_ok` is set is undefined.
12481     */
12482    struct LDKDecodeError *err;
12483 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
12484
12485 /**
12486  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
12487  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
12488  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12489  */
12490 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
12491    /**
12492     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
12493     * `err` or `result` depending on the state of `result_ok`.
12494     */
12495    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
12496    /**
12497     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
12498     */
12499    bool result_ok;
12500 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
12501
12502 /**
12503  * The contents of CResult_NodeAnnouncementDecodeErrorZ
12504  */
12505 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
12506    /**
12507     * A pointer to the contents in the success state.
12508     * Reading from this pointer when `result_ok` is not set is undefined.
12509     */
12510    struct LDKNodeAnnouncement *result;
12511    /**
12512     * A pointer to the contents in the error state.
12513     * Reading from this pointer when `result_ok` is set is undefined.
12514     */
12515    struct LDKDecodeError *err;
12516 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
12517
12518 /**
12519  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
12520  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
12521  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12522  */
12523 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
12524    /**
12525     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
12526     * `err` or `result` depending on the state of `result_ok`.
12527     */
12528    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
12529    /**
12530     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
12531     */
12532    bool result_ok;
12533 } LDKCResult_NodeAnnouncementDecodeErrorZ;
12534
12535 /**
12536  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
12537  */
12538 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
12539    /**
12540     * A pointer to the contents in the success state.
12541     * Reading from this pointer when `result_ok` is not set is undefined.
12542     */
12543    struct LDKQueryShortChannelIds *result;
12544    /**
12545     * A pointer to the contents in the error state.
12546     * Reading from this pointer when `result_ok` is set is undefined.
12547     */
12548    struct LDKDecodeError *err;
12549 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
12550
12551 /**
12552  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
12553  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
12554  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12555  */
12556 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
12557    /**
12558     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
12559     * `err` or `result` depending on the state of `result_ok`.
12560     */
12561    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
12562    /**
12563     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
12564     */
12565    bool result_ok;
12566 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
12567
12568
12569
12570 /**
12571  * A [`reply_short_channel_ids_end`] message is sent as a reply to a
12572  * message. The query recipient makes a best
12573  * effort to respond based on their local network view which may not be
12574  * a perfect view of the network.
12575  *
12576  * [`reply_short_channel_ids_end`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_short_channel_idsreply_short_channel_ids_end-messages
12577  */
12578 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
12579    /**
12580     * A pointer to the opaque Rust object.
12581     * Nearly everywhere, inner must be non-null, however in places where
12582     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12583     */
12584    LDKnativeReplyShortChannelIdsEnd *inner;
12585    /**
12586     * Indicates that this is the only struct which contains the same pointer.
12587     * Rust functions which take ownership of an object provided via an argument require
12588     * this to be true and invalidate the object pointed to by inner.
12589     */
12590    bool is_owned;
12591 } LDKReplyShortChannelIdsEnd;
12592
12593 /**
12594  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
12595  */
12596 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
12597    /**
12598     * A pointer to the contents in the success state.
12599     * Reading from this pointer when `result_ok` is not set is undefined.
12600     */
12601    struct LDKReplyShortChannelIdsEnd *result;
12602    /**
12603     * A pointer to the contents in the error state.
12604     * Reading from this pointer when `result_ok` is set is undefined.
12605     */
12606    struct LDKDecodeError *err;
12607 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
12608
12609 /**
12610  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
12611  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
12612  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12613  */
12614 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
12615    /**
12616     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
12617     * `err` or `result` depending on the state of `result_ok`.
12618     */
12619    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
12620    /**
12621     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
12622     */
12623    bool result_ok;
12624 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
12625
12626 /**
12627  * The contents of CResult_QueryChannelRangeDecodeErrorZ
12628  */
12629 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
12630    /**
12631     * A pointer to the contents in the success state.
12632     * Reading from this pointer when `result_ok` is not set is undefined.
12633     */
12634    struct LDKQueryChannelRange *result;
12635    /**
12636     * A pointer to the contents in the error state.
12637     * Reading from this pointer when `result_ok` is set is undefined.
12638     */
12639    struct LDKDecodeError *err;
12640 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
12641
12642 /**
12643  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
12644  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12645  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12646  */
12647 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
12648    /**
12649     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
12650     * `err` or `result` depending on the state of `result_ok`.
12651     */
12652    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
12653    /**
12654     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
12655     */
12656    bool result_ok;
12657 } LDKCResult_QueryChannelRangeDecodeErrorZ;
12658
12659 /**
12660  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
12661  */
12662 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
12663    /**
12664     * A pointer to the contents in the success state.
12665     * Reading from this pointer when `result_ok` is not set is undefined.
12666     */
12667    struct LDKReplyChannelRange *result;
12668    /**
12669     * A pointer to the contents in the error state.
12670     * Reading from this pointer when `result_ok` is set is undefined.
12671     */
12672    struct LDKDecodeError *err;
12673 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
12674
12675 /**
12676  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
12677  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12678  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12679  */
12680 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
12681    /**
12682     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
12683     * `err` or `result` depending on the state of `result_ok`.
12684     */
12685    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
12686    /**
12687     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
12688     */
12689    bool result_ok;
12690 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
12691
12692 /**
12693  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
12694  */
12695 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
12696    /**
12697     * A pointer to the contents in the success state.
12698     * Reading from this pointer when `result_ok` is not set is undefined.
12699     */
12700    struct LDKGossipTimestampFilter *result;
12701    /**
12702     * A pointer to the contents in the error state.
12703     * Reading from this pointer when `result_ok` is set is undefined.
12704     */
12705    struct LDKDecodeError *err;
12706 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
12707
12708 /**
12709  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
12710  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
12711  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12712  */
12713 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
12714    /**
12715     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
12716     * `err` or `result` depending on the state of `result_ok`.
12717     */
12718    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
12719    /**
12720     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
12721     */
12722    bool result_ok;
12723 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
12724
12725 /**
12726  * A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
12727  * This corresponds to std::vector in C++
12728  */
12729 typedef struct LDKCVec_PhantomRouteHintsZ {
12730    /**
12731     * The elements in the array.
12732     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12733     */
12734    struct LDKPhantomRouteHints *data;
12735    /**
12736     * The number of elements pointed to by `data`.
12737     */
12738    uintptr_t datalen;
12739 } LDKCVec_PhantomRouteHintsZ;
12740
12741 /**
12742  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
12743  * may occur.
12744  */
12745 typedef enum LDKSignOrCreationError_Tag {
12746    /**
12747     * An error occurred during signing
12748     */
12749    LDKSignOrCreationError_SignError,
12750    /**
12751     * An error occurred while building the transaction
12752     */
12753    LDKSignOrCreationError_CreationError,
12754    /**
12755     * Must be last for serialization purposes
12756     */
12757    LDKSignOrCreationError_Sentinel,
12758 } LDKSignOrCreationError_Tag;
12759
12760 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
12761    LDKSignOrCreationError_Tag tag;
12762    union {
12763       struct {
12764          enum LDKCreationError creation_error;
12765       };
12766    };
12767 } LDKSignOrCreationError;
12768
12769 /**
12770  * The contents of CResult_InvoiceSignOrCreationErrorZ
12771  */
12772 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
12773    /**
12774     * A pointer to the contents in the success state.
12775     * Reading from this pointer when `result_ok` is not set is undefined.
12776     */
12777    struct LDKInvoice *result;
12778    /**
12779     * A pointer to the contents in the error state.
12780     * Reading from this pointer when `result_ok` is set is undefined.
12781     */
12782    struct LDKSignOrCreationError *err;
12783 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
12784
12785 /**
12786  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
12787  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
12788  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12789  */
12790 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
12791    /**
12792     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
12793     * `err` or `result` depending on the state of `result_ok`.
12794     */
12795    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
12796    /**
12797     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
12798     */
12799    bool result_ok;
12800 } LDKCResult_InvoiceSignOrCreationErrorZ;
12801
12802
12803
12804 /**
12805  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
12806  *
12807  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
12808  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
12809  * [`Confirm::transactions_confirmed`].
12810  *
12811  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
12812  * may have been spent there. See [`Filter::register_output`] for details.
12813  *
12814  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
12815  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
12816  */
12817 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
12818    /**
12819     * A pointer to the opaque Rust object.
12820     * Nearly everywhere, inner must be non-null, however in places where
12821     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12822     */
12823    LDKnativeWatchedOutput *inner;
12824    /**
12825     * Indicates that this is the only struct which contains the same pointer.
12826     * Rust functions which take ownership of an object provided via an argument require
12827     * this to be true and invalidate the object pointed to by inner.
12828     */
12829    bool is_owned;
12830 } LDKWatchedOutput;
12831
12832 /**
12833  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
12834  * channels.
12835  *
12836  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
12837  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
12838  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
12839  * receiving full blocks from a chain source, any further filtering is unnecessary.
12840  *
12841  * After an output has been registered, subsequent block retrievals from the chain source must not
12842  * exclude any transactions matching the new criteria nor any in-block descendants of such
12843  * transactions.
12844  *
12845  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
12846  * should not block on I/O. Implementations should instead queue the newly monitored data to be
12847  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
12848  * invocation that has called the `Filter` must return [`InProgress`].
12849  *
12850  * [`InProgress`]: ChannelMonitorUpdateStatus::InProgress
12851  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
12852  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
12853  */
12854 typedef struct LDKFilter {
12855    /**
12856     * An opaque pointer which is passed to your function implementations as an argument.
12857     * This has no meaning in the LDK, and can be NULL or any other value.
12858     */
12859    void *this_arg;
12860    /**
12861     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
12862     * a spending condition.
12863     */
12864    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
12865    /**
12866     * Registers interest in spends of a transaction output.
12867     *
12868     * Note that this method might be called during processing of a new block. You therefore need
12869     * to ensure that also dependent output spents within an already connected block are correctly
12870     * handled, e.g., by re-scanning the block in question whenever new outputs have been
12871     * registered mid-processing.
12872     */
12873    void (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
12874    /**
12875     * Frees any resources associated with this object given its this_arg pointer.
12876     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12877     */
12878    void (*free)(void *this_arg);
12879 } LDKFilter;
12880
12881 /**
12882  * An enum which can either contain a crate::lightning::chain::Filter or not
12883  */
12884 typedef enum LDKCOption_FilterZ_Tag {
12885    /**
12886     * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
12887     */
12888    LDKCOption_FilterZ_Some,
12889    /**
12890     * When we're in this state, this COption_FilterZ contains nothing
12891     */
12892    LDKCOption_FilterZ_None,
12893    /**
12894     * Must be last for serialization purposes
12895     */
12896    LDKCOption_FilterZ_Sentinel,
12897 } LDKCOption_FilterZ_Tag;
12898
12899 typedef struct LDKCOption_FilterZ {
12900    LDKCOption_FilterZ_Tag tag;
12901    union {
12902       struct {
12903          struct LDKFilter some;
12904       };
12905    };
12906 } LDKCOption_FilterZ;
12907
12908
12909
12910 /**
12911  * A read-only reference to a current ChannelMonitor.
12912  *
12913  * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is
12914  * released.
12915  */
12916 typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor {
12917    /**
12918     * A pointer to the opaque Rust object.
12919     * Nearly everywhere, inner must be non-null, however in places where
12920     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12921     */
12922    LDKnativeLockedChannelMonitor *inner;
12923    /**
12924     * Indicates that this is the only struct which contains the same pointer.
12925     * Rust functions which take ownership of an object provided via an argument require
12926     * this to be true and invalidate the object pointed to by inner.
12927     */
12928    bool is_owned;
12929 } LDKLockedChannelMonitor;
12930
12931 /**
12932  * The contents of CResult_LockedChannelMonitorNoneZ
12933  */
12934 typedef union LDKCResult_LockedChannelMonitorNoneZPtr {
12935    /**
12936     * A pointer to the contents in the success state.
12937     * Reading from this pointer when `result_ok` is not set is undefined.
12938     */
12939    struct LDKLockedChannelMonitor *result;
12940    /**
12941     * Note that this value is always NULL, as there are no contents in the Err variant
12942     */
12943    void *err;
12944 } LDKCResult_LockedChannelMonitorNoneZPtr;
12945
12946 /**
12947  * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
12948  * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
12949  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
12950  */
12951 typedef struct LDKCResult_LockedChannelMonitorNoneZ {
12952    /**
12953     * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
12954     * `err` or `result` depending on the state of `result_ok`.
12955     */
12956    union LDKCResult_LockedChannelMonitorNoneZPtr contents;
12957    /**
12958     * Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
12959     */
12960    bool result_ok;
12961 } LDKCResult_LockedChannelMonitorNoneZ;
12962
12963 /**
12964  * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
12965  * This corresponds to std::vector in C++
12966  */
12967 typedef struct LDKCVec_OutPointZ {
12968    /**
12969     * The elements in the array.
12970     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12971     */
12972    struct LDKOutPoint *data;
12973    /**
12974     * The number of elements pointed to by `data`.
12975     */
12976    uintptr_t datalen;
12977 } LDKCVec_OutPointZ;
12978
12979
12980
12981 /**
12982  * An opaque identifier describing a specific [`Persist`] method call.
12983  */
12984 typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
12985    /**
12986     * A pointer to the opaque Rust object.
12987     * Nearly everywhere, inner must be non-null, however in places where
12988     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12989     */
12990    LDKnativeMonitorUpdateId *inner;
12991    /**
12992     * Indicates that this is the only struct which contains the same pointer.
12993     * Rust functions which take ownership of an object provided via an argument require
12994     * this to be true and invalidate the object pointed to by inner.
12995     */
12996    bool is_owned;
12997 } LDKMonitorUpdateId;
12998
12999 /**
13000  * A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
13001  * This corresponds to std::vector in C++
13002  */
13003 typedef struct LDKCVec_MonitorUpdateIdZ {
13004    /**
13005     * The elements in the array.
13006     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13007     */
13008    struct LDKMonitorUpdateId *data;
13009    /**
13010     * The number of elements pointed to by `data`.
13011     */
13012    uintptr_t datalen;
13013 } LDKCVec_MonitorUpdateIdZ;
13014
13015 /**
13016  * A tuple of 2 elements. See the individual fields for the types contained.
13017  */
13018 typedef struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ {
13019    /**
13020     * The element at position 0
13021     */
13022    struct LDKOutPoint a;
13023    /**
13024     * The element at position 1
13025     */
13026    struct LDKCVec_MonitorUpdateIdZ b;
13027 } LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ;
13028
13029 /**
13030  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
13031  * This corresponds to std::vector in C++
13032  */
13033 typedef struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
13034    /**
13035     * The elements in the array.
13036     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13037     */
13038    struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *data;
13039    /**
13040     * The number of elements pointed to by `data`.
13041     */
13042    uintptr_t datalen;
13043 } LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ;
13044
13045 /**
13046  * A trait indicating an object may generate message send events
13047  */
13048 typedef struct LDKMessageSendEventsProvider {
13049    /**
13050     * An opaque pointer which is passed to your function implementations as an argument.
13051     * This has no meaning in the LDK, and can be NULL or any other value.
13052     */
13053    void *this_arg;
13054    /**
13055     * Gets the list of pending events which were generated by previous actions, clearing the list
13056     * in the process.
13057     */
13058    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
13059    /**
13060     * Frees any resources associated with this object given its this_arg pointer.
13061     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13062     */
13063    void (*free)(void *this_arg);
13064 } LDKMessageSendEventsProvider;
13065
13066 /**
13067  * A trait indicating an object may generate onion messages to send
13068  */
13069 typedef struct LDKOnionMessageProvider {
13070    /**
13071     * An opaque pointer which is passed to your function implementations as an argument.
13072     * This has no meaning in the LDK, and can be NULL or any other value.
13073     */
13074    void *this_arg;
13075    /**
13076     * Gets the next pending onion message for the peer with the given node id.
13077     *
13078     * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
13079     */
13080    struct LDKOnionMessage (*next_onion_message_for_peer)(const void *this_arg, struct LDKPublicKey peer_node_id);
13081    /**
13082     * Frees any resources associated with this object given its this_arg pointer.
13083     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13084     */
13085    void (*free)(void *this_arg);
13086 } LDKOnionMessageProvider;
13087
13088 /**
13089  * A trait implemented for objects handling events from [`EventsProvider`].
13090  *
13091  * An async variation also exists for implementations of [`EventsProvider`] that support async
13092  * event handling. The async event handler should satisfy the generic bounds: `F:
13093  * core::future::Future, H: Fn(Event) -> F`.
13094  */
13095 typedef struct LDKEventHandler {
13096    /**
13097     * An opaque pointer which is passed to your function implementations as an argument.
13098     * This has no meaning in the LDK, and can be NULL or any other value.
13099     */
13100    void *this_arg;
13101    /**
13102     * Handles the given [`Event`].
13103     *
13104     * See [`EventsProvider`] for details that must be considered when implementing this method.
13105     */
13106    void (*handle_event)(const void *this_arg, struct LDKEvent event);
13107    /**
13108     * Frees any resources associated with this object given its this_arg pointer.
13109     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13110     */
13111    void (*free)(void *this_arg);
13112 } LDKEventHandler;
13113
13114 /**
13115  * A trait indicating an object may generate events.
13116  *
13117  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
13118  *
13119  * Implementations of this trait may also feature an async version of event handling, as shown with
13120  * [`ChannelManager::process_pending_events_async`] and
13121  * [`ChainMonitor::process_pending_events_async`].
13122  *
13123  * # Requirements
13124  *
13125  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
13126  * event since the last invocation.
13127  *
13128  * In order to ensure no [`Event`]s are lost, implementors of this trait will persist [`Event`]s
13129  * and replay any unhandled events on startup. An [`Event`] is considered handled when
13130  * [`process_pending_events`] returns, thus handlers MUST fully handle [`Event`]s and persist any
13131  * relevant changes to disk *before* returning.
13132  *
13133  * Further, because an application may crash between an [`Event`] being handled and the
13134  * implementor of this trait being re-serialized, [`Event`] handling must be idempotent - in
13135  * effect, [`Event`]s may be replayed.
13136  *
13137  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
13138  * consult the provider's documentation on the implication of processing events and how a handler
13139  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
13140  * [`ChainMonitor::process_pending_events`]).
13141  *
13142  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
13143  * own type(s).
13144  *
13145  * [`process_pending_events`]: Self::process_pending_events
13146  * [`handle_event`]: EventHandler::handle_event
13147  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
13148  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
13149  * [`ChannelManager::process_pending_events_async`]: crate::ln::channelmanager::ChannelManager::process_pending_events_async
13150  * [`ChainMonitor::process_pending_events_async`]: crate::chain::chainmonitor::ChainMonitor::process_pending_events_async
13151  */
13152 typedef struct LDKEventsProvider {
13153    /**
13154     * An opaque pointer which is passed to your function implementations as an argument.
13155     * This has no meaning in the LDK, and can be NULL or any other value.
13156     */
13157    void *this_arg;
13158    /**
13159     * Processes any events generated since the last call using the given event handler.
13160     *
13161     * See the trait-level documentation for requirements.
13162     */
13163    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
13164    /**
13165     * Frees any resources associated with this object given its this_arg pointer.
13166     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13167     */
13168    void (*free)(void *this_arg);
13169 } LDKEventsProvider;
13170
13171
13172
13173 /**
13174  * Lightning TLV uses a custom variable-length integer called `BigSize`. It is similar to Bitcoin's
13175  * variable-length integers except that it is serialized in big-endian instead of little-endian.
13176  *
13177  * Like Bitcoin's variable-length integer, it exhibits ambiguity in that certain values can be
13178  * encoded in several different ways, which we must check for at deserialization-time. Thus, if
13179  * you're looking for an example of a variable-length integer to use for your own project, move
13180  * along, this is a rather poor design.
13181  */
13182 typedef struct MUST_USE_STRUCT LDKBigSize {
13183    /**
13184     * A pointer to the opaque Rust object.
13185     * Nearly everywhere, inner must be non-null, however in places where
13186     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13187     */
13188    LDKnativeBigSize *inner;
13189    /**
13190     * Indicates that this is the only struct which contains the same pointer.
13191     * Rust functions which take ownership of an object provided via an argument require
13192     * this to be true and invalidate the object pointed to by inner.
13193     */
13194    bool is_owned;
13195 } LDKBigSize;
13196
13197 /**
13198  * Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk.
13199  */
13200 typedef struct LDKPersister {
13201    /**
13202     * An opaque pointer which is passed to your function implementations as an argument.
13203     * This has no meaning in the LDK, and can be NULL or any other value.
13204     */
13205    void *this_arg;
13206    /**
13207     * Persist the given ['ChannelManager'] to disk, returning an error if persistence failed.
13208     */
13209    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
13210    /**
13211     * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed.
13212     */
13213    struct LDKCResult_NoneErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
13214    /**
13215     * Persist the given [`WriteableScore`] to disk, returning an error if persistence failed.
13216     */
13217    struct LDKCResult_NoneErrorZ (*persist_scorer)(const void *this_arg, const struct LDKWriteableScore *NONNULL_PTR scorer);
13218    /**
13219     * Frees any resources associated with this object given its this_arg pointer.
13220     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13221     */
13222    void (*free)(void *this_arg);
13223 } LDKPersister;
13224
13225
13226
13227 /**
13228  * A string that displays only printable characters, replacing control characters with
13229  * [`core::char::REPLACEMENT_CHARACTER`].
13230  */
13231 typedef struct MUST_USE_STRUCT LDKPrintableString {
13232    /**
13233     * A pointer to the opaque Rust object.
13234     * Nearly everywhere, inner must be non-null, however in places where
13235     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13236     */
13237    LDKnativePrintableString *inner;
13238    /**
13239     * Indicates that this is the only struct which contains the same pointer.
13240     * Rust functions which take ownership of an object provided via an argument require
13241     * this to be true and invalidate the object pointed to by inner.
13242     */
13243    bool is_owned;
13244 } LDKPrintableString;
13245
13246 /**
13247  * A callback which is called when a [`Future`] completes.
13248  *
13249  * Note that this MUST NOT call back into LDK directly, it must instead schedule actions to be
13250  * taken later. Rust users should use the [`std::future::Future`] implementation for [`Future`]
13251  * instead.
13252  *
13253  * Note that the [`std::future::Future`] implementation may only work for runtimes which schedule
13254  * futures when they receive a wake, rather than immediately executing them.
13255  */
13256 typedef struct LDKFutureCallback {
13257    /**
13258     * An opaque pointer which is passed to your function implementations as an argument.
13259     * This has no meaning in the LDK, and can be NULL or any other value.
13260     */
13261    void *this_arg;
13262    /**
13263     * The method which is called.
13264     */
13265    void (*call)(const void *this_arg);
13266    /**
13267     * Frees any resources associated with this object given its this_arg pointer.
13268     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13269     */
13270    void (*free)(void *this_arg);
13271 } LDKFutureCallback;
13272
13273
13274
13275 /**
13276  * A simple future which can complete once, and calls some callback(s) when it does so.
13277  */
13278 typedef struct MUST_USE_STRUCT LDKFuture {
13279    /**
13280     * A pointer to the opaque Rust object.
13281     * Nearly everywhere, inner must be non-null, however in places where
13282     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13283     */
13284    LDKnativeFuture *inner;
13285    /**
13286     * Indicates that this is the only struct which contains the same pointer.
13287     * Rust functions which take ownership of an object provided via an argument require
13288     * this to be true and invalidate the object pointed to by inner.
13289     */
13290    bool is_owned;
13291 } LDKFuture;
13292
13293
13294
13295 /**
13296  * Configuration we set when applicable.
13297  *
13298  * Default::default() provides sane defaults.
13299  */
13300 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
13301    /**
13302     * A pointer to the opaque Rust object.
13303     * Nearly everywhere, inner must be non-null, however in places where
13304     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13305     */
13306    LDKnativeChannelHandshakeConfig *inner;
13307    /**
13308     * Indicates that this is the only struct which contains the same pointer.
13309     * Rust functions which take ownership of an object provided via an argument require
13310     * this to be true and invalidate the object pointed to by inner.
13311     */
13312    bool is_owned;
13313 } LDKChannelHandshakeConfig;
13314
13315
13316
13317 /**
13318  * Optional channel limits which are applied during channel creation.
13319  *
13320  * These limits are only applied to our counterparty's limits, not our own.
13321  *
13322  * Use 0/`<type>::max_value()` as appropriate to skip checking.
13323  *
13324  * Provides sane defaults for most configurations.
13325  *
13326  * Most additional limits are disabled except those with which specify a default in individual
13327  * field documentation. Note that this may result in barely-usable channels, but since they
13328  * are applied mostly only to incoming channels that's not much of a problem.
13329  */
13330 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
13331    /**
13332     * A pointer to the opaque Rust object.
13333     * Nearly everywhere, inner must be non-null, however in places where
13334     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13335     */
13336    LDKnativeChannelHandshakeLimits *inner;
13337    /**
13338     * Indicates that this is the only struct which contains the same pointer.
13339     * Rust functions which take ownership of an object provided via an argument require
13340     * this to be true and invalidate the object pointed to by inner.
13341     */
13342    bool is_owned;
13343 } LDKChannelHandshakeLimits;
13344
13345
13346
13347 /**
13348  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
13349  *
13350  * Default::default() provides sane defaults for most configurations
13351  * (but currently with 0 relay fees!)
13352  */
13353 typedef struct MUST_USE_STRUCT LDKUserConfig {
13354    /**
13355     * A pointer to the opaque Rust object.
13356     * Nearly everywhere, inner must be non-null, however in places where
13357     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13358     */
13359    LDKnativeUserConfig *inner;
13360    /**
13361     * Indicates that this is the only struct which contains the same pointer.
13362     * Rust functions which take ownership of an object provided via an argument require
13363     * this to be true and invalidate the object pointed to by inner.
13364     */
13365    bool is_owned;
13366 } LDKUserConfig;
13367
13368
13369
13370 /**
13371  * The best known block as identified by its hash and height.
13372  */
13373 typedef struct MUST_USE_STRUCT LDKBestBlock {
13374    /**
13375     * A pointer to the opaque Rust object.
13376     * Nearly everywhere, inner must be non-null, however in places where
13377     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13378     */
13379    LDKnativeBestBlock *inner;
13380    /**
13381     * Indicates that this is the only struct which contains the same pointer.
13382     * Rust functions which take ownership of an object provided via an argument require
13383     * this to be true and invalidate the object pointed to by inner.
13384     */
13385    bool is_owned;
13386 } LDKBestBlock;
13387
13388 /**
13389  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
13390  * chain.
13391  *
13392  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
13393  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
13394  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
13395  * when needed.
13396  *
13397  * By using [`Listen::filtered_block_connected`] this interface supports clients fetching the
13398  * entire header chain and only blocks with matching transaction data using BIP 157 filters or
13399  * other similar filtering.
13400  */
13401 typedef struct LDKListen {
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     * Notifies the listener that a block was added at the given height, with the transaction data
13409     * possibly filtered.
13410     */
13411    void (*filtered_block_connected)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
13412    /**
13413     * Notifies the listener that a block was added at the given height.
13414     */
13415    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
13416    /**
13417     * Notifies the listener that a block was removed at the given height.
13418     */
13419    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
13420    /**
13421     * Frees any resources associated with this object given its this_arg pointer.
13422     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13423     */
13424    void (*free)(void *this_arg);
13425 } LDKListen;
13426
13427 /**
13428  * The `Confirm` trait is used to notify LDK when relevant transactions have been confirmed on
13429  * chain or unconfirmed during a chain reorganization.
13430  *
13431  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
13432  * [`Listen`]. For instance, an Electrum-based transaction sync implementation may implement
13433  * [`Filter`] to subscribe to relevant transactions and unspent outputs it should monitor for
13434  * on-chain activity. Then, it needs to notify LDK via this interface upon observing any changes
13435  * with reference to the confirmation status of the monitored objects.
13436  *
13437  * # Use
13438  * The intended use is as follows:
13439  * - Call [`transactions_confirmed`] to notify LDK whenever any of the registered transactions or
13440  *   outputs are, respectively, confirmed or spent on chain.
13441  * - Call [`transaction_unconfirmed`] to notify LDK whenever any transaction returned by
13442  *   [`get_relevant_txids`] is no longer confirmed in the block with the given block hash.
13443  * - Call [`best_block_updated`] to notify LDK whenever a new chain tip becomes available.
13444  *
13445  * # Order
13446  *
13447  * Clients must call these methods in chain order. Specifically:
13448  * - Transactions which are confirmed in a particular block must be given before transactions
13449  *   confirmed in a later block.
13450  * - Dependent transactions within the same block must be given in topological order, possibly in
13451  *   separate calls.
13452  * - All unconfirmed transactions must be given after the original confirmations and before *any*
13453  *   reconfirmations, i.e., [`transactions_confirmed`] and [`transaction_unconfirmed`] calls should
13454  *   never be interleaved, but always conduced *en bloc*.
13455  * - Any reconfirmed transactions need to be explicitly unconfirmed before they are reconfirmed
13456  *   in regard to the new block.
13457  *
13458  * See individual method documentation for further details.
13459  *
13460  * [`transactions_confirmed`]: Self::transactions_confirmed
13461  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
13462  * [`best_block_updated`]: Self::best_block_updated
13463  * [`get_relevant_txids`]: Self::get_relevant_txids
13464  */
13465 typedef struct LDKConfirm {
13466    /**
13467     * An opaque pointer which is passed to your function implementations as an argument.
13468     * This has no meaning in the LDK, and can be NULL or any other value.
13469     */
13470    void *this_arg;
13471    /**
13472     * Notifies LDK of transactions confirmed in a block with a given header and height.
13473     *
13474     * Must be called for any transactions registered by [`Filter::register_tx`] or any
13475     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
13476     * appearing in the same block do not need to be included in the same call; instead, multiple
13477     * calls with additional transactions may be made so long as they are made in [chain order].
13478     *
13479     * May be called before or after [`best_block_updated`] for the corresponding block. However,
13480     * in the event of a chain reorganization, it must not be called with a `header` that is no
13481     * longer in the chain as of the last call to [`best_block_updated`].
13482     *
13483     * [chain order]: Confirm#order
13484     * [`best_block_updated`]: Self::best_block_updated
13485     */
13486    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
13487    /**
13488     * Notifies LDK of a transaction that is no longer confirmed as result of a chain reorganization.
13489     *
13490     * Must be called for any transaction returned by [`get_relevant_txids`] if it has been
13491     * reorganized out of the best chain or if it is no longer confirmed in the block with the
13492     * given block hash. Once called, the given transaction will not be returned
13493     * by [`get_relevant_txids`], unless it has been reconfirmed via [`transactions_confirmed`].
13494     *
13495     * [`get_relevant_txids`]: Self::get_relevant_txids
13496     * [`transactions_confirmed`]: Self::transactions_confirmed
13497     */
13498    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
13499    /**
13500     * Notifies LDK of an update to the best header connected at the given height.
13501     *
13502     * Must be called whenever a new chain tip becomes available. May be skipped for intermediary
13503     * blocks.
13504     */
13505    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
13506    /**
13507     * Returns transactions that must be monitored for reorganization out of the chain along
13508     * with the hash of the block as part of which it had been previously confirmed.
13509     *
13510     * Note that the returned `Option<BlockHash>` might be `None` for channels created with LDK
13511     * 0.0.112 and prior, in which case you need to manually track previous confirmations.
13512     *
13513     * Will include any transactions passed to [`transactions_confirmed`] that have insufficient
13514     * confirmations to be safe from a chain reorganization. Will not include any transactions
13515     * passed to [`transaction_unconfirmed`], unless later reconfirmed.
13516     *
13517     * Must be called to determine the subset of transactions that must be monitored for
13518     * reorganization. Will be idempotent between calls but may change as a result of calls to the
13519     * other interface methods. Thus, this is useful to determine which transactions must be
13520     * given to [`transaction_unconfirmed`].
13521     *
13522     * If any of the returned transactions are confirmed in a block other than the one with the
13523     * given hash, they need to be unconfirmed and reconfirmed via [`transaction_unconfirmed`] and
13524     * [`transactions_confirmed`], respectively.
13525     *
13526     * [`transactions_confirmed`]: Self::transactions_confirmed
13527     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
13528     */
13529    struct LDKCVec_C2Tuple_TxidBlockHashZZ (*get_relevant_txids)(const void *this_arg);
13530    /**
13531     * Frees any resources associated with this object given its this_arg pointer.
13532     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13533     */
13534    void (*free)(void *this_arg);
13535 } LDKConfirm;
13536
13537 /**
13538  * `Persist` defines behavior for persisting channel monitors: this could mean
13539  * writing once to disk, and/or uploading to one or more backup services.
13540  *
13541  * Each method can return three possible values:
13542  *  * If persistence (including any relevant `fsync()` calls) happens immediately, the
13543  *    implementation should return [`ChannelMonitorUpdateStatus::Completed`], indicating normal
13544  *    channel operation should continue.
13545  *  * If persistence happens asynchronously, implementations should first ensure the
13546  *    [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return
13547  *    [`ChannelMonitorUpdateStatus::InProgress`] while the update continues in the background.
13548  *    Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be called with
13549  *    the corresponding [`MonitorUpdateId`].
13550  *
13551  *    Note that unlike the direct [`chain::Watch`] interface,
13552  *    [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
13553  *
13554  *  * If persistence fails for some reason, implementations should return
13555  *    [`ChannelMonitorUpdateStatus::PermanentFailure`], in which case the channel will likely be
13556  *    closed without broadcasting the latest state. See
13557  *    [`ChannelMonitorUpdateStatus::PermanentFailure`] for more details.
13558  */
13559 typedef struct LDKPersist {
13560    /**
13561     * An opaque pointer which is passed to your function implementations as an argument.
13562     * This has no meaning in the LDK, and can be NULL or any other value.
13563     */
13564    void *this_arg;
13565    /**
13566     * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
13567     * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
13568     *
13569     * The data can be stored any way you want, but the identifier provided by LDK is the
13570     * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
13571     * and the stored channel data). Note that you **must** persist every new monitor to disk.
13572     *
13573     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
13574     * if you return [`ChannelMonitorUpdateStatus::InProgress`].
13575     *
13576     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
13577     * and [`ChannelMonitorUpdateStatus`] for requirements when returning errors.
13578     *
13579     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
13580     * [`Writeable::write`]: crate::util::ser::Writeable::write
13581     */
13582    enum LDKChannelMonitorUpdateStatus (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
13583    /**
13584     * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
13585     * update.
13586     *
13587     * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
13588     * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
13589     * details.
13590     *
13591     * During blockchain synchronization operations, this may be called with no
13592     * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
13593     * Note that after the full [`ChannelMonitor`] is persisted any previous
13594     * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
13595     * applied to the persisted [`ChannelMonitor`] as they were already applied.
13596     *
13597     * If an implementer chooses to persist the updates only, they need to make
13598     * sure that all the updates are applied to the `ChannelMonitors` *before*
13599     * the set of channel monitors is given to the `ChannelManager`
13600     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
13601     * applying a monitor update to a monitor. If full `ChannelMonitors` are
13602     * persisted, then there is no need to persist individual updates.
13603     *
13604     * Note that there could be a performance tradeoff between persisting complete
13605     * channel monitors on every update vs. persisting only updates and applying
13606     * them in batches. The size of each monitor grows `O(number of state updates)`
13607     * whereas updates are small and `O(1)`.
13608     *
13609     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
13610     * if you return [`ChannelMonitorUpdateStatus::InProgress`].
13611     *
13612     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
13613     * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
13614     * [`ChannelMonitorUpdateStatus`] for requirements when returning errors.
13615     *
13616     * [`Writeable::write`]: crate::util::ser::Writeable::write
13617     *
13618     * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
13619     */
13620    enum LDKChannelMonitorUpdateStatus (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint channel_id, struct LDKChannelMonitorUpdate update, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
13621    /**
13622     * Frees any resources associated with this object given its this_arg pointer.
13623     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13624     */
13625    void (*free)(void *this_arg);
13626 } LDKPersist;
13627
13628
13629
13630 /**
13631  * An implementation of [`chain::Watch`] for monitoring channels.
13632  *
13633  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
13634  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
13635  * or used independently to monitor channels remotely. See the [module-level documentation] for
13636  * details.
13637  *
13638  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
13639  * [module-level documentation]: crate::chain::chainmonitor
13640  */
13641 typedef struct MUST_USE_STRUCT LDKChainMonitor {
13642    /**
13643     * A pointer to the opaque Rust object.
13644     * Nearly everywhere, inner must be non-null, however in places where
13645     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13646     */
13647    LDKnativeChainMonitor *inner;
13648    /**
13649     * Indicates that this is the only struct which contains the same pointer.
13650     * Rust functions which take ownership of an object provided via an argument require
13651     * this to be true and invalidate the object pointed to by inner.
13652     */
13653    bool is_owned;
13654 } LDKChainMonitor;
13655
13656 /**
13657  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
13658  */
13659 typedef struct LDKSecretKey {
13660    /**
13661     * The bytes of the secret key
13662     */
13663    uint8_t bytes[32];
13664 } LDKSecretKey;
13665
13666
13667
13668 /**
13669  * Simple implementation of [`EntropySource`], [`NodeSigner`], and [`SignerProvider`] that takes a
13670  * 32-byte seed for use as a BIP 32 extended key and derives keys from that.
13671  *
13672  * Your `node_id` is seed/0'.
13673  * Unilateral closes may use seed/1'.
13674  * Cooperative closes may use seed/2'.
13675  * The two close keys may be needed to claim on-chain funds!
13676  *
13677  * This struct cannot be used for nodes that wish to support receiving phantom payments;
13678  * [`PhantomKeysManager`] must be used instead.
13679  *
13680  * Note that switching between this struct and [`PhantomKeysManager`] will invalidate any
13681  * previously issued invoices and attempts to pay previous invoices will fail.
13682  */
13683 typedef struct MUST_USE_STRUCT LDKKeysManager {
13684    /**
13685     * A pointer to the opaque Rust object.
13686     * Nearly everywhere, inner must be non-null, however in places where
13687     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13688     */
13689    LDKnativeKeysManager *inner;
13690    /**
13691     * Indicates that this is the only struct which contains the same pointer.
13692     * Rust functions which take ownership of an object provided via an argument require
13693     * this to be true and invalidate the object pointed to by inner.
13694     */
13695    bool is_owned;
13696 } LDKKeysManager;
13697
13698
13699
13700 /**
13701  * Similar to [`KeysManager`], but allows the node using this struct to receive phantom node
13702  * payments.
13703  *
13704  * A phantom node payment is a payment made to a phantom invoice, which is an invoice that can be
13705  * paid to one of multiple nodes. This works because we encode the invoice route hints such that
13706  * LDK will recognize an incoming payment as destined for a phantom node, and collect the payment
13707  * itself without ever needing to forward to this fake node.
13708  *
13709  * Phantom node payments are useful for load balancing between multiple LDK nodes. They also
13710  * provide some fault tolerance, because payers will automatically retry paying other provided
13711  * nodes in the case that one node goes down.
13712  *
13713  * Note that multi-path payments are not supported in phantom invoices for security reasons.
13714  * Switching between this struct and [`KeysManager`] will invalidate any previously issued
13715  * invoices and attempts to pay previous invoices will fail.
13716  */
13717 typedef struct MUST_USE_STRUCT LDKPhantomKeysManager {
13718    /**
13719     * A pointer to the opaque Rust object.
13720     * Nearly everywhere, inner must be non-null, however in places where
13721     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13722     */
13723    LDKnativePhantomKeysManager *inner;
13724    /**
13725     * Indicates that this is the only struct which contains the same pointer.
13726     * Rust functions which take ownership of an object provided via an argument require
13727     * this to be true and invalidate the object pointed to by inner.
13728     */
13729    bool is_owned;
13730 } LDKPhantomKeysManager;
13731
13732
13733
13734 /**
13735  * Chain-related parameters used to construct a new `ChannelManager`.
13736  *
13737  * Typically, the block-specific parameters are derived from the best block hash for the network,
13738  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
13739  * are not needed when deserializing a previously constructed `ChannelManager`.
13740  */
13741 typedef struct MUST_USE_STRUCT LDKChainParameters {
13742    /**
13743     * A pointer to the opaque Rust object.
13744     * Nearly everywhere, inner must be non-null, however in places where
13745     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13746     */
13747    LDKnativeChainParameters *inner;
13748    /**
13749     * Indicates that this is the only struct which contains the same pointer.
13750     * Rust functions which take ownership of an object provided via an argument require
13751     * this to be true and invalidate the object pointed to by inner.
13752     */
13753    bool is_owned;
13754 } LDKChainParameters;
13755
13756 /**
13757  * Strategies available to retry payment path failures.
13758  */
13759 typedef enum LDKRetry_Tag {
13760    /**
13761     * Max number of attempts to retry payment.
13762     *
13763     * Each attempt may be multiple HTLCs along multiple paths if the router decides to split up a
13764     * retry, and may retry multiple failed HTLCs at once if they failed around the same time and
13765     * were retried along a route from a single call to [`Router::find_route`].
13766     */
13767    LDKRetry_Attempts,
13768    /**
13769     * Time elapsed before abandoning retries for a payment. At least one attempt at payment is made;
13770     * see [`PaymentParameters::expiry_time`] to avoid any attempt at payment after a specific time.
13771     *
13772     * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time
13773     */
13774    LDKRetry_Timeout,
13775    /**
13776     * Must be last for serialization purposes
13777     */
13778    LDKRetry_Sentinel,
13779 } LDKRetry_Tag;
13780
13781 typedef struct MUST_USE_STRUCT LDKRetry {
13782    LDKRetry_Tag tag;
13783    union {
13784       struct {
13785          uintptr_t attempts;
13786       };
13787       struct {
13788          uint64_t timeout;
13789       };
13790    };
13791 } LDKRetry;
13792
13793 /**
13794  * A trait to describe an object which can receive channel messages.
13795  *
13796  * Messages MAY be called in parallel when they originate from different `their_node_ids`, however
13797  * they MUST NOT be called in parallel when the two calls have the same `their_node_id`.
13798  */
13799 typedef struct LDKChannelMessageHandler {
13800    /**
13801     * An opaque pointer which is passed to your function implementations as an argument.
13802     * This has no meaning in the LDK, and can be NULL or any other value.
13803     */
13804    void *this_arg;
13805    /**
13806     * Handle an incoming `open_channel` message from the given peer.
13807     */
13808    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKOpenChannel *NONNULL_PTR msg);
13809    /**
13810     * Handle an incoming `accept_channel` message from the given peer.
13811     */
13812    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAcceptChannel *NONNULL_PTR msg);
13813    /**
13814     * Handle an incoming `funding_created` message from the given peer.
13815     */
13816    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
13817    /**
13818     * Handle an incoming `funding_signed` message from the given peer.
13819     */
13820    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
13821    /**
13822     * Handle an incoming `channel_ready` message from the given peer.
13823     */
13824    void (*handle_channel_ready)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReady *NONNULL_PTR msg);
13825    /**
13826     * Handle an incoming `shutdown` message from the given peer.
13827     */
13828    void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg);
13829    /**
13830     * Handle an incoming `closing_signed` message from the given peer.
13831     */
13832    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
13833    /**
13834     * Handle an incoming `update_add_htlc` message from the given peer.
13835     */
13836    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
13837    /**
13838     * Handle an incoming `update_fulfill_htlc` message from the given peer.
13839     */
13840    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
13841    /**
13842     * Handle an incoming `update_fail_htlc` message from the given peer.
13843     */
13844    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
13845    /**
13846     * Handle an incoming `update_fail_malformed_htlc` message from the given peer.
13847     */
13848    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
13849    /**
13850     * Handle an incoming `commitment_signed` message from the given peer.
13851     */
13852    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
13853    /**
13854     * Handle an incoming `revoke_and_ack` message from the given peer.
13855     */
13856    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
13857    /**
13858     * Handle an incoming `update_fee` message from the given peer.
13859     */
13860    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
13861    /**
13862     * Handle an incoming `announcement_signatures` message from the given peer.
13863     */
13864    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
13865    /**
13866     * Indicates a connection to the peer failed/an existing connection was lost.
13867     */
13868    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id);
13869    /**
13870     * Handle a peer reconnecting, possibly generating `channel_reestablish` message(s).
13871     *
13872     * May return an `Err(())` if the features the peer supports are not sufficient to communicate
13873     * with us. Implementors should be somewhat conservative about doing so, however, as other
13874     * message handlers may still wish to communicate with this peer.
13875     */
13876    struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg, bool inbound);
13877    /**
13878     * Handle an incoming `channel_reestablish` message from the given peer.
13879     */
13880    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
13881    /**
13882     * Handle an incoming `channel_update` message from the given peer.
13883     */
13884    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
13885    /**
13886     * Handle an incoming `error` message from the given peer.
13887     */
13888    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
13889    /**
13890     * Gets the node feature flags which this handler itself supports. All available handlers are
13891     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
13892     * which are broadcasted in our [`NodeAnnouncement`] message.
13893     */
13894    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
13895    /**
13896     * Gets the init feature flags which should be sent to the given peer. All available handlers
13897     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
13898     * which are sent in our [`Init`] message.
13899     *
13900     * Note that this method is called before [`Self::peer_connected`].
13901     */
13902    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
13903    /**
13904     * Implementation of MessageSendEventsProvider for this object.
13905     */
13906    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
13907    /**
13908     * Frees any resources associated with this object given its this_arg pointer.
13909     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13910     */
13911    void (*free)(void *this_arg);
13912 } LDKChannelMessageHandler;
13913
13914
13915
13916 /**
13917  * Arguments for the creation of a ChannelManager that are not deserialized.
13918  *
13919  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
13920  * is:
13921  * 1) Deserialize all stored [`ChannelMonitor`]s.
13922  * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
13923  *    `<(BlockHash, ChannelManager)>::read(reader, args)`
13924  *    This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
13925  *    [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
13926  * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
13927  *    same way you would handle a [`chain::Filter`] call using
13928  *    [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
13929  * 4) Reconnect blocks on your [`ChannelMonitor`]s.
13930  * 5) Disconnect/connect blocks on the [`ChannelManager`].
13931  * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
13932  *    Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
13933  *    will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
13934  *    the next step.
13935  * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
13936  *    [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
13937  *
13938  * Note that the ordering of #4-7 is not of importance, however all four must occur before you
13939  * call any other methods on the newly-deserialized [`ChannelManager`].
13940  *
13941  * Note that because some channels may be closed during deserialization, it is critical that you
13942  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
13943  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
13944  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
13945  * not force-close the same channels but consider them live), you may end up revoking a state for
13946  * which you've already broadcasted the transaction.
13947  *
13948  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
13949  */
13950 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
13951    /**
13952     * A pointer to the opaque Rust object.
13953     * Nearly everywhere, inner must be non-null, however in places where
13954     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13955     */
13956    LDKnativeChannelManagerReadArgs *inner;
13957    /**
13958     * Indicates that this is the only struct which contains the same pointer.
13959     * Rust functions which take ownership of an object provided via an argument require
13960     * this to be true and invalidate the object pointed to by inner.
13961     */
13962    bool is_owned;
13963 } LDKChannelManagerReadArgs;
13964
13965
13966
13967 /**
13968  * A set of keys that were HKDF-expanded from an initial call to
13969  * [`NodeSigner::get_inbound_payment_key_material`].
13970  *
13971  * [`NodeSigner::get_inbound_payment_key_material`]: crate::chain::keysinterface::NodeSigner::get_inbound_payment_key_material
13972  */
13973 typedef struct MUST_USE_STRUCT LDKExpandedKey {
13974    /**
13975     * A pointer to the opaque Rust object.
13976     * Nearly everywhere, inner must be non-null, however in places where
13977     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13978     */
13979    LDKnativeExpandedKey *inner;
13980    /**
13981     * Indicates that this is the only struct which contains the same pointer.
13982     * Rust functions which take ownership of an object provided via an argument require
13983     * this to be true and invalidate the object pointed to by inner.
13984     */
13985    bool is_owned;
13986 } LDKExpandedKey;
13987
13988
13989
13990 /**
13991  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
13992  *
13993  * This is used to convince the recipient that the channel is at a certain commitment
13994  * number even if they lost that data due to a local failure. Of course, the peer may lie
13995  * and even later commitments may have been revoked.
13996  */
13997 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
13998    /**
13999     * A pointer to the opaque Rust object.
14000     * Nearly everywhere, inner must be non-null, however in places where
14001     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14002     */
14003    LDKnativeDataLossProtect *inner;
14004    /**
14005     * Indicates that this is the only struct which contains the same pointer.
14006     * Rust functions which take ownership of an object provided via an argument require
14007     * this to be true and invalidate the object pointed to by inner.
14008     */
14009    bool is_owned;
14010 } LDKDataLossProtect;
14011
14012 /**
14013  * A 3-byte byte array.
14014  */
14015 typedef struct LDKThreeBytes {
14016    /**
14017     * The three bytes
14018     */
14019    uint8_t data[3];
14020 } LDKThreeBytes;
14021
14022 /**
14023  * A trait to describe an object which can receive routing messages.
14024  *
14025  * # Implementor DoS Warnings
14026  *
14027  * For messages enabled with the `gossip_queries` feature there are potential DoS vectors when
14028  * handling inbound queries. Implementors using an on-disk network graph should be aware of
14029  * repeated disk I/O for queries accessing different parts of the network graph.
14030  */
14031 typedef struct LDKRoutingMessageHandler {
14032    /**
14033     * An opaque pointer which is passed to your function implementations as an argument.
14034     * This has no meaning in the LDK, and can be NULL or any other value.
14035     */
14036    void *this_arg;
14037    /**
14038     * Handle an incoming `node_announcement` message, returning `true` if it should be forwarded on,
14039     * `false` or returning an `Err` otherwise.
14040     */
14041    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
14042    /**
14043     * Handle a `channel_announcement` message, returning `true` if it should be forwarded on, `false`
14044     * or returning an `Err` otherwise.
14045     */
14046    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
14047    /**
14048     * Handle an incoming `channel_update` message, returning true if it should be forwarded on,
14049     * `false` or returning an `Err` otherwise.
14050     */
14051    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
14052    /**
14053     * Gets channel announcements and updates required to dump our routing table to a remote node,
14054     * starting at the `short_channel_id` indicated by `starting_point` and including announcements
14055     * for a single channel.
14056     */
14057    struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcement)(const void *this_arg, uint64_t starting_point);
14058    /**
14059     * Gets a node announcement required to dump our routing table to a remote node, starting at
14060     * the node *after* the provided pubkey and including up to one announcement immediately
14061     * higher (as defined by `<PublicKey as Ord>::cmp`) than `starting_point`.
14062     * If `None` is provided for `starting_point`, we start at the first node.
14063     *
14064     * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
14065     * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
14066     */
14067    struct LDKNodeAnnouncement (*get_next_node_announcement)(const void *this_arg, struct LDKNodeId starting_point);
14068    /**
14069     * Called when a connection is established with a peer. This can be used to
14070     * perform routing table synchronization using a strategy defined by the
14071     * implementor.
14072     *
14073     * May return an `Err(())` if the features the peer supports are not sufficient to communicate
14074     * with us. Implementors should be somewhat conservative about doing so, however, as other
14075     * message handlers may still wish to communicate with this peer.
14076     */
14077    struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init, bool inbound);
14078    /**
14079     * Handles the reply of a query we initiated to learn about channels
14080     * for a given range of blocks. We can expect to receive one or more
14081     * replies to a single query.
14082     */
14083    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
14084    /**
14085     * Handles the reply of a query we initiated asking for routing gossip
14086     * messages for a list of channels. We should receive this message when
14087     * a node has completed its best effort to send us the pertaining routing
14088     * gossip messages.
14089     */
14090    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
14091    /**
14092     * Handles when a peer asks us to send a list of `short_channel_id`s
14093     * for the requested range of blocks.
14094     */
14095    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
14096    /**
14097     * Handles when a peer asks us to send routing gossip messages for a
14098     * list of `short_channel_id`s.
14099     */
14100    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
14101    /**
14102     * Indicates that there are a large number of [`ChannelAnnouncement`] (or other) messages
14103     * pending some async action. While there is no guarantee of the rate of future messages, the
14104     * caller should seek to reduce the rate of new gossip messages handled, especially
14105     * [`ChannelAnnouncement`]s.
14106     */
14107    bool (*processing_queue_high)(const void *this_arg);
14108    /**
14109     * Gets the node feature flags which this handler itself supports. All available handlers are
14110     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
14111     * which are broadcasted in our [`NodeAnnouncement`] message.
14112     */
14113    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
14114    /**
14115     * Gets the init feature flags which should be sent to the given peer. All available handlers
14116     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
14117     * which are sent in our [`Init`] message.
14118     *
14119     * Note that this method is called before [`Self::peer_connected`].
14120     */
14121    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
14122    /**
14123     * Implementation of MessageSendEventsProvider for this object.
14124     */
14125    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
14126    /**
14127     * Frees any resources associated with this object given its this_arg pointer.
14128     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
14129     */
14130    void (*free)(void *this_arg);
14131 } LDKRoutingMessageHandler;
14132
14133 /**
14134  * A trait to describe an object that can receive onion messages.
14135  */
14136 typedef struct LDKOnionMessageHandler {
14137    /**
14138     * An opaque pointer which is passed to your function implementations as an argument.
14139     * This has no meaning in the LDK, and can be NULL or any other value.
14140     */
14141    void *this_arg;
14142    /**
14143     * Handle an incoming `onion_message` message from the given peer.
14144     */
14145    void (*handle_onion_message)(const void *this_arg, struct LDKPublicKey peer_node_id, const struct LDKOnionMessage *NONNULL_PTR msg);
14146    /**
14147     * Called when a connection is established with a peer. Can be used to track which peers
14148     * advertise onion message support and are online.
14149     *
14150     * May return an `Err(())` if the features the peer supports are not sufficient to communicate
14151     * with us. Implementors should be somewhat conservative about doing so, however, as other
14152     * message handlers may still wish to communicate with this peer.
14153     */
14154    struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init, bool inbound);
14155    /**
14156     * Indicates a connection to the peer failed/an existing connection was lost. Allows handlers to
14157     * drop and refuse to forward onion messages to this peer.
14158     */
14159    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id);
14160    /**
14161     * Gets the node feature flags which this handler itself supports. All available handlers are
14162     * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
14163     * which are broadcasted in our [`NodeAnnouncement`] message.
14164     */
14165    struct LDKNodeFeatures (*provided_node_features)(const void *this_arg);
14166    /**
14167     * Gets the init feature flags which should be sent to the given peer. All available handlers
14168     * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`]
14169     * which are sent in our [`Init`] message.
14170     *
14171     * Note that this method is called before [`Self::peer_connected`].
14172     */
14173    struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id);
14174    /**
14175     * Implementation of OnionMessageProvider for this object.
14176     */
14177    struct LDKOnionMessageProvider OnionMessageProvider;
14178    /**
14179     * Frees any resources associated with this object given its this_arg pointer.
14180     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
14181     */
14182    void (*free)(void *this_arg);
14183 } LDKOnionMessageHandler;
14184
14185 /**
14186  * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
14187  * decoders.
14188  */
14189 typedef struct LDKCustomMessageReader {
14190    /**
14191     * An opaque pointer which is passed to your function implementations as an argument.
14192     * This has no meaning in the LDK, and can be NULL or any other value.
14193     */
14194    void *this_arg;
14195    /**
14196     * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
14197     * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
14198     * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
14199     * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
14200     */
14201    struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer);
14202    /**
14203     * Frees any resources associated with this object given its this_arg pointer.
14204     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
14205     */
14206    void (*free)(void *this_arg);
14207 } LDKCustomMessageReader;
14208
14209 /**
14210  * A handler provided to [`PeerManager`] for reading and handling custom messages.
14211  *
14212  * [BOLT 1] specifies a custom message type range for use with experimental or application-specific
14213  * messages. `CustomMessageHandler` allows for user-defined handling of such types. See the
14214  * [`lightning_custom_message`] crate for tools useful in composing more than one custom handler.
14215  *
14216  * [BOLT 1]: https://github.com/lightning/bolts/blob/master/01-messaging.md
14217  * [`lightning_custom_message`]: https://docs.rs/lightning_custom_message/latest/lightning_custom_message
14218  */
14219 typedef struct LDKCustomMessageHandler {
14220    /**
14221     * An opaque pointer which is passed to your function implementations as an argument.
14222     * This has no meaning in the LDK, and can be NULL or any other value.
14223     */
14224    void *this_arg;
14225    /**
14226     * Handles the given message sent from `sender_node_id`, possibly producing messages for
14227     * [`CustomMessageHandler::get_and_clear_pending_msg`] to return and thus for [`PeerManager`]
14228     * to send.
14229     */
14230    struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id);
14231    /**
14232     * Returns the list of pending messages that were generated by the handler, clearing the list
14233     * in the process. Each message is paired with the node id of the intended recipient. If no
14234     * connection to the node exists, then the message is simply not sent.
14235     */
14236    struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg);
14237    /**
14238     * Implementation of CustomMessageReader for this object.
14239     */
14240    struct LDKCustomMessageReader CustomMessageReader;
14241    /**
14242     * Frees any resources associated with this object given its this_arg pointer.
14243     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
14244     */
14245    void (*free)(void *this_arg);
14246 } LDKCustomMessageHandler;
14247
14248
14249
14250 /**
14251  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
14252  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
14253  */
14254 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
14255    /**
14256     * A pointer to the opaque Rust object.
14257     * Nearly everywhere, inner must be non-null, however in places where
14258     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14259     */
14260    LDKnativeIgnoringMessageHandler *inner;
14261    /**
14262     * Indicates that this is the only struct which contains the same pointer.
14263     * Rust functions which take ownership of an object provided via an argument require
14264     * this to be true and invalidate the object pointed to by inner.
14265     */
14266    bool is_owned;
14267 } LDKIgnoringMessageHandler;
14268
14269 /**
14270  * Handler for custom onion messages. If you are using [`SimpleArcOnionMessenger`],
14271  * [`SimpleRefOnionMessenger`], or prefer to ignore inbound custom onion messages,
14272  * [`IgnoringMessageHandler`] must be provided to [`OnionMessenger::new`]. Otherwise, a custom
14273  * implementation of this trait must be provided, with [`CustomMessage`] specifying the supported
14274  * message types.
14275  *
14276  * See [`OnionMessenger`] for example usage.
14277  *
14278  * [`IgnoringMessageHandler`]: crate::ln::peer_handler::IgnoringMessageHandler
14279  * [`CustomMessage`]: Self::CustomMessage
14280  */
14281 typedef struct LDKCustomOnionMessageHandler {
14282    /**
14283     * An opaque pointer which is passed to your function implementations as an argument.
14284     * This has no meaning in the LDK, and can be NULL or any other value.
14285     */
14286    void *this_arg;
14287    /**
14288     * Called with the custom message that was received.
14289     */
14290    void (*handle_custom_message)(const void *this_arg, struct LDKCustomOnionMessageContents msg);
14291    /**
14292     * Read a custom message of type `message_type` from `buffer`, returning `Ok(None)` if the
14293     * message type is unknown.
14294     */
14295    struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ (*read_custom_message)(const void *this_arg, uint64_t message_type, struct LDKu8slice buffer);
14296    /**
14297     * Frees any resources associated with this object given its this_arg pointer.
14298     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
14299     */
14300    void (*free)(void *this_arg);
14301 } LDKCustomOnionMessageHandler;
14302
14303
14304
14305 /**
14306  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
14307  * You can provide one of these as the route_handler in a MessageHandler.
14308  */
14309 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
14310    /**
14311     * A pointer to the opaque Rust object.
14312     * Nearly everywhere, inner must be non-null, however in places where
14313     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14314     */
14315    LDKnativeErroringMessageHandler *inner;
14316    /**
14317     * Indicates that this is the only struct which contains the same pointer.
14318     * Rust functions which take ownership of an object provided via an argument require
14319     * this to be true and invalidate the object pointed to by inner.
14320     */
14321    bool is_owned;
14322 } LDKErroringMessageHandler;
14323
14324
14325
14326 /**
14327  * Provides references to trait impls which handle different types of messages.
14328  */
14329 typedef struct MUST_USE_STRUCT LDKMessageHandler {
14330    /**
14331     * A pointer to the opaque Rust object.
14332     * Nearly everywhere, inner must be non-null, however in places where
14333     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14334     */
14335    LDKnativeMessageHandler *inner;
14336    /**
14337     * Indicates that this is the only struct which contains the same pointer.
14338     * Rust functions which take ownership of an object provided via an argument require
14339     * this to be true and invalidate the object pointed to by inner.
14340     */
14341    bool is_owned;
14342 } LDKMessageHandler;
14343
14344 /**
14345  * Provides an object which can be used to send data to and which uniquely identifies a connection
14346  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
14347  * implement Hash to meet the PeerManager API.
14348  *
14349  * For efficiency, Clone should be relatively cheap for this type.
14350  *
14351  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
14352  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
14353  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
14354  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
14355  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
14356  * to simply use another value which is guaranteed to be globally unique instead.
14357  */
14358 typedef struct LDKSocketDescriptor {
14359    /**
14360     * An opaque pointer which is passed to your function implementations as an argument.
14361     * This has no meaning in the LDK, and can be NULL or any other value.
14362     */
14363    void *this_arg;
14364    /**
14365     * Attempts to send some data from the given slice to the peer.
14366     *
14367     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
14368     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
14369     * called and further write attempts may occur until that time.
14370     *
14371     * If the returned size is smaller than `data.len()`, a
14372     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
14373     * written. Additionally, until a `send_data` event completes fully, no further
14374     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
14375     * prevent denial-of-service issues, you should not read or buffer any data from the socket
14376     * until then.
14377     *
14378     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
14379     * (indicating that read events should be paused to prevent DoS in the send buffer),
14380     * `resume_read` may be set indicating that read events on this descriptor should resume. A
14381     * `resume_read` of false carries no meaning, and should not cause any action.
14382     */
14383    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
14384    /**
14385     * Disconnect the socket pointed to by this SocketDescriptor.
14386     *
14387     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
14388     * call (doing so is a noop).
14389     */
14390    void (*disconnect_socket)(void *this_arg);
14391    /**
14392     * Checks if two objects are equal given this object's this_arg pointer and another object.
14393     */
14394    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
14395    /**
14396     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
14397     * This is used, for example, for inclusion of this object in a hash map.
14398     */
14399    uint64_t (*hash)(const void *this_arg);
14400    /**
14401     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
14402     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
14403     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
14404     */
14405    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
14406    /**
14407     * Frees any resources associated with this object given its this_arg pointer.
14408     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
14409     */
14410    void (*free)(void *this_arg);
14411 } LDKSocketDescriptor;
14412
14413
14414
14415 /**
14416  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
14417  * socket events into messages which it passes on to its [`MessageHandler`].
14418  *
14419  * Locks are taken internally, so you must never assume that reentrancy from a
14420  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
14421  *
14422  * Calls to [`read_event`] will decode relevant messages and pass them to the
14423  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
14424  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
14425  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
14426  * calls only after previous ones have returned.
14427  *
14428  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
14429  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
14430  * essentially you should default to using a SimpleRefPeerManager, and use a
14431  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
14432  * you're using lightning-net-tokio.
14433  *
14434  * [`read_event`]: PeerManager::read_event
14435  */
14436 typedef struct MUST_USE_STRUCT LDKPeerManager {
14437    /**
14438     * A pointer to the opaque Rust object.
14439     * Nearly everywhere, inner must be non-null, however in places where
14440     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14441     */
14442    LDKnativePeerManager *inner;
14443    /**
14444     * Indicates that this is the only struct which contains the same pointer.
14445     * Rust functions which take ownership of an object provided via an argument require
14446     * this to be true and invalidate the object pointed to by inner.
14447     */
14448    bool is_owned;
14449 } LDKPeerManager;
14450
14451
14452
14453 /**
14454  * Static channel fields used to build transactions given per-commitment fields, organized by
14455  * broadcaster/countersignatory.
14456  *
14457  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
14458  * as_holder_broadcastable and as_counterparty_broadcastable functions.
14459  */
14460 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
14461    /**
14462     * A pointer to the opaque Rust object.
14463     * Nearly everywhere, inner must be non-null, however in places where
14464     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14465     */
14466    LDKnativeDirectedChannelTransactionParameters *inner;
14467    /**
14468     * Indicates that this is the only struct which contains the same pointer.
14469     * Rust functions which take ownership of an object provided via an argument require
14470     * this to be true and invalidate the object pointed to by inner.
14471     */
14472    bool is_owned;
14473 } LDKDirectedChannelTransactionParameters;
14474
14475
14476
14477 /**
14478  * Features used within an `offer`.
14479  */
14480 typedef struct MUST_USE_STRUCT LDKOfferFeatures {
14481    /**
14482     * A pointer to the opaque Rust object.
14483     * Nearly everywhere, inner must be non-null, however in places where
14484     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14485     */
14486    LDKnativeOfferFeatures *inner;
14487    /**
14488     * Indicates that this is the only struct which contains the same pointer.
14489     * Rust functions which take ownership of an object provided via an argument require
14490     * this to be true and invalidate the object pointed to by inner.
14491     */
14492    bool is_owned;
14493 } LDKOfferFeatures;
14494
14495
14496
14497 /**
14498  * Features used within an `invoice_request`.
14499  */
14500 typedef struct MUST_USE_STRUCT LDKInvoiceRequestFeatures {
14501    /**
14502     * A pointer to the opaque Rust object.
14503     * Nearly everywhere, inner must be non-null, however in places where
14504     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14505     */
14506    LDKnativeInvoiceRequestFeatures *inner;
14507    /**
14508     * Indicates that this is the only struct which contains the same pointer.
14509     * Rust functions which take ownership of an object provided via an argument require
14510     * this to be true and invalidate the object pointed to by inner.
14511     */
14512    bool is_owned;
14513 } LDKInvoiceRequestFeatures;
14514
14515
14516
14517 /**
14518  * Features used within an `invoice`.
14519  */
14520 typedef struct MUST_USE_STRUCT LDKBolt12InvoiceFeatures {
14521    /**
14522     * A pointer to the opaque Rust object.
14523     * Nearly everywhere, inner must be non-null, however in places where
14524     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14525     */
14526    LDKnativeBolt12InvoiceFeatures *inner;
14527    /**
14528     * Indicates that this is the only struct which contains the same pointer.
14529     * Rust functions which take ownership of an object provided via an argument require
14530     * this to be true and invalidate the object pointed to by inner.
14531     */
14532    bool is_owned;
14533 } LDKBolt12InvoiceFeatures;
14534
14535 /**
14536  * Integer in the range `0..=16`
14537  */
14538 typedef struct LDKWitnessVersion {
14539    uint8_t _0;
14540 } LDKWitnessVersion;
14541
14542
14543
14544 /**
14545  * Receives and validates network updates from peers,
14546  * stores authentic and relevant data as a network graph.
14547  * This network graph is then used for routing payments.
14548  * Provides interface to help with initial routing sync by
14549  * serving historical announcements.
14550  */
14551 typedef struct MUST_USE_STRUCT LDKP2PGossipSync {
14552    /**
14553     * A pointer to the opaque Rust object.
14554     * Nearly everywhere, inner must be non-null, however in places where
14555     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14556     */
14557    LDKnativeP2PGossipSync *inner;
14558    /**
14559     * Indicates that this is the only struct which contains the same pointer.
14560     * Rust functions which take ownership of an object provided via an argument require
14561     * this to be true and invalidate the object pointed to by inner.
14562     */
14563    bool is_owned;
14564 } LDKP2PGossipSync;
14565
14566
14567
14568 /**
14569  * A read-only view of [`NetworkGraph`].
14570  */
14571 typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
14572    /**
14573     * A pointer to the opaque Rust object.
14574     * Nearly everywhere, inner must be non-null, however in places where
14575     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14576     */
14577    LDKnativeReadOnlyNetworkGraph *inner;
14578    /**
14579     * Indicates that this is the only struct which contains the same pointer.
14580     * Rust functions which take ownership of an object provided via an argument require
14581     * this to be true and invalidate the object pointed to by inner.
14582     */
14583    bool is_owned;
14584 } LDKReadOnlyNetworkGraph;
14585
14586
14587
14588 /**
14589  * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a
14590  * source node to a target node.
14591  */
14592 typedef struct MUST_USE_STRUCT LDKDirectedChannelInfo {
14593    /**
14594     * A pointer to the opaque Rust object.
14595     * Nearly everywhere, inner must be non-null, however in places where
14596     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14597     */
14598    LDKnativeDirectedChannelInfo *inner;
14599    /**
14600     * Indicates that this is the only struct which contains the same pointer.
14601     * Rust functions which take ownership of an object provided via an argument require
14602     * this to be true and invalidate the object pointed to by inner.
14603     */
14604    bool is_owned;
14605 } LDKDirectedChannelInfo;
14606
14607 /**
14608  * The effective capacity of a channel for routing purposes.
14609  *
14610  * While this may be smaller than the actual channel capacity, amounts greater than
14611  * [`Self::as_msat`] should not be routed through the channel.
14612  */
14613 typedef enum LDKEffectiveCapacity_Tag {
14614    /**
14615     * The available liquidity in the channel known from being a channel counterparty, and thus a
14616     * direct hop.
14617     */
14618    LDKEffectiveCapacity_ExactLiquidity,
14619    /**
14620     * The maximum HTLC amount in one direction as advertised on the gossip network.
14621     */
14622    LDKEffectiveCapacity_MaximumHTLC,
14623    /**
14624     * The total capacity of the channel as determined by the funding transaction.
14625     */
14626    LDKEffectiveCapacity_Total,
14627    /**
14628     * A capacity sufficient to route any payment, typically used for private channels provided by
14629     * an invoice.
14630     */
14631    LDKEffectiveCapacity_Infinite,
14632    /**
14633     * A capacity that is unknown possibly because either the chain state is unavailable to know
14634     * the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network.
14635     */
14636    LDKEffectiveCapacity_Unknown,
14637    /**
14638     * Must be last for serialization purposes
14639     */
14640    LDKEffectiveCapacity_Sentinel,
14641 } LDKEffectiveCapacity_Tag;
14642
14643 typedef struct LDKEffectiveCapacity_LDKExactLiquidity_Body {
14644    /**
14645     * Either the inbound or outbound liquidity depending on the direction, denominated in
14646     * millisatoshi.
14647     */
14648    uint64_t liquidity_msat;
14649 } LDKEffectiveCapacity_LDKExactLiquidity_Body;
14650
14651 typedef struct LDKEffectiveCapacity_LDKMaximumHTLC_Body {
14652    /**
14653     * The maximum HTLC amount denominated in millisatoshi.
14654     */
14655    uint64_t amount_msat;
14656 } LDKEffectiveCapacity_LDKMaximumHTLC_Body;
14657
14658 typedef struct LDKEffectiveCapacity_LDKTotal_Body {
14659    /**
14660     * The funding amount denominated in millisatoshi.
14661     */
14662    uint64_t capacity_msat;
14663    /**
14664     * The maximum HTLC amount denominated in millisatoshi.
14665     */
14666    uint64_t htlc_maximum_msat;
14667 } LDKEffectiveCapacity_LDKTotal_Body;
14668
14669 typedef struct MUST_USE_STRUCT LDKEffectiveCapacity {
14670    LDKEffectiveCapacity_Tag tag;
14671    union {
14672       LDKEffectiveCapacity_LDKExactLiquidity_Body exact_liquidity;
14673       LDKEffectiveCapacity_LDKMaximumHTLC_Body maximum_htlc;
14674       LDKEffectiveCapacity_LDKTotal_Body total;
14675    };
14676 } LDKEffectiveCapacity;
14677
14678
14679
14680 /**
14681  * A [`Router`] implemented using [`find_route`].
14682  */
14683 typedef struct MUST_USE_STRUCT LDKDefaultRouter {
14684    /**
14685     * A pointer to the opaque Rust object.
14686     * Nearly everywhere, inner must be non-null, however in places where
14687     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14688     */
14689    LDKnativeDefaultRouter *inner;
14690    /**
14691     * Indicates that this is the only struct which contains the same pointer.
14692     * Rust functions which take ownership of an object provided via an argument require
14693     * this to be true and invalidate the object pointed to by inner.
14694     */
14695    bool is_owned;
14696 } LDKDefaultRouter;
14697
14698
14699
14700 /**
14701  * [`Score`] implementation that factors in in-flight HTLC liquidity.
14702  *
14703  * Useful for custom [`Router`] implementations to wrap their [`Score`] on-the-fly when calling
14704  * [`find_route`].
14705  *
14706  * [`Score`]: crate::routing::scoring::Score
14707  */
14708 typedef struct MUST_USE_STRUCT LDKScorerAccountingForInFlightHtlcs {
14709    /**
14710     * A pointer to the opaque Rust object.
14711     * Nearly everywhere, inner must be non-null, however in places where
14712     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14713     */
14714    LDKnativeScorerAccountingForInFlightHtlcs *inner;
14715    /**
14716     * Indicates that this is the only struct which contains the same pointer.
14717     * Rust functions which take ownership of an object provided via an argument require
14718     * this to be true and invalidate the object pointed to by inner.
14719     */
14720    bool is_owned;
14721 } LDKScorerAccountingForInFlightHtlcs;
14722
14723
14724
14725 /**
14726  * A concrete implementation of [`LockableScore`] which supports multi-threading.
14727  */
14728 typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore {
14729    /**
14730     * A pointer to the opaque Rust object.
14731     * Nearly everywhere, inner must be non-null, however in places where
14732     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14733     */
14734    LDKnativeMultiThreadedLockableScore *inner;
14735    /**
14736     * Indicates that this is the only struct which contains the same pointer.
14737     * Rust functions which take ownership of an object provided via an argument require
14738     * this to be true and invalidate the object pointed to by inner.
14739     */
14740    bool is_owned;
14741 } LDKMultiThreadedLockableScore;
14742
14743
14744
14745 /**
14746  * A locked `MultiThreadedLockableScore`.
14747  */
14748 typedef struct MUST_USE_STRUCT LDKMultiThreadedScoreLock {
14749    /**
14750     * A pointer to the opaque Rust object.
14751     * Nearly everywhere, inner must be non-null, however in places where
14752     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14753     */
14754    LDKnativeMultiThreadedScoreLock *inner;
14755    /**
14756     * Indicates that this is the only struct which contains the same pointer.
14757     * Rust functions which take ownership of an object provided via an argument require
14758     * this to be true and invalidate the object pointed to by inner.
14759     */
14760    bool is_owned;
14761 } LDKMultiThreadedScoreLock;
14762
14763
14764
14765 /**
14766  * Parameters for configuring [`ProbabilisticScorer`].
14767  *
14768  * Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel
14769  * penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel).
14770  *
14771  * The penalty applied to any channel by the [`ProbabilisticScorer`] is the sum of each of the
14772  * parameters here.
14773  */
14774 typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters {
14775    /**
14776     * A pointer to the opaque Rust object.
14777     * Nearly everywhere, inner must be non-null, however in places where
14778     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14779     */
14780    LDKnativeProbabilisticScoringParameters *inner;
14781    /**
14782     * Indicates that this is the only struct which contains the same pointer.
14783     * Rust functions which take ownership of an object provided via an argument require
14784     * this to be true and invalidate the object pointed to by inner.
14785     */
14786    bool is_owned;
14787 } LDKProbabilisticScoringParameters;
14788
14789
14790
14791 /**
14792  * A sender, receiver and forwarder of onion messages. In upcoming releases, this object will be
14793  * used to retrieve invoices and fulfill invoice requests from [offers]. Currently, only sending
14794  * and receiving custom onion messages is supported.
14795  *
14796  * # Example
14797  *
14798  * ```
14799  * # extern crate bitcoin;
14800  * # use bitcoin::hashes::_export::_core::time::Duration;
14801  * # use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};
14802  * # use lightning::chain::keysinterface::KeysManager;
14803  * # use lightning::ln::peer_handler::IgnoringMessageHandler;
14804  * # use lightning::onion_message::blinded_path::BlindedPath;
14805  * # use lightning::onion_message::messenger::{Destination, OnionMessenger};
14806  * # use lightning::onion_message::packet::{CustomOnionMessageContents, OnionMessageContents};
14807  * # use lightning::util::logger::{Logger, Record};
14808  * # use lightning::util::ser::{Writeable, Writer};
14809  * # use lightning::io;
14810  * # use std::sync::Arc;
14811  * # struct FakeLogger;
14812  * # impl Logger for FakeLogger {
14813  * #     fn log(&self, record: &Record) { unimplemented!() }
14814  * # }
14815  * # let seed = [42u8; 32];
14816  * # let time = Duration::from_secs(123456);
14817  * # let keys_manager = KeysManager::new(&seed, time.as_secs(), time.subsec_nanos());
14818  * # let logger = Arc::new(FakeLogger {});
14819  * # let node_secret = SecretKey::from_slice(&hex::decode(\"0101010101010101010101010101010101010101010101010101010101010101\").unwrap()[..]).unwrap();
14820  * # let secp_ctx = Secp256k1::new();
14821  * # let hop_node_id1 = PublicKey::from_secret_key(&secp_ctx, &node_secret);
14822  * # let (hop_node_id2, hop_node_id3, hop_node_id4) = (hop_node_id1, hop_node_id1, hop_node_id1);
14823  * # let destination_node_id = hop_node_id1;
14824  * # let your_custom_message_handler = IgnoringMessageHandler {};
14825  * // Create the onion messenger. This must use the same `keys_manager` as is passed to your
14826  * // ChannelManager.
14827  * let onion_messenger = OnionMessenger::new(&keys_manager, &keys_manager, logger, &your_custom_message_handler);
14828  *
14829  * # struct YourCustomMessage {}
14830  * impl Writeable for YourCustomMessage {
14831  * \tfn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
14832  * \t\t# Ok(())
14833  * \t\t// Write your custom onion message to `w`
14834  * \t}
14835  * }
14836  * impl CustomOnionMessageContents for YourCustomMessage {
14837  * \tfn tlv_type(&self) -> u64 {
14838  * \t\t# let your_custom_message_type = 42;
14839  * \t\tyour_custom_message_type
14840  * \t}
14841  * }
14842  * // Send a custom onion message to a node id.
14843  * let intermediate_hops = [hop_node_id1, hop_node_id2];
14844  * let reply_path = None;
14845  * # let your_custom_message = YourCustomMessage {};
14846  * let message = OnionMessageContents::Custom(your_custom_message);
14847  * onion_messenger.send_onion_message(&intermediate_hops, Destination::Node(destination_node_id), message, reply_path);
14848  *
14849  * // Create a blinded path to yourself, for someone to send an onion message to.
14850  * # let your_node_id = hop_node_id1;
14851  * let hops = [hop_node_id3, hop_node_id4, your_node_id];
14852  * let blinded_path = BlindedPath::new(&hops, &keys_manager, &secp_ctx).unwrap();
14853  *
14854  * // Send a custom onion message to a blinded path.
14855  * # let intermediate_hops = [hop_node_id1, hop_node_id2];
14856  * let reply_path = None;
14857  * # let your_custom_message = YourCustomMessage {};
14858  * let message = OnionMessageContents::Custom(your_custom_message);
14859  * onion_messenger.send_onion_message(&intermediate_hops, Destination::BlindedPath(blinded_path), message, reply_path);
14860  * ```
14861  *
14862  * [offers]: <https://github.com/lightning/bolts/pull/798>
14863  * [`OnionMessenger`]: crate::onion_message::OnionMessenger
14864  */
14865 typedef struct MUST_USE_STRUCT LDKOnionMessenger {
14866    /**
14867     * A pointer to the opaque Rust object.
14868     * Nearly everywhere, inner must be non-null, however in places where
14869     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14870     */
14871    LDKnativeOnionMessenger *inner;
14872    /**
14873     * Indicates that this is the only struct which contains the same pointer.
14874     * Rust functions which take ownership of an object provided via an argument require
14875     * this to be true and invalidate the object pointed to by inner.
14876     */
14877    bool is_owned;
14878 } LDKOnionMessenger;
14879
14880 /**
14881  * The destination of an onion message.
14882  */
14883 typedef enum LDKDestination_Tag {
14884    /**
14885     * We're sending this onion message to a node.
14886     */
14887    LDKDestination_Node,
14888    /**
14889     * We're sending this onion message to a blinded path.
14890     */
14891    LDKDestination_BlindedPath,
14892    /**
14893     * Must be last for serialization purposes
14894     */
14895    LDKDestination_Sentinel,
14896 } LDKDestination_Tag;
14897
14898 typedef struct MUST_USE_STRUCT LDKDestination {
14899    LDKDestination_Tag tag;
14900    union {
14901       struct {
14902          struct LDKPublicKey node;
14903       };
14904       struct {
14905          struct LDKBlindedPath blinded_path;
14906       };
14907    };
14908 } LDKDestination;
14909
14910 /**
14911  * The contents of an onion message. In the context of offers, this would be the invoice, invoice
14912  * request, or invoice error.
14913  */
14914 typedef enum LDKOnionMessageContents_Tag {
14915    /**
14916     * A custom onion message specified by the user.
14917     */
14918    LDKOnionMessageContents_Custom,
14919    /**
14920     * Must be last for serialization purposes
14921     */
14922    LDKOnionMessageContents_Sentinel,
14923 } LDKOnionMessageContents_Tag;
14924
14925 typedef struct MUST_USE_STRUCT LDKOnionMessageContents {
14926    LDKOnionMessageContents_Tag tag;
14927    union {
14928       struct {
14929          struct LDKCustomOnionMessageContents custom;
14930       };
14931    };
14932 } LDKOnionMessageContents;
14933
14934
14935
14936 /**
14937  * FilesystemPersister persists channel data on disk, where each channel's
14938  * data is stored in a file named after its funding outpoint.
14939  *
14940  * Warning: this module does the best it can with calls to persist data, but it
14941  * can only guarantee that the data is passed to the drive. It is up to the
14942  * drive manufacturers to do the actual persistence properly, which they often
14943  * don't (especially on consumer-grade hardware). Therefore, it is up to the
14944  * user to validate their entire storage stack, to ensure the writes are
14945  * persistent.
14946  * Corollary: especially when dealing with larger amounts of money, it is best
14947  * practice to have multiple channel data backups and not rely only on one
14948  * FilesystemPersister.
14949  */
14950 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
14951    /**
14952     * A pointer to the opaque Rust object.
14953     * Nearly everywhere, inner must be non-null, however in places where
14954     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14955     */
14956    LDKnativeFilesystemPersister *inner;
14957    /**
14958     * Indicates that this is the only struct which contains the same pointer.
14959     * Rust functions which take ownership of an object provided via an argument require
14960     * this to be true and invalidate the object pointed to by inner.
14961     */
14962    bool is_owned;
14963 } LDKFilesystemPersister;
14964
14965
14966
14967 /**
14968  * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
14969  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
14970  * responsibilities are:
14971  * * Processing [`Event`]s with a user-provided [`EventHandler`].
14972  * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
14973  *   writing it to disk/backups by invoking the callback given to it at startup.
14974  *   [`ChannelManager`] persistence should be done in the background.
14975  * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
14976  *   at the appropriate intervals.
14977  * * Calling [`NetworkGraph::remove_stale_channels_and_tracking`] (if a [`GossipSync`] with a
14978  *   [`NetworkGraph`] is provided to [`BackgroundProcessor::start`]).
14979  *
14980  * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
14981  * upon as doing so may result in high latency.
14982  *
14983  * # Note
14984  *
14985  * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
14986  * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
14987  * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
14988  * unilateral chain closure fees are at risk.
14989  *
14990  * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
14991  * [`Event`]: lightning::util::events::Event
14992  *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
14993  */
14994 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
14995    /**
14996     * A pointer to the opaque Rust object.
14997     * Nearly everywhere, inner must be non-null, however in places where
14998     * the Rust equivalent takes an Option, it may be set to null to indicate None.
14999     */
15000    LDKnativeBackgroundProcessor *inner;
15001    /**
15002     * Indicates that this is the only struct which contains the same pointer.
15003     * Rust functions which take ownership of an object provided via an argument require
15004     * this to be true and invalidate the object pointed to by inner.
15005     */
15006    bool is_owned;
15007 } LDKBackgroundProcessor;
15008
15009
15010
15011 /**
15012  * The main Rapid Gossip Sync object.
15013  *
15014  * See [crate-level documentation] for usage.
15015  *
15016  * [crate-level documentation]: crate
15017  */
15018 typedef struct MUST_USE_STRUCT LDKRapidGossipSync {
15019    /**
15020     * A pointer to the opaque Rust object.
15021     * Nearly everywhere, inner must be non-null, however in places where
15022     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15023     */
15024    LDKnativeRapidGossipSync *inner;
15025    /**
15026     * Indicates that this is the only struct which contains the same pointer.
15027     * Rust functions which take ownership of an object provided via an argument require
15028     * this to be true and invalidate the object pointed to by inner.
15029     */
15030    bool is_owned;
15031 } LDKRapidGossipSync;
15032
15033 /**
15034  * Either [`P2PGossipSync`] or [`RapidGossipSync`].
15035  */
15036 typedef enum LDKGossipSync_Tag {
15037    /**
15038     * Gossip sync via the lightning peer-to-peer network as defined by BOLT 7.
15039     */
15040    LDKGossipSync_P2P,
15041    /**
15042     * Rapid gossip sync from a trusted server.
15043     */
15044    LDKGossipSync_Rapid,
15045    /**
15046     * No gossip sync.
15047     */
15048    LDKGossipSync_None,
15049    /**
15050     * Must be last for serialization purposes
15051     */
15052    LDKGossipSync_Sentinel,
15053 } LDKGossipSync_Tag;
15054
15055 typedef struct MUST_USE_STRUCT LDKGossipSync {
15056    LDKGossipSync_Tag tag;
15057    union {
15058       struct {
15059          /**
15060           * Note that this field is expected to be a reference.
15061           */
15062          struct LDKP2PGossipSync p2p;
15063       };
15064       struct {
15065          /**
15066           * Note that this field is expected to be a reference.
15067           */
15068          struct LDKRapidGossipSync rapid;
15069       };
15070    };
15071 } LDKGossipSync;
15072
15073
15074
15075 /**
15076  * Data of the `RawInvoice` that is encoded in the data part
15077  */
15078 typedef struct MUST_USE_STRUCT LDKRawDataPart {
15079    /**
15080     * A pointer to the opaque Rust object.
15081     * Nearly everywhere, inner must be non-null, however in places where
15082     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15083     */
15084    LDKnativeRawDataPart *inner;
15085    /**
15086     * Indicates that this is the only struct which contains the same pointer.
15087     * Rust functions which take ownership of an object provided via an argument require
15088     * this to be true and invalidate the object pointed to by inner.
15089     */
15090    bool is_owned;
15091 } LDKRawDataPart;
15092
15093
15094
15095 /**
15096  * SHA-256 hash
15097  */
15098 typedef struct MUST_USE_STRUCT LDKSha256 {
15099    /**
15100     * A pointer to the opaque Rust object.
15101     * Nearly everywhere, inner must be non-null, however in places where
15102     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15103     */
15104    LDKnativeSha256 *inner;
15105    /**
15106     * Indicates that this is the only struct which contains the same pointer.
15107     * Rust functions which take ownership of an object provided via an argument require
15108     * this to be true and invalidate the object pointed to by inner.
15109     */
15110    bool is_owned;
15111 } LDKSha256;
15112
15113
15114
15115 /**
15116  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
15117  * expires
15118  */
15119 typedef struct MUST_USE_STRUCT LDKExpiryTime {
15120    /**
15121     * A pointer to the opaque Rust object.
15122     * Nearly everywhere, inner must be non-null, however in places where
15123     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15124     */
15125    LDKnativeExpiryTime *inner;
15126    /**
15127     * Indicates that this is the only struct which contains the same pointer.
15128     * Rust functions which take ownership of an object provided via an argument require
15129     * this to be true and invalidate the object pointed to by inner.
15130     */
15131    bool is_owned;
15132 } LDKExpiryTime;
15133
15134
15135
15136 /**
15137  * `min_final_cltv_expiry_delta` to use for the last HTLC in the route
15138  */
15139 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiryDelta {
15140    /**
15141     * A pointer to the opaque Rust object.
15142     * Nearly everywhere, inner must be non-null, however in places where
15143     * the Rust equivalent takes an Option, it may be set to null to indicate None.
15144     */
15145    LDKnativeMinFinalCltvExpiryDelta *inner;
15146    /**
15147     * Indicates that this is the only struct which contains the same pointer.
15148     * Rust functions which take ownership of an object provided via an argument require
15149     * this to be true and invalidate the object pointed to by inner.
15150     */
15151    bool is_owned;
15152 } LDKMinFinalCltvExpiryDelta;
15153
15154 /**
15155  * A 20-byte byte array.
15156  */
15157 typedef struct LDKTwentyBytes {
15158    /**
15159     * The twenty bytes
15160     */
15161    uint8_t data[20];
15162 } LDKTwentyBytes;
15163
15164 /**
15165  * Fallback address in case no LN payment is possible
15166  */
15167 typedef enum LDKFallback_Tag {
15168    LDKFallback_SegWitProgram,
15169    LDKFallback_PubKeyHash,
15170    LDKFallback_ScriptHash,
15171    /**
15172     * Must be last for serialization purposes
15173     */
15174    LDKFallback_Sentinel,
15175 } LDKFallback_Tag;
15176
15177 typedef struct LDKFallback_LDKSegWitProgram_Body {
15178    struct LDKU5 version;
15179    struct LDKCVec_u8Z program;
15180 } LDKFallback_LDKSegWitProgram_Body;
15181
15182 typedef struct MUST_USE_STRUCT LDKFallback {
15183    LDKFallback_Tag tag;
15184    union {
15185       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
15186       struct {
15187          struct LDKTwentyBytes pub_key_hash;
15188       };
15189       struct {
15190          struct LDKTwentyBytes script_hash;
15191       };
15192    };
15193 } LDKFallback;
15194
15195 extern const uintptr_t MAX_BUF_SIZE;
15196
15197 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
15198
15199 extern const uint32_t FEERATE_FLOOR_SATS_PER_KW;
15200
15201 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
15202
15203 extern const uint32_t ANTI_REORG_DELAY;
15204
15205 extern const uint16_t BREAKDOWN_TIMEOUT;
15206
15207 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
15208
15209 extern const uint16_t MIN_FINAL_CLTV_EXPIRY_DELTA;
15210
15211 extern const uint16_t MAX_HTLCS;
15212
15213 extern const uintptr_t OFFERED_HTLC_SCRIPT_WEIGHT;
15214
15215 extern const uintptr_t OFFERED_HTLC_SCRIPT_WEIGHT_ANCHORS;
15216
15217 extern const uintptr_t MAX_ACCEPTED_HTLC_SCRIPT_WEIGHT;
15218
15219 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
15220
15221 extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT;
15222
15223 extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA;
15224
15225 extern const uint8_t DEFAULT_MAX_PATH_COUNT;
15226
15227 extern const uint64_t MAX_TIMESTAMP;
15228
15229 extern const uint64_t DEFAULT_EXPIRY_TIME;
15230
15231 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA;
15232
15233 extern const uint8_t TAG_PAYMENT_HASH;
15234
15235 extern const uint8_t TAG_DESCRIPTION;
15236
15237 extern const uint8_t TAG_PAYEE_PUB_KEY;
15238
15239 extern const uint8_t TAG_DESCRIPTION_HASH;
15240
15241 extern const uint8_t TAG_EXPIRY_TIME;
15242
15243 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY_DELTA;
15244
15245 extern const uint8_t TAG_FALLBACK;
15246
15247 extern const uint8_t TAG_PRIVATE_ROUTE;
15248
15249 extern const uint8_t TAG_PAYMENT_SECRET;
15250
15251 extern const uint8_t TAG_FEATURES;
15252
15253 struct LDKStr _ldk_get_compiled_version(void);
15254
15255 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
15256
15257 /**
15258  * Gets the 128-bit integer, as 16 little-endian bytes
15259  */
15260 struct LDKSixteenBytes U128_le_bytes(struct LDKU128 val);
15261
15262 /**
15263  * Constructs a new U128 from 16 little-endian bytes
15264  */
15265 struct LDKU128 U128_new(struct LDKSixteenBytes le_bytes);
15266
15267 /**
15268  * Convenience function for constructing a new BigEndianScalar
15269  */
15270 struct LDKBigEndianScalar BigEndianScalar_new(struct LDKThirtyTwoBytes big_endian_bytes);
15271
15272 /**
15273  * Creates a new Bech32Error which has the same data as `orig`
15274  */
15275 struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig);
15276
15277 /**
15278  * Releases any memory held by the given `Bech32Error` (which is currently none)
15279  */
15280 void Bech32Error_free(struct LDKBech32Error o);
15281
15282 /**
15283  * Frees the data buffer, if data_is_owned is set and datalen > 0.
15284  */
15285 void Transaction_free(struct LDKTransaction _res);
15286
15287 /**
15288  * Frees the data pointed to by data
15289  */
15290 void Witness_free(struct LDKWitness _res);
15291
15292 /**
15293  * Convenience function for constructing a new TxOut
15294  */
15295 struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
15296
15297 /**
15298  * Frees the data pointed to by script_pubkey.
15299  */
15300 void TxOut_free(struct LDKTxOut _res);
15301
15302 /**
15303  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
15304  */
15305 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
15306
15307 /**
15308  * Frees the data buffer, if chars_is_owned is set and len > 0.
15309  */
15310 void Str_free(struct LDKStr _res);
15311
15312 #if defined(LDK_DEBUG_BUILD)
15313 /**
15314  * This function exists for memory safety testing purposes. It should never be used in production
15315  * code
15316  */
15317 const void *__unmangle_inner_ptr(const void *ptr);
15318 #endif
15319
15320 /**
15321  * Creates a new CResult_NoneAPIErrorZ in the success state.
15322  */
15323 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
15324
15325 /**
15326  * Creates a new CResult_NoneAPIErrorZ in the error state.
15327  */
15328 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
15329
15330 /**
15331  * Checks if the given object is currently in the success state
15332  */
15333 bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o);
15334
15335 /**
15336  * Frees any resources used by the CResult_NoneAPIErrorZ.
15337  */
15338 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
15339
15340 /**
15341  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
15342  * but with all dynamically-allocated buffers duplicated in new buffers.
15343  */
15344 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
15345
15346 /**
15347  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15348  */
15349 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
15350
15351 /**
15352  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15353  */
15354 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
15355
15356 /**
15357  * Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
15358  */
15359 struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_some(enum LDKHTLCClaim o);
15360
15361 /**
15362  * Constructs a new COption_HTLCClaimZ containing nothing
15363  */
15364 struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_none(void);
15365
15366 /**
15367  * Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
15368  */
15369 void COption_HTLCClaimZ_free(struct LDKCOption_HTLCClaimZ _res);
15370
15371 /**
15372  * Creates a new CResult_NoneNoneZ in the success state.
15373  */
15374 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
15375
15376 /**
15377  * Creates a new CResult_NoneNoneZ in the error state.
15378  */
15379 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
15380
15381 /**
15382  * Checks if the given object is currently in the success state
15383  */
15384 bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o);
15385
15386 /**
15387  * Frees any resources used by the CResult_NoneNoneZ.
15388  */
15389 void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
15390
15391 /**
15392  * Creates a new CResult_NoneNoneZ which has the same data as `orig`
15393  * but with all dynamically-allocated buffers duplicated in new buffers.
15394  */
15395 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
15396
15397 /**
15398  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
15399  */
15400 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o);
15401
15402 /**
15403  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
15404  */
15405 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e);
15406
15407 /**
15408  * Checks if the given object is currently in the success state
15409  */
15410 bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o);
15411
15412 /**
15413  * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
15414  */
15415 void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res);
15416
15417 /**
15418  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
15419  * but with all dynamically-allocated buffers duplicated in new buffers.
15420  */
15421 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig);
15422
15423 /**
15424  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
15425  */
15426 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
15427
15428 /**
15429  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
15430  */
15431 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
15432
15433 /**
15434  * Checks if the given object is currently in the success state
15435  */
15436 bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o);
15437
15438 /**
15439  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
15440  */
15441 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
15442
15443 /**
15444  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
15445  * but with all dynamically-allocated buffers duplicated in new buffers.
15446  */
15447 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
15448
15449 /**
15450  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
15451  */
15452 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
15453
15454 /**
15455  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
15456  */
15457 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
15458
15459 /**
15460  * Checks if the given object is currently in the success state
15461  */
15462 bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o);
15463
15464 /**
15465  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
15466  */
15467 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
15468
15469 /**
15470  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
15471  * but with all dynamically-allocated buffers duplicated in new buffers.
15472  */
15473 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
15474
15475 /**
15476  * Constructs a new COption_u32Z containing a u32
15477  */
15478 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
15479
15480 /**
15481  * Constructs a new COption_u32Z containing nothing
15482  */
15483 struct LDKCOption_u32Z COption_u32Z_none(void);
15484
15485 /**
15486  * Frees any resources associated with the u32, if we are in the Some state
15487  */
15488 void COption_u32Z_free(struct LDKCOption_u32Z _res);
15489
15490 /**
15491  * Creates a new COption_u32Z which has the same data as `orig`
15492  * but with all dynamically-allocated buffers duplicated in new buffers.
15493  */
15494 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
15495
15496 /**
15497  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
15498  */
15499 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
15500
15501 /**
15502  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
15503  */
15504 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
15505
15506 /**
15507  * Checks if the given object is currently in the success state
15508  */
15509 bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o);
15510
15511 /**
15512  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
15513  */
15514 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
15515
15516 /**
15517  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
15518  * but with all dynamically-allocated buffers duplicated in new buffers.
15519  */
15520 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
15521
15522 /**
15523  * Constructs a new COption_NoneZ containing a
15524  */
15525 enum LDKCOption_NoneZ COption_NoneZ_some(void);
15526
15527 /**
15528  * Constructs a new COption_NoneZ containing nothing
15529  */
15530 enum LDKCOption_NoneZ COption_NoneZ_none(void);
15531
15532 /**
15533  * Frees any resources associated with the , if we are in the Some state
15534  */
15535 void COption_NoneZ_free(enum LDKCOption_NoneZ _res);
15536
15537 /**
15538  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
15539  */
15540 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
15541
15542 /**
15543  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
15544  */
15545 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
15546
15547 /**
15548  * Checks if the given object is currently in the success state
15549  */
15550 bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
15551
15552 /**
15553  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
15554  */
15555 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
15556
15557 /**
15558  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
15559  * but with all dynamically-allocated buffers duplicated in new buffers.
15560  */
15561 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
15562
15563 /**
15564  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
15565  */
15566 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
15567
15568 /**
15569  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
15570  */
15571 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
15572
15573 /**
15574  * Checks if the given object is currently in the success state
15575  */
15576 bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
15577
15578 /**
15579  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
15580  */
15581 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
15582
15583 /**
15584  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
15585  * but with all dynamically-allocated buffers duplicated in new buffers.
15586  */
15587 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
15588
15589 /**
15590  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15591  */
15592 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
15593
15594 /**
15595  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
15596  */
15597 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
15598
15599 /**
15600  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
15601  */
15602 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
15603
15604 /**
15605  * Checks if the given object is currently in the success state
15606  */
15607 bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
15608
15609 /**
15610  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
15611  */
15612 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
15613
15614 /**
15615  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
15616  * but with all dynamically-allocated buffers duplicated in new buffers.
15617  */
15618 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
15619
15620 /**
15621  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
15622  */
15623 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
15624
15625 /**
15626  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
15627  */
15628 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
15629
15630 /**
15631  * Checks if the given object is currently in the success state
15632  */
15633 bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
15634
15635 /**
15636  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
15637  */
15638 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
15639
15640 /**
15641  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
15642  * but with all dynamically-allocated buffers duplicated in new buffers.
15643  */
15644 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
15645
15646 /**
15647  * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
15648  */
15649 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
15650
15651 /**
15652  * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
15653  */
15654 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
15655
15656 /**
15657  * Checks if the given object is currently in the success state
15658  */
15659 bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o);
15660
15661 /**
15662  * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
15663  */
15664 void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
15665
15666 /**
15667  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
15668  */
15669 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
15670
15671 /**
15672  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
15673  */
15674 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
15675
15676 /**
15677  * Checks if the given object is currently in the success state
15678  */
15679 bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
15680
15681 /**
15682  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
15683  */
15684 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
15685
15686 /**
15687  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
15688  * but with all dynamically-allocated buffers duplicated in new buffers.
15689  */
15690 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
15691
15692 /**
15693  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
15694  */
15695 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
15696
15697 /**
15698  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
15699  */
15700 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
15701
15702 /**
15703  * Checks if the given object is currently in the success state
15704  */
15705 bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o);
15706
15707 /**
15708  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
15709  */
15710 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
15711
15712 /**
15713  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
15714  */
15715 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
15716
15717 /**
15718  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
15719  */
15720 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
15721
15722 /**
15723  * Checks if the given object is currently in the success state
15724  */
15725 bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o);
15726
15727 /**
15728  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
15729  */
15730 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
15731
15732 /**
15733  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
15734  * but with all dynamically-allocated buffers duplicated in new buffers.
15735  */
15736 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
15737
15738 /**
15739  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
15740  */
15741 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
15742
15743 /**
15744  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
15745  */
15746 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
15747
15748 /**
15749  * Checks if the given object is currently in the success state
15750  */
15751 bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o);
15752
15753 /**
15754  * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
15755  */
15756 void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
15757
15758 /**
15759  * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
15760  * but with all dynamically-allocated buffers duplicated in new buffers.
15761  */
15762 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
15763
15764 /**
15765  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
15766  */
15767 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
15768
15769 /**
15770  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
15771  */
15772 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
15773
15774 /**
15775  * Checks if the given object is currently in the success state
15776  */
15777 bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o);
15778
15779 /**
15780  * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
15781  */
15782 void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
15783
15784 /**
15785  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
15786  * but with all dynamically-allocated buffers duplicated in new buffers.
15787  */
15788 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig);
15789
15790 /**
15791  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15792  */
15793 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
15794
15795 /**
15796  * Creates a new CResult_BlindedPathNoneZ in the success state.
15797  */
15798 struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_ok(struct LDKBlindedPath o);
15799
15800 /**
15801  * Creates a new CResult_BlindedPathNoneZ in the error state.
15802  */
15803 struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_err(void);
15804
15805 /**
15806  * Checks if the given object is currently in the success state
15807  */
15808 bool CResult_BlindedPathNoneZ_is_ok(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR o);
15809
15810 /**
15811  * Frees any resources used by the CResult_BlindedPathNoneZ.
15812  */
15813 void CResult_BlindedPathNoneZ_free(struct LDKCResult_BlindedPathNoneZ _res);
15814
15815 /**
15816  * Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
15817  * but with all dynamically-allocated buffers duplicated in new buffers.
15818  */
15819 struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_clone(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR orig);
15820
15821 /**
15822  * Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
15823  */
15824 struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_ok(struct LDKBlindedPath o);
15825
15826 /**
15827  * Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
15828  */
15829 struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_err(struct LDKDecodeError e);
15830
15831 /**
15832  * Checks if the given object is currently in the success state
15833  */
15834 bool CResult_BlindedPathDecodeErrorZ_is_ok(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR o);
15835
15836 /**
15837  * Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
15838  */
15839 void CResult_BlindedPathDecodeErrorZ_free(struct LDKCResult_BlindedPathDecodeErrorZ _res);
15840
15841 /**
15842  * Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
15843  * but with all dynamically-allocated buffers duplicated in new buffers.
15844  */
15845 struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_clone(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR orig);
15846
15847 /**
15848  * Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
15849  */
15850 struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_ok(struct LDKBlindedHop o);
15851
15852 /**
15853  * Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
15854  */
15855 struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_err(struct LDKDecodeError e);
15856
15857 /**
15858  * Checks if the given object is currently in the success state
15859  */
15860 bool CResult_BlindedHopDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR o);
15861
15862 /**
15863  * Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
15864  */
15865 void CResult_BlindedHopDecodeErrorZ_free(struct LDKCResult_BlindedHopDecodeErrorZ _res);
15866
15867 /**
15868  * Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
15869  * but with all dynamically-allocated buffers duplicated in new buffers.
15870  */
15871 struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_clone(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR orig);
15872
15873 /**
15874  * Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
15875  */
15876 struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_some(struct LDKWriteableScore o);
15877
15878 /**
15879  * Constructs a new COption_WriteableScoreZ containing nothing
15880  */
15881 struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_none(void);
15882
15883 /**
15884  * Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
15885  */
15886 void COption_WriteableScoreZ_free(struct LDKCOption_WriteableScoreZ _res);
15887
15888 /**
15889  * Creates a new CResult_NoneErrorZ in the success state.
15890  */
15891 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
15892
15893 /**
15894  * Creates a new CResult_NoneErrorZ in the error state.
15895  */
15896 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
15897
15898 /**
15899  * Checks if the given object is currently in the success state
15900  */
15901 bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o);
15902
15903 /**
15904  * Frees any resources used by the CResult_NoneErrorZ.
15905  */
15906 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
15907
15908 /**
15909  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
15910  * but with all dynamically-allocated buffers duplicated in new buffers.
15911  */
15912 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
15913
15914 /**
15915  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15916  */
15917 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
15918
15919 /**
15920  * Creates a new CResult_RouteLightningErrorZ in the success state.
15921  */
15922 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
15923
15924 /**
15925  * Creates a new CResult_RouteLightningErrorZ in the error state.
15926  */
15927 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
15928
15929 /**
15930  * Checks if the given object is currently in the success state
15931  */
15932 bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o);
15933
15934 /**
15935  * Frees any resources used by the CResult_RouteLightningErrorZ.
15936  */
15937 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
15938
15939 /**
15940  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
15941  * but with all dynamically-allocated buffers duplicated in new buffers.
15942  */
15943 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
15944
15945 /**
15946  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15947  */
15948 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
15949
15950 /**
15951  * Constructs a new COption_u64Z containing a u64
15952  */
15953 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
15954
15955 /**
15956  * Constructs a new COption_u64Z containing nothing
15957  */
15958 struct LDKCOption_u64Z COption_u64Z_none(void);
15959
15960 /**
15961  * Frees any resources associated with the u64, if we are in the Some state
15962  */
15963 void COption_u64Z_free(struct LDKCOption_u64Z _res);
15964
15965 /**
15966  * Creates a new COption_u64Z which has the same data as `orig`
15967  * but with all dynamically-allocated buffers duplicated in new buffers.
15968  */
15969 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
15970
15971 /**
15972  * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
15973  */
15974 struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_ok(struct LDKInFlightHtlcs o);
15975
15976 /**
15977  * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
15978  */
15979 struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_err(struct LDKDecodeError e);
15980
15981 /**
15982  * Checks if the given object is currently in the success state
15983  */
15984 bool CResult_InFlightHtlcsDecodeErrorZ_is_ok(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR o);
15985
15986 /**
15987  * Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
15988  */
15989 void CResult_InFlightHtlcsDecodeErrorZ_free(struct LDKCResult_InFlightHtlcsDecodeErrorZ _res);
15990
15991 /**
15992  * Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
15993  * but with all dynamically-allocated buffers duplicated in new buffers.
15994  */
15995 struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_clone(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR orig);
15996
15997 /**
15998  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
15999  */
16000 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
16001
16002 /**
16003  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
16004  */
16005 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
16006
16007 /**
16008  * Checks if the given object is currently in the success state
16009  */
16010 bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o);
16011
16012 /**
16013  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
16014  */
16015 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
16016
16017 /**
16018  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
16019  * but with all dynamically-allocated buffers duplicated in new buffers.
16020  */
16021 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
16022
16023 /**
16024  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16025  */
16026 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
16027
16028 /**
16029  * Creates a new CResult_RouteDecodeErrorZ in the success state.
16030  */
16031 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
16032
16033 /**
16034  * Creates a new CResult_RouteDecodeErrorZ in the error state.
16035  */
16036 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
16037
16038 /**
16039  * Checks if the given object is currently in the success state
16040  */
16041 bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o);
16042
16043 /**
16044  * Frees any resources used by the CResult_RouteDecodeErrorZ.
16045  */
16046 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
16047
16048 /**
16049  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
16050  * but with all dynamically-allocated buffers duplicated in new buffers.
16051  */
16052 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
16053
16054 /**
16055  * Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
16056  */
16057 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o);
16058
16059 /**
16060  * Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
16061  */
16062 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e);
16063
16064 /**
16065  * Checks if the given object is currently in the success state
16066  */
16067 bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o);
16068
16069 /**
16070  * Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
16071  */
16072 void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res);
16073
16074 /**
16075  * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
16076  * but with all dynamically-allocated buffers duplicated in new buffers.
16077  */
16078 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig);
16079
16080 /**
16081  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16082  */
16083 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
16084
16085 /**
16086  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16087  */
16088 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
16089
16090 /**
16091  * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
16092  */
16093 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o);
16094
16095 /**
16096  * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
16097  */
16098 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e);
16099
16100 /**
16101  * Checks if the given object is currently in the success state
16102  */
16103 bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o);
16104
16105 /**
16106  * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
16107  */
16108 void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res);
16109
16110 /**
16111  * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
16112  * but with all dynamically-allocated buffers duplicated in new buffers.
16113  */
16114 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig);
16115
16116 /**
16117  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16118  */
16119 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
16120
16121 /**
16122  * Creates a new CResult_RouteHintDecodeErrorZ in the success state.
16123  */
16124 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o);
16125
16126 /**
16127  * Creates a new CResult_RouteHintDecodeErrorZ in the error state.
16128  */
16129 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e);
16130
16131 /**
16132  * Checks if the given object is currently in the success state
16133  */
16134 bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o);
16135
16136 /**
16137  * Frees any resources used by the CResult_RouteHintDecodeErrorZ.
16138  */
16139 void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res);
16140
16141 /**
16142  * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
16143  * but with all dynamically-allocated buffers duplicated in new buffers.
16144  */
16145 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig);
16146
16147 /**
16148  * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
16149  */
16150 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o);
16151
16152 /**
16153  * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
16154  */
16155 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e);
16156
16157 /**
16158  * Checks if the given object is currently in the success state
16159  */
16160 bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o);
16161
16162 /**
16163  * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
16164  */
16165 void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res);
16166
16167 /**
16168  * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
16169  * but with all dynamically-allocated buffers duplicated in new buffers.
16170  */
16171 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
16172
16173 /**
16174  * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
16175  */
16176 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o);
16177
16178 /**
16179  * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
16180  */
16181 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_err(struct LDKDecodeError e);
16182
16183 /**
16184  * Checks if the given object is currently in the success state
16185  */
16186 bool CResult_PaymentPurposeDecodeErrorZ_is_ok(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR o);
16187
16188 /**
16189  * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
16190  */
16191 void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res);
16192
16193 /**
16194  * Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
16195  * but with all dynamically-allocated buffers duplicated in new buffers.
16196  */
16197 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig);
16198
16199 /**
16200  * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
16201  */
16202 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
16203
16204 /**
16205  * Constructs a new COption_NetworkUpdateZ containing nothing
16206  */
16207 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
16208
16209 /**
16210  * Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
16211  */
16212 void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
16213
16214 /**
16215  * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
16216  * but with all dynamically-allocated buffers duplicated in new buffers.
16217  */
16218 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
16219
16220 /**
16221  * Constructs a new COption_PathFailureZ containing a crate::lightning::util::events::PathFailure
16222  */
16223 struct LDKCOption_PathFailureZ COption_PathFailureZ_some(struct LDKPathFailure o);
16224
16225 /**
16226  * Constructs a new COption_PathFailureZ containing nothing
16227  */
16228 struct LDKCOption_PathFailureZ COption_PathFailureZ_none(void);
16229
16230 /**
16231  * Frees any resources associated with the crate::lightning::util::events::PathFailure, if we are in the Some state
16232  */
16233 void COption_PathFailureZ_free(struct LDKCOption_PathFailureZ _res);
16234
16235 /**
16236  * Creates a new COption_PathFailureZ which has the same data as `orig`
16237  * but with all dynamically-allocated buffers duplicated in new buffers.
16238  */
16239 struct LDKCOption_PathFailureZ COption_PathFailureZ_clone(const struct LDKCOption_PathFailureZ *NONNULL_PTR orig);
16240
16241 /**
16242  * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
16243  */
16244 struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_ok(struct LDKCOption_PathFailureZ o);
16245
16246 /**
16247  * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
16248  */
16249 struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_err(struct LDKDecodeError e);
16250
16251 /**
16252  * Checks if the given object is currently in the success state
16253  */
16254 bool CResult_COption_PathFailureZDecodeErrorZ_is_ok(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR o);
16255
16256 /**
16257  * Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
16258  */
16259 void CResult_COption_PathFailureZDecodeErrorZ_free(struct LDKCResult_COption_PathFailureZDecodeErrorZ _res);
16260
16261 /**
16262  * Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
16263  * but with all dynamically-allocated buffers duplicated in new buffers.
16264  */
16265 struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_clone(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR orig);
16266
16267 /**
16268  * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
16269  */
16270 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o);
16271
16272 /**
16273  * Constructs a new COption_ClosureReasonZ containing nothing
16274  */
16275 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void);
16276
16277 /**
16278  * Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
16279  */
16280 void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res);
16281
16282 /**
16283  * Creates a new COption_ClosureReasonZ which has the same data as `orig`
16284  * but with all dynamically-allocated buffers duplicated in new buffers.
16285  */
16286 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig);
16287
16288 /**
16289  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
16290  */
16291 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o);
16292
16293 /**
16294  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
16295  */
16296 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e);
16297
16298 /**
16299  * Checks if the given object is currently in the success state
16300  */
16301 bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o);
16302
16303 /**
16304  * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
16305  */
16306 void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res);
16307
16308 /**
16309  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
16310  * but with all dynamically-allocated buffers duplicated in new buffers.
16311  */
16312 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig);
16313
16314 /**
16315  * Constructs a new COption_HTLCDestinationZ containing a crate::lightning::util::events::HTLCDestination
16316  */
16317 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_some(struct LDKHTLCDestination o);
16318
16319 /**
16320  * Constructs a new COption_HTLCDestinationZ containing nothing
16321  */
16322 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_none(void);
16323
16324 /**
16325  * Frees any resources associated with the crate::lightning::util::events::HTLCDestination, if we are in the Some state
16326  */
16327 void COption_HTLCDestinationZ_free(struct LDKCOption_HTLCDestinationZ _res);
16328
16329 /**
16330  * Creates a new COption_HTLCDestinationZ which has the same data as `orig`
16331  * but with all dynamically-allocated buffers duplicated in new buffers.
16332  */
16333 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_clone(const struct LDKCOption_HTLCDestinationZ *NONNULL_PTR orig);
16334
16335 /**
16336  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
16337  */
16338 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_ok(struct LDKCOption_HTLCDestinationZ o);
16339
16340 /**
16341  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
16342  */
16343 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_err(struct LDKDecodeError e);
16344
16345 /**
16346  * Checks if the given object is currently in the success state
16347  */
16348 bool CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR o);
16349
16350 /**
16351  * Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
16352  */
16353 void CResult_COption_HTLCDestinationZDecodeErrorZ_free(struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res);
16354
16355 /**
16356  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
16357  * but with all dynamically-allocated buffers duplicated in new buffers.
16358  */
16359 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_clone(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR orig);
16360
16361 /**
16362  * Constructs a new COption_u128Z containing a crate::c_types::U128
16363  */
16364 struct LDKCOption_u128Z COption_u128Z_some(struct LDKU128 o);
16365
16366 /**
16367  * Constructs a new COption_u128Z containing nothing
16368  */
16369 struct LDKCOption_u128Z COption_u128Z_none(void);
16370
16371 /**
16372  * Frees any resources associated with the crate::c_types::U128, if we are in the Some state
16373  */
16374 void COption_u128Z_free(struct LDKCOption_u128Z _res);
16375
16376 /**
16377  * Creates a new COption_u128Z which has the same data as `orig`
16378  * but with all dynamically-allocated buffers duplicated in new buffers.
16379  */
16380 struct LDKCOption_u128Z COption_u128Z_clone(const struct LDKCOption_u128Z *NONNULL_PTR orig);
16381
16382 /**
16383  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16384  */
16385 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
16386
16387 /**
16388  * Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
16389  */
16390 struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o);
16391
16392 /**
16393  * Constructs a new COption_EventZ containing nothing
16394  */
16395 struct LDKCOption_EventZ COption_EventZ_none(void);
16396
16397 /**
16398  * Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
16399  */
16400 void COption_EventZ_free(struct LDKCOption_EventZ _res);
16401
16402 /**
16403  * Creates a new COption_EventZ which has the same data as `orig`
16404  * but with all dynamically-allocated buffers duplicated in new buffers.
16405  */
16406 struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig);
16407
16408 /**
16409  * Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
16410  */
16411 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o);
16412
16413 /**
16414  * Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
16415  */
16416 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e);
16417
16418 /**
16419  * Checks if the given object is currently in the success state
16420  */
16421 bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o);
16422
16423 /**
16424  * Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
16425  */
16426 void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res);
16427
16428 /**
16429  * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
16430  * but with all dynamically-allocated buffers duplicated in new buffers.
16431  */
16432 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig);
16433
16434 /**
16435  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16436  */
16437 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
16438
16439 /**
16440  * Creates a new tuple which has the same data as `orig`
16441  * but with all dynamically-allocated buffers duplicated in new buffers.
16442  */
16443 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
16444
16445 /**
16446  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
16447  */
16448 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
16449
16450 /**
16451  * Frees any resources used by the C2Tuple_usizeTransactionZ.
16452  */
16453 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
16454
16455 /**
16456  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16457  */
16458 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
16459
16460 /**
16461  * Creates a new tuple which has the same data as `orig`
16462  * but with all dynamically-allocated buffers duplicated in new buffers.
16463  */
16464 struct LDKC2Tuple_TxidBlockHashZ C2Tuple_TxidBlockHashZ_clone(const struct LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR orig);
16465
16466 /**
16467  * Creates a new C2Tuple_TxidBlockHashZ from the contained elements.
16468  */
16469 struct LDKC2Tuple_TxidBlockHashZ C2Tuple_TxidBlockHashZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
16470
16471 /**
16472  * Frees any resources used by the C2Tuple_TxidBlockHashZ.
16473  */
16474 void C2Tuple_TxidBlockHashZ_free(struct LDKC2Tuple_TxidBlockHashZ _res);
16475
16476 /**
16477  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16478  */
16479 void CVec_C2Tuple_TxidBlockHashZZ_free(struct LDKCVec_C2Tuple_TxidBlockHashZZ _res);
16480
16481 /**
16482  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16483  */
16484 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
16485
16486 /**
16487  * Creates a new tuple which has the same data as `orig`
16488  * but with all dynamically-allocated buffers duplicated in new buffers.
16489  */
16490 struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(const struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR orig);
16491
16492 /**
16493  * Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
16494  */
16495 struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorEventZ b, struct LDKPublicKey c);
16496
16497 /**
16498  * Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
16499  */
16500 void C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res);
16501
16502 /**
16503  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16504  */
16505 void CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res);
16506
16507 /**
16508  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
16509  */
16510 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o);
16511
16512 /**
16513  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
16514  */
16515 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e);
16516
16517 /**
16518  * Checks if the given object is currently in the success state
16519  */
16520 bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o);
16521
16522 /**
16523  * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
16524  */
16525 void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res);
16526
16527 /**
16528  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
16529  * but with all dynamically-allocated buffers duplicated in new buffers.
16530  */
16531 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig);
16532
16533 /**
16534  * Creates a new tuple which has the same data as `orig`
16535  * but with all dynamically-allocated buffers duplicated in new buffers.
16536  */
16537 struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const struct LDKC2Tuple_u64u64Z *NONNULL_PTR orig);
16538
16539 /**
16540  * Creates a new C2Tuple_u64u64Z from the contained elements.
16541  */
16542 struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
16543
16544 /**
16545  * Frees any resources used by the C2Tuple_u64u64Z.
16546  */
16547 void C2Tuple_u64u64Z_free(struct LDKC2Tuple_u64u64Z _res);
16548
16549 /**
16550  * Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
16551  */
16552 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_some(struct LDKC2Tuple_u64u64Z o);
16553
16554 /**
16555  * Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
16556  */
16557 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_none(void);
16558
16559 /**
16560  * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
16561  */
16562 void COption_C2Tuple_u64u64ZZ_free(struct LDKCOption_C2Tuple_u64u64ZZ _res);
16563
16564 /**
16565  * Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
16566  * but with all dynamically-allocated buffers duplicated in new buffers.
16567  */
16568 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_clone(const struct LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR orig);
16569
16570 /**
16571  * Creates a new tuple which has the same data as `orig`
16572  * but with all dynamically-allocated buffers duplicated in new buffers.
16573  */
16574 struct LDKC2Tuple_Z C2Tuple_Z_clone(const struct LDKC2Tuple_Z *NONNULL_PTR orig);
16575
16576 /**
16577  * Creates a new C2Tuple_Z from the contained elements.
16578  */
16579 struct LDKC2Tuple_Z C2Tuple_Z_new(struct LDKEightU16s a, struct LDKEightU16s b);
16580
16581 /**
16582  * Frees any resources used by the C2Tuple_Z.
16583  */
16584 void C2Tuple_Z_free(struct LDKC2Tuple_Z _res);
16585
16586 /**
16587  * Creates a new tuple which has the same data as `orig`
16588  * but with all dynamically-allocated buffers duplicated in new buffers.
16589  */
16590 struct LDKC2Tuple__u168_u168Z C2Tuple__u168_u168Z_clone(const struct LDKC2Tuple__u168_u168Z *NONNULL_PTR orig);
16591
16592 /**
16593  * Creates a new C2Tuple__u168_u168Z from the contained elements.
16594  */
16595 struct LDKC2Tuple__u168_u168Z C2Tuple__u168_u168Z_new(struct LDKEightU16s a, struct LDKEightU16s b);
16596
16597 /**
16598  * Frees any resources used by the C2Tuple__u168_u168Z.
16599  */
16600 void C2Tuple__u168_u168Z_free(struct LDKC2Tuple__u168_u168Z _res);
16601
16602 /**
16603  * Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing a crate::c_types::derived::C2Tuple__u168_u168Z
16604  */
16605 struct LDKCOption_C2Tuple_EightU16sEightU16sZZ COption_C2Tuple_EightU16sEightU16sZZ_some(struct LDKC2Tuple__u168_u168Z o);
16606
16607 /**
16608  * Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing nothing
16609  */
16610 struct LDKCOption_C2Tuple_EightU16sEightU16sZZ COption_C2Tuple_EightU16sEightU16sZZ_none(void);
16611
16612 /**
16613  * Frees any resources associated with the crate::c_types::derived::C2Tuple__u168_u168Z, if we are in the Some state
16614  */
16615 void COption_C2Tuple_EightU16sEightU16sZZ_free(struct LDKCOption_C2Tuple_EightU16sEightU16sZZ _res);
16616
16617 /**
16618  * Creates a new COption_C2Tuple_EightU16sEightU16sZZ which has the same data as `orig`
16619  * but with all dynamically-allocated buffers duplicated in new buffers.
16620  */
16621 struct LDKCOption_C2Tuple_EightU16sEightU16sZZ COption_C2Tuple_EightU16sEightU16sZZ_clone(const struct LDKCOption_C2Tuple_EightU16sEightU16sZZ *NONNULL_PTR orig);
16622
16623 /**
16624  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16625  */
16626 void CVec_NodeIdZ_free(struct LDKCVec_NodeIdZ _res);
16627
16628 /**
16629  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
16630  */
16631 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o);
16632
16633 /**
16634  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
16635  */
16636 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e);
16637
16638 /**
16639  * Checks if the given object is currently in the success state
16640  */
16641 bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o);
16642
16643 /**
16644  * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
16645  */
16646 void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res);
16647
16648 /**
16649  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
16650  */
16651 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
16652
16653 /**
16654  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
16655  */
16656 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
16657
16658 /**
16659  * Checks if the given object is currently in the success state
16660  */
16661 bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o);
16662
16663 /**
16664  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
16665  */
16666 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
16667
16668 /**
16669  * Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
16670  * but with all dynamically-allocated buffers duplicated in new buffers.
16671  */
16672 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_clone(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR orig);
16673
16674 /**
16675  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
16676  */
16677 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
16678
16679 /**
16680  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
16681  */
16682 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
16683
16684 /**
16685  * Checks if the given object is currently in the success state
16686  */
16687 bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o);
16688
16689 /**
16690  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
16691  */
16692 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
16693
16694 /**
16695  * Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
16696  * but with all dynamically-allocated buffers duplicated in new buffers.
16697  */
16698 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR orig);
16699
16700 /**
16701  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
16702  */
16703 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
16704
16705 /**
16706  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
16707  */
16708 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
16709
16710 /**
16711  * Checks if the given object is currently in the success state
16712  */
16713 bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o);
16714
16715 /**
16716  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
16717  */
16718 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
16719
16720 /**
16721  * Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
16722  * but with all dynamically-allocated buffers duplicated in new buffers.
16723  */
16724 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_clone(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR orig);
16725
16726 /**
16727  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
16728  */
16729 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
16730
16731 /**
16732  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
16733  */
16734 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
16735
16736 /**
16737  * Checks if the given object is currently in the success state
16738  */
16739 bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o);
16740
16741 /**
16742  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
16743  */
16744 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
16745
16746 /**
16747  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
16748  * but with all dynamically-allocated buffers duplicated in new buffers.
16749  */
16750 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig);
16751
16752 /**
16753  * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state.
16754  */
16755 struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_ok(struct LDKBlindedHopFeatures o);
16756
16757 /**
16758  * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state.
16759  */
16760 struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
16761
16762 /**
16763  * Checks if the given object is currently in the success state
16764  */
16765 bool CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR o);
16766
16767 /**
16768  * Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ.
16769  */
16770 void CResult_BlindedHopFeaturesDecodeErrorZ_free(struct LDKCResult_BlindedHopFeaturesDecodeErrorZ _res);
16771
16772 /**
16773  * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig`
16774  * but with all dynamically-allocated buffers duplicated in new buffers.
16775  */
16776 struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_clone(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR orig);
16777
16778 /**
16779  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
16780  */
16781 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o);
16782
16783 /**
16784  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
16785  */
16786 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
16787
16788 /**
16789  * Checks if the given object is currently in the success state
16790  */
16791 bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o);
16792
16793 /**
16794  * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
16795  */
16796 void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res);
16797
16798 /**
16799  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
16800  * but with all dynamically-allocated buffers duplicated in new buffers.
16801  */
16802 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig);
16803
16804 /**
16805  * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
16806  */
16807 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
16808
16809 /**
16810  * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
16811  */
16812 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
16813
16814 /**
16815  * Checks if the given object is currently in the success state
16816  */
16817 bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o);
16818
16819 /**
16820  * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
16821  */
16822 void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
16823
16824 /**
16825  * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
16826  * but with all dynamically-allocated buffers duplicated in new buffers.
16827  */
16828 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
16829
16830 /**
16831  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
16832  */
16833 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o);
16834
16835 /**
16836  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
16837  */
16838 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e);
16839
16840 /**
16841  * Checks if the given object is currently in the success state
16842  */
16843 bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o);
16844
16845 /**
16846  * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
16847  */
16848 void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res);
16849
16850 /**
16851  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
16852  * but with all dynamically-allocated buffers duplicated in new buffers.
16853  */
16854 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig);
16855
16856 /**
16857  * Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup
16858  */
16859 struct LDKCOption_UtxoLookupZ COption_UtxoLookupZ_some(struct LDKUtxoLookup o);
16860
16861 /**
16862  * Constructs a new COption_UtxoLookupZ containing nothing
16863  */
16864 struct LDKCOption_UtxoLookupZ COption_UtxoLookupZ_none(void);
16865
16866 /**
16867  * Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state
16868  */
16869 void COption_UtxoLookupZ_free(struct LDKCOption_UtxoLookupZ _res);
16870
16871 /**
16872  * Creates a new CResult_boolLightningErrorZ in the success state.
16873  */
16874 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
16875
16876 /**
16877  * Creates a new CResult_boolLightningErrorZ in the error state.
16878  */
16879 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
16880
16881 /**
16882  * Checks if the given object is currently in the success state
16883  */
16884 bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o);
16885
16886 /**
16887  * Frees any resources used by the CResult_boolLightningErrorZ.
16888  */
16889 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
16890
16891 /**
16892  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
16893  * but with all dynamically-allocated buffers duplicated in new buffers.
16894  */
16895 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
16896
16897 /**
16898  * Creates a new tuple which has the same data as `orig`
16899  * but with all dynamically-allocated buffers duplicated in new buffers.
16900  */
16901 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
16902
16903 /**
16904  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
16905  */
16906 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
16907
16908 /**
16909  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
16910  */
16911 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
16912
16913 /**
16914  * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
16915  */
16916 struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o);
16917
16918 /**
16919  * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
16920  */
16921 struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none(void);
16922
16923 /**
16924  * Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
16925  */
16926 void COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
16927
16928 /**
16929  * Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
16930  * but with all dynamically-allocated buffers duplicated in new buffers.
16931  */
16932 struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR orig);
16933
16934 /**
16935  * Creates a new CResult_NoneLightningErrorZ in the success state.
16936  */
16937 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
16938
16939 /**
16940  * Creates a new CResult_NoneLightningErrorZ in the error state.
16941  */
16942 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
16943
16944 /**
16945  * Checks if the given object is currently in the success state
16946  */
16947 bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o);
16948
16949 /**
16950  * Frees any resources used by the CResult_NoneLightningErrorZ.
16951  */
16952 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
16953
16954 /**
16955  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
16956  * but with all dynamically-allocated buffers duplicated in new buffers.
16957  */
16958 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
16959
16960 /**
16961  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
16962  */
16963 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o);
16964
16965 /**
16966  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
16967  */
16968 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e);
16969
16970 /**
16971  * Checks if the given object is currently in the success state
16972  */
16973 bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o);
16974
16975 /**
16976  * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
16977  */
16978 void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res);
16979
16980 /**
16981  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
16982  * but with all dynamically-allocated buffers duplicated in new buffers.
16983  */
16984 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig);
16985
16986 /**
16987  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
16988  */
16989 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
16990
16991 /**
16992  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
16993  */
16994 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
16995
16996 /**
16997  * Checks if the given object is currently in the success state
16998  */
16999 bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o);
17000
17001 /**
17002  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
17003  */
17004 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
17005
17006 /**
17007  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
17008  * but with all dynamically-allocated buffers duplicated in new buffers.
17009  */
17010 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
17011
17012 /**
17013  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
17014  */
17015 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
17016
17017 /**
17018  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
17019  */
17020 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
17021
17022 /**
17023  * Checks if the given object is currently in the success state
17024  */
17025 bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o);
17026
17027 /**
17028  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
17029  */
17030 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
17031
17032 /**
17033  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
17034  * but with all dynamically-allocated buffers duplicated in new buffers.
17035  */
17036 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
17037
17038 /**
17039  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17040  */
17041 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
17042
17043 /**
17044  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
17045  */
17046 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
17047
17048 /**
17049  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
17050  */
17051 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
17052
17053 /**
17054  * Checks if the given object is currently in the success state
17055  */
17056 bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o);
17057
17058 /**
17059  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
17060  */
17061 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
17062
17063 /**
17064  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
17065  * but with all dynamically-allocated buffers duplicated in new buffers.
17066  */
17067 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
17068
17069 /**
17070  * Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
17071  */
17072 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_ok(struct LDKNodeAlias o);
17073
17074 /**
17075  * Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
17076  */
17077 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_err(struct LDKDecodeError e);
17078
17079 /**
17080  * Checks if the given object is currently in the success state
17081  */
17082 bool CResult_NodeAliasDecodeErrorZ_is_ok(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR o);
17083
17084 /**
17085  * Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
17086  */
17087 void CResult_NodeAliasDecodeErrorZ_free(struct LDKCResult_NodeAliasDecodeErrorZ _res);
17088
17089 /**
17090  * Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
17091  * but with all dynamically-allocated buffers duplicated in new buffers.
17092  */
17093 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_clone(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR orig);
17094
17095 /**
17096  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
17097  */
17098 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
17099
17100 /**
17101  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
17102  */
17103 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
17104
17105 /**
17106  * Checks if the given object is currently in the success state
17107  */
17108 bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o);
17109
17110 /**
17111  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
17112  */
17113 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
17114
17115 /**
17116  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
17117  * but with all dynamically-allocated buffers duplicated in new buffers.
17118  */
17119 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
17120
17121 /**
17122  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
17123  */
17124 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
17125
17126 /**
17127  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
17128  */
17129 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
17130
17131 /**
17132  * Checks if the given object is currently in the success state
17133  */
17134 bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o);
17135
17136 /**
17137  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
17138  */
17139 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
17140
17141 /**
17142  * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
17143  */
17144 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o);
17145
17146 /**
17147  * Constructs a new COption_CVec_NetAddressZZ containing nothing
17148  */
17149 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void);
17150
17151 /**
17152  * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
17153  */
17154 void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
17155
17156 /**
17157  * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
17158  * but with all dynamically-allocated buffers duplicated in new buffers.
17159  */
17160 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
17161
17162 /**
17163  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
17164  */
17165 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
17166
17167 /**
17168  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
17169  */
17170 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
17171
17172 /**
17173  * Checks if the given object is currently in the success state
17174  */
17175 bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
17176
17177 /**
17178  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
17179  */
17180 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
17181
17182 /**
17183  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
17184  * but with all dynamically-allocated buffers duplicated in new buffers.
17185  */
17186 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
17187
17188 /**
17189  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
17190  */
17191 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
17192
17193 /**
17194  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
17195  */
17196 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
17197
17198 /**
17199  * Checks if the given object is currently in the success state
17200  */
17201 bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
17202
17203 /**
17204  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
17205  */
17206 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
17207
17208 /**
17209  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
17210  * but with all dynamically-allocated buffers duplicated in new buffers.
17211  */
17212 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
17213
17214 /**
17215  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
17216  */
17217 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
17218
17219 /**
17220  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
17221  */
17222 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
17223
17224 /**
17225  * Checks if the given object is currently in the success state
17226  */
17227 bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
17228
17229 /**
17230  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
17231  */
17232 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
17233
17234 /**
17235  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
17236  * but with all dynamically-allocated buffers duplicated in new buffers.
17237  */
17238 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
17239
17240 /**
17241  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17242  */
17243 void CVec_PaymentPreimageZ_free(struct LDKCVec_PaymentPreimageZ _res);
17244
17245 /**
17246  * Creates a new tuple which has the same data as `orig`
17247  * but with all dynamically-allocated buffers duplicated in new buffers.
17248  */
17249 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
17250
17251 /**
17252  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
17253  */
17254 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
17255
17256 /**
17257  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
17258  */
17259 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
17260
17261 /**
17262  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
17263  */
17264 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
17265
17266 /**
17267  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
17268  */
17269 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
17270
17271 /**
17272  * Checks if the given object is currently in the success state
17273  */
17274 bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o);
17275
17276 /**
17277  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
17278  */
17279 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
17280
17281 /**
17282  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
17283  * but with all dynamically-allocated buffers duplicated in new buffers.
17284  */
17285 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
17286
17287 /**
17288  * Creates a new CResult_SignatureNoneZ in the success state.
17289  */
17290 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
17291
17292 /**
17293  * Creates a new CResult_SignatureNoneZ in the error state.
17294  */
17295 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
17296
17297 /**
17298  * Checks if the given object is currently in the success state
17299  */
17300 bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o);
17301
17302 /**
17303  * Frees any resources used by the CResult_SignatureNoneZ.
17304  */
17305 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
17306
17307 /**
17308  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
17309  * but with all dynamically-allocated buffers duplicated in new buffers.
17310  */
17311 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
17312
17313 /**
17314  * Creates a new CResult_PublicKeyNoneZ in the success state.
17315  */
17316 struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_ok(struct LDKPublicKey o);
17317
17318 /**
17319  * Creates a new CResult_PublicKeyNoneZ in the error state.
17320  */
17321 struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_err(void);
17322
17323 /**
17324  * Checks if the given object is currently in the success state
17325  */
17326 bool CResult_PublicKeyNoneZ_is_ok(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR o);
17327
17328 /**
17329  * Frees any resources used by the CResult_PublicKeyNoneZ.
17330  */
17331 void CResult_PublicKeyNoneZ_free(struct LDKCResult_PublicKeyNoneZ _res);
17332
17333 /**
17334  * Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
17335  * but with all dynamically-allocated buffers duplicated in new buffers.
17336  */
17337 struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_clone(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR orig);
17338
17339 /**
17340  * Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar
17341  */
17342 struct LDKCOption_ScalarZ COption_ScalarZ_some(struct LDKBigEndianScalar o);
17343
17344 /**
17345  * Constructs a new COption_ScalarZ containing nothing
17346  */
17347 struct LDKCOption_ScalarZ COption_ScalarZ_none(void);
17348
17349 /**
17350  * Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
17351  */
17352 void COption_ScalarZ_free(struct LDKCOption_ScalarZ _res);
17353
17354 /**
17355  * Creates a new CResult_SharedSecretNoneZ in the success state.
17356  */
17357 struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
17358
17359 /**
17360  * Creates a new CResult_SharedSecretNoneZ in the error state.
17361  */
17362 struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_err(void);
17363
17364 /**
17365  * Checks if the given object is currently in the success state
17366  */
17367 bool CResult_SharedSecretNoneZ_is_ok(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR o);
17368
17369 /**
17370  * Frees any resources used by the CResult_SharedSecretNoneZ.
17371  */
17372 void CResult_SharedSecretNoneZ_free(struct LDKCResult_SharedSecretNoneZ _res);
17373
17374 /**
17375  * Creates a new CResult_SharedSecretNoneZ which has the same data as `orig`
17376  * but with all dynamically-allocated buffers duplicated in new buffers.
17377  */
17378 struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_clone(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR orig);
17379
17380 /**
17381  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17382  */
17383 void CVec_U5Z_free(struct LDKCVec_U5Z _res);
17384
17385 /**
17386  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
17387  */
17388 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
17389
17390 /**
17391  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
17392  */
17393 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
17394
17395 /**
17396  * Checks if the given object is currently in the success state
17397  */
17398 bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o);
17399
17400 /**
17401  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
17402  */
17403 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
17404
17405 /**
17406  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
17407  * but with all dynamically-allocated buffers duplicated in new buffers.
17408  */
17409 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
17410
17411 /**
17412  * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state.
17413  */
17414 struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(struct LDKWriteableEcdsaChannelSigner o);
17415
17416 /**
17417  * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state.
17418  */
17419 struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(struct LDKDecodeError e);
17420
17421 /**
17422  * Checks if the given object is currently in the success state
17423  */
17424 bool CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(const struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR o);
17425
17426 /**
17427  * Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ.
17428  */
17429 void CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res);
17430
17431 /**
17432  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17433  */
17434 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
17435
17436 /**
17437  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17438  */
17439 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
17440
17441 /**
17442  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
17443  */
17444 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
17445
17446 /**
17447  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
17448  */
17449 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
17450
17451 /**
17452  * Checks if the given object is currently in the success state
17453  */
17454 bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o);
17455
17456 /**
17457  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
17458  */
17459 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
17460
17461 /**
17462  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
17463  * but with all dynamically-allocated buffers duplicated in new buffers.
17464  */
17465 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
17466
17467 /**
17468  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
17469  */
17470 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
17471
17472 /**
17473  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
17474  */
17475 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
17476
17477 /**
17478  * Checks if the given object is currently in the success state
17479  */
17480 bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o);
17481
17482 /**
17483  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
17484  */
17485 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
17486
17487 /**
17488  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
17489  * but with all dynamically-allocated buffers duplicated in new buffers.
17490  */
17491 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
17492
17493 /**
17494  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17495  */
17496 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
17497
17498 /**
17499  * Creates a new CResult_TransactionNoneZ in the success state.
17500  */
17501 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
17502
17503 /**
17504  * Creates a new CResult_TransactionNoneZ in the error state.
17505  */
17506 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
17507
17508 /**
17509  * Checks if the given object is currently in the success state
17510  */
17511 bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o);
17512
17513 /**
17514  * Frees any resources used by the CResult_TransactionNoneZ.
17515  */
17516 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
17517
17518 /**
17519  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
17520  * but with all dynamically-allocated buffers duplicated in new buffers.
17521  */
17522 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
17523
17524 /**
17525  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
17526  */
17527 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
17528
17529 /**
17530  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
17531  */
17532 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
17533
17534 /**
17535  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17536  */
17537 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
17538
17539 /**
17540  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
17541  */
17542 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
17543
17544 /**
17545  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
17546  */
17547 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
17548
17549 /**
17550  * Checks if the given object is currently in the success state
17551  */
17552 bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o);
17553
17554 /**
17555  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
17556  */
17557 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
17558
17559 /**
17560  * Constructs a new COption_u16Z containing a u16
17561  */
17562 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
17563
17564 /**
17565  * Constructs a new COption_u16Z containing nothing
17566  */
17567 struct LDKCOption_u16Z COption_u16Z_none(void);
17568
17569 /**
17570  * Frees any resources associated with the u16, if we are in the Some state
17571  */
17572 void COption_u16Z_free(struct LDKCOption_u16Z _res);
17573
17574 /**
17575  * Creates a new COption_u16Z which has the same data as `orig`
17576  * but with all dynamically-allocated buffers duplicated in new buffers.
17577  */
17578 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
17579
17580 /**
17581  * Creates a new CResult__u832APIErrorZ in the success state.
17582  */
17583 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o);
17584
17585 /**
17586  * Creates a new CResult__u832APIErrorZ in the error state.
17587  */
17588 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
17589
17590 /**
17591  * Checks if the given object is currently in the success state
17592  */
17593 bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o);
17594
17595 /**
17596  * Frees any resources used by the CResult__u832APIErrorZ.
17597  */
17598 void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res);
17599
17600 /**
17601  * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
17602  * but with all dynamically-allocated buffers duplicated in new buffers.
17603  */
17604 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig);
17605
17606 /**
17607  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17608  */
17609 void CVec_RecentPaymentDetailsZ_free(struct LDKCVec_RecentPaymentDetailsZ _res);
17610
17611 /**
17612  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
17613  */
17614 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
17615
17616 /**
17617  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
17618  */
17619 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
17620
17621 /**
17622  * Checks if the given object is currently in the success state
17623  */
17624 bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o);
17625
17626 /**
17627  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
17628  */
17629 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
17630
17631 /**
17632  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
17633  * but with all dynamically-allocated buffers duplicated in new buffers.
17634  */
17635 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
17636
17637 /**
17638  * Creates a new CResult_NoneRetryableSendFailureZ in the success state.
17639  */
17640 struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_ok(void);
17641
17642 /**
17643  * Creates a new CResult_NoneRetryableSendFailureZ in the error state.
17644  */
17645 struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_err(enum LDKRetryableSendFailure e);
17646
17647 /**
17648  * Checks if the given object is currently in the success state
17649  */
17650 bool CResult_NoneRetryableSendFailureZ_is_ok(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR o);
17651
17652 /**
17653  * Frees any resources used by the CResult_NoneRetryableSendFailureZ.
17654  */
17655 void CResult_NoneRetryableSendFailureZ_free(struct LDKCResult_NoneRetryableSendFailureZ _res);
17656
17657 /**
17658  * Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig`
17659  * but with all dynamically-allocated buffers duplicated in new buffers.
17660  */
17661 struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_clone(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR orig);
17662
17663 /**
17664  * Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
17665  */
17666 struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
17667
17668 /**
17669  * Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
17670  */
17671 struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
17672
17673 /**
17674  * Checks if the given object is currently in the success state
17675  */
17676 bool CResult_PaymentHashPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR o);
17677
17678 /**
17679  * Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ.
17680  */
17681 void CResult_PaymentHashPaymentSendFailureZ_free(struct LDKCResult_PaymentHashPaymentSendFailureZ _res);
17682
17683 /**
17684  * Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
17685  * but with all dynamically-allocated buffers duplicated in new buffers.
17686  */
17687 struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_clone(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR orig);
17688
17689 /**
17690  * Creates a new CResult_PaymentHashRetryableSendFailureZ in the success state.
17691  */
17692 struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_ok(struct LDKThirtyTwoBytes o);
17693
17694 /**
17695  * Creates a new CResult_PaymentHashRetryableSendFailureZ in the error state.
17696  */
17697 struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_err(enum LDKRetryableSendFailure e);
17698
17699 /**
17700  * Checks if the given object is currently in the success state
17701  */
17702 bool CResult_PaymentHashRetryableSendFailureZ_is_ok(const struct LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR o);
17703
17704 /**
17705  * Frees any resources used by the CResult_PaymentHashRetryableSendFailureZ.
17706  */
17707 void CResult_PaymentHashRetryableSendFailureZ_free(struct LDKCResult_PaymentHashRetryableSendFailureZ _res);
17708
17709 /**
17710  * Creates a new CResult_PaymentHashRetryableSendFailureZ which has the same data as `orig`
17711  * but with all dynamically-allocated buffers duplicated in new buffers.
17712  */
17713 struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_clone(const struct LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR orig);
17714
17715 /**
17716  * Creates a new tuple which has the same data as `orig`
17717  * but with all dynamically-allocated buffers duplicated in new buffers.
17718  */
17719 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig);
17720
17721 /**
17722  * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
17723  */
17724 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
17725
17726 /**
17727  * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
17728  */
17729 void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res);
17730
17731 /**
17732  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
17733  */
17734 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o);
17735
17736 /**
17737  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
17738  */
17739 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
17740
17741 /**
17742  * Checks if the given object is currently in the success state
17743  */
17744 bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o);
17745
17746 /**
17747  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
17748  */
17749 void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res);
17750
17751 /**
17752  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
17753  * but with all dynamically-allocated buffers duplicated in new buffers.
17754  */
17755 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig);
17756
17757 /**
17758  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17759  */
17760 void CVec_ThirtyTwoBytesZ_free(struct LDKCVec_ThirtyTwoBytesZ _res);
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_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
17767
17768 /**
17769  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
17770  */
17771 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
17772
17773 /**
17774  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
17775  */
17776 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
17777
17778 /**
17779  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
17780  */
17781 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
17782
17783 /**
17784  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
17785  */
17786 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void);
17787
17788 /**
17789  * Checks if the given object is currently in the success state
17790  */
17791 bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o);
17792
17793 /**
17794  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
17795  */
17796 void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res);
17797
17798 /**
17799  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
17800  * but with all dynamically-allocated buffers duplicated in new buffers.
17801  */
17802 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig);
17803
17804 /**
17805  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
17806  */
17807 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
17808
17809 /**
17810  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
17811  */
17812 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e);
17813
17814 /**
17815  * Checks if the given object is currently in the success state
17816  */
17817 bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o);
17818
17819 /**
17820  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
17821  */
17822 void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res);
17823
17824 /**
17825  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
17826  * but with all dynamically-allocated buffers duplicated in new buffers.
17827  */
17828 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig);
17829
17830 /**
17831  * Creates a new CResult_PaymentSecretNoneZ in the success state.
17832  */
17833 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
17834
17835 /**
17836  * Creates a new CResult_PaymentSecretNoneZ in the error state.
17837  */
17838 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void);
17839
17840 /**
17841  * Checks if the given object is currently in the success state
17842  */
17843 bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o);
17844
17845 /**
17846  * Frees any resources used by the CResult_PaymentSecretNoneZ.
17847  */
17848 void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res);
17849
17850 /**
17851  * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
17852  * but with all dynamically-allocated buffers duplicated in new buffers.
17853  */
17854 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig);
17855
17856 /**
17857  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
17858  */
17859 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
17860
17861 /**
17862  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
17863  */
17864 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
17865
17866 /**
17867  * Checks if the given object is currently in the success state
17868  */
17869 bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o);
17870
17871 /**
17872  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
17873  */
17874 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
17875
17876 /**
17877  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
17878  * but with all dynamically-allocated buffers duplicated in new buffers.
17879  */
17880 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
17881
17882 /**
17883  * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
17884  */
17885 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
17886
17887 /**
17888  * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
17889  */
17890 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e);
17891
17892 /**
17893  * Checks if the given object is currently in the success state
17894  */
17895 bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o);
17896
17897 /**
17898  * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
17899  */
17900 void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res);
17901
17902 /**
17903  * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
17904  * but with all dynamically-allocated buffers duplicated in new buffers.
17905  */
17906 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig);
17907
17908 /**
17909  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
17910  */
17911 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o);
17912
17913 /**
17914  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
17915  */
17916 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e);
17917
17918 /**
17919  * Checks if the given object is currently in the success state
17920  */
17921 bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o);
17922
17923 /**
17924  * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
17925  */
17926 void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res);
17927
17928 /**
17929  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
17930  * but with all dynamically-allocated buffers duplicated in new buffers.
17931  */
17932 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig);
17933
17934 /**
17935  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
17936  */
17937 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o);
17938
17939 /**
17940  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
17941  */
17942 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e);
17943
17944 /**
17945  * Checks if the given object is currently in the success state
17946  */
17947 bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o);
17948
17949 /**
17950  * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
17951  */
17952 void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res);
17953
17954 /**
17955  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
17956  * but with all dynamically-allocated buffers duplicated in new buffers.
17957  */
17958 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig);
17959
17960 /**
17961  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
17962  */
17963 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o);
17964
17965 /**
17966  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
17967  */
17968 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e);
17969
17970 /**
17971  * Checks if the given object is currently in the success state
17972  */
17973 bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o);
17974
17975 /**
17976  * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
17977  */
17978 void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res);
17979
17980 /**
17981  * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
17982  * but with all dynamically-allocated buffers duplicated in new buffers.
17983  */
17984 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig);
17985
17986 /**
17987  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
17988  */
17989 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o);
17990
17991 /**
17992  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
17993  */
17994 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e);
17995
17996 /**
17997  * Checks if the given object is currently in the success state
17998  */
17999 bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o);
18000
18001 /**
18002  * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
18003  */
18004 void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res);
18005
18006 /**
18007  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
18008  * but with all dynamically-allocated buffers duplicated in new buffers.
18009  */
18010 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig);
18011
18012 /**
18013  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18014  */
18015 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
18016
18017 /**
18018  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
18019  */
18020 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
18021
18022 /**
18023  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
18024  */
18025 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
18026
18027 /**
18028  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
18029  */
18030 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
18031
18032 /**
18033  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
18034  */
18035 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
18036
18037 /**
18038  * Checks if the given object is currently in the success state
18039  */
18040 bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o);
18041
18042 /**
18043  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
18044  */
18045 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
18046
18047 /**
18048  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
18049  */
18050 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
18051
18052 /**
18053  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
18054  */
18055 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
18056
18057 /**
18058  * Checks if the given object is currently in the success state
18059  */
18060 bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o);
18061
18062 /**
18063  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
18064  */
18065 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
18066
18067 /**
18068  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
18069  * but with all dynamically-allocated buffers duplicated in new buffers.
18070  */
18071 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
18072
18073 /**
18074  * Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
18075  */
18076 struct LDKCOption_APIErrorZ COption_APIErrorZ_some(struct LDKAPIError o);
18077
18078 /**
18079  * Constructs a new COption_APIErrorZ containing nothing
18080  */
18081 struct LDKCOption_APIErrorZ COption_APIErrorZ_none(void);
18082
18083 /**
18084  * Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
18085  */
18086 void COption_APIErrorZ_free(struct LDKCOption_APIErrorZ _res);
18087
18088 /**
18089  * Creates a new COption_APIErrorZ which has the same data as `orig`
18090  * but with all dynamically-allocated buffers duplicated in new buffers.
18091  */
18092 struct LDKCOption_APIErrorZ COption_APIErrorZ_clone(const struct LDKCOption_APIErrorZ *NONNULL_PTR orig);
18093
18094 /**
18095  * Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
18096  */
18097 struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_ok(struct LDKCOption_APIErrorZ o);
18098
18099 /**
18100  * Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
18101  */
18102 struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_err(struct LDKDecodeError e);
18103
18104 /**
18105  * Checks if the given object is currently in the success state
18106  */
18107 bool CResult_COption_APIErrorZDecodeErrorZ_is_ok(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR o);
18108
18109 /**
18110  * Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
18111  */
18112 void CResult_COption_APIErrorZDecodeErrorZ_free(struct LDKCResult_COption_APIErrorZDecodeErrorZ _res);
18113
18114 /**
18115  * Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
18116  * but with all dynamically-allocated buffers duplicated in new buffers.
18117  */
18118 struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_clone(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR orig);
18119
18120 /**
18121  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
18122  */
18123 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
18124
18125 /**
18126  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
18127  */
18128 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
18129
18130 /**
18131  * Checks if the given object is currently in the success state
18132  */
18133 bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o);
18134
18135 /**
18136  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
18137  */
18138 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
18139
18140 /**
18141  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
18142  * but with all dynamically-allocated buffers duplicated in new buffers.
18143  */
18144 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
18145
18146 /**
18147  * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
18148  */
18149 struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
18150
18151 /**
18152  * Constructs a new COption_TypeZ containing nothing
18153  */
18154 struct LDKCOption_TypeZ COption_TypeZ_none(void);
18155
18156 /**
18157  * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
18158  */
18159 void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
18160
18161 /**
18162  * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
18163  */
18164 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
18165
18166 /**
18167  * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
18168  */
18169 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
18170
18171 /**
18172  * Checks if the given object is currently in the success state
18173  */
18174 bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o);
18175
18176 /**
18177  * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
18178  */
18179 void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
18180
18181 /**
18182  * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
18183  */
18184 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
18185
18186 /**
18187  * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
18188  */
18189 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
18190
18191 /**
18192  * Checks if the given object is currently in the success state
18193  */
18194 bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o);
18195
18196 /**
18197  * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
18198  */
18199 void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
18200
18201 /**
18202  * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
18203  * but with all dynamically-allocated buffers duplicated in new buffers.
18204  */
18205 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
18206
18207 /**
18208  * Creates a new CResult_NonePaymentErrorZ in the success state.
18209  */
18210 struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_ok(void);
18211
18212 /**
18213  * Creates a new CResult_NonePaymentErrorZ in the error state.
18214  */
18215 struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_err(struct LDKPaymentError e);
18216
18217 /**
18218  * Checks if the given object is currently in the success state
18219  */
18220 bool CResult_NonePaymentErrorZ_is_ok(const struct LDKCResult_NonePaymentErrorZ *NONNULL_PTR o);
18221
18222 /**
18223  * Frees any resources used by the CResult_NonePaymentErrorZ.
18224  */
18225 void CResult_NonePaymentErrorZ_free(struct LDKCResult_NonePaymentErrorZ _res);
18226
18227 /**
18228  * Creates a new CResult_NonePaymentErrorZ which has the same data as `orig`
18229  * but with all dynamically-allocated buffers duplicated in new buffers.
18230  */
18231 struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_clone(const struct LDKCResult_NonePaymentErrorZ *NONNULL_PTR orig);
18232
18233 /**
18234  * Creates a new CResult_StringErrorZ in the success state.
18235  */
18236 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
18237
18238 /**
18239  * Creates a new CResult_StringErrorZ in the error state.
18240  */
18241 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
18242
18243 /**
18244  * Checks if the given object is currently in the success state
18245  */
18246 bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o);
18247
18248 /**
18249  * Frees any resources used by the CResult_StringErrorZ.
18250  */
18251 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
18252
18253 /**
18254  * Creates a new CResult_StringErrorZ which has the same data as `orig`
18255  * but with all dynamically-allocated buffers duplicated in new buffers.
18256  */
18257 struct LDKCResult_StringErrorZ CResult_StringErrorZ_clone(const struct LDKCResult_StringErrorZ *NONNULL_PTR orig);
18258
18259 /**
18260  * Creates a new CResult_PublicKeyErrorZ in the success state.
18261  */
18262 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
18263
18264 /**
18265  * Creates a new CResult_PublicKeyErrorZ in the error state.
18266  */
18267 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
18268
18269 /**
18270  * Checks if the given object is currently in the success state
18271  */
18272 bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o);
18273
18274 /**
18275  * Frees any resources used by the CResult_PublicKeyErrorZ.
18276  */
18277 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
18278
18279 /**
18280  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
18281  * but with all dynamically-allocated buffers duplicated in new buffers.
18282  */
18283 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
18284
18285 /**
18286  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
18287  */
18288 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
18289
18290 /**
18291  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
18292  */
18293 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
18294
18295 /**
18296  * Checks if the given object is currently in the success state
18297  */
18298 bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o);
18299
18300 /**
18301  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
18302  */
18303 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
18304
18305 /**
18306  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
18307  * but with all dynamically-allocated buffers duplicated in new buffers.
18308  */
18309 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
18310
18311 /**
18312  * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
18313  */
18314 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o);
18315
18316 /**
18317  * Constructs a new COption_MonitorEventZ containing nothing
18318  */
18319 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void);
18320
18321 /**
18322  * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
18323  */
18324 void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res);
18325
18326 /**
18327  * Creates a new COption_MonitorEventZ which has the same data as `orig`
18328  * but with all dynamically-allocated buffers duplicated in new buffers.
18329  */
18330 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig);
18331
18332 /**
18333  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
18334  */
18335 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o);
18336
18337 /**
18338  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
18339  */
18340 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e);
18341
18342 /**
18343  * Checks if the given object is currently in the success state
18344  */
18345 bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o);
18346
18347 /**
18348  * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
18349  */
18350 void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res);
18351
18352 /**
18353  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
18354  * but with all dynamically-allocated buffers duplicated in new buffers.
18355  */
18356 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig);
18357
18358 /**
18359  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
18360  */
18361 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
18362
18363 /**
18364  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
18365  */
18366 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
18367
18368 /**
18369  * Checks if the given object is currently in the success state
18370  */
18371 bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o);
18372
18373 /**
18374  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
18375  */
18376 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
18377
18378 /**
18379  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
18380  * but with all dynamically-allocated buffers duplicated in new buffers.
18381  */
18382 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
18383
18384 /**
18385  * Creates a new tuple which has the same data as `orig`
18386  * but with all dynamically-allocated buffers duplicated in new buffers.
18387  */
18388 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
18389
18390 /**
18391  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
18392  */
18393 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
18394
18395 /**
18396  * Frees any resources used by the C2Tuple_OutPointScriptZ.
18397  */
18398 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
18399
18400 /**
18401  * Creates a new tuple which has the same data as `orig`
18402  * but with all dynamically-allocated buffers duplicated in new buffers.
18403  */
18404 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
18405
18406 /**
18407  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
18408  */
18409 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
18410
18411 /**
18412  * Frees any resources used by the C2Tuple_u32ScriptZ.
18413  */
18414 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
18415
18416 /**
18417  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18418  */
18419 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
18420
18421 /**
18422  * Creates a new tuple which has the same data as `orig`
18423  * but with all dynamically-allocated buffers duplicated in new buffers.
18424  */
18425 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
18426
18427 /**
18428  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
18429  */
18430 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
18431
18432 /**
18433  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
18434  */
18435 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
18436
18437 /**
18438  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18439  */
18440 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
18441
18442 /**
18443  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18444  */
18445 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
18446
18447 /**
18448  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18449  */
18450 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
18451
18452 /**
18453  * Creates a new tuple which has the same data as `orig`
18454  * but with all dynamically-allocated buffers duplicated in new buffers.
18455  */
18456 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
18457
18458 /**
18459  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
18460  */
18461 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
18462
18463 /**
18464  * Frees any resources used by the C2Tuple_u32TxOutZ.
18465  */
18466 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
18467
18468 /**
18469  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18470  */
18471 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
18472
18473 /**
18474  * Creates a new tuple which has the same data as `orig`
18475  * but with all dynamically-allocated buffers duplicated in new buffers.
18476  */
18477 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
18478
18479 /**
18480  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
18481  */
18482 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
18483
18484 /**
18485  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
18486  */
18487 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
18488
18489 /**
18490  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18491  */
18492 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
18493
18494 /**
18495  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18496  */
18497 void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
18498
18499 /**
18500  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
18501  */
18502 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
18503
18504 /**
18505  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
18506  */
18507 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
18508
18509 /**
18510  * Checks if the given object is currently in the success state
18511  */
18512 bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o);
18513
18514 /**
18515  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
18516  */
18517 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
18518
18519 /**
18520  * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
18521  */
18522 struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
18523
18524 /**
18525  * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
18526  */
18527 void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
18528
18529 /**
18530  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18531  */
18532 void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
18533
18534 /**
18535  * Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
18536  */
18537 struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_some(struct LDKCustomOnionMessageContents o);
18538
18539 /**
18540  * Constructs a new COption_CustomOnionMessageContentsZ containing nothing
18541  */
18542 struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_none(void);
18543
18544 /**
18545  * Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
18546  */
18547 void COption_CustomOnionMessageContentsZ_free(struct LDKCOption_CustomOnionMessageContentsZ _res);
18548
18549 /**
18550  * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
18551  */
18552 struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_CustomOnionMessageContentsZ o);
18553
18554 /**
18555  * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
18556  */
18557 struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(struct LDKDecodeError e);
18558
18559 /**
18560  * Checks if the given object is currently in the success state
18561  */
18562 bool CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR o);
18563
18564 /**
18565  * Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
18566  */
18567 void CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res);
18568
18569 /**
18570  * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
18571  */
18572 struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o);
18573
18574 /**
18575  * Constructs a new COption_NetAddressZ containing nothing
18576  */
18577 struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void);
18578
18579 /**
18580  * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
18581  */
18582 void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res);
18583
18584 /**
18585  * Creates a new COption_NetAddressZ which has the same data as `orig`
18586  * but with all dynamically-allocated buffers duplicated in new buffers.
18587  */
18588 struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig);
18589
18590 /**
18591  * Creates a new tuple which has the same data as `orig`
18592  * but with all dynamically-allocated buffers duplicated in new buffers.
18593  */
18594 struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ C2Tuple_PublicKeyCOption_NetAddressZZ_clone(const struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR orig);
18595
18596 /**
18597  * Creates a new C2Tuple_PublicKeyCOption_NetAddressZZ from the contained elements.
18598  */
18599 struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ C2Tuple_PublicKeyCOption_NetAddressZZ_new(struct LDKPublicKey a, struct LDKCOption_NetAddressZ b);
18600
18601 /**
18602  * Frees any resources used by the C2Tuple_PublicKeyCOption_NetAddressZZ.
18603  */
18604 void C2Tuple_PublicKeyCOption_NetAddressZZ_free(struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res);
18605
18606 /**
18607  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18608  */
18609 void CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ _res);
18610
18611 /**
18612  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
18613  */
18614 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
18615
18616 /**
18617  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
18618  */
18619 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
18620
18621 /**
18622  * Checks if the given object is currently in the success state
18623  */
18624 bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o);
18625
18626 /**
18627  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
18628  */
18629 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
18630
18631 /**
18632  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
18633  * but with all dynamically-allocated buffers duplicated in new buffers.
18634  */
18635 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
18636
18637 /**
18638  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
18639  */
18640 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
18641
18642 /**
18643  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
18644  */
18645 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
18646
18647 /**
18648  * Checks if the given object is currently in the success state
18649  */
18650 bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o);
18651
18652 /**
18653  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
18654  */
18655 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
18656
18657 /**
18658  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
18659  * but with all dynamically-allocated buffers duplicated in new buffers.
18660  */
18661 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
18662
18663 /**
18664  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
18665  */
18666 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
18667
18668 /**
18669  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
18670  */
18671 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
18672
18673 /**
18674  * Checks if the given object is currently in the success state
18675  */
18676 bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o);
18677
18678 /**
18679  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
18680  */
18681 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
18682
18683 /**
18684  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
18685  * but with all dynamically-allocated buffers duplicated in new buffers.
18686  */
18687 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
18688
18689 /**
18690  * Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
18691  */
18692 struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_ok(struct LDKTxOut o);
18693
18694 /**
18695  * Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
18696  */
18697 struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_err(enum LDKUtxoLookupError e);
18698
18699 /**
18700  * Checks if the given object is currently in the success state
18701  */
18702 bool CResult_TxOutUtxoLookupErrorZ_is_ok(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR o);
18703
18704 /**
18705  * Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
18706  */
18707 void CResult_TxOutUtxoLookupErrorZ_free(struct LDKCResult_TxOutUtxoLookupErrorZ _res);
18708
18709 /**
18710  * Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
18711  * but with all dynamically-allocated buffers duplicated in new buffers.
18712  */
18713 struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_clone(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR orig);
18714
18715 /**
18716  * Creates a new CResult_NoneSendErrorZ in the success state.
18717  */
18718 struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_ok(void);
18719
18720 /**
18721  * Creates a new CResult_NoneSendErrorZ in the error state.
18722  */
18723 struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_err(struct LDKSendError e);
18724
18725 /**
18726  * Checks if the given object is currently in the success state
18727  */
18728 bool CResult_NoneSendErrorZ_is_ok(const struct LDKCResult_NoneSendErrorZ *NONNULL_PTR o);
18729
18730 /**
18731  * Frees any resources used by the CResult_NoneSendErrorZ.
18732  */
18733 void CResult_NoneSendErrorZ_free(struct LDKCResult_NoneSendErrorZ _res);
18734
18735 /**
18736  * Creates a new CResult_SiPrefixParseErrorZ in the success state.
18737  */
18738 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o);
18739
18740 /**
18741  * Creates a new CResult_SiPrefixParseErrorZ in the error state.
18742  */
18743 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e);
18744
18745 /**
18746  * Checks if the given object is currently in the success state
18747  */
18748 bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o);
18749
18750 /**
18751  * Frees any resources used by the CResult_SiPrefixParseErrorZ.
18752  */
18753 void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res);
18754
18755 /**
18756  * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
18757  * but with all dynamically-allocated buffers duplicated in new buffers.
18758  */
18759 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_clone(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR orig);
18760
18761 /**
18762  * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
18763  */
18764 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o);
18765
18766 /**
18767  * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
18768  */
18769 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e);
18770
18771 /**
18772  * Checks if the given object is currently in the success state
18773  */
18774 bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o);
18775
18776 /**
18777  * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
18778  */
18779 void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res);
18780
18781 /**
18782  * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
18783  * but with all dynamically-allocated buffers duplicated in new buffers.
18784  */
18785 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig);
18786
18787 /**
18788  * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
18789  */
18790 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o);
18791
18792 /**
18793  * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
18794  */
18795 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e);
18796
18797 /**
18798  * Checks if the given object is currently in the success state
18799  */
18800 bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o);
18801
18802 /**
18803  * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
18804  */
18805 void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res);
18806
18807 /**
18808  * Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
18809  * but with all dynamically-allocated buffers duplicated in new buffers.
18810  */
18811 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig);
18812
18813 /**
18814  * Creates a new tuple which has the same data as `orig`
18815  * but with all dynamically-allocated buffers duplicated in new buffers.
18816  */
18817 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
18818
18819 /**
18820  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
18821  */
18822 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
18823
18824 /**
18825  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
18826  */
18827 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
18828
18829 /**
18830  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
18831  */
18832 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
18833
18834 /**
18835  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
18836  */
18837 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
18838
18839 /**
18840  * Checks if the given object is currently in the success state
18841  */
18842 bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o);
18843
18844 /**
18845  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
18846  */
18847 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
18848
18849 /**
18850  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
18851  * but with all dynamically-allocated buffers duplicated in new buffers.
18852  */
18853 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
18854
18855 /**
18856  * Frees the buffer pointed to by `data` if `datalen` is non-0.
18857  */
18858 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
18859
18860 /**
18861  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
18862  */
18863 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
18864
18865 /**
18866  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
18867  */
18868 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
18869
18870 /**
18871  * Checks if the given object is currently in the success state
18872  */
18873 bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o);
18874
18875 /**
18876  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
18877  */
18878 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
18879
18880 /**
18881  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
18882  * but with all dynamically-allocated buffers duplicated in new buffers.
18883  */
18884 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
18885
18886 /**
18887  * Creates a new CResult_NoneSemanticErrorZ in the success state.
18888  */
18889 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
18890
18891 /**
18892  * Creates a new CResult_NoneSemanticErrorZ in the error state.
18893  */
18894 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
18895
18896 /**
18897  * Checks if the given object is currently in the success state
18898  */
18899 bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o);
18900
18901 /**
18902  * Frees any resources used by the CResult_NoneSemanticErrorZ.
18903  */
18904 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
18905
18906 /**
18907  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
18908  * but with all dynamically-allocated buffers duplicated in new buffers.
18909  */
18910 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
18911
18912 /**
18913  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
18914  */
18915 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
18916
18917 /**
18918  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
18919  */
18920 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
18921
18922 /**
18923  * Checks if the given object is currently in the success state
18924  */
18925 bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o);
18926
18927 /**
18928  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
18929  */
18930 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
18931
18932 /**
18933  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
18934  * but with all dynamically-allocated buffers duplicated in new buffers.
18935  */
18936 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
18937
18938 /**
18939  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
18940  */
18941 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
18942
18943 /**
18944  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
18945  */
18946 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
18947
18948 /**
18949  * Checks if the given object is currently in the success state
18950  */
18951 bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o);
18952
18953 /**
18954  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
18955  */
18956 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
18957
18958 /**
18959  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
18960  * but with all dynamically-allocated buffers duplicated in new buffers.
18961  */
18962 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
18963
18964 /**
18965  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
18966  */
18967 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
18968
18969 /**
18970  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
18971  */
18972 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
18973
18974 /**
18975  * Checks if the given object is currently in the success state
18976  */
18977 bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o);
18978
18979 /**
18980  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
18981  */
18982 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
18983
18984 /**
18985  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
18986  * but with all dynamically-allocated buffers duplicated in new buffers.
18987  */
18988 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
18989
18990 /**
18991  * Creates a new CResult_u32GraphSyncErrorZ in the success state.
18992  */
18993 struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_ok(uint32_t o);
18994
18995 /**
18996  * Creates a new CResult_u32GraphSyncErrorZ in the error state.
18997  */
18998 struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_err(struct LDKGraphSyncError e);
18999
19000 /**
19001  * Checks if the given object is currently in the success state
19002  */
19003 bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR o);
19004
19005 /**
19006  * Frees any resources used by the CResult_u32GraphSyncErrorZ.
19007  */
19008 void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res);
19009
19010 /**
19011  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
19012  */
19013 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
19014
19015 /**
19016  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
19017  */
19018 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
19019
19020 /**
19021  * Checks if the given object is currently in the success state
19022  */
19023 bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o);
19024
19025 /**
19026  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
19027  */
19028 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
19029
19030 /**
19031  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
19032  * but with all dynamically-allocated buffers duplicated in new buffers.
19033  */
19034 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
19035
19036 /**
19037  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19038  */
19039 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
19040
19041 /**
19042  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19043  */
19044 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
19045
19046 /**
19047  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19048  */
19049 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
19050
19051 /**
19052  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19053  */
19054 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
19055
19056 /**
19057  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
19058  */
19059 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
19060
19061 /**
19062  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
19063  */
19064 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
19065
19066 /**
19067  * Checks if the given object is currently in the success state
19068  */
19069 bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o);
19070
19071 /**
19072  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
19073  */
19074 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
19075
19076 /**
19077  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
19078  * but with all dynamically-allocated buffers duplicated in new buffers.
19079  */
19080 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
19081
19082 /**
19083  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
19084  */
19085 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
19086
19087 /**
19088  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
19089  */
19090 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
19091
19092 /**
19093  * Checks if the given object is currently in the success state
19094  */
19095 bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o);
19096
19097 /**
19098  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
19099  */
19100 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
19101
19102 /**
19103  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
19104  * but with all dynamically-allocated buffers duplicated in new buffers.
19105  */
19106 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
19107
19108 /**
19109  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
19110  */
19111 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
19112
19113 /**
19114  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
19115  */
19116 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
19117
19118 /**
19119  * Checks if the given object is currently in the success state
19120  */
19121 bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o);
19122
19123 /**
19124  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
19125  */
19126 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
19127
19128 /**
19129  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
19130  * but with all dynamically-allocated buffers duplicated in new buffers.
19131  */
19132 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
19133
19134 /**
19135  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
19136  */
19137 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
19138
19139 /**
19140  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
19141  */
19142 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
19143
19144 /**
19145  * Checks if the given object is currently in the success state
19146  */
19147 bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o);
19148
19149 /**
19150  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
19151  */
19152 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
19153
19154 /**
19155  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
19156  * but with all dynamically-allocated buffers duplicated in new buffers.
19157  */
19158 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
19159
19160 /**
19161  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
19162  */
19163 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
19164
19165 /**
19166  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
19167  */
19168 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
19169
19170 /**
19171  * Checks if the given object is currently in the success state
19172  */
19173 bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o);
19174
19175 /**
19176  * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
19177  */
19178 void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
19179
19180 /**
19181  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
19182  * but with all dynamically-allocated buffers duplicated in new buffers.
19183  */
19184 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
19185
19186 /**
19187  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
19188  */
19189 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
19190
19191 /**
19192  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
19193  */
19194 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
19195
19196 /**
19197  * Checks if the given object is currently in the success state
19198  */
19199 bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o);
19200
19201 /**
19202  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
19203  */
19204 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
19205
19206 /**
19207  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
19208  * but with all dynamically-allocated buffers duplicated in new buffers.
19209  */
19210 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
19211
19212 /**
19213  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
19214  */
19215 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
19216
19217 /**
19218  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
19219  */
19220 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
19221
19222 /**
19223  * Checks if the given object is currently in the success state
19224  */
19225 bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o);
19226
19227 /**
19228  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
19229  */
19230 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
19231
19232 /**
19233  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
19234  * but with all dynamically-allocated buffers duplicated in new buffers.
19235  */
19236 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
19237
19238 /**
19239  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
19240  */
19241 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
19242
19243 /**
19244  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
19245  */
19246 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
19247
19248 /**
19249  * Checks if the given object is currently in the success state
19250  */
19251 bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o);
19252
19253 /**
19254  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
19255  */
19256 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
19257
19258 /**
19259  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
19260  * but with all dynamically-allocated buffers duplicated in new buffers.
19261  */
19262 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
19263
19264 /**
19265  * Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
19266  */
19267 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_ok(struct LDKChannelReady o);
19268
19269 /**
19270  * Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
19271  */
19272 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_err(struct LDKDecodeError e);
19273
19274 /**
19275  * Checks if the given object is currently in the success state
19276  */
19277 bool CResult_ChannelReadyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR o);
19278
19279 /**
19280  * Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
19281  */
19282 void CResult_ChannelReadyDecodeErrorZ_free(struct LDKCResult_ChannelReadyDecodeErrorZ _res);
19283
19284 /**
19285  * Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
19286  * but with all dynamically-allocated buffers duplicated in new buffers.
19287  */
19288 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_clone(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR orig);
19289
19290 /**
19291  * Creates a new CResult_InitDecodeErrorZ in the success state.
19292  */
19293 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
19294
19295 /**
19296  * Creates a new CResult_InitDecodeErrorZ in the error state.
19297  */
19298 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
19299
19300 /**
19301  * Checks if the given object is currently in the success state
19302  */
19303 bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o);
19304
19305 /**
19306  * Frees any resources used by the CResult_InitDecodeErrorZ.
19307  */
19308 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
19309
19310 /**
19311  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
19312  * but with all dynamically-allocated buffers duplicated in new buffers.
19313  */
19314 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
19315
19316 /**
19317  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
19318  */
19319 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
19320
19321 /**
19322  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
19323  */
19324 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
19325
19326 /**
19327  * Checks if the given object is currently in the success state
19328  */
19329 bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o);
19330
19331 /**
19332  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
19333  */
19334 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
19335
19336 /**
19337  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
19338  * but with all dynamically-allocated buffers duplicated in new buffers.
19339  */
19340 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
19341
19342 /**
19343  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
19344  */
19345 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
19346
19347 /**
19348  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
19349  */
19350 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
19351
19352 /**
19353  * Checks if the given object is currently in the success state
19354  */
19355 bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o);
19356
19357 /**
19358  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
19359  */
19360 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
19361
19362 /**
19363  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
19364  * but with all dynamically-allocated buffers duplicated in new buffers.
19365  */
19366 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
19367
19368 /**
19369  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
19370  */
19371 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
19372
19373 /**
19374  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
19375  */
19376 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
19377
19378 /**
19379  * Checks if the given object is currently in the success state
19380  */
19381 bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o);
19382
19383 /**
19384  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
19385  */
19386 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
19387
19388 /**
19389  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
19390  * but with all dynamically-allocated buffers duplicated in new buffers.
19391  */
19392 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
19393
19394 /**
19395  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
19396  */
19397 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
19398
19399 /**
19400  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
19401  */
19402 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
19403
19404 /**
19405  * Checks if the given object is currently in the success state
19406  */
19407 bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o);
19408
19409 /**
19410  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
19411  */
19412 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
19413
19414 /**
19415  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
19416  * but with all dynamically-allocated buffers duplicated in new buffers.
19417  */
19418 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
19419
19420 /**
19421  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
19422  */
19423 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
19424
19425 /**
19426  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
19427  */
19428 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
19429
19430 /**
19431  * Checks if the given object is currently in the success state
19432  */
19433 bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o);
19434
19435 /**
19436  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
19437  */
19438 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
19439
19440 /**
19441  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
19442  * but with all dynamically-allocated buffers duplicated in new buffers.
19443  */
19444 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
19445
19446 /**
19447  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
19448  */
19449 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
19450
19451 /**
19452  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
19453  */
19454 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
19455
19456 /**
19457  * Checks if the given object is currently in the success state
19458  */
19459 bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o);
19460
19461 /**
19462  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
19463  */
19464 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
19465
19466 /**
19467  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
19468  * but with all dynamically-allocated buffers duplicated in new buffers.
19469  */
19470 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
19471
19472 /**
19473  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
19474  */
19475 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
19476
19477 /**
19478  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
19479  */
19480 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
19481
19482 /**
19483  * Checks if the given object is currently in the success state
19484  */
19485 bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o);
19486
19487 /**
19488  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
19489  */
19490 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
19491
19492 /**
19493  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
19494  * but with all dynamically-allocated buffers duplicated in new buffers.
19495  */
19496 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
19497
19498 /**
19499  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
19500  */
19501 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
19502
19503 /**
19504  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
19505  */
19506 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
19507
19508 /**
19509  * Checks if the given object is currently in the success state
19510  */
19511 bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o);
19512
19513 /**
19514  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
19515  */
19516 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
19517
19518 /**
19519  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
19520  * but with all dynamically-allocated buffers duplicated in new buffers.
19521  */
19522 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
19523
19524 /**
19525  * Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
19526  */
19527 struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_ok(struct LDKOnionMessage o);
19528
19529 /**
19530  * Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
19531  */
19532 struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_err(struct LDKDecodeError e);
19533
19534 /**
19535  * Checks if the given object is currently in the success state
19536  */
19537 bool CResult_OnionMessageDecodeErrorZ_is_ok(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR o);
19538
19539 /**
19540  * Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
19541  */
19542 void CResult_OnionMessageDecodeErrorZ_free(struct LDKCResult_OnionMessageDecodeErrorZ _res);
19543
19544 /**
19545  * Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
19546  * but with all dynamically-allocated buffers duplicated in new buffers.
19547  */
19548 struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_clone(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR orig);
19549
19550 /**
19551  * Creates a new CResult_PingDecodeErrorZ in the success state.
19552  */
19553 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
19554
19555 /**
19556  * Creates a new CResult_PingDecodeErrorZ in the error state.
19557  */
19558 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
19559
19560 /**
19561  * Checks if the given object is currently in the success state
19562  */
19563 bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o);
19564
19565 /**
19566  * Frees any resources used by the CResult_PingDecodeErrorZ.
19567  */
19568 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
19569
19570 /**
19571  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
19572  * but with all dynamically-allocated buffers duplicated in new buffers.
19573  */
19574 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
19575
19576 /**
19577  * Creates a new CResult_PongDecodeErrorZ in the success state.
19578  */
19579 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
19580
19581 /**
19582  * Creates a new CResult_PongDecodeErrorZ in the error state.
19583  */
19584 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
19585
19586 /**
19587  * Checks if the given object is currently in the success state
19588  */
19589 bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o);
19590
19591 /**
19592  * Frees any resources used by the CResult_PongDecodeErrorZ.
19593  */
19594 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
19595
19596 /**
19597  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
19598  * but with all dynamically-allocated buffers duplicated in new buffers.
19599  */
19600 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
19601
19602 /**
19603  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
19604  */
19605 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
19606
19607 /**
19608  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
19609  */
19610 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
19611
19612 /**
19613  * Checks if the given object is currently in the success state
19614  */
19615 bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
19616
19617 /**
19618  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
19619  */
19620 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
19621
19622 /**
19623  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
19624  * but with all dynamically-allocated buffers duplicated in new buffers.
19625  */
19626 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
19627
19628 /**
19629  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
19630  */
19631 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
19632
19633 /**
19634  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
19635  */
19636 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
19637
19638 /**
19639  * Checks if the given object is currently in the success state
19640  */
19641 bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
19642
19643 /**
19644  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
19645  */
19646 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
19647
19648 /**
19649  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
19650  * but with all dynamically-allocated buffers duplicated in new buffers.
19651  */
19652 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
19653
19654 /**
19655  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
19656  */
19657 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
19658
19659 /**
19660  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
19661  */
19662 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
19663
19664 /**
19665  * Checks if the given object is currently in the success state
19666  */
19667 bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o);
19668
19669 /**
19670  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
19671  */
19672 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
19673
19674 /**
19675  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
19676  * but with all dynamically-allocated buffers duplicated in new buffers.
19677  */
19678 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
19679
19680 /**
19681  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
19682  */
19683 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
19684
19685 /**
19686  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
19687  */
19688 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
19689
19690 /**
19691  * Checks if the given object is currently in the success state
19692  */
19693 bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o);
19694
19695 /**
19696  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
19697  */
19698 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
19699
19700 /**
19701  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
19702  * but with all dynamically-allocated buffers duplicated in new buffers.
19703  */
19704 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
19705
19706 /**
19707  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
19708  */
19709 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
19710
19711 /**
19712  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
19713  */
19714 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
19715
19716 /**
19717  * Checks if the given object is currently in the success state
19718  */
19719 bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o);
19720
19721 /**
19722  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
19723  */
19724 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
19725
19726 /**
19727  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
19728  * but with all dynamically-allocated buffers duplicated in new buffers.
19729  */
19730 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
19731
19732 /**
19733  * Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
19734  */
19735 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o);
19736
19737 /**
19738  * Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
19739  */
19740 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e);
19741
19742 /**
19743  * Checks if the given object is currently in the success state
19744  */
19745 bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o);
19746
19747 /**
19748  * Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
19749  */
19750 void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res);
19751
19752 /**
19753  * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
19754  * but with all dynamically-allocated buffers duplicated in new buffers.
19755  */
19756 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig);
19757
19758 /**
19759  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
19760  */
19761 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
19762
19763 /**
19764  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
19765  */
19766 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
19767
19768 /**
19769  * Checks if the given object is currently in the success state
19770  */
19771 bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
19772
19773 /**
19774  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
19775  */
19776 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
19777
19778 /**
19779  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
19780  * but with all dynamically-allocated buffers duplicated in new buffers.
19781  */
19782 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
19783
19784 /**
19785  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
19786  */
19787 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
19788
19789 /**
19790  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
19791  */
19792 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
19793
19794 /**
19795  * Checks if the given object is currently in the success state
19796  */
19797 bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
19798
19799 /**
19800  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
19801  */
19802 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
19803
19804 /**
19805  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
19806  * but with all dynamically-allocated buffers duplicated in new buffers.
19807  */
19808 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
19809
19810 /**
19811  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
19812  */
19813 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
19814
19815 /**
19816  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
19817  */
19818 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
19819
19820 /**
19821  * Checks if the given object is currently in the success state
19822  */
19823 bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o);
19824
19825 /**
19826  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
19827  */
19828 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
19829
19830 /**
19831  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
19832  * but with all dynamically-allocated buffers duplicated in new buffers.
19833  */
19834 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
19835
19836 /**
19837  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
19838  */
19839 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
19840
19841 /**
19842  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
19843  */
19844 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
19845
19846 /**
19847  * Checks if the given object is currently in the success state
19848  */
19849 bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o);
19850
19851 /**
19852  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
19853  */
19854 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
19855
19856 /**
19857  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
19858  * but with all dynamically-allocated buffers duplicated in new buffers.
19859  */
19860 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
19861
19862 /**
19863  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
19864  */
19865 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
19866
19867 /**
19868  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
19869  */
19870 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
19871
19872 /**
19873  * Checks if the given object is currently in the success state
19874  */
19875 bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o);
19876
19877 /**
19878  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
19879  */
19880 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
19881
19882 /**
19883  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
19884  * but with all dynamically-allocated buffers duplicated in new buffers.
19885  */
19886 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
19887
19888 /**
19889  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
19890  */
19891 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
19892
19893 /**
19894  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
19895  */
19896 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
19897
19898 /**
19899  * Checks if the given object is currently in the success state
19900  */
19901 bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o);
19902
19903 /**
19904  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
19905  */
19906 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
19907
19908 /**
19909  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
19910  * but with all dynamically-allocated buffers duplicated in new buffers.
19911  */
19912 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
19913
19914 /**
19915  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
19916  */
19917 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
19918
19919 /**
19920  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
19921  */
19922 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
19923
19924 /**
19925  * Checks if the given object is currently in the success state
19926  */
19927 bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o);
19928
19929 /**
19930  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
19931  */
19932 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
19933
19934 /**
19935  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
19936  * but with all dynamically-allocated buffers duplicated in new buffers.
19937  */
19938 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
19939
19940 /**
19941  * Frees the buffer pointed to by `data` if `datalen` is non-0.
19942  */
19943 void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res);
19944
19945 /**
19946  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
19947  */
19948 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
19949
19950 /**
19951  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
19952  */
19953 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
19954
19955 /**
19956  * Checks if the given object is currently in the success state
19957  */
19958 bool CResult_InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR o);
19959
19960 /**
19961  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
19962  */
19963 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
19964
19965 /**
19966  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
19967  * but with all dynamically-allocated buffers duplicated in new buffers.
19968  */
19969 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
19970
19971 /**
19972  * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
19973  */
19974 struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
19975
19976 /**
19977  * Constructs a new COption_FilterZ containing nothing
19978  */
19979 struct LDKCOption_FilterZ COption_FilterZ_none(void);
19980
19981 /**
19982  * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
19983  */
19984 void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
19985
19986 /**
19987  * Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
19988  */
19989 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o);
19990
19991 /**
19992  * Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
19993  */
19994 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
19995
19996 /**
19997  * Checks if the given object is currently in the success state
19998  */
19999 bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o);
20000
20001 /**
20002  * Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
20003  */
20004 void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res);
20005
20006 /**
20007  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20008  */
20009 void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res);
20010
20011 /**
20012  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20013  */
20014 void CVec_MonitorUpdateIdZ_free(struct LDKCVec_MonitorUpdateIdZ _res);
20015
20016 /**
20017  * Creates a new tuple which has the same data as `orig`
20018  * but with all dynamically-allocated buffers duplicated in new buffers.
20019  */
20020 struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(const struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR orig);
20021
20022 /**
20023  * Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
20024  */
20025 struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorUpdateIdZ b);
20026
20027 /**
20028  * Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
20029  */
20030 void C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res);
20031
20032 /**
20033  * Frees the buffer pointed to by `data` if `datalen` is non-0.
20034  */
20035 void CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res);
20036
20037 /**
20038  * Frees any resources used by the PaymentPurpose
20039  */
20040 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
20041
20042 /**
20043  * Creates a copy of the PaymentPurpose
20044  */
20045 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
20046
20047 /**
20048  * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
20049  */
20050 struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret);
20051
20052 /**
20053  * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
20054  */
20055 struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
20056
20057 /**
20058  * Checks if two PaymentPurposes contain equal inner contents.
20059  * This ignores pointers and is_owned flags and looks at the values in fields.
20060  */
20061 bool PaymentPurpose_eq(const struct LDKPaymentPurpose *NONNULL_PTR a, const struct LDKPaymentPurpose *NONNULL_PTR b);
20062
20063 /**
20064  * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read
20065  */
20066 struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_PTR obj);
20067
20068 /**
20069  * Read a PaymentPurpose from a byte array, created by PaymentPurpose_write
20070  */
20071 struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser);
20072
20073 /**
20074  * Frees any resources used by the PathFailure
20075  */
20076 void PathFailure_free(struct LDKPathFailure this_ptr);
20077
20078 /**
20079  * Creates a copy of the PathFailure
20080  */
20081 struct LDKPathFailure PathFailure_clone(const struct LDKPathFailure *NONNULL_PTR orig);
20082
20083 /**
20084  * Utility method to constructs a new InitialSend-variant PathFailure
20085  */
20086 struct LDKPathFailure PathFailure_initial_send(struct LDKAPIError err);
20087
20088 /**
20089  * Utility method to constructs a new OnPath-variant PathFailure
20090  */
20091 struct LDKPathFailure PathFailure_on_path(struct LDKCOption_NetworkUpdateZ network_update);
20092
20093 /**
20094  * Checks if two PathFailures contain equal inner contents.
20095  * This ignores pointers and is_owned flags and looks at the values in fields.
20096  */
20097 bool PathFailure_eq(const struct LDKPathFailure *NONNULL_PTR a, const struct LDKPathFailure *NONNULL_PTR b);
20098
20099 /**
20100  * Serialize the PathFailure object into a byte array which can be read by PathFailure_read
20101  */
20102 struct LDKCVec_u8Z PathFailure_write(const struct LDKPathFailure *NONNULL_PTR obj);
20103
20104 /**
20105  * Read a PathFailure from a byte array, created by PathFailure_write
20106  */
20107 struct LDKCResult_COption_PathFailureZDecodeErrorZ PathFailure_read(struct LDKu8slice ser);
20108
20109 /**
20110  * Frees any resources used by the ClosureReason
20111  */
20112 void ClosureReason_free(struct LDKClosureReason this_ptr);
20113
20114 /**
20115  * Creates a copy of the ClosureReason
20116  */
20117 struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
20118
20119 /**
20120  * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
20121  */
20122 struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg);
20123
20124 /**
20125  * Utility method to constructs a new HolderForceClosed-variant ClosureReason
20126  */
20127 struct LDKClosureReason ClosureReason_holder_force_closed(void);
20128
20129 /**
20130  * Utility method to constructs a new CooperativeClosure-variant ClosureReason
20131  */
20132 struct LDKClosureReason ClosureReason_cooperative_closure(void);
20133
20134 /**
20135  * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
20136  */
20137 struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
20138
20139 /**
20140  * Utility method to constructs a new FundingTimedOut-variant ClosureReason
20141  */
20142 struct LDKClosureReason ClosureReason_funding_timed_out(void);
20143
20144 /**
20145  * Utility method to constructs a new ProcessingError-variant ClosureReason
20146  */
20147 struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
20148
20149 /**
20150  * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
20151  */
20152 struct LDKClosureReason ClosureReason_disconnected_peer(void);
20153
20154 /**
20155  * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
20156  */
20157 struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
20158
20159 /**
20160  * Checks if two ClosureReasons contain equal inner contents.
20161  * This ignores pointers and is_owned flags and looks at the values in fields.
20162  */
20163 bool ClosureReason_eq(const struct LDKClosureReason *NONNULL_PTR a, const struct LDKClosureReason *NONNULL_PTR b);
20164
20165 /**
20166  * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
20167  */
20168 struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
20169
20170 /**
20171  * Read a ClosureReason from a byte array, created by ClosureReason_write
20172  */
20173 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser);
20174
20175 /**
20176  * Frees any resources used by the HTLCDestination
20177  */
20178 void HTLCDestination_free(struct LDKHTLCDestination this_ptr);
20179
20180 /**
20181  * Creates a copy of the HTLCDestination
20182  */
20183 struct LDKHTLCDestination HTLCDestination_clone(const struct LDKHTLCDestination *NONNULL_PTR orig);
20184
20185 /**
20186  * Utility method to constructs a new NextHopChannel-variant HTLCDestination
20187  */
20188 struct LDKHTLCDestination HTLCDestination_next_hop_channel(struct LDKPublicKey node_id, struct LDKThirtyTwoBytes channel_id);
20189
20190 /**
20191  * Utility method to constructs a new UnknownNextHop-variant HTLCDestination
20192  */
20193 struct LDKHTLCDestination HTLCDestination_unknown_next_hop(uint64_t requested_forward_scid);
20194
20195 /**
20196  * Utility method to constructs a new InvalidForward-variant HTLCDestination
20197  */
20198 struct LDKHTLCDestination HTLCDestination_invalid_forward(uint64_t requested_forward_scid);
20199
20200 /**
20201  * Utility method to constructs a new FailedPayment-variant HTLCDestination
20202  */
20203 struct LDKHTLCDestination HTLCDestination_failed_payment(struct LDKThirtyTwoBytes payment_hash);
20204
20205 /**
20206  * Checks if two HTLCDestinations contain equal inner contents.
20207  * This ignores pointers and is_owned flags and looks at the values in fields.
20208  */
20209 bool HTLCDestination_eq(const struct LDKHTLCDestination *NONNULL_PTR a, const struct LDKHTLCDestination *NONNULL_PTR b);
20210
20211 /**
20212  * Serialize the HTLCDestination object into a byte array which can be read by HTLCDestination_read
20213  */
20214 struct LDKCVec_u8Z HTLCDestination_write(const struct LDKHTLCDestination *NONNULL_PTR obj);
20215
20216 /**
20217  * Read a HTLCDestination from a byte array, created by HTLCDestination_write
20218  */
20219 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ HTLCDestination_read(struct LDKu8slice ser);
20220
20221 /**
20222  * Frees any resources used by the Event
20223  */
20224 void Event_free(struct LDKEvent this_ptr);
20225
20226 /**
20227  * Creates a copy of the Event
20228  */
20229 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
20230
20231 /**
20232  * Utility method to constructs a new FundingGenerationReady-variant Event
20233  */
20234 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);
20235
20236 /**
20237  * Utility method to constructs a new PaymentClaimable-variant Event
20238  */
20239 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);
20240
20241 /**
20242  * Utility method to constructs a new PaymentClaimed-variant Event
20243  */
20244 struct LDKEvent Event_payment_claimed(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose);
20245
20246 /**
20247  * Utility method to constructs a new PaymentSent-variant Event
20248  */
20249 struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
20250
20251 /**
20252  * Utility method to constructs a new PaymentFailed-variant Event
20253  */
20254 struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash);
20255
20256 /**
20257  * Utility method to constructs a new PaymentPathSuccessful-variant Event
20258  */
20259 struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
20260
20261 /**
20262  * Utility method to constructs a new PaymentPathFailed-variant Event
20263  */
20264 struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool payment_failed_permanently, struct LDKPathFailure failure, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id, struct LDKRouteParameters retry);
20265
20266 /**
20267  * Utility method to constructs a new ProbeSuccessful-variant Event
20268  */
20269 struct LDKEvent Event_probe_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
20270
20271 /**
20272  * Utility method to constructs a new ProbeFailed-variant Event
20273  */
20274 struct LDKEvent Event_probe_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id);
20275
20276 /**
20277  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
20278  */
20279 struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
20280
20281 /**
20282  * Utility method to constructs a new HTLCIntercepted-variant Event
20283  */
20284 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);
20285
20286 /**
20287  * Utility method to constructs a new SpendableOutputs-variant Event
20288  */
20289 struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
20290
20291 /**
20292  * Utility method to constructs a new PaymentForwarded-variant Event
20293  */
20294 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);
20295
20296 /**
20297  * Utility method to constructs a new ChannelReady-variant Event
20298  */
20299 struct LDKEvent Event_channel_ready(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKChannelTypeFeatures channel_type);
20300
20301 /**
20302  * Utility method to constructs a new ChannelClosed-variant Event
20303  */
20304 struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKClosureReason reason);
20305
20306 /**
20307  * Utility method to constructs a new DiscardFunding-variant Event
20308  */
20309 struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
20310
20311 /**
20312  * Utility method to constructs a new OpenChannelRequest-variant Event
20313  */
20314 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);
20315
20316 /**
20317  * Utility method to constructs a new HTLCHandlingFailed-variant Event
20318  */
20319 struct LDKEvent Event_htlchandling_failed(struct LDKThirtyTwoBytes prev_channel_id, struct LDKHTLCDestination failed_next_destination);
20320
20321 /**
20322  * Checks if two Events contain equal inner contents.
20323  * This ignores pointers and is_owned flags and looks at the values in fields.
20324  */
20325 bool Event_eq(const struct LDKEvent *NONNULL_PTR a, const struct LDKEvent *NONNULL_PTR b);
20326
20327 /**
20328  * Serialize the Event object into a byte array which can be read by Event_read
20329  */
20330 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
20331
20332 /**
20333  * Read a Event from a byte array, created by Event_write
20334  */
20335 struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser);
20336
20337 /**
20338  * Frees any resources used by the MessageSendEvent
20339  */
20340 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
20341
20342 /**
20343  * Creates a copy of the MessageSendEvent
20344  */
20345 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
20346
20347 /**
20348  * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
20349  */
20350 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
20351
20352 /**
20353  * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
20354  */
20355 struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
20356
20357 /**
20358  * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
20359  */
20360 struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
20361
20362 /**
20363  * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
20364  */
20365 struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
20366
20367 /**
20368  * Utility method to constructs a new SendChannelReady-variant MessageSendEvent
20369  */
20370 struct LDKMessageSendEvent MessageSendEvent_send_channel_ready(struct LDKPublicKey node_id, struct LDKChannelReady msg);
20371
20372 /**
20373  * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
20374  */
20375 struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
20376
20377 /**
20378  * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
20379  */
20380 struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
20381
20382 /**
20383  * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
20384  */
20385 struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
20386
20387 /**
20388  * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
20389  */
20390 struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
20391
20392 /**
20393  * Utility method to constructs a new SendShutdown-variant MessageSendEvent
20394  */
20395 struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
20396
20397 /**
20398  * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
20399  */
20400 struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
20401
20402 /**
20403  * Utility method to constructs a new SendChannelAnnouncement-variant MessageSendEvent
20404  */
20405 struct LDKMessageSendEvent MessageSendEvent_send_channel_announcement(struct LDKPublicKey node_id, struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
20406
20407 /**
20408  * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
20409  */
20410 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
20411
20412 /**
20413  * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
20414  */
20415 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
20416
20417 /**
20418  * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
20419  */
20420 struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg);
20421
20422 /**
20423  * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
20424  */
20425 struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
20426
20427 /**
20428  * Utility method to constructs a new HandleError-variant MessageSendEvent
20429  */
20430 struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
20431
20432 /**
20433  * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
20434  */
20435 struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
20436
20437 /**
20438  * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
20439  */
20440 struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
20441
20442 /**
20443  * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
20444  */
20445 struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
20446
20447 /**
20448  * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent
20449  */
20450 struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg);
20451
20452 /**
20453  * Calls the free function if one is set
20454  */
20455 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
20456
20457 /**
20458  * Calls the free function if one is set
20459  */
20460 void OnionMessageProvider_free(struct LDKOnionMessageProvider this_ptr);
20461
20462 /**
20463  * Calls the free function if one is set
20464  */
20465 void EventsProvider_free(struct LDKEventsProvider this_ptr);
20466
20467 /**
20468  * Calls the free function if one is set
20469  */
20470 void EventHandler_free(struct LDKEventHandler this_ptr);
20471
20472 /**
20473  * Frees any resources used by the APIError
20474  */
20475 void APIError_free(struct LDKAPIError this_ptr);
20476
20477 /**
20478  * Creates a copy of the APIError
20479  */
20480 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
20481
20482 /**
20483  * Utility method to constructs a new APIMisuseError-variant APIError
20484  */
20485 struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
20486
20487 /**
20488  * Utility method to constructs a new FeeRateTooHigh-variant APIError
20489  */
20490 struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
20491
20492 /**
20493  * Utility method to constructs a new InvalidRoute-variant APIError
20494  */
20495 struct LDKAPIError APIError_invalid_route(struct LDKStr err);
20496
20497 /**
20498  * Utility method to constructs a new ChannelUnavailable-variant APIError
20499  */
20500 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
20501
20502 /**
20503  * Utility method to constructs a new MonitorUpdateInProgress-variant APIError
20504  */
20505 struct LDKAPIError APIError_monitor_update_in_progress(void);
20506
20507 /**
20508  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
20509  */
20510 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
20511
20512 /**
20513  * Checks if two APIErrors contain equal inner contents.
20514  * This ignores pointers and is_owned flags and looks at the values in fields.
20515  */
20516 bool APIError_eq(const struct LDKAPIError *NONNULL_PTR a, const struct LDKAPIError *NONNULL_PTR b);
20517
20518 /**
20519  * Serialize the APIError object into a byte array which can be read by APIError_read
20520  */
20521 struct LDKCVec_u8Z APIError_write(const struct LDKAPIError *NONNULL_PTR obj);
20522
20523 /**
20524  * Read a APIError from a byte array, created by APIError_write
20525  */
20526 struct LDKCResult_COption_APIErrorZDecodeErrorZ APIError_read(struct LDKu8slice ser);
20527
20528 /**
20529  * Frees any resources used by the BigSize, if is_owned is set and inner is non-NULL.
20530  */
20531 void BigSize_free(struct LDKBigSize this_obj);
20532
20533 uint64_t BigSize_get_a(const struct LDKBigSize *NONNULL_PTR this_ptr);
20534
20535 void BigSize_set_a(struct LDKBigSize *NONNULL_PTR this_ptr, uint64_t val);
20536
20537 /**
20538  * Constructs a new BigSize given each field
20539  */
20540 MUST_USE_RES struct LDKBigSize BigSize_new(uint64_t a_arg);
20541
20542 /**
20543  * Frees any resources used by the Hostname, if is_owned is set and inner is non-NULL.
20544  */
20545 void Hostname_free(struct LDKHostname this_obj);
20546
20547 /**
20548  * Creates a copy of the Hostname
20549  */
20550 struct LDKHostname Hostname_clone(const struct LDKHostname *NONNULL_PTR orig);
20551
20552 /**
20553  * Checks if two Hostnames contain equal inner contents.
20554  * This ignores pointers and is_owned flags and looks at the values in fields.
20555  * Two objects with NULL inner values will be considered "equal" here.
20556  */
20557 bool Hostname_eq(const struct LDKHostname *NONNULL_PTR a, const struct LDKHostname *NONNULL_PTR b);
20558
20559 /**
20560  * Returns the length of the hostname.
20561  */
20562 MUST_USE_RES uint8_t Hostname_len(const struct LDKHostname *NONNULL_PTR this_arg);
20563
20564 /**
20565  * Creates a digital signature of a message given a SecretKey, like the node's secret.
20566  * 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.
20567  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
20568  */
20569 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
20570
20571 /**
20572  * Recovers the PublicKey of the signer of the message given the message and the signature.
20573  */
20574 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
20575
20576 /**
20577  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
20578  * and the PublicKey.
20579  */
20580 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
20581
20582 /**
20583  * Construct the invoice's HRP and signatureless data into a preimage to be hashed.
20584  */
20585 struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z data_without_signature);
20586
20587 /**
20588  * Calls the free function if one is set
20589  */
20590 void Persister_free(struct LDKPersister this_ptr);
20591
20592 /**
20593  * Frees any resources used by the PrintableString, if is_owned is set and inner is non-NULL.
20594  */
20595 void PrintableString_free(struct LDKPrintableString this_obj);
20596
20597 struct LDKStr PrintableString_get_a(const struct LDKPrintableString *NONNULL_PTR this_ptr);
20598
20599 void PrintableString_set_a(struct LDKPrintableString *NONNULL_PTR this_ptr, struct LDKStr val);
20600
20601 /**
20602  * Constructs a new PrintableString given each field
20603  */
20604 MUST_USE_RES struct LDKPrintableString PrintableString_new(struct LDKStr a_arg);
20605
20606 /**
20607  * Calls the free function if one is set
20608  */
20609 void FutureCallback_free(struct LDKFutureCallback this_ptr);
20610
20611 /**
20612  * Frees any resources used by the Future, if is_owned is set and inner is non-NULL.
20613  */
20614 void Future_free(struct LDKFuture this_obj);
20615
20616 /**
20617  * Registers a callback to be called upon completion of this future. If the future has already
20618  * completed, the callback will be called immediately.
20619  */
20620 void Future_register_callback_fn(const struct LDKFuture *NONNULL_PTR this_arg, struct LDKFutureCallback callback);
20621
20622 /**
20623  * Creates a copy of the Level
20624  */
20625 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
20626
20627 /**
20628  * Utility method to constructs a new Gossip-variant Level
20629  */
20630 enum LDKLevel Level_gossip(void);
20631
20632 /**
20633  * Utility method to constructs a new Trace-variant Level
20634  */
20635 enum LDKLevel Level_trace(void);
20636
20637 /**
20638  * Utility method to constructs a new Debug-variant Level
20639  */
20640 enum LDKLevel Level_debug(void);
20641
20642 /**
20643  * Utility method to constructs a new Info-variant Level
20644  */
20645 enum LDKLevel Level_info(void);
20646
20647 /**
20648  * Utility method to constructs a new Warn-variant Level
20649  */
20650 enum LDKLevel Level_warn(void);
20651
20652 /**
20653  * Utility method to constructs a new Error-variant Level
20654  */
20655 enum LDKLevel Level_error(void);
20656
20657 /**
20658  * Checks if two Levels contain equal inner contents.
20659  * This ignores pointers and is_owned flags and looks at the values in fields.
20660  */
20661 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
20662
20663 /**
20664  * Checks if two Levels contain equal inner contents.
20665  */
20666 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
20667
20668 /**
20669  * Returns the most verbose logging level.
20670  */
20671 MUST_USE_RES enum LDKLevel Level_max(void);
20672
20673 /**
20674  * Frees any resources used by the Record, if is_owned is set and inner is non-NULL.
20675  */
20676 void Record_free(struct LDKRecord this_obj);
20677
20678 /**
20679  * The verbosity level of the message.
20680  */
20681 enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr);
20682
20683 /**
20684  * The verbosity level of the message.
20685  */
20686 void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val);
20687
20688 /**
20689  * The message body.
20690  */
20691 struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr);
20692
20693 /**
20694  * The message body.
20695  */
20696 void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
20697
20698 /**
20699  * The module path of the message.
20700  */
20701 struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr);
20702
20703 /**
20704  * The module path of the message.
20705  */
20706 void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
20707
20708 /**
20709  * The source file containing the message.
20710  */
20711 struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr);
20712
20713 /**
20714  * The source file containing the message.
20715  */
20716 void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
20717
20718 /**
20719  * The line containing the message.
20720  */
20721 uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr);
20722
20723 /**
20724  * The line containing the message.
20725  */
20726 void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val);
20727
20728 /**
20729  * Creates a copy of the Record
20730  */
20731 struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig);
20732
20733 /**
20734  * Calls the free function if one is set
20735  */
20736 void Logger_free(struct LDKLogger this_ptr);
20737
20738 /**
20739  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
20740  */
20741 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
20742
20743 /**
20744  * Confirmations we will wait for before considering the channel locked in.
20745  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
20746  * equivalent limit applied to outbound channels).
20747  *
20748  * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
20749  * transaction before operation. If you wish to accept channels with zero confirmations, see
20750  * [`UserConfig::manually_accept_inbound_channels`] and
20751  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
20752  *
20753  * Default value: 6.
20754  *
20755  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
20756  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
20757  */
20758 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
20759
20760 /**
20761  * Confirmations we will wait for before considering the channel locked in.
20762  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
20763  * equivalent limit applied to outbound channels).
20764  *
20765  * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
20766  * transaction before operation. If you wish to accept channels with zero confirmations, see
20767  * [`UserConfig::manually_accept_inbound_channels`] and
20768  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
20769  *
20770  * Default value: 6.
20771  *
20772  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
20773  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
20774  */
20775 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
20776
20777 /**
20778  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
20779  * the number of blocks we have to punish our counterparty if they broadcast a revoked
20780  * transaction).
20781  *
20782  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
20783  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
20784  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
20785  * possibly with time in between to RBF the spending transaction).
20786  *
20787  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
20788  * case of an honest unilateral channel close, which implicitly decrease the economic value of
20789  * our channel.
20790  *
20791  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
20792  * can tweak config to ask for more security, not less.
20793  */
20794 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
20795
20796 /**
20797  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
20798  * the number of blocks we have to punish our counterparty if they broadcast a revoked
20799  * transaction).
20800  *
20801  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
20802  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
20803  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
20804  * possibly with time in between to RBF the spending transaction).
20805  *
20806  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
20807  * case of an honest unilateral channel close, which implicitly decrease the economic value of
20808  * our channel.
20809  *
20810  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
20811  * can tweak config to ask for more security, not less.
20812  */
20813 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
20814
20815 /**
20816  * Set to the smallest value HTLC we will accept to process.
20817  *
20818  * This value is sent to our counterparty on channel-open and we close the channel any time
20819  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
20820  *
20821  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
20822  * by the protocol.
20823  */
20824 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
20825
20826 /**
20827  * Set to the smallest value HTLC we will accept to process.
20828  *
20829  * This value is sent to our counterparty on channel-open and we close the channel any time
20830  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
20831  *
20832  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
20833  * by the protocol.
20834  */
20835 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
20836
20837 /**
20838  * Sets the percentage of the channel value we will cap the total value of outstanding inbound
20839  * HTLCs to.
20840  *
20841  * This can be set to a value between 1-100, where the value corresponds to the percent of the
20842  * channel value in whole percentages.
20843  *
20844  * Note that:
20845  * * If configured to another value than the default value 10, any new channels created with
20846  * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
20847  * `ChannelManager`.
20848  *
20849  * * This caps the total value for inbound HTLCs in-flight only, and there's currently
20850  * no way to configure the cap for the total value of outbound HTLCs in-flight.
20851  *
20852  * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
20853  * are different from the non-HTLC-encumbered funds. This makes this an important knob to
20854  * restrict exposure to loss due to being offline for too long.
20855  * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
20856  * for more information.
20857  *
20858  * Default value: 10.
20859  * Minimum value: 1, any values less than 1 will be treated as 1 instead.
20860  * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
20861  */
20862 uint8_t ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
20863
20864 /**
20865  * Sets the percentage of the channel value we will cap the total value of outstanding inbound
20866  * HTLCs to.
20867  *
20868  * This can be set to a value between 1-100, where the value corresponds to the percent of the
20869  * channel value in whole percentages.
20870  *
20871  * Note that:
20872  * * If configured to another value than the default value 10, any new channels created with
20873  * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
20874  * `ChannelManager`.
20875  *
20876  * * This caps the total value for inbound HTLCs in-flight only, and there's currently
20877  * no way to configure the cap for the total value of outbound HTLCs in-flight.
20878  *
20879  * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
20880  * are different from the non-HTLC-encumbered funds. This makes this an important knob to
20881  * restrict exposure to loss due to being offline for too long.
20882  * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
20883  * for more information.
20884  *
20885  * Default value: 10.
20886  * Minimum value: 1, any values less than 1 will be treated as 1 instead.
20887  * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
20888  */
20889 void ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint8_t val);
20890
20891 /**
20892  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
20893  * BOLTs) option for outbound private channels. This provides better privacy by not including
20894  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
20895  * relay HTLCs to us using the channel's SCID alias.
20896  *
20897  * If this option is set, channels may be created that will not be readable by LDK versions
20898  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
20899  * [`DecodeError::InvalidValue`].
20900  *
20901  * Note that setting this to true does *not* prevent us from opening channels with
20902  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
20903  * private channel without that option.
20904  *
20905  * Ignored if the channel is negotiated to be announced, see
20906  * [`ChannelHandshakeConfig::announced_channel`] and
20907  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
20908  *
20909  * Default value: false. This value is likely to change to true in the future.
20910  *
20911  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
20912  * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
20913  */
20914 bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
20915
20916 /**
20917  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
20918  * BOLTs) option for outbound private channels. This provides better privacy by not including
20919  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
20920  * relay HTLCs to us using the channel's SCID alias.
20921  *
20922  * If this option is set, channels may be created that will not be readable by LDK versions
20923  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
20924  * [`DecodeError::InvalidValue`].
20925  *
20926  * Note that setting this to true does *not* prevent us from opening channels with
20927  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
20928  * private channel without that option.
20929  *
20930  * Ignored if the channel is negotiated to be announced, see
20931  * [`ChannelHandshakeConfig::announced_channel`] and
20932  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
20933  *
20934  * Default value: false. This value is likely to change to true in the future.
20935  *
20936  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
20937  * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
20938  */
20939 void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
20940
20941 /**
20942  * Set to announce the channel publicly and notify all nodes that they can route via this
20943  * channel.
20944  *
20945  * This should only be set to true for nodes which expect to be online reliably.
20946  *
20947  * As the node which funds a channel picks this value this will only apply for new outbound
20948  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
20949  *
20950  * Default value: false.
20951  */
20952 bool ChannelHandshakeConfig_get_announced_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
20953
20954 /**
20955  * Set to announce the channel publicly and notify all nodes that they can route via this
20956  * channel.
20957  *
20958  * This should only be set to true for nodes which expect to be online reliably.
20959  *
20960  * As the node which funds a channel picks this value this will only apply for new outbound
20961  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
20962  *
20963  * Default value: false.
20964  */
20965 void ChannelHandshakeConfig_set_announced_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
20966
20967 /**
20968  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
20969  * supports it, they will then enforce the mutual-close output to us matches what we provided
20970  * at intialization, preventing us from closing to an alternate pubkey.
20971  *
20972  * This is set to true by default to provide a slight increase in security, though ultimately
20973  * any attacker who is able to take control of a channel can just as easily send the funds via
20974  * lightning payments, so we never require that our counterparties support this option.
20975  *
20976  * The upfront key committed is provided from [`SignerProvider::get_shutdown_scriptpubkey`].
20977  *
20978  * Default value: true.
20979  *
20980  * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::SignerProvider::get_shutdown_scriptpubkey
20981  */
20982 bool ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
20983
20984 /**
20985  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
20986  * supports it, they will then enforce the mutual-close output to us matches what we provided
20987  * at intialization, preventing us from closing to an alternate pubkey.
20988  *
20989  * This is set to true by default to provide a slight increase in security, though ultimately
20990  * any attacker who is able to take control of a channel can just as easily send the funds via
20991  * lightning payments, so we never require that our counterparties support this option.
20992  *
20993  * The upfront key committed is provided from [`SignerProvider::get_shutdown_scriptpubkey`].
20994  *
20995  * Default value: true.
20996  *
20997  * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::SignerProvider::get_shutdown_scriptpubkey
20998  */
20999 void ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
21000
21001 /**
21002  * The Proportion of the channel value to configure as counterparty's channel reserve,
21003  * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels.
21004  *
21005  * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain
21006  * on their side, at all times.
21007  * This ensures that if our counterparty broadcasts a revoked state, we can punish them by
21008  * claiming at least this value on chain.
21009  *
21010  * Channel reserve values greater than 30% could be considered highly unreasonable, since that
21011  * amount can never be used for payments.
21012  * Also, if our selected channel reserve for counterparty and counterparty's selected
21013  * channel reserve for us sum up to equal or greater than channel value, channel negotiations
21014  * will fail.
21015  *
21016  * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve
21017  * other than the default value.
21018  *
21019  * Default value: 1% of channel value, i.e., configured as 10,000 millionths.
21020  * Minimum value: If the calculated proportional value is less than 1000 sats, it will be treated
21021  *                as 1000 sats instead, which is a safe implementation-specific lower bound.
21022  * Maximum value: 1,000,000, any values larger than 1 Million will be treated as 1 Million (or 100%)
21023  *                instead, although channel negotiations will fail in that case.
21024  */
21025 uint32_t ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
21026
21027 /**
21028  * The Proportion of the channel value to configure as counterparty's channel reserve,
21029  * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels.
21030  *
21031  * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain
21032  * on their side, at all times.
21033  * This ensures that if our counterparty broadcasts a revoked state, we can punish them by
21034  * claiming at least this value on chain.
21035  *
21036  * Channel reserve values greater than 30% could be considered highly unreasonable, since that
21037  * amount can never be used for payments.
21038  * Also, if our selected channel reserve for counterparty and counterparty's selected
21039  * channel reserve for us sum up to equal or greater than channel value, channel negotiations
21040  * will fail.
21041  *
21042  * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve
21043  * other than the default value.
21044  *
21045  * Default value: 1% of channel value, i.e., configured as 10,000 millionths.
21046  * Minimum value: If the calculated proportional value is less than 1000 sats, it will be treated
21047  *                as 1000 sats instead, which is a safe implementation-specific lower bound.
21048  * Maximum value: 1,000,000, any values larger than 1 Million will be treated as 1 Million (or 100%)
21049  *                instead, although channel negotiations will fail in that case.
21050  */
21051 void ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
21052
21053 /**
21054  * Constructs a new ChannelHandshakeConfig given each field
21055  */
21056 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);
21057
21058 /**
21059  * Creates a copy of the ChannelHandshakeConfig
21060  */
21061 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
21062
21063 /**
21064  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
21065  */
21066 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
21067
21068 /**
21069  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
21070  */
21071 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
21072
21073 /**
21074  * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
21075  * only applies to inbound channels.
21076  *
21077  * Default value: 0.
21078  */
21079 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
21080
21081 /**
21082  * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
21083  * only applies to inbound channels.
21084  *
21085  * Default value: 0.
21086  */
21087 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
21088
21089 /**
21090  * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
21091  * only applies to inbound channels.
21092  *
21093  * Default value: 2^24 - 1.
21094  */
21095 uint64_t ChannelHandshakeLimits_get_max_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
21096
21097 /**
21098  * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
21099  * only applies to inbound channels.
21100  *
21101  * Default value: 2^24 - 1.
21102  */
21103 void ChannelHandshakeLimits_set_max_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
21104
21105 /**
21106  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
21107  * you to limit the maximum minimum-size they can require.
21108  *
21109  * Default value: u64::max_value.
21110  */
21111 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
21112
21113 /**
21114  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
21115  * you to limit the maximum minimum-size they can require.
21116  *
21117  * Default value: u64::max_value.
21118  */
21119 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
21120
21121 /**
21122  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
21123  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
21124  *
21125  * Default value: 0.
21126  */
21127 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
21128
21129 /**
21130  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
21131  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
21132  *
21133  * Default value: 0.
21134  */
21135 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
21136
21137 /**
21138  * The remote node will require we keep a certain amount in direct payment to ourselves at all
21139  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
21140  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
21141  *
21142  * Default value: u64::max_value.
21143  */
21144 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
21145
21146 /**
21147  * The remote node will require we keep a certain amount in direct payment to ourselves at all
21148  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
21149  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
21150  *
21151  * Default value: u64::max_value.
21152  */
21153 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
21154
21155 /**
21156  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
21157  * time. This allows you to set a minimum such value.
21158  *
21159  * Default value: 0.
21160  */
21161 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
21162
21163 /**
21164  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
21165  * time. This allows you to set a minimum such value.
21166  *
21167  * Default value: 0.
21168  */
21169 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
21170
21171 /**
21172  * Before a channel is usable the funding transaction will need to be confirmed by at least a
21173  * certain number of blocks, specified by the node which is not the funder (as the funder can
21174  * assume they aren't going to double-spend themselves).
21175  * This config allows you to set a limit on the maximum amount of time to wait.
21176  *
21177  * Default value: 144, or roughly one day and only applies to outbound channels.
21178  */
21179 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
21180
21181 /**
21182  * Before a channel is usable the funding transaction will need to be confirmed by at least a
21183  * certain number of blocks, specified by the node which is not the funder (as the funder can
21184  * assume they aren't going to double-spend themselves).
21185  * This config allows you to set a limit on the maximum amount of time to wait.
21186  *
21187  * Default value: 144, or roughly one day and only applies to outbound channels.
21188  */
21189 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
21190
21191 /**
21192  * Whether we implicitly trust funding transactions generated by us for our own outbound
21193  * channels to not be double-spent.
21194  *
21195  * If this is set, we assume that our own funding transactions are *never* double-spent, and
21196  * thus we can trust them without any confirmations. This is generally a reasonable
21197  * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
21198  * control of the signing keys).
21199  *
21200  * You may wish to un-set this if you allow the user to (or do in an automated fashion)
21201  * double-spend the funding transaction to RBF with an alternative channel open.
21202  *
21203  * This only applies if our counterparty set their confirmations-required value to 0, and we
21204  * always trust our own funding transaction at 1 confirmation irrespective of this value.
21205  * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
21206  * `true` (0) and `false` (1).
21207  *
21208  * Default value: true
21209  */
21210 bool ChannelHandshakeLimits_get_trust_own_funding_0conf(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
21211
21212 /**
21213  * Whether we implicitly trust funding transactions generated by us for our own outbound
21214  * channels to not be double-spent.
21215  *
21216  * If this is set, we assume that our own funding transactions are *never* double-spent, and
21217  * thus we can trust them without any confirmations. This is generally a reasonable
21218  * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
21219  * control of the signing keys).
21220  *
21221  * You may wish to un-set this if you allow the user to (or do in an automated fashion)
21222  * double-spend the funding transaction to RBF with an alternative channel open.
21223  *
21224  * This only applies if our counterparty set their confirmations-required value to 0, and we
21225  * always trust our own funding transaction at 1 confirmation irrespective of this value.
21226  * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
21227  * `true` (0) and `false` (1).
21228  *
21229  * Default value: true
21230  */
21231 void ChannelHandshakeLimits_set_trust_own_funding_0conf(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
21232
21233 /**
21234  * Set to force an incoming channel to match our announced channel preference in
21235  * [`ChannelHandshakeConfig::announced_channel`].
21236  *
21237  * For a node which is not online reliably, this should be set to true and
21238  * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public)
21239  * channels will ever be opened.
21240  *
21241  * Default value: true.
21242  */
21243 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
21244
21245 /**
21246  * Set to force an incoming channel to match our announced channel preference in
21247  * [`ChannelHandshakeConfig::announced_channel`].
21248  *
21249  * For a node which is not online reliably, this should be set to true and
21250  * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public)
21251  * channels will ever be opened.
21252  *
21253  * Default value: true.
21254  */
21255 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
21256
21257 /**
21258  * Set to the amount of time we're willing to wait to claim money back to us.
21259  *
21260  * Not checking this value would be a security issue, as our peer would be able to set it to
21261  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
21262  *
21263  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
21264  * reduce the loss of having useless locked funds (if your peer accepts)
21265  */
21266 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
21267
21268 /**
21269  * Set to the amount of time we're willing to wait to claim money back to us.
21270  *
21271  * Not checking this value would be a security issue, as our peer would be able to set it to
21272  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
21273  *
21274  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
21275  * reduce the loss of having useless locked funds (if your peer accepts)
21276  */
21277 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
21278
21279 /**
21280  * Constructs a new ChannelHandshakeLimits given each field
21281  */
21282 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);
21283
21284 /**
21285  * Creates a copy of the ChannelHandshakeLimits
21286  */
21287 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
21288
21289 /**
21290  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
21291  */
21292 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
21293
21294 /**
21295  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
21296  */
21297 void ChannelConfig_free(struct LDKChannelConfig this_obj);
21298
21299 /**
21300  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
21301  * over the channel.
21302  * This may be allowed to change at runtime in a later update, however doing so must result in
21303  * update messages sent to notify all nodes of our updated relay fee.
21304  *
21305  * Default value: 0.
21306  */
21307 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
21308
21309 /**
21310  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
21311  * over the channel.
21312  * This may be allowed to change at runtime in a later update, however doing so must result in
21313  * update messages sent to notify all nodes of our updated relay fee.
21314  *
21315  * Default value: 0.
21316  */
21317 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
21318
21319 /**
21320  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
21321  * excess of [`forwarding_fee_proportional_millionths`].
21322  * This may be allowed to change at runtime in a later update, however doing so must result in
21323  * update messages sent to notify all nodes of our updated relay fee.
21324  *
21325  * The default value of a single satoshi roughly matches the market rate on many routing nodes
21326  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
21327  * this node.
21328  *
21329  * Default value: 1000.
21330  *
21331  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
21332  */
21333 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
21334
21335 /**
21336  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
21337  * excess of [`forwarding_fee_proportional_millionths`].
21338  * This may be allowed to change at runtime in a later update, however doing so must result in
21339  * update messages sent to notify all nodes of our updated relay fee.
21340  *
21341  * The default value of a single satoshi roughly matches the market rate on many routing nodes
21342  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
21343  * this node.
21344  *
21345  * Default value: 1000.
21346  *
21347  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
21348  */
21349 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
21350
21351 /**
21352  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
21353  * the channel this config applies to.
21354  *
21355  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
21356  * HTLC balance when a channel appears on-chain whereas
21357  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
21358  * (non-HTLC-encumbered) balance.
21359  *
21360  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
21361  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
21362  * commitment transaction at least once per this many blocks (minus some margin to allow us
21363  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
21364  * the spending transaction).
21365  *
21366  * Default value: 72 (12 hours at an average of 6 blocks/hour).
21367  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
21368  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
21369  *
21370  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
21371  */
21372 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
21373
21374 /**
21375  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
21376  * the channel this config applies to.
21377  *
21378  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
21379  * HTLC balance when a channel appears on-chain whereas
21380  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
21381  * (non-HTLC-encumbered) balance.
21382  *
21383  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
21384  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
21385  * commitment transaction at least once per this many blocks (minus some margin to allow us
21386  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
21387  * the spending transaction).
21388  *
21389  * Default value: 72 (12 hours at an average of 6 blocks/hour).
21390  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
21391  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
21392  *
21393  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
21394  */
21395 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
21396
21397 /**
21398  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
21399  * small to claim on-chain.
21400  *
21401  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
21402  * not be claimable on-chain, instead being turned into additional miner fees if either
21403  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
21404  * to such payments may be sustantial if there are many dust HTLCs present when the
21405  * channel is force-closed.
21406  *
21407  * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a
21408  * channel negotiated throughout the channel open process, along with the fees required to have
21409  * a broadcastable HTLC spending transaction. When a channel supports anchor outputs
21410  * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into
21411  * account the HTLC transaction fee as it is zero.
21412  *
21413  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
21414  * exposure across all three types per-channel. Setting this too low may prevent the
21415  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
21416  * important to prevent stealing of dust HTLCs by miners.
21417  *
21418  * Default value: 5_000_000 msat.
21419  */
21420 uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
21421
21422 /**
21423  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
21424  * small to claim on-chain.
21425  *
21426  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
21427  * not be claimable on-chain, instead being turned into additional miner fees if either
21428  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
21429  * to such payments may be sustantial if there are many dust HTLCs present when the
21430  * channel is force-closed.
21431  *
21432  * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a
21433  * channel negotiated throughout the channel open process, along with the fees required to have
21434  * a broadcastable HTLC spending transaction. When a channel supports anchor outputs
21435  * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into
21436  * account the HTLC transaction fee as it is zero.
21437  *
21438  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
21439  * exposure across all three types per-channel. Setting this too low may prevent the
21440  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
21441  * important to prevent stealing of dust HTLCs by miners.
21442  *
21443  * Default value: 5_000_000 msat.
21444  */
21445 void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
21446
21447 /**
21448  * The additional fee we're willing to pay to avoid waiting for the counterparty's
21449  * `to_self_delay` to reclaim funds.
21450  *
21451  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
21452  * closing transaction which both sides find acceptable, ultimately paid by the channel
21453  * funder/initiator.
21454  *
21455  * When we are the funder, because we have to pay the channel closing fee, we bound the
21456  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
21457  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
21458  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
21459  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
21460  * funds.
21461  *
21462  * When we are not the funder, we require the closing transaction fee pay at least our
21463  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
21464  * Thus, this value is ignored when we are not the funder.
21465  *
21466  * Default value: 1000 satoshis.
21467  *
21468  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
21469  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
21470  */
21471 uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
21472
21473 /**
21474  * The additional fee we're willing to pay to avoid waiting for the counterparty's
21475  * `to_self_delay` to reclaim funds.
21476  *
21477  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
21478  * closing transaction which both sides find acceptable, ultimately paid by the channel
21479  * funder/initiator.
21480  *
21481  * When we are the funder, because we have to pay the channel closing fee, we bound the
21482  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
21483  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
21484  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
21485  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
21486  * funds.
21487  *
21488  * When we are not the funder, we require the closing transaction fee pay at least our
21489  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
21490  * Thus, this value is ignored when we are not the funder.
21491  *
21492  * Default value: 1000 satoshis.
21493  *
21494  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
21495  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
21496  */
21497 void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
21498
21499 /**
21500  * Constructs a new ChannelConfig given each field
21501  */
21502 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);
21503
21504 /**
21505  * Creates a copy of the ChannelConfig
21506  */
21507 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
21508
21509 /**
21510  * Checks if two ChannelConfigs contain equal inner contents.
21511  * This ignores pointers and is_owned flags and looks at the values in fields.
21512  * Two objects with NULL inner values will be considered "equal" here.
21513  */
21514 bool ChannelConfig_eq(const struct LDKChannelConfig *NONNULL_PTR a, const struct LDKChannelConfig *NONNULL_PTR b);
21515
21516 /**
21517  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
21518  */
21519 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
21520
21521 /**
21522  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
21523  */
21524 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
21525
21526 /**
21527  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
21528  */
21529 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
21530
21531 /**
21532  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
21533  */
21534 void UserConfig_free(struct LDKUserConfig this_obj);
21535
21536 /**
21537  * Channel handshake config that we propose to our counterparty.
21538  */
21539 struct LDKChannelHandshakeConfig UserConfig_get_channel_handshake_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
21540
21541 /**
21542  * Channel handshake config that we propose to our counterparty.
21543  */
21544 void UserConfig_set_channel_handshake_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
21545
21546 /**
21547  * Limits applied to our counterparty's proposed channel handshake config settings.
21548  */
21549 struct LDKChannelHandshakeLimits UserConfig_get_channel_handshake_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
21550
21551 /**
21552  * Limits applied to our counterparty's proposed channel handshake config settings.
21553  */
21554 void UserConfig_set_channel_handshake_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
21555
21556 /**
21557  * Channel config which affects behavior during channel lifetime.
21558  */
21559 struct LDKChannelConfig UserConfig_get_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
21560
21561 /**
21562  * Channel config which affects behavior during channel lifetime.
21563  */
21564 void UserConfig_set_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
21565
21566 /**
21567  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
21568  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
21569  * node which is not online reliably.
21570  *
21571  * For nodes which are not online reliably, you should set all channels to *not* be announced
21572  * (using [`ChannelHandshakeConfig::announced_channel`] and
21573  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
21574  * ensure you are not exposed to any forwarding risk.
21575  *
21576  * Note that because you cannot change a channel's announced state after creation, there is no
21577  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
21578  * from a publicly-announced forwarding node to a private non-forwarding node you must close
21579  * all your channels and open new ones. For privacy, you should also change your node_id
21580  * (swapping all private and public key material for new ones) at that time.
21581  *
21582  * Default value: false.
21583  */
21584 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
21585
21586 /**
21587  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
21588  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
21589  * node which is not online reliably.
21590  *
21591  * For nodes which are not online reliably, you should set all channels to *not* be announced
21592  * (using [`ChannelHandshakeConfig::announced_channel`] and
21593  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
21594  * ensure you are not exposed to any forwarding risk.
21595  *
21596  * Note that because you cannot change a channel's announced state after creation, there is no
21597  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
21598  * from a publicly-announced forwarding node to a private non-forwarding node you must close
21599  * all your channels and open new ones. For privacy, you should also change your node_id
21600  * (swapping all private and public key material for new ones) at that time.
21601  *
21602  * Default value: false.
21603  */
21604 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
21605
21606 /**
21607  * If this is set to false, we do not accept inbound requests to open a new channel.
21608  * Default value: true.
21609  */
21610 bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
21611
21612 /**
21613  * If this is set to false, we do not accept inbound requests to open a new channel.
21614  * Default value: true.
21615  */
21616 void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
21617
21618 /**
21619  * If this is set to true, the user needs to manually accept inbound requests to open a new
21620  * channel.
21621  *
21622  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
21623  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
21624  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
21625  * user explicitly chooses to accept the request.
21626  *
21627  * Default value: false.
21628  *
21629  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
21630  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
21631  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
21632  */
21633 bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
21634
21635 /**
21636  * If this is set to true, the user needs to manually accept inbound requests to open a new
21637  * channel.
21638  *
21639  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
21640  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
21641  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
21642  * user explicitly chooses to accept the request.
21643  *
21644  * Default value: false.
21645  *
21646  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
21647  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
21648  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
21649  */
21650 void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
21651
21652 /**
21653  *  If this is set to true, LDK will intercept HTLCs that are attempting to be forwarded over
21654  *  fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC
21655  *  intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user.
21656  *
21657  *  Setting this to true may break backwards compatibility with LDK versions < 0.0.113.
21658  *
21659  *  Default value: false.
21660  *
21661  * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
21662  * [`Event::HTLCIntercepted`]: crate::util::events::Event::HTLCIntercepted
21663  */
21664 bool UserConfig_get_accept_intercept_htlcs(const struct LDKUserConfig *NONNULL_PTR this_ptr);
21665
21666 /**
21667  *  If this is set to true, LDK will intercept HTLCs that are attempting to be forwarded over
21668  *  fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC
21669  *  intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user.
21670  *
21671  *  Setting this to true may break backwards compatibility with LDK versions < 0.0.113.
21672  *
21673  *  Default value: false.
21674  *
21675  * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
21676  * [`Event::HTLCIntercepted`]: crate::util::events::Event::HTLCIntercepted
21677  */
21678 void UserConfig_set_accept_intercept_htlcs(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
21679
21680 /**
21681  * Constructs a new UserConfig given each field
21682  */
21683 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);
21684
21685 /**
21686  * Creates a copy of the UserConfig
21687  */
21688 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
21689
21690 /**
21691  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
21692  */
21693 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
21694
21695 /**
21696  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
21697  */
21698 void BestBlock_free(struct LDKBestBlock this_obj);
21699
21700 /**
21701  * Creates a copy of the BestBlock
21702  */
21703 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
21704
21705 /**
21706  * Checks if two BestBlocks contain equal inner contents.
21707  * This ignores pointers and is_owned flags and looks at the values in fields.
21708  * Two objects with NULL inner values will be considered "equal" here.
21709  */
21710 bool BestBlock_eq(const struct LDKBestBlock *NONNULL_PTR a, const struct LDKBestBlock *NONNULL_PTR b);
21711
21712 /**
21713  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
21714  * network.
21715  */
21716 MUST_USE_RES struct LDKBestBlock BestBlock_from_network(enum LDKNetwork network);
21717
21718 /**
21719  * Returns a `BestBlock` as identified by the given block hash and height.
21720  */
21721 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
21722
21723 /**
21724  * Returns the best block hash.
21725  */
21726 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
21727
21728 /**
21729  * Returns the best block height.
21730  */
21731 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
21732
21733 /**
21734  * Calls the free function if one is set
21735  */
21736 void Listen_free(struct LDKListen this_ptr);
21737
21738 /**
21739  * Calls the free function if one is set
21740  */
21741 void Confirm_free(struct LDKConfirm this_ptr);
21742
21743 /**
21744  * Creates a copy of the ChannelMonitorUpdateStatus
21745  */
21746 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_clone(const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR orig);
21747
21748 /**
21749  * Utility method to constructs a new Completed-variant ChannelMonitorUpdateStatus
21750  */
21751 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_completed(void);
21752
21753 /**
21754  * Utility method to constructs a new InProgress-variant ChannelMonitorUpdateStatus
21755  */
21756 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_in_progress(void);
21757
21758 /**
21759  * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateStatus
21760  */
21761 enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_permanent_failure(void);
21762
21763 /**
21764  * Checks if two ChannelMonitorUpdateStatuss contain equal inner contents.
21765  * This ignores pointers and is_owned flags and looks at the values in fields.
21766  */
21767 bool ChannelMonitorUpdateStatus_eq(const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR a, const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR b);
21768
21769 /**
21770  * Calls the free function if one is set
21771  */
21772 void Watch_free(struct LDKWatch this_ptr);
21773
21774 /**
21775  * Calls the free function if one is set
21776  */
21777 void Filter_free(struct LDKFilter this_ptr);
21778
21779 /**
21780  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
21781  */
21782 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
21783
21784 /**
21785  * First block where the transaction output may have been spent.
21786  *
21787  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21788  */
21789 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
21790
21791 /**
21792  * First block where the transaction output may have been spent.
21793  *
21794  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21795  */
21796 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21797
21798 /**
21799  * Outpoint identifying the transaction output.
21800  */
21801 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
21802
21803 /**
21804  * Outpoint identifying the transaction output.
21805  */
21806 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
21807
21808 /**
21809  * Spending condition of the transaction output.
21810  */
21811 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
21812
21813 /**
21814  * Spending condition of the transaction output.
21815  */
21816 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
21817
21818 /**
21819  * Constructs a new WatchedOutput given each field
21820  */
21821 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
21822
21823 /**
21824  * Creates a copy of the WatchedOutput
21825  */
21826 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
21827
21828 /**
21829  * Checks if two WatchedOutputs contain equal inner contents.
21830  * This ignores pointers and is_owned flags and looks at the values in fields.
21831  * Two objects with NULL inner values will be considered "equal" here.
21832  */
21833 bool WatchedOutput_eq(const struct LDKWatchedOutput *NONNULL_PTR a, const struct LDKWatchedOutput *NONNULL_PTR b);
21834
21835 /**
21836  * Checks if two WatchedOutputs contain equal inner contents.
21837  */
21838 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
21839
21840 /**
21841  * Calls the free function if one is set
21842  */
21843 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
21844
21845 /**
21846  * Creates a copy of the ConfirmationTarget
21847  */
21848 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
21849
21850 /**
21851  * Utility method to constructs a new Background-variant ConfirmationTarget
21852  */
21853 enum LDKConfirmationTarget ConfirmationTarget_background(void);
21854
21855 /**
21856  * Utility method to constructs a new Normal-variant ConfirmationTarget
21857  */
21858 enum LDKConfirmationTarget ConfirmationTarget_normal(void);
21859
21860 /**
21861  * Utility method to constructs a new HighPriority-variant ConfirmationTarget
21862  */
21863 enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
21864
21865 /**
21866  * Checks if two ConfirmationTargets contain equal inner contents.
21867  */
21868 uint64_t ConfirmationTarget_hash(const enum LDKConfirmationTarget *NONNULL_PTR o);
21869
21870 /**
21871  * Checks if two ConfirmationTargets contain equal inner contents.
21872  * This ignores pointers and is_owned flags and looks at the values in fields.
21873  */
21874 bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
21875
21876 /**
21877  * Calls the free function if one is set
21878  */
21879 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
21880
21881 /**
21882  * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
21883  */
21884 void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj);
21885
21886 /**
21887  * Creates a copy of the MonitorUpdateId
21888  */
21889 struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
21890
21891 /**
21892  * Checks if two MonitorUpdateIds contain equal inner contents.
21893  */
21894 uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
21895
21896 /**
21897  * Checks if two MonitorUpdateIds contain equal inner contents.
21898  * This ignores pointers and is_owned flags and looks at the values in fields.
21899  * Two objects with NULL inner values will be considered "equal" here.
21900  */
21901 bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b);
21902
21903 /**
21904  * Calls the free function if one is set
21905  */
21906 void Persist_free(struct LDKPersist this_ptr);
21907
21908 /**
21909  * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL.
21910  */
21911 void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj);
21912
21913 /**
21914  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
21915  */
21916 void ChainMonitor_free(struct LDKChainMonitor this_obj);
21917
21918 /**
21919  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
21920  *
21921  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
21922  * will call back to it indicating transactions and outputs of interest. This allows clients to
21923  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
21924  * always need to fetch full blocks absent another means for determining which blocks contain
21925  * transactions relevant to the watched channels.
21926  */
21927 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
21928
21929 /**
21930  * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
21931  * claims which are awaiting confirmation.
21932  *
21933  * Includes the balances from each [`ChannelMonitor`] *except* those included in
21934  * `ignored_channels`, allowing you to filter out balances from channels which are still open
21935  * (and whose balance should likely be pulled from the [`ChannelDetails`]).
21936  *
21937  * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
21938  * inclusion in the return value.
21939  */
21940 MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
21941
21942 /**
21943  * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no
21944  * such [`ChannelMonitor`] is currently being monitored for.
21945  *
21946  * Note that the result holds a mutex over our monitor set, and should not be held
21947  * indefinitely.
21948  */
21949 MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo);
21950
21951 /**
21952  * Lists the funding outpoint of each [`ChannelMonitor`] being monitored.
21953  *
21954  * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always
21955  * monitoring for on-chain state resolutions.
21956  */
21957 MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
21958
21959 /**
21960  * Lists the pending updates for each [`ChannelMonitor`] (by `OutPoint` being monitored).
21961  */
21962 MUST_USE_RES struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ChainMonitor_list_pending_monitor_updates(const struct LDKChainMonitor *NONNULL_PTR this_arg);
21963
21964 /**
21965  * Indicates the persistence of a [`ChannelMonitor`] has completed after
21966  * [`ChannelMonitorUpdateStatus::InProgress`] was returned from an update operation.
21967  *
21968  * Thus, the anticipated use is, at a high level:
21969  *  1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
21970  *     update to disk and begins updating any remote (e.g. watchtower/backup) copies,
21971  *     returning [`ChannelMonitorUpdateStatus::InProgress`],
21972  *  2) once all remote copies are updated, you call this function with the
21973  *     `completed_update_id` that completed, and once all pending updates have completed the
21974  *     channel will be re-enabled.
21975  *
21976  * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
21977  * registered [`ChannelMonitor`]s.
21978  */
21979 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);
21980
21981 /**
21982  * Constructs a new Listen which calls the relevant methods on this_arg.
21983  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
21984  */
21985 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
21986
21987 /**
21988  * Constructs a new Confirm which calls the relevant methods on this_arg.
21989  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
21990  */
21991 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
21992
21993 /**
21994  * Constructs a new Watch which calls the relevant methods on this_arg.
21995  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
21996  */
21997 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
21998
21999 /**
22000  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
22001  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
22002  */
22003 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
22004
22005 /**
22006  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
22007  */
22008 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
22009
22010 /**
22011  * The sequence number of this update. Updates *must* be replayed in-order according to this
22012  * sequence number (and updates may panic if they are not). The update_id values are strictly
22013  * increasing and increase by one for each new update, with one exception specified below.
22014  *
22015  * This sequence number is also used to track up to which points updates which returned
22016  * [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given
22017  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
22018  *
22019  * The only instance where update_id values are not strictly increasing is the case where we
22020  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
22021  * its docs for more details.
22022  *
22023  * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
22024  */
22025 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
22026
22027 /**
22028  * The sequence number of this update. Updates *must* be replayed in-order according to this
22029  * sequence number (and updates may panic if they are not). The update_id values are strictly
22030  * increasing and increase by one for each new update, with one exception specified below.
22031  *
22032  * This sequence number is also used to track up to which points updates which returned
22033  * [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given
22034  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
22035  *
22036  * The only instance where update_id values are not strictly increasing is the case where we
22037  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
22038  * its docs for more details.
22039  *
22040  * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
22041  */
22042 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
22043
22044 /**
22045  * Creates a copy of the ChannelMonitorUpdate
22046  */
22047 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
22048
22049 /**
22050  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
22051  */
22052 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
22053
22054 /**
22055  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
22056  */
22057 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
22058
22059 /**
22060  * Frees any resources used by the MonitorEvent
22061  */
22062 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
22063
22064 /**
22065  * Creates a copy of the MonitorEvent
22066  */
22067 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
22068
22069 /**
22070  * Utility method to constructs a new HTLCEvent-variant MonitorEvent
22071  */
22072 struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
22073
22074 /**
22075  * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
22076  */
22077 struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
22078
22079 /**
22080  * Utility method to constructs a new Completed-variant MonitorEvent
22081  */
22082 struct LDKMonitorEvent MonitorEvent_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id);
22083
22084 /**
22085  * Utility method to constructs a new UpdateFailed-variant MonitorEvent
22086  */
22087 struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a);
22088
22089 /**
22090  * Checks if two MonitorEvents contain equal inner contents.
22091  * This ignores pointers and is_owned flags and looks at the values in fields.
22092  */
22093 bool MonitorEvent_eq(const struct LDKMonitorEvent *NONNULL_PTR a, const struct LDKMonitorEvent *NONNULL_PTR b);
22094
22095 /**
22096  * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
22097  */
22098 struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj);
22099
22100 /**
22101  * Read a MonitorEvent from a byte array, created by MonitorEvent_write
22102  */
22103 struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser);
22104
22105 /**
22106  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
22107  */
22108 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
22109
22110 /**
22111  * Creates a copy of the HTLCUpdate
22112  */
22113 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
22114
22115 /**
22116  * Checks if two HTLCUpdates contain equal inner contents.
22117  * This ignores pointers and is_owned flags and looks at the values in fields.
22118  * Two objects with NULL inner values will be considered "equal" here.
22119  */
22120 bool HTLCUpdate_eq(const struct LDKHTLCUpdate *NONNULL_PTR a, const struct LDKHTLCUpdate *NONNULL_PTR b);
22121
22122 /**
22123  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
22124  */
22125 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
22126
22127 /**
22128  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
22129  */
22130 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
22131
22132 /**
22133  * Frees any resources used by the Balance
22134  */
22135 void Balance_free(struct LDKBalance this_ptr);
22136
22137 /**
22138  * Creates a copy of the Balance
22139  */
22140 struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
22141
22142 /**
22143  * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
22144  */
22145 struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
22146
22147 /**
22148  * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
22149  */
22150 struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
22151
22152 /**
22153  * Utility method to constructs a new ContentiousClaimable-variant Balance
22154  */
22155 struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height);
22156
22157 /**
22158  * Utility method to constructs a new MaybeTimeoutClaimableHTLC-variant Balance
22159  */
22160 struct LDKBalance Balance_maybe_timeout_claimable_htlc(uint64_t claimable_amount_satoshis, uint32_t claimable_height);
22161
22162 /**
22163  * Utility method to constructs a new MaybePreimageClaimableHTLC-variant Balance
22164  */
22165 struct LDKBalance Balance_maybe_preimage_claimable_htlc(uint64_t claimable_amount_satoshis, uint32_t expiry_height);
22166
22167 /**
22168  * Utility method to constructs a new CounterpartyRevokedOutputClaimable-variant Balance
22169  */
22170 struct LDKBalance Balance_counterparty_revoked_output_claimable(uint64_t claimable_amount_satoshis);
22171
22172 /**
22173  * Checks if two Balances contain equal inner contents.
22174  * This ignores pointers and is_owned flags and looks at the values in fields.
22175  */
22176 bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
22177
22178 /**
22179  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
22180  */
22181 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
22182
22183 /**
22184  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
22185  */
22186 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
22187
22188 /**
22189  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
22190  * itself.
22191  *
22192  * panics if the given update is not the next update by update_id.
22193  */
22194 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);
22195
22196 /**
22197  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
22198  * ChannelMonitor.
22199  */
22200 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
22201
22202 /**
22203  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
22204  */
22205 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
22206
22207 /**
22208  * Gets a list of txids, with their output scripts (in the order they appear in the
22209  * transaction), which we must learn about spends of via block_connected().
22210  */
22211 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
22212
22213 /**
22214  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
22215  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
22216  * have been registered.
22217  */
22218 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
22219
22220 /**
22221  * Get the list of HTLCs who's status has been updated on chain. This should be called by
22222  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
22223  */
22224 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
22225
22226 /**
22227  * Gets the list of pending events which were generated by previous actions, clearing the list
22228  * in the process.
22229  *
22230  * This is called by the [`EventsProvider::process_pending_events`] implementation for
22231  * [`ChainMonitor`].
22232  *
22233  * [`EventsProvider::process_pending_events`]: crate::util::events::EventsProvider::process_pending_events
22234  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
22235  */
22236 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
22237
22238 /**
22239  * Gets the `node_id` of the counterparty for this channel.
22240  *
22241  * Will be `None` for channels constructed on LDK versions prior to 0.0.110 and always `Some`
22242  * otherwise.
22243  *
22244  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22245  */
22246 MUST_USE_RES struct LDKPublicKey ChannelMonitor_get_counterparty_node_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
22247
22248 /**
22249  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
22250  * the Channel was out-of-date.
22251  *
22252  * You may also use this to broadcast the latest local commitment transaction, either because
22253  * a monitor update failed with [`ChannelMonitorUpdateStatus::PermanentFailure`] or because we've
22254  * fallen behind (i.e. we've received proof that our counterparty side knows a revocation
22255  * secret we gave them that they shouldn't know).
22256  *
22257  * Broadcasting these transactions in the second case is UNSAFE, as they allow counterparty
22258  * side to punish you. Nevertheless you may want to broadcast them if counterparty doesn't
22259  * close channel with their commitment transaction after a substantial amount of time. Best
22260  * may be to contact the other node operator out-of-band to coordinate other options available
22261  * to you. In any-case, the choice is up to you.
22262  *
22263  * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure
22264  */
22265 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);
22266
22267 /**
22268  * Processes transactions in a newly connected block, which may result in any of the following:
22269  * - update the monitor's state against resolved HTLCs
22270  * - punish the counterparty in the case of seeing a revoked commitment transaction
22271  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
22272  * - detect settled outputs for later spending
22273  * - schedule and bump any in-flight claims
22274  *
22275  * Returns any new outputs to watch from `txdata`; after called, these are also included in
22276  * [`get_outputs_to_watch`].
22277  *
22278  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
22279  */
22280 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);
22281
22282 /**
22283  * Determines if the disconnected block contained any transactions of interest and updates
22284  * appropriately.
22285  */
22286 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);
22287
22288 /**
22289  * Processes transactions confirmed in a block with the given header and height, returning new
22290  * outputs to watch. See [`block_connected`] for details.
22291  *
22292  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
22293  * blocks. See [`chain::Confirm`] for calling expectations.
22294  *
22295  * [`block_connected`]: Self::block_connected
22296  */
22297 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);
22298
22299 /**
22300  * Processes a transaction that was reorganized out of the chain.
22301  *
22302  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
22303  * than blocks. See [`chain::Confirm`] for calling expectations.
22304  *
22305  * [`block_disconnected`]: Self::block_disconnected
22306  */
22307 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);
22308
22309 /**
22310  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
22311  * [`block_connected`] for details.
22312  *
22313  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
22314  * blocks. See [`chain::Confirm`] for calling expectations.
22315  *
22316  * [`block_connected`]: Self::block_connected
22317  */
22318 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);
22319
22320 /**
22321  * Returns the set of txids that should be monitored for re-organization out of the chain.
22322  */
22323 MUST_USE_RES struct LDKCVec_C2Tuple_TxidBlockHashZZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
22324
22325 /**
22326  * Gets the latest best block which was connected either via the [`chain::Listen`] or
22327  * [`chain::Confirm`] interfaces.
22328  */
22329 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
22330
22331 /**
22332  * Gets the balances in this channel which are either claimable by us if we were to
22333  * force-close the channel now or which are claimable on-chain (possibly awaiting
22334  * confirmation).
22335  *
22336  * Any balances in the channel which are available on-chain (excluding on-chain fees) are
22337  * included here until an [`Event::SpendableOutputs`] event has been generated for the
22338  * balance, or until our counterparty has claimed the balance and accrued several
22339  * confirmations on the claim transaction.
22340  *
22341  * Note that for `ChannelMonitors` which track a channel which went on-chain with versions of
22342  * LDK prior to 0.0.111, balances may not be fully captured if our counterparty broadcasted
22343  * a revoked state.
22344  *
22345  * See [`Balance`] for additional details on the types of claimable balances which
22346  * may be returned here and their meanings.
22347  */
22348 MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
22349
22350 /**
22351  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
22352  */
22353 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKEntropySource *NONNULL_PTR arg_a, const struct LDKSignerProvider *NONNULL_PTR arg_b);
22354
22355 /**
22356  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
22357  */
22358 void OutPoint_free(struct LDKOutPoint this_obj);
22359
22360 /**
22361  * The referenced transaction's txid.
22362  */
22363 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
22364
22365 /**
22366  * The referenced transaction's txid.
22367  */
22368 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22369
22370 /**
22371  * The index of the referenced output in its transaction's vout.
22372  */
22373 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
22374
22375 /**
22376  * The index of the referenced output in its transaction's vout.
22377  */
22378 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
22379
22380 /**
22381  * Constructs a new OutPoint given each field
22382  */
22383 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
22384
22385 /**
22386  * Creates a copy of the OutPoint
22387  */
22388 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
22389
22390 /**
22391  * Checks if two OutPoints contain equal inner contents.
22392  * This ignores pointers and is_owned flags and looks at the values in fields.
22393  * Two objects with NULL inner values will be considered "equal" here.
22394  */
22395 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
22396
22397 /**
22398  * Checks if two OutPoints contain equal inner contents.
22399  */
22400 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
22401
22402 /**
22403  * Convert an `OutPoint` to a lightning channel id.
22404  */
22405 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
22406
22407 /**
22408  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
22409  */
22410 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
22411
22412 /**
22413  * Read a OutPoint from a byte array, created by OutPoint_write
22414  */
22415 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
22416
22417 /**
22418  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
22419  */
22420 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
22421
22422 /**
22423  * The outpoint which is spendable.
22424  */
22425 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
22426
22427 /**
22428  * The outpoint which is spendable.
22429  */
22430 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
22431
22432 /**
22433  * Per commitment point to derive the delayed payment key by key holder.
22434  */
22435 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
22436
22437 /**
22438  * Per commitment point to derive the delayed payment key by key holder.
22439  */
22440 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22441
22442 /**
22443  * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in
22444  * the witness_script.
22445  */
22446 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
22447
22448 /**
22449  * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in
22450  * the witness_script.
22451  */
22452 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
22453
22454 /**
22455  * The output which is referenced by the given outpoint.
22456  *
22457  * Returns a copy of the field.
22458  */
22459 struct LDKTxOut DelayedPaymentOutputDescriptor_get_output(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
22460
22461 /**
22462  * The output which is referenced by the given outpoint.
22463  */
22464 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
22465
22466 /**
22467  * The revocation point specific to the commitment transaction which was broadcast. Used to
22468  * derive the witnessScript for this output.
22469  */
22470 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
22471
22472 /**
22473  * The revocation point specific to the commitment transaction which was broadcast. Used to
22474  * derive the witnessScript for this output.
22475  */
22476 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22477
22478 /**
22479  * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`].
22480  * This may be useful in re-deriving keys used in the channel to spend the output.
22481  */
22482 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
22483
22484 /**
22485  * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`].
22486  * This may be useful in re-deriving keys used in the channel to spend the output.
22487  */
22488 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22489
22490 /**
22491  * The value of the channel which this output originated from, possibly indirectly.
22492  */
22493 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
22494
22495 /**
22496  * The value of the channel which this output originated from, possibly indirectly.
22497  */
22498 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
22499
22500 /**
22501  * Constructs a new DelayedPaymentOutputDescriptor given each field
22502  */
22503 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);
22504
22505 /**
22506  * Creates a copy of the DelayedPaymentOutputDescriptor
22507  */
22508 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
22509
22510 /**
22511  * Checks if two DelayedPaymentOutputDescriptors contain equal inner contents.
22512  * This ignores pointers and is_owned flags and looks at the values in fields.
22513  * Two objects with NULL inner values will be considered "equal" here.
22514  */
22515 bool DelayedPaymentOutputDescriptor_eq(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR b);
22516
22517 /**
22518  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
22519  */
22520 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
22521
22522 /**
22523  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
22524  */
22525 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
22526
22527 /**
22528  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
22529  */
22530 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
22531
22532 /**
22533  * The outpoint which is spendable.
22534  */
22535 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
22536
22537 /**
22538  * The outpoint which is spendable.
22539  */
22540 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
22541
22542 /**
22543  * The output which is referenced by the given outpoint.
22544  *
22545  * Returns a copy of the field.
22546  */
22547 struct LDKTxOut StaticPaymentOutputDescriptor_get_output(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
22548
22549 /**
22550  * The output which is referenced by the given outpoint.
22551  */
22552 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
22553
22554 /**
22555  * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`].
22556  * This may be useful in re-deriving keys used in the channel to spend the output.
22557  */
22558 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
22559
22560 /**
22561  * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`].
22562  * This may be useful in re-deriving keys used in the channel to spend the output.
22563  */
22564 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22565
22566 /**
22567  * The value of the channel which this transactions spends.
22568  */
22569 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
22570
22571 /**
22572  * The value of the channel which this transactions spends.
22573  */
22574 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
22575
22576 /**
22577  * Constructs a new StaticPaymentOutputDescriptor given each field
22578  */
22579 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);
22580
22581 /**
22582  * Creates a copy of the StaticPaymentOutputDescriptor
22583  */
22584 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
22585
22586 /**
22587  * Checks if two StaticPaymentOutputDescriptors contain equal inner contents.
22588  * This ignores pointers and is_owned flags and looks at the values in fields.
22589  * Two objects with NULL inner values will be considered "equal" here.
22590  */
22591 bool StaticPaymentOutputDescriptor_eq(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR b);
22592
22593 /**
22594  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
22595  */
22596 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
22597
22598 /**
22599  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
22600  */
22601 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
22602
22603 /**
22604  * Frees any resources used by the SpendableOutputDescriptor
22605  */
22606 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
22607
22608 /**
22609  * Creates a copy of the SpendableOutputDescriptor
22610  */
22611 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
22612
22613 /**
22614  * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
22615  */
22616 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output);
22617
22618 /**
22619  * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
22620  */
22621 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a);
22622
22623 /**
22624  * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
22625  */
22626 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
22627
22628 /**
22629  * Checks if two SpendableOutputDescriptors contain equal inner contents.
22630  * This ignores pointers and is_owned flags and looks at the values in fields.
22631  */
22632 bool SpendableOutputDescriptor_eq(const struct LDKSpendableOutputDescriptor *NONNULL_PTR a, const struct LDKSpendableOutputDescriptor *NONNULL_PTR b);
22633
22634 /**
22635  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
22636  */
22637 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
22638
22639 /**
22640  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
22641  */
22642 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
22643
22644 /**
22645  * Calls the free function if one is set
22646  */
22647 void ChannelSigner_free(struct LDKChannelSigner this_ptr);
22648
22649 /**
22650  * Calls the free function if one is set
22651  */
22652 void EcdsaChannelSigner_free(struct LDKEcdsaChannelSigner this_ptr);
22653
22654 /**
22655  * Calls the free function if one is set
22656  */
22657 void WriteableEcdsaChannelSigner_free(struct LDKWriteableEcdsaChannelSigner this_ptr);
22658
22659 /**
22660  * Creates a copy of the Recipient
22661  */
22662 enum LDKRecipient Recipient_clone(const enum LDKRecipient *NONNULL_PTR orig);
22663
22664 /**
22665  * Utility method to constructs a new Node-variant Recipient
22666  */
22667 enum LDKRecipient Recipient_node(void);
22668
22669 /**
22670  * Utility method to constructs a new PhantomNode-variant Recipient
22671  */
22672 enum LDKRecipient Recipient_phantom_node(void);
22673
22674 /**
22675  * Calls the free function if one is set
22676  */
22677 void EntropySource_free(struct LDKEntropySource this_ptr);
22678
22679 /**
22680  * Calls the free function if one is set
22681  */
22682 void NodeSigner_free(struct LDKNodeSigner this_ptr);
22683
22684 /**
22685  * Calls the free function if one is set
22686  */
22687 void SignerProvider_free(struct LDKSignerProvider this_ptr);
22688
22689 /**
22690  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
22691  */
22692 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
22693
22694 /**
22695  * Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the
22696  * holder's anchor output in a commitment transaction, if one is present.
22697  */
22698 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
22699
22700 /**
22701  * Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the
22702  * holder's anchor output in a commitment transaction, if one is present.
22703  */
22704 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
22705
22706 /**
22707  * Holder secret key for blinded revocation pubkey.
22708  */
22709 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
22710
22711 /**
22712  * Holder secret key for blinded revocation pubkey.
22713  */
22714 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
22715
22716 /**
22717  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions.
22718  */
22719 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
22720
22721 /**
22722  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions.
22723  */
22724 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
22725
22726 /**
22727  * Holder secret key used in an HTLC transaction.
22728  */
22729 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
22730
22731 /**
22732  * Holder secret key used in an HTLC transaction.
22733  */
22734 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
22735
22736 /**
22737  * Holder HTLC secret key used in commitment transaction HTLC outputs.
22738  */
22739 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
22740
22741 /**
22742  * Holder HTLC secret key used in commitment transaction HTLC outputs.
22743  */
22744 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
22745
22746 /**
22747  * Commitment seed.
22748  */
22749 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
22750
22751 /**
22752  * Commitment seed.
22753  */
22754 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22755
22756 /**
22757  * Creates a copy of the InMemorySigner
22758  */
22759 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
22760
22761 /**
22762  * Creates a new [`InMemorySigner`].
22763  */
22764 MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id);
22765
22766 /**
22767  * Returns the counterparty's pubkeys.
22768  *
22769  * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
22770  */
22771 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
22772
22773 /**
22774  * Returns the `contest_delay` value specified by our counterparty and applied on holder-broadcastable
22775  * transactions, i.e., the amount of time that we have to wait to recover our funds if we
22776  * broadcast a transaction.
22777  *
22778  * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
22779  */
22780 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
22781
22782 /**
22783  * Returns the `contest_delay` value specified by us and applied on transactions broadcastable
22784  * by our counterparty, i.e., the amount of time that they have to wait to recover their funds
22785  * if they broadcast a transaction.
22786  *
22787  * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
22788  */
22789 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
22790
22791 /**
22792  * Returns whether the holder is the initiator.
22793  *
22794  * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
22795  */
22796 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
22797
22798 /**
22799  * Funding outpoint
22800  *
22801  * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
22802  */
22803 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
22804
22805 /**
22806  * Returns a [`ChannelTransactionParameters`] for this channel, to be used when verifying or
22807  * building transactions.
22808  *
22809  * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
22810  */
22811 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
22812
22813 /**
22814  * Returns whether anchors should be used.
22815  *
22816  * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before.
22817  */
22818 MUST_USE_RES bool InMemorySigner_opt_anchors(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
22819
22820 /**
22821  * Sign the single input of `spend_tx` at index `input_idx`, which spends the output described
22822  * by `descriptor`, returning the witness stack for the input.
22823  *
22824  * Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`,
22825  * is not spending the outpoint described by [`descriptor.outpoint`],
22826  * or if an output descriptor `script_pubkey` does not match the one we can spend.
22827  *
22828  * [`descriptor.outpoint`]: StaticPaymentOutputDescriptor::outpoint
22829  */
22830 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);
22831
22832 /**
22833  * Sign the single input of `spend_tx` at index `input_idx` which spends the output
22834  * described by `descriptor`, returning the witness stack for the input.
22835  *
22836  * Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`,
22837  * is not spending the outpoint described by [`descriptor.outpoint`], does not have a
22838  * sequence set to [`descriptor.to_self_delay`], or if an output descriptor
22839  * `script_pubkey` does not match the one we can spend.
22840  *
22841  * [`descriptor.outpoint`]: DelayedPaymentOutputDescriptor::outpoint
22842  * [`descriptor.to_self_delay`]: DelayedPaymentOutputDescriptor::to_self_delay
22843  */
22844 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);
22845
22846 /**
22847  * Constructs a new ChannelSigner which calls the relevant methods on this_arg.
22848  * This copies the `inner` pointer in this_arg and thus the returned ChannelSigner must be freed before this_arg is
22849  */
22850 struct LDKChannelSigner InMemorySigner_as_ChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
22851
22852 /**
22853  * Constructs a new EcdsaChannelSigner which calls the relevant methods on this_arg.
22854  * This copies the `inner` pointer in this_arg and thus the returned EcdsaChannelSigner must be freed before this_arg is
22855  */
22856 struct LDKEcdsaChannelSigner InMemorySigner_as_EcdsaChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
22857
22858 /**
22859  * Constructs a new WriteableEcdsaChannelSigner which calls the relevant methods on this_arg.
22860  * This copies the `inner` pointer in this_arg and thus the returned WriteableEcdsaChannelSigner must be freed before this_arg is
22861  */
22862 struct LDKWriteableEcdsaChannelSigner InMemorySigner_as_WriteableEcdsaChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
22863
22864 /**
22865  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
22866  */
22867 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
22868
22869 /**
22870  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
22871  */
22872 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
22873
22874 /**
22875  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
22876  */
22877 void KeysManager_free(struct LDKKeysManager this_obj);
22878
22879 /**
22880  * Constructs a [`KeysManager`] from a 32-byte seed. If the seed is in some way biased (e.g.,
22881  * your CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
22882  * `starting_time` isn't strictly required to actually be a time, but it must absolutely,
22883  * without a doubt, be unique to this instance. ie if you start multiple times with the same
22884  * `seed`, `starting_time` must be unique to each run. Thus, the easiest way to achieve this
22885  * is to simply use the current time (with very high precision).
22886  *
22887  * The `seed` MUST be backed up safely prior to use so that the keys can be re-created, however,
22888  * obviously, `starting_time` should be unique every time you reload the library - it is only
22889  * used to generate new ephemeral key data (which will be stored by the individual channel if
22890  * necessary).
22891  *
22892  * Note that the seed is required to recover certain on-chain funds independent of
22893  * [`ChannelMonitor`] data, though a current copy of [`ChannelMonitor`] data is also required
22894  * for any channel, and some on-chain during-closing funds.
22895  *
22896  * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
22897  */
22898 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
22899
22900 /**
22901  * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc.
22902  */
22903 MUST_USE_RES struct LDKSecretKey KeysManager_get_node_secret_key(const struct LDKKeysManager *NONNULL_PTR this_arg);
22904
22905 /**
22906  * Derive an old [`WriteableEcdsaChannelSigner`] containing per-channel secrets based on a key derivation parameters.
22907  */
22908 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]);
22909
22910 /**
22911  * Creates a [`Transaction`] which spends the given descriptors to the given outputs, plus an
22912  * output to the given change destination (if sufficient change value remains). The
22913  * transaction will have a feerate, at least, of the given value.
22914  *
22915  * Returns `Err(())` if the output value is greater than the input value minus required fee,
22916  * if a descriptor was duplicated, or if an output descriptor `script_pubkey`
22917  * does not match the one we can spend.
22918  *
22919  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
22920  *
22921  * May panic if the [`SpendableOutputDescriptor`]s were not generated by channels which used
22922  * this [`KeysManager`] or one of the [`InMemorySigner`] created by this [`KeysManager`].
22923  */
22924 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);
22925
22926 /**
22927  * Constructs a new EntropySource which calls the relevant methods on this_arg.
22928  * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is
22929  */
22930 struct LDKEntropySource KeysManager_as_EntropySource(const struct LDKKeysManager *NONNULL_PTR this_arg);
22931
22932 /**
22933  * Constructs a new NodeSigner which calls the relevant methods on this_arg.
22934  * This copies the `inner` pointer in this_arg and thus the returned NodeSigner must be freed before this_arg is
22935  */
22936 struct LDKNodeSigner KeysManager_as_NodeSigner(const struct LDKKeysManager *NONNULL_PTR this_arg);
22937
22938 /**
22939  * Constructs a new SignerProvider which calls the relevant methods on this_arg.
22940  * This copies the `inner` pointer in this_arg and thus the returned SignerProvider must be freed before this_arg is
22941  */
22942 struct LDKSignerProvider KeysManager_as_SignerProvider(const struct LDKKeysManager *NONNULL_PTR this_arg);
22943
22944 /**
22945  * Frees any resources used by the PhantomKeysManager, if is_owned is set and inner is non-NULL.
22946  */
22947 void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj);
22948
22949 /**
22950  * Constructs a new EntropySource which calls the relevant methods on this_arg.
22951  * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is
22952  */
22953 struct LDKEntropySource PhantomKeysManager_as_EntropySource(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
22954
22955 /**
22956  * Constructs a new NodeSigner which calls the relevant methods on this_arg.
22957  * This copies the `inner` pointer in this_arg and thus the returned NodeSigner must be freed before this_arg is
22958  */
22959 struct LDKNodeSigner PhantomKeysManager_as_NodeSigner(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
22960
22961 /**
22962  * Constructs a new SignerProvider which calls the relevant methods on this_arg.
22963  * This copies the `inner` pointer in this_arg and thus the returned SignerProvider must be freed before this_arg is
22964  */
22965 struct LDKSignerProvider PhantomKeysManager_as_SignerProvider(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
22966
22967 /**
22968  * Constructs a [`PhantomKeysManager`] given a 32-byte seed and an additional `cross_node_seed`
22969  * that is shared across all nodes that intend to participate in [phantom node payments]
22970  * together.
22971  *
22972  * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and
22973  * `starting_time_nanos`.
22974  *
22975  * `cross_node_seed` must be the same across all phantom payment-receiving nodes and also the
22976  * same across restarts, or else inbound payments may fail.
22977  *
22978  * [phantom node payments]: PhantomKeysManager
22979  */
22980 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]);
22981
22982 /**
22983  * See [`KeysManager::spend_spendable_outputs`] for documentation on this method.
22984  */
22985 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);
22986
22987 /**
22988  * See [`KeysManager::derive_channel_keys`] for documentation on this method.
22989  */
22990 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]);
22991
22992 /**
22993  * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc.
22994  */
22995 MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
22996
22997 /**
22998  * Gets the \"node_id\" secret key of the phantom node used to sign invoices, decode the
22999  * last-hop onion data, etc.
23000  */
23001 MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_phantom_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
23002
23003 /**
23004  * Creates a copy of the FailureCode
23005  */
23006 enum LDKFailureCode FailureCode_clone(const enum LDKFailureCode *NONNULL_PTR orig);
23007
23008 /**
23009  * Utility method to constructs a new TemporaryNodeFailure-variant FailureCode
23010  */
23011 enum LDKFailureCode FailureCode_temporary_node_failure(void);
23012
23013 /**
23014  * Utility method to constructs a new RequiredNodeFeatureMissing-variant FailureCode
23015  */
23016 enum LDKFailureCode FailureCode_required_node_feature_missing(void);
23017
23018 /**
23019  * Utility method to constructs a new IncorrectOrUnknownPaymentDetails-variant FailureCode
23020  */
23021 enum LDKFailureCode FailureCode_incorrect_or_unknown_payment_details(void);
23022
23023 /**
23024  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
23025  */
23026 void ChannelManager_free(struct LDKChannelManager this_obj);
23027
23028 /**
23029  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
23030  */
23031 void ChainParameters_free(struct LDKChainParameters this_obj);
23032
23033 /**
23034  * The network for determining the `chain_hash` in Lightning messages.
23035  */
23036 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
23037
23038 /**
23039  * The network for determining the `chain_hash` in Lightning messages.
23040  */
23041 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
23042
23043 /**
23044  * The hash and height of the latest block successfully connected.
23045  *
23046  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
23047  */
23048 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
23049
23050 /**
23051  * The hash and height of the latest block successfully connected.
23052  *
23053  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
23054  */
23055 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
23056
23057 /**
23058  * Constructs a new ChainParameters given each field
23059  */
23060 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
23061
23062 /**
23063  * Creates a copy of the ChainParameters
23064  */
23065 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
23066
23067 /**
23068  * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL.
23069  */
23070 void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
23071
23072 /**
23073  * Base routing fee in millisatoshis.
23074  */
23075 uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
23076
23077 /**
23078  * Base routing fee in millisatoshis.
23079  */
23080 void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
23081
23082 /**
23083  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
23084  */
23085 uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
23086
23087 /**
23088  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
23089  */
23090 void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
23091
23092 /**
23093  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
23094  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
23095  * `cltv_expiry_delta` for more details.
23096  */
23097 uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
23098
23099 /**
23100  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
23101  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
23102  * `cltv_expiry_delta` for more details.
23103  */
23104 void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
23105
23106 /**
23107  * Constructs a new CounterpartyForwardingInfo given each field
23108  */
23109 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);
23110
23111 /**
23112  * Creates a copy of the CounterpartyForwardingInfo
23113  */
23114 struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
23115
23116 /**
23117  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
23118  */
23119 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
23120
23121 /**
23122  * The node_id of our counterparty
23123  */
23124 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
23125
23126 /**
23127  * The node_id of our counterparty
23128  */
23129 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23130
23131 /**
23132  * The Features the channel counterparty provided upon last connection.
23133  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
23134  * many routing-relevant features are present in the init context.
23135  */
23136 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
23137
23138 /**
23139  * The Features the channel counterparty provided upon last connection.
23140  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
23141  * many routing-relevant features are present in the init context.
23142  */
23143 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
23144
23145 /**
23146  * The value, in satoshis, that must always be held in the channel for our counterparty. This
23147  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
23148  * claiming at least this value on chain.
23149  *
23150  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
23151  *
23152  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
23153  */
23154 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
23155
23156 /**
23157  * The value, in satoshis, that must always be held in the channel for our counterparty. This
23158  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
23159  * claiming at least this value on chain.
23160  *
23161  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
23162  *
23163  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
23164  */
23165 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
23166
23167 /**
23168  * Information on the fees and requirements that the counterparty requires when forwarding
23169  * payments to us through this channel.
23170  *
23171  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23172  */
23173 struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
23174
23175 /**
23176  * Information on the fees and requirements that the counterparty requires when forwarding
23177  * payments to us through this channel.
23178  *
23179  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23180  */
23181 void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
23182
23183 /**
23184  * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
23185  * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
23186  * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
23187  */
23188 struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_minimum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
23189
23190 /**
23191  * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
23192  * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
23193  * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
23194  */
23195 void ChannelCounterparty_set_outbound_htlc_minimum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
23196
23197 /**
23198  * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
23199  */
23200 struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_maximum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
23201
23202 /**
23203  * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
23204  */
23205 void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
23206
23207 /**
23208  * Constructs a new ChannelCounterparty given each field
23209  */
23210 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);
23211
23212 /**
23213  * Creates a copy of the ChannelCounterparty
23214  */
23215 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
23216
23217 /**
23218  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
23219  */
23220 void ChannelDetails_free(struct LDKChannelDetails this_obj);
23221
23222 /**
23223  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
23224  * thereafter this is the txid of the funding transaction xor the funding transaction output).
23225  * Note that this means this value is *not* persistent - it can change once during the
23226  * lifetime of the channel.
23227  */
23228 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
23229
23230 /**
23231  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
23232  * thereafter this is the txid of the funding transaction xor the funding transaction output).
23233  * Note that this means this value is *not* persistent - it can change once during the
23234  * lifetime of the channel.
23235  */
23236 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23237
23238 /**
23239  * Parameters which apply to our counterparty. See individual fields for more information.
23240  */
23241 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23242
23243 /**
23244  * Parameters which apply to our counterparty. See individual fields for more information.
23245  */
23246 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
23247
23248 /**
23249  * The Channel's funding transaction output, if we've negotiated the funding transaction with
23250  * our counterparty already.
23251  *
23252  * Note that, if this has been set, `channel_id` will be equivalent to
23253  * `funding_txo.unwrap().to_channel_id()`.
23254  *
23255  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23256  */
23257 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23258
23259 /**
23260  * The Channel's funding transaction output, if we've negotiated the funding transaction with
23261  * our counterparty already.
23262  *
23263  * Note that, if this has been set, `channel_id` will be equivalent to
23264  * `funding_txo.unwrap().to_channel_id()`.
23265  *
23266  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23267  */
23268 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
23269
23270 /**
23271  * The features which this channel operates with. See individual features for more info.
23272  *
23273  * `None` until negotiation completes and the channel type is finalized.
23274  *
23275  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23276  */
23277 struct LDKChannelTypeFeatures ChannelDetails_get_channel_type(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23278
23279 /**
23280  * The features which this channel operates with. See individual features for more info.
23281  *
23282  * `None` until negotiation completes and the channel type is finalized.
23283  *
23284  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23285  */
23286 void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
23287
23288 /**
23289  * The position of the funding transaction in the chain. None if the funding transaction has
23290  * not yet been confirmed and the channel fully opened.
23291  *
23292  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
23293  * payments instead of this. See [`get_inbound_payment_scid`].
23294  *
23295  * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
23296  * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
23297  *
23298  * [`inbound_scid_alias`]: Self::inbound_scid_alias
23299  * [`outbound_scid_alias`]: Self::outbound_scid_alias
23300  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
23301  * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
23302  * [`confirmations_required`]: Self::confirmations_required
23303  */
23304 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23305
23306 /**
23307  * The position of the funding transaction in the chain. None if the funding transaction has
23308  * not yet been confirmed and the channel fully opened.
23309  *
23310  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
23311  * payments instead of this. See [`get_inbound_payment_scid`].
23312  *
23313  * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
23314  * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
23315  *
23316  * [`inbound_scid_alias`]: Self::inbound_scid_alias
23317  * [`outbound_scid_alias`]: Self::outbound_scid_alias
23318  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
23319  * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
23320  * [`confirmations_required`]: Self::confirmations_required
23321  */
23322 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
23323
23324 /**
23325  * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
23326  * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
23327  * the channel has not yet been confirmed (as long as [`confirmations_required`] is
23328  * `Some(0)`).
23329  *
23330  * This will be `None` as long as the channel is not available for routing outbound payments.
23331  *
23332  * [`short_channel_id`]: Self::short_channel_id
23333  * [`confirmations_required`]: Self::confirmations_required
23334  */
23335 struct LDKCOption_u64Z ChannelDetails_get_outbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23336
23337 /**
23338  * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
23339  * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
23340  * the channel has not yet been confirmed (as long as [`confirmations_required`] is
23341  * `Some(0)`).
23342  *
23343  * This will be `None` as long as the channel is not available for routing outbound payments.
23344  *
23345  * [`short_channel_id`]: Self::short_channel_id
23346  * [`confirmations_required`]: Self::confirmations_required
23347  */
23348 void ChannelDetails_set_outbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
23349
23350 /**
23351  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
23352  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
23353  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
23354  * when they see a payment to be routed to us.
23355  *
23356  * Our counterparty may choose to rotate this value at any time, though will always recognize
23357  * previous values for inbound payment forwarding.
23358  *
23359  * [`short_channel_id`]: Self::short_channel_id
23360  */
23361 struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23362
23363 /**
23364  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
23365  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
23366  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
23367  * when they see a payment to be routed to us.
23368  *
23369  * Our counterparty may choose to rotate this value at any time, though will always recognize
23370  * previous values for inbound payment forwarding.
23371  *
23372  * [`short_channel_id`]: Self::short_channel_id
23373  */
23374 void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
23375
23376 /**
23377  * The value, in satoshis, of this channel as appears in the funding output
23378  */
23379 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23380
23381 /**
23382  * The value, in satoshis, of this channel as appears in the funding output
23383  */
23384 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
23385
23386 /**
23387  * The value, in satoshis, that must always be held in the channel for us. This value ensures
23388  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
23389  * this value on chain.
23390  *
23391  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
23392  *
23393  * This value will be `None` for outbound channels until the counterparty accepts the channel.
23394  *
23395  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
23396  */
23397 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23398
23399 /**
23400  * The value, in satoshis, that must always be held in the channel for us. This value ensures
23401  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
23402  * this value on chain.
23403  *
23404  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
23405  *
23406  * This value will be `None` for outbound channels until the counterparty accepts the channel.
23407  *
23408  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
23409  */
23410 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
23411
23412 /**
23413  * The `user_channel_id` passed in to create_channel, or a random value if the channel was
23414  * inbound. This may be zero for inbound channels serialized with LDK versions prior to
23415  * 0.0.113.
23416  */
23417 struct LDKU128 ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23418
23419 /**
23420  * The `user_channel_id` passed in to create_channel, or a random value if the channel was
23421  * inbound. This may be zero for inbound channels serialized with LDK versions prior to
23422  * 0.0.113.
23423  */
23424 void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKU128 val);
23425
23426 /**
23427  * Our total balance.  This is the amount we would get if we close the channel.
23428  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
23429  * amount is not likely to be recoverable on close.
23430  *
23431  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
23432  * balance is not available for inclusion in new outbound HTLCs). This further does not include
23433  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
23434  * This does not consider any on-chain fees.
23435  *
23436  * See also [`ChannelDetails::outbound_capacity_msat`]
23437  */
23438 uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23439
23440 /**
23441  * Our total balance.  This is the amount we would get if we close the channel.
23442  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
23443  * amount is not likely to be recoverable on close.
23444  *
23445  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
23446  * balance is not available for inclusion in new outbound HTLCs). This further does not include
23447  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
23448  * This does not consider any on-chain fees.
23449  *
23450  * See also [`ChannelDetails::outbound_capacity_msat`]
23451  */
23452 void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
23453
23454 /**
23455  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
23456  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
23457  * available for inclusion in new outbound HTLCs). This further does not include any pending
23458  * outgoing HTLCs which are awaiting some other resolution to be sent.
23459  *
23460  * See also [`ChannelDetails::balance_msat`]
23461  *
23462  * This value is not exact. Due to various in-flight changes, feerate changes, and our
23463  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
23464  * should be able to spend nearly this amount.
23465  */
23466 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23467
23468 /**
23469  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
23470  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
23471  * available for inclusion in new outbound HTLCs). This further does not include any pending
23472  * outgoing HTLCs which are awaiting some other resolution to be sent.
23473  *
23474  * See also [`ChannelDetails::balance_msat`]
23475  *
23476  * This value is not exact. Due to various in-flight changes, feerate changes, and our
23477  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
23478  * should be able to spend nearly this amount.
23479  */
23480 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
23481
23482 /**
23483  * The available outbound capacity for sending a single HTLC to the remote peer. This is
23484  * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
23485  * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
23486  * to use a limit as close as possible to the HTLC limit we can currently send.
23487  *
23488  * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
23489  */
23490 uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23491
23492 /**
23493  * The available outbound capacity for sending a single HTLC to the remote peer. This is
23494  * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
23495  * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
23496  * to use a limit as close as possible to the HTLC limit we can currently send.
23497  *
23498  * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
23499  */
23500 void ChannelDetails_set_next_outbound_htlc_limit_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
23501
23502 /**
23503  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
23504  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
23505  * available for inclusion in new inbound HTLCs).
23506  * Note that there are some corner cases not fully handled here, so the actual available
23507  * inbound capacity may be slightly higher than this.
23508  *
23509  * This value is not exact. Due to various in-flight changes, feerate changes, and our
23510  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
23511  * However, our counterparty should be able to spend nearly this amount.
23512  */
23513 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23514
23515 /**
23516  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
23517  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
23518  * available for inclusion in new inbound HTLCs).
23519  * Note that there are some corner cases not fully handled here, so the actual available
23520  * inbound capacity may be slightly higher than this.
23521  *
23522  * This value is not exact. Due to various in-flight changes, feerate changes, and our
23523  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
23524  * However, our counterparty should be able to spend nearly this amount.
23525  */
23526 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
23527
23528 /**
23529  * The number of required confirmations on the funding transaction before the funding will be
23530  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
23531  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
23532  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
23533  * [`ChannelHandshakeLimits::max_minimum_depth`].
23534  *
23535  * This value will be `None` for outbound channels until the counterparty accepts the channel.
23536  *
23537  * [`is_outbound`]: ChannelDetails::is_outbound
23538  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
23539  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
23540  */
23541 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23542
23543 /**
23544  * The number of required confirmations on the funding transaction before the funding will be
23545  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
23546  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
23547  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
23548  * [`ChannelHandshakeLimits::max_minimum_depth`].
23549  *
23550  * This value will be `None` for outbound channels until the counterparty accepts the channel.
23551  *
23552  * [`is_outbound`]: ChannelDetails::is_outbound
23553  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
23554  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
23555  */
23556 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
23557
23558 /**
23559  * The current number of confirmations on the funding transaction.
23560  *
23561  * This value will be `None` for objects serialized with LDK versions prior to 0.0.113.
23562  */
23563 struct LDKCOption_u32Z ChannelDetails_get_confirmations(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23564
23565 /**
23566  * The current number of confirmations on the funding transaction.
23567  *
23568  * This value will be `None` for objects serialized with LDK versions prior to 0.0.113.
23569  */
23570 void ChannelDetails_set_confirmations(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
23571
23572 /**
23573  * The number of blocks (after our commitment transaction confirms) that we will need to wait
23574  * until we can claim our funds after we force-close the channel. During this time our
23575  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
23576  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
23577  * time to claim our non-HTLC-encumbered funds.
23578  *
23579  * This value will be `None` for outbound channels until the counterparty accepts the channel.
23580  */
23581 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23582
23583 /**
23584  * The number of blocks (after our commitment transaction confirms) that we will need to wait
23585  * until we can claim our funds after we force-close the channel. During this time our
23586  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
23587  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
23588  * time to claim our non-HTLC-encumbered funds.
23589  *
23590  * This value will be `None` for outbound channels until the counterparty accepts the channel.
23591  */
23592 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
23593
23594 /**
23595  * True if the channel was initiated (and thus funded) by us.
23596  */
23597 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23598
23599 /**
23600  * True if the channel was initiated (and thus funded) by us.
23601  */
23602 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
23603
23604 /**
23605  * True if the channel is confirmed, channel_ready messages have been exchanged, and the
23606  * channel is not currently being shut down. `channel_ready` message exchange implies the
23607  * required confirmation count has been reached (and we were connected to the peer at some
23608  * point after the funding transaction received enough confirmations). The required
23609  * confirmation count is provided in [`confirmations_required`].
23610  *
23611  * [`confirmations_required`]: ChannelDetails::confirmations_required
23612  */
23613 bool ChannelDetails_get_is_channel_ready(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23614
23615 /**
23616  * True if the channel is confirmed, channel_ready messages have been exchanged, and the
23617  * channel is not currently being shut down. `channel_ready` message exchange implies the
23618  * required confirmation count has been reached (and we were connected to the peer at some
23619  * point after the funding transaction received enough confirmations). The required
23620  * confirmation count is provided in [`confirmations_required`].
23621  *
23622  * [`confirmations_required`]: ChannelDetails::confirmations_required
23623  */
23624 void ChannelDetails_set_is_channel_ready(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
23625
23626 /**
23627  * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
23628  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
23629  *
23630  * This is a strict superset of `is_channel_ready`.
23631  */
23632 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23633
23634 /**
23635  * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
23636  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
23637  *
23638  * This is a strict superset of `is_channel_ready`.
23639  */
23640 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
23641
23642 /**
23643  * True if this channel is (or will be) publicly-announced.
23644  */
23645 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23646
23647 /**
23648  * True if this channel is (or will be) publicly-announced.
23649  */
23650 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
23651
23652 /**
23653  * The smallest value HTLC (in msat) we will accept, for this channel. This field
23654  * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
23655  */
23656 struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23657
23658 /**
23659  * The smallest value HTLC (in msat) we will accept, for this channel. This field
23660  * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
23661  */
23662 void ChannelDetails_set_inbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
23663
23664 /**
23665  * The largest value HTLC (in msat) we currently will accept, for this channel.
23666  */
23667 struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_maximum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23668
23669 /**
23670  * The largest value HTLC (in msat) we currently will accept, for this channel.
23671  */
23672 void ChannelDetails_set_inbound_htlc_maximum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
23673
23674 /**
23675  * Set of configurable parameters that affect channel operation.
23676  *
23677  * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
23678  *
23679  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23680  */
23681 struct LDKChannelConfig ChannelDetails_get_config(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
23682
23683 /**
23684  * Set of configurable parameters that affect channel operation.
23685  *
23686  * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
23687  *
23688  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23689  */
23690 void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
23691
23692 /**
23693  * Constructs a new ChannelDetails given each field
23694  */
23695 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);
23696
23697 /**
23698  * Creates a copy of the ChannelDetails
23699  */
23700 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
23701
23702 /**
23703  * Gets the current SCID which should be used to identify this channel for inbound payments.
23704  * This should be used for providing invoice hints or in any other context where our
23705  * counterparty will forward a payment to us.
23706  *
23707  * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the
23708  * [`ChannelDetails::short_channel_id`]. See those for more information.
23709  */
23710 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
23711
23712 /**
23713  * Gets the current SCID which should be used to identify this channel for outbound payments.
23714  * This should be used in [`Route`]s to describe the first hop or in other contexts where
23715  * we're sending or forwarding a payment outbound over this channel.
23716  *
23717  * This is either the [`ChannelDetails::short_channel_id`], if set, or the
23718  * [`ChannelDetails::outbound_scid_alias`]. See those for more information.
23719  */
23720 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
23721
23722 /**
23723  * Frees any resources used by the RecentPaymentDetails
23724  */
23725 void RecentPaymentDetails_free(struct LDKRecentPaymentDetails this_ptr);
23726
23727 /**
23728  * Creates a copy of the RecentPaymentDetails
23729  */
23730 struct LDKRecentPaymentDetails RecentPaymentDetails_clone(const struct LDKRecentPaymentDetails *NONNULL_PTR orig);
23731
23732 /**
23733  * Utility method to constructs a new Pending-variant RecentPaymentDetails
23734  */
23735 struct LDKRecentPaymentDetails RecentPaymentDetails_pending(struct LDKThirtyTwoBytes payment_hash, uint64_t total_msat);
23736
23737 /**
23738  * Utility method to constructs a new Fulfilled-variant RecentPaymentDetails
23739  */
23740 struct LDKRecentPaymentDetails RecentPaymentDetails_fulfilled(struct LDKThirtyTwoBytes payment_hash);
23741
23742 /**
23743  * Utility method to constructs a new Abandoned-variant RecentPaymentDetails
23744  */
23745 struct LDKRecentPaymentDetails RecentPaymentDetails_abandoned(struct LDKThirtyTwoBytes payment_hash);
23746
23747 /**
23748  * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL.
23749  */
23750 void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj);
23751
23752 /**
23753  * The list of channels to be included in the invoice route hints.
23754  */
23755 struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
23756
23757 /**
23758  * The list of channels to be included in the invoice route hints.
23759  */
23760 void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val);
23761
23762 /**
23763  * A fake scid used for representing the phantom node's fake channel in generating the invoice
23764  * route hints.
23765  */
23766 uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
23767
23768 /**
23769  * A fake scid used for representing the phantom node's fake channel in generating the invoice
23770  * route hints.
23771  */
23772 void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val);
23773
23774 /**
23775  * The pubkey of the real backing node that would ultimately receive the payment.
23776  */
23777 struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
23778
23779 /**
23780  * The pubkey of the real backing node that would ultimately receive the payment.
23781  */
23782 void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23783
23784 /**
23785  * Constructs a new PhantomRouteHints given each field
23786  */
23787 MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg);
23788
23789 /**
23790  * Creates a copy of the PhantomRouteHints
23791  */
23792 struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig);
23793
23794 /**
23795  * Constructs a new ChannelManager to hold several channels and route between them.
23796  *
23797  * This is the main \"logic hub\" for all channel-related actions, and implements
23798  * ChannelMessageHandler.
23799  *
23800  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
23801  *
23802  * Users need to notify the new ChannelManager when a new block is connected or
23803  * disconnected using its `block_connected` and `block_disconnected` methods, starting
23804  * from after `params.latest_hash`.
23805  */
23806 MUST_USE_RES struct LDKChannelManager ChannelManager_new(struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKRouter router, struct LDKLogger logger, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKSignerProvider signer_provider, struct LDKUserConfig config, struct LDKChainParameters params);
23807
23808 /**
23809  * Gets the current configuration applied to all new channels.
23810  */
23811 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
23812
23813 /**
23814  * Creates a new outbound channel to the given remote node and with the given value.
23815  *
23816  * `user_channel_id` will be provided back as in
23817  * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
23818  * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to a
23819  * randomized value for inbound channels. `user_channel_id` has no meaning inside of LDK, it
23820  * is simply copied to events and otherwise ignored.
23821  *
23822  * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
23823  * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
23824  *
23825  * Note that we do not check if you are currently connected to the given peer. If no
23826  * connection is available, the outbound `open_channel` message may fail to send, resulting in
23827  * the channel eventually being silently forgotten (dropped on reload).
23828  *
23829  * Returns the new Channel's temporary `channel_id`. This ID will appear as
23830  * [`Event::FundingGenerationReady::temporary_channel_id`] and in
23831  * [`ChannelDetails::channel_id`] until after
23832  * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
23833  * one derived from the funding transaction's TXID. If the counterparty rejects the channel
23834  * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
23835  *
23836  * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
23837  * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
23838  * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
23839  *
23840  * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
23841  */
23842 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);
23843
23844 /**
23845  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
23846  * more information.
23847  */
23848 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
23849
23850 /**
23851  * Gets the list of usable channels, in random order. Useful as an argument to
23852  * [`Router::find_route`] to ensure non-announced channels are used.
23853  *
23854  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
23855  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
23856  * are.
23857  */
23858 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
23859
23860 /**
23861  * Returns in an undefined order recent payments that -- if not fulfilled -- have yet to find a
23862  * successful path, or have unresolved HTLCs.
23863  *
23864  * This can be useful for payments that may have been prepared, but ultimately not sent, as a
23865  * result of a crash. If such a payment exists, is not listed here, and an
23866  * [`Event::PaymentSent`] has not been received, you may consider resending the payment.
23867  *
23868  * [`Event::PaymentSent`]: events::Event::PaymentSent
23869  */
23870 MUST_USE_RES struct LDKCVec_RecentPaymentDetailsZ ChannelManager_list_recent_payments(const struct LDKChannelManager *NONNULL_PTR this_arg);
23871
23872 /**
23873  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
23874  * will be accepted on the given channel, and after additional timeout/the closing of all
23875  * pending HTLCs, the channel will be closed on chain.
23876  *
23877  *  * If we are the channel initiator, we will pay between our [`Background`] and
23878  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
23879  *    estimate.
23880  *  * If our counterparty is the channel initiator, we will require a channel closing
23881  *    transaction feerate of at least our [`Background`] feerate or the feerate which
23882  *    would appear on a force-closure transaction, whichever is lower. We will allow our
23883  *    counterparty to pay as much fee as they'd like, however.
23884  *
23885  * May generate a SendShutdown message event on success, which should be relayed.
23886  *
23887  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
23888  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
23889  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
23890  */
23891 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);
23892
23893 /**
23894  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
23895  * will be accepted on the given channel, and after additional timeout/the closing of all
23896  * pending HTLCs, the channel will be closed on chain.
23897  *
23898  * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
23899  * the channel being closed or not:
23900  *  * If we are the channel initiator, we will pay at least this feerate on the closing
23901  *    transaction. The upper-bound is set by
23902  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
23903  *    estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
23904  *  * If our counterparty is the channel initiator, we will refuse to accept a channel closure
23905  *    transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
23906  *    will appear on a force-closure transaction, whichever is lower).
23907  *
23908  * May generate a SendShutdown message event on success, which should be relayed.
23909  *
23910  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
23911  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
23912  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
23913  */
23914 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);
23915
23916 /**
23917  * Force closes a channel, immediately broadcasting the latest local transaction(s) and
23918  * rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to
23919  * the manager, or if the `counterparty_node_id` isn't the counterparty of the corresponding
23920  * channel.
23921  */
23922 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);
23923
23924 /**
23925  * Force closes a channel, rejecting new HTLCs on the given channel but skips broadcasting
23926  * the latest local transaction(s). Fails if `channel_id` is unknown to the manager, or if the
23927  * `counterparty_node_id` isn't the counterparty of the corresponding channel.
23928  *
23929  * You can always get the latest local transaction(s) to broadcast from
23930  * [`ChannelMonitor::get_latest_holder_commitment_txn`].
23931  */
23932 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);
23933
23934 /**
23935  * Force close all channels, immediately broadcasting the latest local commitment transaction
23936  * for each to the chain and rejecting new HTLCs on each.
23937  */
23938 void ChannelManager_force_close_all_channels_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg);
23939
23940 /**
23941  * Force close all channels rejecting new HTLCs on each but without broadcasting the latest
23942  * local transaction(s).
23943  */
23944 void ChannelManager_force_close_all_channels_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg);
23945
23946 /**
23947  * Sends a payment along a given route.
23948  *
23949  * Value parameters are provided via the last hop in route, see documentation for [`RouteHop`]
23950  * fields for more info.
23951  *
23952  * May generate SendHTLCs message(s) event on success, which should be relayed (e.g. via
23953  * [`PeerManager::process_events`]).
23954  *
23955  * # Avoiding Duplicate Payments
23956  *
23957  * If a pending payment is currently in-flight with the same [`PaymentId`] provided, this
23958  * method will error with an [`APIError::InvalidRoute`]. Note, however, that once a payment
23959  * is no longer pending (either via [`ChannelManager::abandon_payment`], or handling of an
23960  * [`Event::PaymentSent`] or [`Event::PaymentFailed`]) LDK will not stop you from sending a
23961  * second payment with the same [`PaymentId`].
23962  *
23963  * Thus, in order to ensure duplicate payments are not sent, you should implement your own
23964  * tracking of payments, including state to indicate once a payment has completed. Because you
23965  * should also ensure that [`PaymentHash`]es are not re-used, for simplicity, you should
23966  * consider using the [`PaymentHash`] as the key for tracking payments. In that case, the
23967  * [`PaymentId`] should be a copy of the [`PaymentHash`] bytes.
23968  *
23969  * Additionally, in the scenario where we begin the process of sending a payment, but crash
23970  * before `send_payment` returns (or prior to [`ChannelMonitorUpdate`] persistence if you're
23971  * using [`ChannelMonitorUpdateStatus::InProgress`]), the payment may be lost on restart. See
23972  * [`ChannelManager::list_recent_payments`] for more information.
23973  *
23974  * # Possible Error States on [`PaymentSendFailure`]
23975  *
23976  * Each path may have a different return value, and PaymentSendValue may return a Vec with
23977  * each entry matching the corresponding-index entry in the route paths, see
23978  * [`PaymentSendFailure`] for more info.
23979  *
23980  * In general, a path may raise:
23981  *  * [`APIError::InvalidRoute`] when an invalid route or forwarding parameter (cltv_delta, fee,
23982  *    node public key) is specified.
23983  *  * [`APIError::ChannelUnavailable`] if the next-hop channel is not available for updates
23984  *    (including due to previous monitor update failure or new permanent monitor update
23985  *    failure).
23986  *  * [`APIError::MonitorUpdateInProgress`] if a new monitor update failure prevented sending the
23987  *    relevant updates.
23988  *
23989  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
23990  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
23991  * different route unless you intend to pay twice!
23992  *
23993  * # A caution on `payment_secret`
23994  *
23995  * `payment_secret` is unrelated to `payment_hash` (or [`PaymentPreimage`]) and exists to
23996  * authenticate the sender to the recipient and prevent payment-probing (deanonymization)
23997  * attacks. For newer nodes, it will be provided to you in the invoice. If you do not have one,
23998  * the [`Route`] must not contain multiple paths as multi-path payments require a
23999  * recipient-provided `payment_secret`.
24000  *
24001  * If a `payment_secret` *is* provided, we assume that the invoice had the payment_secret
24002  * feature bit set (either as required or as available). If multiple paths are present in the
24003  * [`Route`], we assume the invoice had the basic_mpp feature set.
24004  *
24005  * [`Event::PaymentSent`]: events::Event::PaymentSent
24006  * [`Event::PaymentFailed`]: events::Event::PaymentFailed
24007  * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
24008  * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress
24009  *
24010  * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
24011  */
24012 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);
24013
24014 /**
24015  * Similar to [`ChannelManager::send_payment`], but will automatically find a route based on
24016  * `route_params` and retry failed payment paths based on `retry_strategy`.
24017  *
24018  * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
24019  */
24020 MUST_USE_RES struct LDKCResult_NoneRetryableSendFailureZ ChannelManager_send_payment_with_retry(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy);
24021
24022 /**
24023  * Signals that no further retries for the given payment should occur. Useful if you have a
24024  * pending outbound payment with retries remaining, but wish to stop retrying the payment before
24025  * retries are exhausted.
24026  *
24027  * If no [`Event::PaymentFailed`] event had been generated before, one will be generated as soon
24028  * as there are no remaining pending HTLCs for this payment.
24029  *
24030  * Note that calling this method does *not* prevent a payment from succeeding. You must still
24031  * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
24032  * determine the ultimate status of a payment.
24033  *
24034  * If an [`Event::PaymentFailed`] event is generated and we restart without this
24035  * [`ChannelManager`] having been persisted, another [`Event::PaymentFailed`] may be generated.
24036  *
24037  * [`Event::PaymentFailed`]: events::Event::PaymentFailed
24038  * [`Event::PaymentSent`]: events::Event::PaymentSent
24039  */
24040 void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id);
24041
24042 /**
24043  * Send a spontaneous payment, which is a payment that does not require the recipient to have
24044  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
24045  * the preimage, it must be a cryptographically secure random value that no intermediate node
24046  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
24047  * never reach the recipient.
24048  *
24049  * See [`send_payment`] documentation for more details on the return value of this function
24050  * and idempotency guarantees provided by the [`PaymentId`] key.
24051  *
24052  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
24053  * [`send_payment`] for more information about the risks of duplicate preimage usage.
24054  *
24055  * Note that `route` must have exactly one path.
24056  *
24057  * [`send_payment`]: Self::send_payment
24058  *
24059  * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
24060  */
24061 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);
24062
24063 /**
24064  * Similar to [`ChannelManager::send_spontaneous_payment`], but will automatically find a route
24065  * based on `route_params` and retry failed payment paths based on `retry_strategy`.
24066  *
24067  * See [`PaymentParameters::for_keysend`] for help in constructing `route_params` for spontaneous
24068  * payments.
24069  *
24070  * [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend
24071  *
24072  * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
24073  */
24074 MUST_USE_RES struct LDKCResult_PaymentHashRetryableSendFailureZ ChannelManager_send_spontaneous_payment_with_retry(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy);
24075
24076 /**
24077  * Send a payment that is probing the given route for liquidity. We calculate the
24078  * [`PaymentHash`] of probes based on a static secret and a random [`PaymentId`], which allows
24079  * us to easily discern them from real payments.
24080  */
24081 MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCVec_RouteHopZ hops);
24082
24083 /**
24084  * Call this upon creation of a funding transaction for the given channel.
24085  *
24086  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
24087  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
24088  *
24089  * Returns [`APIError::APIMisuseError`] if the funding transaction is not final for propagation
24090  * across the p2p network.
24091  *
24092  * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided
24093  * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`].
24094  *
24095  * May panic if the output found in the funding transaction is duplicative with some other
24096  * channel (note that this should be trivially prevented by using unique funding transaction
24097  * keys per-channel).
24098  *
24099  * Do NOT broadcast the funding transaction yourself. When we have safely received our
24100  * counterparty's signature the funding transaction will automatically be broadcast via the
24101  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
24102  *
24103  * Note that this includes RBF or similar transaction replacement strategies - lightning does
24104  * not currently support replacing a funding transaction on an existing channel. Instead,
24105  * create a new channel with a conflicting funding transaction.
24106  *
24107  * Note to keep the miner incentives aligned in moving the blockchain forward, we recommend
24108  * the wallet software generating the funding transaction to apply anti-fee sniping as
24109  * implemented by Bitcoin Core wallet. See <https://bitcoinops.org/en/topics/fee-sniping/>
24110  * for more details.
24111  *
24112  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
24113  * [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed
24114  */
24115 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);
24116
24117 /**
24118  * Atomically updates the [`ChannelConfig`] for the given channels.
24119  *
24120  * Once the updates are applied, each eligible channel (advertised with a known short channel
24121  * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`],
24122  * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated
24123  * containing the new [`ChannelUpdate`] message which should be broadcast to the network.
24124  *
24125  * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect
24126  * `counterparty_node_id` is provided.
24127  *
24128  * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value
24129  * below [`MIN_CLTV_EXPIRY_DELTA`].
24130  *
24131  * If an error is returned, none of the updates should be considered applied.
24132  *
24133  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
24134  * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat
24135  * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta
24136  * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate
24137  * [`ChannelUpdate`]: msgs::ChannelUpdate
24138  * [`ChannelUnavailable`]: APIError::ChannelUnavailable
24139  * [`APIMisuseError`]: APIError::APIMisuseError
24140  */
24141 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);
24142
24143 /**
24144  * Attempts to forward an intercepted HTLC over the provided channel id and with the provided
24145  * amount to forward. Should only be called in response to an [`HTLCIntercepted`] event.
24146  *
24147  * Intercepted HTLCs can be useful for Lightning Service Providers (LSPs) to open a just-in-time
24148  * channel to a receiving node if the node lacks sufficient inbound liquidity.
24149  *
24150  * To make use of intercepted HTLCs, set [`UserConfig::accept_intercept_htlcs`] and use
24151  * [`ChannelManager::get_intercept_scid`] to generate short channel id(s) to put in the
24152  * receiver's invoice route hints. These route hints will signal to LDK to generate an
24153  * [`HTLCIntercepted`] event when it receives the forwarded HTLC, and this method or
24154  * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to the event.
24155  *
24156  * Note that LDK does not enforce fee requirements in `amt_to_forward_msat`, and will not stop
24157  * you from forwarding more than you received.
24158  *
24159  * Errors if the event was not handled in time, in which case the HTLC was automatically failed
24160  * backwards.
24161  *
24162  * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
24163  * [`HTLCIntercepted`]: events::Event::HTLCIntercepted
24164  */
24165 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);
24166
24167 /**
24168  * Fails the intercepted HTLC indicated by intercept_id. Should only be called in response to
24169  * an [`HTLCIntercepted`] event. See [`ChannelManager::forward_intercepted_htlc`].
24170  *
24171  * Errors if the event was not handled in time, in which case the HTLC was automatically failed
24172  * backwards.
24173  *
24174  * [`HTLCIntercepted`]: events::Event::HTLCIntercepted
24175  */
24176 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_fail_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id);
24177
24178 /**
24179  * Processes HTLCs which are pending waiting on random forward delay.
24180  *
24181  * Should only really ever be called in response to a PendingHTLCsForwardable event.
24182  * Will likely generate further events.
24183  */
24184 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
24185
24186 /**
24187  * Performs actions which should happen on startup and roughly once per minute thereafter.
24188  *
24189  * This currently includes:
24190  *  * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
24191  *  * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more
24192  *    than a minute, informing the network that they should no longer attempt to route over
24193  *    the channel.
24194  *  * Expiring a channel's previous `ChannelConfig` if necessary to only allow forwarding HTLCs
24195  *    with the current `ChannelConfig`.
24196  *  * Removing peers which have disconnected but and no longer have any channels.
24197  *
24198  * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate
24199  * estimate fetches.
24200  */
24201 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
24202
24203 /**
24204  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
24205  * after a PaymentClaimable event, failing the HTLC back to its origin and freeing resources
24206  * along the path (including in our own channel on which we received it).
24207  *
24208  * Note that in some cases around unclean shutdown, it is possible the payment may have
24209  * already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a
24210  * second copy of) the [`events::Event::PaymentClaimable`] event. Alternatively, the payment
24211  * may have already been failed automatically by LDK if it was nearing its expiration time.
24212  *
24213  * While LDK will never claim a payment automatically on your behalf (i.e. without you calling
24214  * [`ChannelManager::claim_funds`]), you should still monitor for
24215  * [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on
24216  * startup during which time claims that were in-progress at shutdown may be replayed.
24217  */
24218 void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
24219
24220 /**
24221  * This is a variant of [`ChannelManager::fail_htlc_backwards`] that allows you to specify the
24222  * reason for the failure.
24223  *
24224  * See [`FailureCode`] for valid failure codes.
24225  */
24226 void ChannelManager_fail_htlc_backwards_with_reason(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], enum LDKFailureCode failure_code);
24227
24228 /**
24229  * Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any
24230  * [`MessageSendEvent`]s needed to claim the payment.
24231  *
24232  * Note that calling this method does *not* guarantee that the payment has been claimed. You
24233  * *must* wait for an [`Event::PaymentClaimed`] event which upon a successful claim will be
24234  * provided to your [`EventHandler`] when [`process_pending_events`] is next called.
24235  *
24236  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
24237  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentClaimable`
24238  * event matches your expectation. If you fail to do so and call this method, you may provide
24239  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
24240  *
24241  * [`Event::PaymentClaimable`]: crate::util::events::Event::PaymentClaimable
24242  * [`Event::PaymentClaimed`]: crate::util::events::Event::PaymentClaimed
24243  * [`process_pending_events`]: EventsProvider::process_pending_events
24244  * [`create_inbound_payment`]: Self::create_inbound_payment
24245  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
24246  */
24247 void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
24248
24249 /**
24250  * Gets the node_id held by this ChannelManager
24251  */
24252 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
24253
24254 /**
24255  * Accepts a request to open a channel after a [`Event::OpenChannelRequest`].
24256  *
24257  * The `temporary_channel_id` parameter indicates which inbound channel should be accepted,
24258  * and the `counterparty_node_id` parameter is the id of the peer which has requested to open
24259  * the channel.
24260  *
24261  * The `user_channel_id` parameter will be provided back in
24262  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
24263  * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
24264  *
24265  * Note that this method will return an error and reject the channel, if it requires support
24266  * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be
24267  * used to accept such channels.
24268  *
24269  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
24270  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
24271  */
24272 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);
24273
24274 /**
24275  * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating
24276  * it as confirmed immediately.
24277  *
24278  * The `user_channel_id` parameter will be provided back in
24279  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
24280  * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
24281  *
24282  * Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel
24283  * and (if the counterparty agrees), enables forwarding of payments immediately.
24284  *
24285  * This fully trusts that the counterparty has honestly and correctly constructed the funding
24286  * transaction and blindly assumes that it will eventually confirm.
24287  *
24288  * If it does not confirm before we decide to close the channel, or if the funding transaction
24289  * does not pay to the correct script the correct amount, *you will lose funds*.
24290  *
24291  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
24292  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
24293  */
24294 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);
24295
24296 /**
24297  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
24298  * to pay us.
24299  *
24300  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
24301  * [`PaymentHash`] and [`PaymentPreimage`] for you.
24302  *
24303  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentClaimable`], which
24304  * will have the [`PaymentClaimable::purpose`] be [`PaymentPurpose::InvoicePayment`] with
24305  * its [`PaymentPurpose::InvoicePayment::payment_preimage`] field filled in. That should then be
24306  * passed directly to [`claim_funds`].
24307  *
24308  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
24309  *
24310  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
24311  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
24312  *
24313  * # Note
24314  *
24315  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
24316  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
24317  *
24318  * Errors if `min_value_msat` is greater than total bitcoin supply.
24319  *
24320  * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
24321  * on versions of LDK prior to 0.0.114.
24322  *
24323  * [`claim_funds`]: Self::claim_funds
24324  * [`PaymentClaimable`]: events::Event::PaymentClaimable
24325  * [`PaymentClaimable::purpose`]: events::Event::PaymentClaimable::purpose
24326  * [`PaymentPurpose::InvoicePayment`]: events::PaymentPurpose::InvoicePayment
24327  * [`PaymentPurpose::InvoicePayment::payment_preimage`]: events::PaymentPurpose::InvoicePayment::payment_preimage
24328  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
24329  */
24330 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, struct LDKCOption_u16Z min_final_cltv_expiry_delta);
24331
24332 /**
24333  * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share
24334  * serialized state with LDK node(s) running 0.0.103 and earlier.
24335  *
24336  * May panic if `invoice_expiry_delta_secs` is greater than one year.
24337  *
24338  * # Note
24339  * This method is deprecated and will be removed soon.
24340  *
24341  * [`create_inbound_payment`]: Self::create_inbound_payment
24342  */
24343 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);
24344
24345 /**
24346  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
24347  * stored external to LDK.
24348  *
24349  * A [`PaymentClaimable`] event will only be generated if the [`PaymentSecret`] matches a
24350  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
24351  * the `min_value_msat` provided here, if one is provided.
24352  *
24353  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
24354  * note that LDK will not stop you from registering duplicate payment hashes for inbound
24355  * payments.
24356  *
24357  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
24358  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
24359  * before a [`PaymentClaimable`] event will be generated, ensuring that we do not provide the
24360  * sender \"proof-of-payment\" unless they have paid the required amount.
24361  *
24362  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
24363  * in excess of the current time. This should roughly match the expiry time set in the invoice.
24364  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
24365  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
24366  * invoices when no timeout is set.
24367  *
24368  * Note that we use block header time to time-out pending inbound payments (with some margin
24369  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
24370  * accept a payment and generate a [`PaymentClaimable`] event for some time after the expiry.
24371  * If you need exact expiry semantics, you should enforce them upon receipt of
24372  * [`PaymentClaimable`].
24373  *
24374  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry_delta`
24375  * set to at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
24376  *
24377  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
24378  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
24379  *
24380  * # Note
24381  *
24382  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
24383  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
24384  *
24385  * Errors if `min_value_msat` is greater than total bitcoin supply.
24386  *
24387  * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
24388  * on versions of LDK prior to 0.0.114.
24389  *
24390  * [`create_inbound_payment`]: Self::create_inbound_payment
24391  * [`PaymentClaimable`]: events::Event::PaymentClaimable
24392  */
24393 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, struct LDKCOption_u16Z min_final_cltv_expiry);
24394
24395 /**
24396  * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
24397  * serialized state with LDK node(s) running 0.0.103 and earlier.
24398  *
24399  * May panic if `invoice_expiry_delta_secs` is greater than one year.
24400  *
24401  * # Note
24402  * This method is deprecated and will be removed soon.
24403  *
24404  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
24405  */
24406 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);
24407
24408 /**
24409  * Gets an LDK-generated payment preimage from a payment hash and payment secret that were
24410  * previously returned from [`create_inbound_payment`].
24411  *
24412  * [`create_inbound_payment`]: Self::create_inbound_payment
24413  */
24414 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);
24415
24416 /**
24417  * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
24418  * are used when constructing the phantom invoice's route hints.
24419  *
24420  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
24421  */
24422 MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg);
24423
24424 /**
24425  * Gets route hints for use in receiving [phantom node payments].
24426  *
24427  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
24428  */
24429 MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg);
24430
24431 /**
24432  * Gets a fake short channel id for use in receiving intercepted payments. These fake scids are
24433  * used when constructing the route hints for HTLCs intended to be intercepted. See
24434  * [`ChannelManager::forward_intercepted_htlc`].
24435  *
24436  * Note that this method is not guaranteed to return unique values, you may need to call it a few
24437  * times to get a unique scid.
24438  */
24439 MUST_USE_RES uint64_t ChannelManager_get_intercept_scid(const struct LDKChannelManager *NONNULL_PTR this_arg);
24440
24441 /**
24442  * Gets inflight HTLC information by processing pending outbound payments that are in
24443  * our channels. May be used during pathfinding to account for in-use channel liquidity.
24444  */
24445 MUST_USE_RES struct LDKInFlightHtlcs ChannelManager_compute_inflight_htlcs(const struct LDKChannelManager *NONNULL_PTR this_arg);
24446
24447 /**
24448  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
24449  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
24450  */
24451 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
24452
24453 /**
24454  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
24455  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
24456  */
24457 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
24458
24459 /**
24460  * Constructs a new Listen which calls the relevant methods on this_arg.
24461  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
24462  */
24463 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
24464
24465 /**
24466  * Constructs a new Confirm which calls the relevant methods on this_arg.
24467  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
24468  */
24469 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
24470
24471 /**
24472  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
24473  * indicating whether persistence is necessary. Only one listener on
24474  * [`await_persistable_update`], [`await_persistable_update_timeout`], or a future returned by
24475  * [`get_persistable_update_future`] is guaranteed to be woken up.
24476  *
24477  * Note that this method is not available with the `no-std` feature.
24478  *
24479  * [`await_persistable_update`]: Self::await_persistable_update
24480  * [`await_persistable_update_timeout`]: Self::await_persistable_update_timeout
24481  * [`get_persistable_update_future`]: Self::get_persistable_update_future
24482  */
24483 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
24484
24485 /**
24486  * Blocks until ChannelManager needs to be persisted. Only one listener on
24487  * [`await_persistable_update`], `await_persistable_update_timeout`, or a future returned by
24488  * [`get_persistable_update_future`] is guaranteed to be woken up.
24489  *
24490  * [`await_persistable_update`]: Self::await_persistable_update
24491  * [`get_persistable_update_future`]: Self::get_persistable_update_future
24492  */
24493 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
24494
24495 /**
24496  * Gets a [`Future`] that completes when a persistable update is available. Note that
24497  * callbacks registered on the [`Future`] MUST NOT call back into this [`ChannelManager`] and
24498  * should instead register actions to be taken later.
24499  */
24500 MUST_USE_RES struct LDKFuture ChannelManager_get_persistable_update_future(const struct LDKChannelManager *NONNULL_PTR this_arg);
24501
24502 /**
24503  * Gets the latest best block which was connected either via the [`chain::Listen`] or
24504  * [`chain::Confirm`] interfaces.
24505  */
24506 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
24507
24508 /**
24509  * Fetches the set of [`NodeFeatures`] flags which are provided by or required by
24510  * [`ChannelManager`].
24511  */
24512 MUST_USE_RES struct LDKNodeFeatures ChannelManager_node_features(const struct LDKChannelManager *NONNULL_PTR this_arg);
24513
24514 /**
24515  * Fetches the set of [`ChannelFeatures`] flags which are provided by or required by
24516  * [`ChannelManager`].
24517  */
24518 MUST_USE_RES struct LDKChannelFeatures ChannelManager_channel_features(const struct LDKChannelManager *NONNULL_PTR this_arg);
24519
24520 /**
24521  * Fetches the set of [`ChannelTypeFeatures`] flags which are provided by or required by
24522  * [`ChannelManager`].
24523  */
24524 MUST_USE_RES struct LDKChannelTypeFeatures ChannelManager_channel_type_features(const struct LDKChannelManager *NONNULL_PTR this_arg);
24525
24526 /**
24527  * Fetches the set of [`InitFeatures`] flags which are provided by or required by
24528  * [`ChannelManager`].
24529  */
24530 MUST_USE_RES struct LDKInitFeatures ChannelManager_init_features(const struct LDKChannelManager *NONNULL_PTR this_arg);
24531
24532 /**
24533  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
24534  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
24535  */
24536 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
24537
24538 /**
24539  * Fetches the set of [`InitFeatures`] flags which are provided by or required by
24540  * [`ChannelManager`].
24541  */
24542 struct LDKInitFeatures provided_init_features(const struct LDKUserConfig *NONNULL_PTR _config);
24543
24544 /**
24545  * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read
24546  */
24547 struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj);
24548
24549 /**
24550  * Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write
24551  */
24552 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser);
24553
24554 /**
24555  * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read
24556  */
24557 struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj);
24558
24559 /**
24560  * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write
24561  */
24562 struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser);
24563
24564 /**
24565  * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read
24566  */
24567 struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj);
24568
24569 /**
24570  * Read a ChannelDetails from a byte array, created by ChannelDetails_write
24571  */
24572 struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser);
24573
24574 /**
24575  * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read
24576  */
24577 struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj);
24578
24579 /**
24580  * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write
24581  */
24582 struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser);
24583
24584 /**
24585  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
24586  */
24587 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
24588
24589 /**
24590  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
24591  */
24592 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
24593
24594 /**
24595  * A cryptographically secure source of entropy.
24596  */
24597 const struct LDKEntropySource *ChannelManagerReadArgs_get_entropy_source(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
24598
24599 /**
24600  * A cryptographically secure source of entropy.
24601  */
24602 void ChannelManagerReadArgs_set_entropy_source(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKEntropySource val);
24603
24604 /**
24605  * A signer that is able to perform node-scoped cryptographic operations.
24606  */
24607 const struct LDKNodeSigner *ChannelManagerReadArgs_get_node_signer(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
24608
24609 /**
24610  * A signer that is able to perform node-scoped cryptographic operations.
24611  */
24612 void ChannelManagerReadArgs_set_node_signer(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKNodeSigner val);
24613
24614 /**
24615  * The keys provider which will give us relevant keys. Some keys will be loaded during
24616  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
24617  * signing data.
24618  */
24619 const struct LDKSignerProvider *ChannelManagerReadArgs_get_signer_provider(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
24620
24621 /**
24622  * The keys provider which will give us relevant keys. Some keys will be loaded during
24623  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
24624  * signing data.
24625  */
24626 void ChannelManagerReadArgs_set_signer_provider(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKSignerProvider val);
24627
24628 /**
24629  * The fee_estimator for use in the ChannelManager in the future.
24630  *
24631  * No calls to the FeeEstimator will be made during deserialization.
24632  */
24633 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
24634
24635 /**
24636  * The fee_estimator for use in the ChannelManager in the future.
24637  *
24638  * No calls to the FeeEstimator will be made during deserialization.
24639  */
24640 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
24641
24642 /**
24643  * The chain::Watch for use in the ChannelManager in the future.
24644  *
24645  * No calls to the chain::Watch will be made during deserialization. It is assumed that
24646  * you have deserialized ChannelMonitors separately and will add them to your
24647  * chain::Watch after deserializing this ChannelManager.
24648  */
24649 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
24650
24651 /**
24652  * The chain::Watch for use in the ChannelManager in the future.
24653  *
24654  * No calls to the chain::Watch will be made during deserialization. It is assumed that
24655  * you have deserialized ChannelMonitors separately and will add them to your
24656  * chain::Watch after deserializing this ChannelManager.
24657  */
24658 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
24659
24660 /**
24661  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
24662  * used to broadcast the latest local commitment transactions of channels which must be
24663  * force-closed during deserialization.
24664  */
24665 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
24666
24667 /**
24668  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
24669  * used to broadcast the latest local commitment transactions of channels which must be
24670  * force-closed during deserialization.
24671  */
24672 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
24673
24674 /**
24675  * The router which will be used in the ChannelManager in the future for finding routes
24676  * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding.
24677  *
24678  * No calls to the router will be made during deserialization.
24679  */
24680 const struct LDKRouter *ChannelManagerReadArgs_get_router(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
24681
24682 /**
24683  * The router which will be used in the ChannelManager in the future for finding routes
24684  * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding.
24685  *
24686  * No calls to the router will be made during deserialization.
24687  */
24688 void ChannelManagerReadArgs_set_router(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKRouter val);
24689
24690 /**
24691  * The Logger for use in the ChannelManager and which may be used to log information during
24692  * deserialization.
24693  */
24694 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
24695
24696 /**
24697  * The Logger for use in the ChannelManager and which may be used to log information during
24698  * deserialization.
24699  */
24700 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
24701
24702 /**
24703  * Default settings used for new channels. Any existing channels will continue to use the
24704  * runtime settings which were stored when the ChannelManager was serialized.
24705  */
24706 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
24707
24708 /**
24709  * Default settings used for new channels. Any existing channels will continue to use the
24710  * runtime settings which were stored when the ChannelManager was serialized.
24711  */
24712 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
24713
24714 /**
24715  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
24716  * HashMap for you. This is primarily useful for C bindings where it is not practical to
24717  * populate a HashMap directly from C.
24718  */
24719 MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKSignerProvider signer_provider, struct LDKFeeEstimator fee_estimator, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKRouter router, struct LDKLogger logger, struct LDKUserConfig default_config, struct LDKCVec_ChannelMonitorZ channel_monitors);
24720
24721 /**
24722  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
24723  */
24724 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
24725
24726 /**
24727  * Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL.
24728  */
24729 void ExpandedKey_free(struct LDKExpandedKey this_obj);
24730
24731 /**
24732  * Create a  new [`ExpandedKey`] for generating an inbound payment hash and secret.
24733  *
24734  * It is recommended to cache this value and not regenerate it for each new inbound payment.
24735  */
24736 MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material)[32]);
24737
24738 /**
24739  * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no
24740  * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without
24741  * a `ChannelManager`.
24742  *
24743  * `keys` is generated by calling [`NodeSigner::get_inbound_payment_key_material`] and then
24744  * calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not
24745  * regenerate it for each new inbound payment.
24746  *
24747  * `current_time` is a Unix timestamp representing the current time.
24748  *
24749  * Note that if `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
24750  * on versions of LDK prior to 0.0.114.
24751  *
24752  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
24753  * [`NodeSigner::get_inbound_payment_key_material`]: crate::chain::keysinterface::NodeSigner::get_inbound_payment_key_material
24754  */
24755 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 LDKEntropySource *NONNULL_PTR entropy_source, uint64_t current_time, struct LDKCOption_u16Z min_final_cltv_expiry_delta);
24756
24757 /**
24758  * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`],
24759  * but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments]
24760  * without a `ChannelManager`.
24761  *
24762  * See [`create`] for information on the `keys` and `current_time` parameters.
24763  *
24764  * Note that if `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
24765  * on versions of LDK prior to 0.0.114.
24766  *
24767  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
24768  */
24769 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, struct LDKCOption_u16Z min_final_cltv_expiry_delta);
24770
24771 /**
24772  * Frees any resources used by the DecodeError
24773  */
24774 void DecodeError_free(struct LDKDecodeError this_ptr);
24775
24776 /**
24777  * Creates a copy of the DecodeError
24778  */
24779 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
24780
24781 /**
24782  * Utility method to constructs a new UnknownVersion-variant DecodeError
24783  */
24784 struct LDKDecodeError DecodeError_unknown_version(void);
24785
24786 /**
24787  * Utility method to constructs a new UnknownRequiredFeature-variant DecodeError
24788  */
24789 struct LDKDecodeError DecodeError_unknown_required_feature(void);
24790
24791 /**
24792  * Utility method to constructs a new InvalidValue-variant DecodeError
24793  */
24794 struct LDKDecodeError DecodeError_invalid_value(void);
24795
24796 /**
24797  * Utility method to constructs a new ShortRead-variant DecodeError
24798  */
24799 struct LDKDecodeError DecodeError_short_read(void);
24800
24801 /**
24802  * Utility method to constructs a new BadLengthDescriptor-variant DecodeError
24803  */
24804 struct LDKDecodeError DecodeError_bad_length_descriptor(void);
24805
24806 /**
24807  * Utility method to constructs a new Io-variant DecodeError
24808  */
24809 struct LDKDecodeError DecodeError_io(enum LDKIOError a);
24810
24811 /**
24812  * Utility method to constructs a new UnsupportedCompression-variant DecodeError
24813  */
24814 struct LDKDecodeError DecodeError_unsupported_compression(void);
24815
24816 /**
24817  * Checks if two DecodeErrors contain equal inner contents.
24818  * This ignores pointers and is_owned flags and looks at the values in fields.
24819  */
24820 bool DecodeError_eq(const struct LDKDecodeError *NONNULL_PTR a, const struct LDKDecodeError *NONNULL_PTR b);
24821
24822 /**
24823  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
24824  */
24825 void Init_free(struct LDKInit this_obj);
24826
24827 /**
24828  * The relevant features which the sender supports.
24829  */
24830 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
24831
24832 /**
24833  * The relevant features which the sender supports.
24834  */
24835 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
24836
24837 /**
24838  * The receipient's network address.
24839  *
24840  * This adds the option to report a remote IP address back to a connecting peer using the init
24841  * message. A node can decide to use that information to discover a potential update to its
24842  * public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing
24843  * the new address.
24844  */
24845 struct LDKCOption_NetAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr);
24846
24847 /**
24848  * The receipient's network address.
24849  *
24850  * This adds the option to report a remote IP address back to a connecting peer using the init
24851  * message. A node can decide to use that information to discover a potential update to its
24852  * public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing
24853  * the new address.
24854  */
24855 void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_NetAddressZ val);
24856
24857 /**
24858  * Constructs a new Init given each field
24859  */
24860 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_NetAddressZ remote_network_address_arg);
24861
24862 /**
24863  * Creates a copy of the Init
24864  */
24865 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
24866
24867 /**
24868  * Checks if two Inits contain equal inner contents.
24869  * This ignores pointers and is_owned flags and looks at the values in fields.
24870  * Two objects with NULL inner values will be considered "equal" here.
24871  */
24872 bool Init_eq(const struct LDKInit *NONNULL_PTR a, const struct LDKInit *NONNULL_PTR b);
24873
24874 /**
24875  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
24876  */
24877 void ErrorMessage_free(struct LDKErrorMessage this_obj);
24878
24879 /**
24880  * The channel ID involved in the error.
24881  *
24882  * All-0s indicates a general error unrelated to a specific channel, after which all channels
24883  * with the sending peer should be closed.
24884  */
24885 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
24886
24887 /**
24888  * The channel ID involved in the error.
24889  *
24890  * All-0s indicates a general error unrelated to a specific channel, after which all channels
24891  * with the sending peer should be closed.
24892  */
24893 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24894
24895 /**
24896  * A possibly human-readable error description.
24897  *
24898  * The string should be sanitized before it is used (e.g., emitted to logs or printed to
24899  * `stdout`). Otherwise, a well crafted error message may trigger a security vulnerability in
24900  * the terminal emulator or the logging subsystem.
24901  */
24902 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
24903
24904 /**
24905  * A possibly human-readable error description.
24906  *
24907  * The string should be sanitized before it is used (e.g., emitted to logs or printed to
24908  * `stdout`). Otherwise, a well crafted error message may trigger a security vulnerability in
24909  * the terminal emulator or the logging subsystem.
24910  */
24911 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
24912
24913 /**
24914  * Constructs a new ErrorMessage given each field
24915  */
24916 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
24917
24918 /**
24919  * Creates a copy of the ErrorMessage
24920  */
24921 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
24922
24923 /**
24924  * Checks if two ErrorMessages contain equal inner contents.
24925  * This ignores pointers and is_owned flags and looks at the values in fields.
24926  * Two objects with NULL inner values will be considered "equal" here.
24927  */
24928 bool ErrorMessage_eq(const struct LDKErrorMessage *NONNULL_PTR a, const struct LDKErrorMessage *NONNULL_PTR b);
24929
24930 /**
24931  * Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL.
24932  */
24933 void WarningMessage_free(struct LDKWarningMessage this_obj);
24934
24935 /**
24936  * The channel ID involved in the warning.
24937  *
24938  * All-0s indicates a warning unrelated to a specific channel.
24939  */
24940 const uint8_t (*WarningMessage_get_channel_id(const struct LDKWarningMessage *NONNULL_PTR this_ptr))[32];
24941
24942 /**
24943  * The channel ID involved in the warning.
24944  *
24945  * All-0s indicates a warning unrelated to a specific channel.
24946  */
24947 void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24948
24949 /**
24950  * A possibly human-readable warning description.
24951  *
24952  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
24953  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
24954  * the terminal emulator or the logging subsystem.
24955  */
24956 struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PTR this_ptr);
24957
24958 /**
24959  * A possibly human-readable warning description.
24960  *
24961  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
24962  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
24963  * the terminal emulator or the logging subsystem.
24964  */
24965 void WarningMessage_set_data(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKStr val);
24966
24967 /**
24968  * Constructs a new WarningMessage given each field
24969  */
24970 MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
24971
24972 /**
24973  * Creates a copy of the WarningMessage
24974  */
24975 struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig);
24976
24977 /**
24978  * Checks if two WarningMessages contain equal inner contents.
24979  * This ignores pointers and is_owned flags and looks at the values in fields.
24980  * Two objects with NULL inner values will be considered "equal" here.
24981  */
24982 bool WarningMessage_eq(const struct LDKWarningMessage *NONNULL_PTR a, const struct LDKWarningMessage *NONNULL_PTR b);
24983
24984 /**
24985  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
24986  */
24987 void Ping_free(struct LDKPing this_obj);
24988
24989 /**
24990  * The desired response length.
24991  */
24992 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
24993
24994 /**
24995  * The desired response length.
24996  */
24997 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
24998
24999 /**
25000  * The ping packet size.
25001  *
25002  * This field is not sent on the wire. byteslen zeros are sent.
25003  */
25004 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
25005
25006 /**
25007  * The ping packet size.
25008  *
25009  * This field is not sent on the wire. byteslen zeros are sent.
25010  */
25011 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
25012
25013 /**
25014  * Constructs a new Ping given each field
25015  */
25016 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
25017
25018 /**
25019  * Creates a copy of the Ping
25020  */
25021 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
25022
25023 /**
25024  * Checks if two Pings contain equal inner contents.
25025  * This ignores pointers and is_owned flags and looks at the values in fields.
25026  * Two objects with NULL inner values will be considered "equal" here.
25027  */
25028 bool Ping_eq(const struct LDKPing *NONNULL_PTR a, const struct LDKPing *NONNULL_PTR b);
25029
25030 /**
25031  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
25032  */
25033 void Pong_free(struct LDKPong this_obj);
25034
25035 /**
25036  * The pong packet size.
25037  *
25038  * This field is not sent on the wire. byteslen zeros are sent.
25039  */
25040 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
25041
25042 /**
25043  * The pong packet size.
25044  *
25045  * This field is not sent on the wire. byteslen zeros are sent.
25046  */
25047 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
25048
25049 /**
25050  * Constructs a new Pong given each field
25051  */
25052 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
25053
25054 /**
25055  * Creates a copy of the Pong
25056  */
25057 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
25058
25059 /**
25060  * Checks if two Pongs contain equal inner contents.
25061  * This ignores pointers and is_owned flags and looks at the values in fields.
25062  * Two objects with NULL inner values will be considered "equal" here.
25063  */
25064 bool Pong_eq(const struct LDKPong *NONNULL_PTR a, const struct LDKPong *NONNULL_PTR b);
25065
25066 /**
25067  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
25068  */
25069 void OpenChannel_free(struct LDKOpenChannel this_obj);
25070
25071 /**
25072  * The genesis hash of the blockchain where the channel is to be opened
25073  */
25074 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
25075
25076 /**
25077  * The genesis hash of the blockchain where the channel is to be opened
25078  */
25079 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25080
25081 /**
25082  * A temporary channel ID, until the funding outpoint is announced
25083  */
25084 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
25085
25086 /**
25087  * A temporary channel ID, until the funding outpoint is announced
25088  */
25089 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25090
25091 /**
25092  * The channel value
25093  */
25094 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25095
25096 /**
25097  * The channel value
25098  */
25099 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
25100
25101 /**
25102  * The amount to push to the counterparty as part of the open, in milli-satoshi
25103  */
25104 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25105
25106 /**
25107  * The amount to push to the counterparty as part of the open, in milli-satoshi
25108  */
25109 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
25110
25111 /**
25112  * The threshold below which outputs on transactions broadcast by sender will be omitted
25113  */
25114 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25115
25116 /**
25117  * The threshold below which outputs on transactions broadcast by sender will be omitted
25118  */
25119 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
25120
25121 /**
25122  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
25123  */
25124 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25125
25126 /**
25127  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
25128  */
25129 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
25130
25131 /**
25132  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
25133  */
25134 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25135
25136 /**
25137  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
25138  */
25139 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
25140
25141 /**
25142  * The minimum HTLC size incoming to sender, in milli-satoshi
25143  */
25144 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25145
25146 /**
25147  * The minimum HTLC size incoming to sender, in milli-satoshi
25148  */
25149 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
25150
25151 /**
25152  * The feerate per 1000-weight of sender generated transactions, until updated by
25153  * [`UpdateFee`]
25154  */
25155 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25156
25157 /**
25158  * The feerate per 1000-weight of sender generated transactions, until updated by
25159  * [`UpdateFee`]
25160  */
25161 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
25162
25163 /**
25164  * The number of blocks which the counterparty will have to wait to claim on-chain funds if
25165  * they broadcast a commitment transaction
25166  */
25167 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25168
25169 /**
25170  * The number of blocks which the counterparty will have to wait to claim on-chain funds if
25171  * they broadcast a commitment transaction
25172  */
25173 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
25174
25175 /**
25176  * The maximum number of inbound HTLCs towards sender
25177  */
25178 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25179
25180 /**
25181  * The maximum number of inbound HTLCs towards sender
25182  */
25183 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
25184
25185 /**
25186  * The sender's key controlling the funding transaction
25187  */
25188 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25189
25190 /**
25191  * The sender's key controlling the funding transaction
25192  */
25193 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25194
25195 /**
25196  * Used to derive a revocation key for transactions broadcast by counterparty
25197  */
25198 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25199
25200 /**
25201  * Used to derive a revocation key for transactions broadcast by counterparty
25202  */
25203 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25204
25205 /**
25206  * A payment key to sender for transactions broadcast by counterparty
25207  */
25208 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25209
25210 /**
25211  * A payment key to sender for transactions broadcast by counterparty
25212  */
25213 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25214
25215 /**
25216  * Used to derive a payment key to sender for transactions broadcast by sender
25217  */
25218 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25219
25220 /**
25221  * Used to derive a payment key to sender for transactions broadcast by sender
25222  */
25223 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25224
25225 /**
25226  * Used to derive an HTLC payment key to sender
25227  */
25228 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25229
25230 /**
25231  * Used to derive an HTLC payment key to sender
25232  */
25233 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25234
25235 /**
25236  * The first to-be-broadcast-by-sender transaction's per commitment point
25237  */
25238 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25239
25240 /**
25241  * The first to-be-broadcast-by-sender transaction's per commitment point
25242  */
25243 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25244
25245 /**
25246  * The channel flags to be used
25247  */
25248 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25249
25250 /**
25251  * The channel flags to be used
25252  */
25253 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
25254
25255 /**
25256  * The channel type that this channel will represent
25257  *
25258  * If this is `None`, we derive the channel type from the intersection of our
25259  * feature bits with our counterparty's feature bits from the [`Init`] message.
25260  *
25261  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25262  */
25263 struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
25264
25265 /**
25266  * The channel type that this channel will represent
25267  *
25268  * If this is `None`, we derive the channel type from the intersection of our
25269  * feature bits with our counterparty's feature bits from the [`Init`] message.
25270  *
25271  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25272  */
25273 void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
25274
25275 /**
25276  * Creates a copy of the OpenChannel
25277  */
25278 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
25279
25280 /**
25281  * Checks if two OpenChannels contain equal inner contents.
25282  * This ignores pointers and is_owned flags and looks at the values in fields.
25283  * Two objects with NULL inner values will be considered "equal" here.
25284  */
25285 bool OpenChannel_eq(const struct LDKOpenChannel *NONNULL_PTR a, const struct LDKOpenChannel *NONNULL_PTR b);
25286
25287 /**
25288  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
25289  */
25290 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
25291
25292 /**
25293  * A temporary channel ID, until the funding outpoint is announced
25294  */
25295 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
25296
25297 /**
25298  * A temporary channel ID, until the funding outpoint is announced
25299  */
25300 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25301
25302 /**
25303  * The threshold below which outputs on transactions broadcast by sender will be omitted
25304  */
25305 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
25306
25307 /**
25308  * The threshold below which outputs on transactions broadcast by sender will be omitted
25309  */
25310 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
25311
25312 /**
25313  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
25314  */
25315 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
25316
25317 /**
25318  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
25319  */
25320 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
25321
25322 /**
25323  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
25324  */
25325 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
25326
25327 /**
25328  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
25329  */
25330 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
25331
25332 /**
25333  * The minimum HTLC size incoming to sender, in milli-satoshi
25334  */
25335 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
25336
25337 /**
25338  * The minimum HTLC size incoming to sender, in milli-satoshi
25339  */
25340 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
25341
25342 /**
25343  * Minimum depth of the funding transaction before the channel is considered open
25344  */
25345 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
25346
25347 /**
25348  * Minimum depth of the funding transaction before the channel is considered open
25349  */
25350 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
25351
25352 /**
25353  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
25354  */
25355 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
25356
25357 /**
25358  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
25359  */
25360 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
25361
25362 /**
25363  * The maximum number of inbound HTLCs towards sender
25364  */
25365 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
25366
25367 /**
25368  * The maximum number of inbound HTLCs towards sender
25369  */
25370 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
25371
25372 /**
25373  * The sender's key controlling the funding transaction
25374  */
25375 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
25376
25377 /**
25378  * The sender's key controlling the funding transaction
25379  */
25380 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25381
25382 /**
25383  * Used to derive a revocation key for transactions broadcast by counterparty
25384  */
25385 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
25386
25387 /**
25388  * Used to derive a revocation key for transactions broadcast by counterparty
25389  */
25390 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25391
25392 /**
25393  * A payment key to sender for transactions broadcast by counterparty
25394  */
25395 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
25396
25397 /**
25398  * A payment key to sender for transactions broadcast by counterparty
25399  */
25400 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25401
25402 /**
25403  * Used to derive a payment key to sender for transactions broadcast by sender
25404  */
25405 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
25406
25407 /**
25408  * Used to derive a payment key to sender for transactions broadcast by sender
25409  */
25410 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25411
25412 /**
25413  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
25414  */
25415 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
25416
25417 /**
25418  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
25419  */
25420 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25421
25422 /**
25423  * The first to-be-broadcast-by-sender transaction's per commitment point
25424  */
25425 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
25426
25427 /**
25428  * The first to-be-broadcast-by-sender transaction's per commitment point
25429  */
25430 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25431
25432 /**
25433  * The channel type that this channel will represent.
25434  *
25435  * If this is `None`, we derive the channel type from the intersection of
25436  * our feature bits with our counterparty's feature bits from the [`Init`] message.
25437  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
25438  *
25439  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25440  */
25441 struct LDKChannelTypeFeatures AcceptChannel_get_channel_type(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
25442
25443 /**
25444  * The channel type that this channel will represent.
25445  *
25446  * If this is `None`, we derive the channel type from the intersection of
25447  * our feature bits with our counterparty's feature bits from the [`Init`] message.
25448  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
25449  *
25450  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25451  */
25452 void AcceptChannel_set_channel_type(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
25453
25454 /**
25455  * Creates a copy of the AcceptChannel
25456  */
25457 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
25458
25459 /**
25460  * Checks if two AcceptChannels contain equal inner contents.
25461  * This ignores pointers and is_owned flags and looks at the values in fields.
25462  * Two objects with NULL inner values will be considered "equal" here.
25463  */
25464 bool AcceptChannel_eq(const struct LDKAcceptChannel *NONNULL_PTR a, const struct LDKAcceptChannel *NONNULL_PTR b);
25465
25466 /**
25467  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
25468  */
25469 void FundingCreated_free(struct LDKFundingCreated this_obj);
25470
25471 /**
25472  * A temporary channel ID, until the funding is established
25473  */
25474 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
25475
25476 /**
25477  * A temporary channel ID, until the funding is established
25478  */
25479 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25480
25481 /**
25482  * The funding transaction ID
25483  */
25484 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
25485
25486 /**
25487  * The funding transaction ID
25488  */
25489 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25490
25491 /**
25492  * The specific output index funding this channel
25493  */
25494 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
25495
25496 /**
25497  * The specific output index funding this channel
25498  */
25499 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
25500
25501 /**
25502  * The signature of the channel initiator (funder) on the initial commitment transaction
25503  */
25504 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
25505
25506 /**
25507  * The signature of the channel initiator (funder) on the initial commitment transaction
25508  */
25509 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
25510
25511 /**
25512  * Constructs a new FundingCreated given each field
25513  */
25514 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);
25515
25516 /**
25517  * Creates a copy of the FundingCreated
25518  */
25519 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
25520
25521 /**
25522  * Checks if two FundingCreateds contain equal inner contents.
25523  * This ignores pointers and is_owned flags and looks at the values in fields.
25524  * Two objects with NULL inner values will be considered "equal" here.
25525  */
25526 bool FundingCreated_eq(const struct LDKFundingCreated *NONNULL_PTR a, const struct LDKFundingCreated *NONNULL_PTR b);
25527
25528 /**
25529  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
25530  */
25531 void FundingSigned_free(struct LDKFundingSigned this_obj);
25532
25533 /**
25534  * The channel ID
25535  */
25536 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
25537
25538 /**
25539  * The channel ID
25540  */
25541 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25542
25543 /**
25544  * The signature of the channel acceptor (fundee) on the initial commitment transaction
25545  */
25546 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
25547
25548 /**
25549  * The signature of the channel acceptor (fundee) on the initial commitment transaction
25550  */
25551 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
25552
25553 /**
25554  * Constructs a new FundingSigned given each field
25555  */
25556 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
25557
25558 /**
25559  * Creates a copy of the FundingSigned
25560  */
25561 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
25562
25563 /**
25564  * Checks if two FundingSigneds contain equal inner contents.
25565  * This ignores pointers and is_owned flags and looks at the values in fields.
25566  * Two objects with NULL inner values will be considered "equal" here.
25567  */
25568 bool FundingSigned_eq(const struct LDKFundingSigned *NONNULL_PTR a, const struct LDKFundingSigned *NONNULL_PTR b);
25569
25570 /**
25571  * Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL.
25572  */
25573 void ChannelReady_free(struct LDKChannelReady this_obj);
25574
25575 /**
25576  * The channel ID
25577  */
25578 const uint8_t (*ChannelReady_get_channel_id(const struct LDKChannelReady *NONNULL_PTR this_ptr))[32];
25579
25580 /**
25581  * The channel ID
25582  */
25583 void ChannelReady_set_channel_id(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25584
25585 /**
25586  * The per-commitment point of the second commitment transaction
25587  */
25588 struct LDKPublicKey ChannelReady_get_next_per_commitment_point(const struct LDKChannelReady *NONNULL_PTR this_ptr);
25589
25590 /**
25591  * The per-commitment point of the second commitment transaction
25592  */
25593 void ChannelReady_set_next_per_commitment_point(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25594
25595 /**
25596  * If set, provides a `short_channel_id` alias for this channel.
25597  *
25598  * The sender will accept payments to be forwarded over this SCID and forward them to this
25599  * messages' recipient.
25600  */
25601 struct LDKCOption_u64Z ChannelReady_get_short_channel_id_alias(const struct LDKChannelReady *NONNULL_PTR this_ptr);
25602
25603 /**
25604  * If set, provides a `short_channel_id` alias for this channel.
25605  *
25606  * The sender will accept payments to be forwarded over this SCID and forward them to this
25607  * messages' recipient.
25608  */
25609 void ChannelReady_set_short_channel_id_alias(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
25610
25611 /**
25612  * Constructs a new ChannelReady given each field
25613  */
25614 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);
25615
25616 /**
25617  * Creates a copy of the ChannelReady
25618  */
25619 struct LDKChannelReady ChannelReady_clone(const struct LDKChannelReady *NONNULL_PTR orig);
25620
25621 /**
25622  * Checks if two ChannelReadys contain equal inner contents.
25623  * This ignores pointers and is_owned flags and looks at the values in fields.
25624  * Two objects with NULL inner values will be considered "equal" here.
25625  */
25626 bool ChannelReady_eq(const struct LDKChannelReady *NONNULL_PTR a, const struct LDKChannelReady *NONNULL_PTR b);
25627
25628 /**
25629  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
25630  */
25631 void Shutdown_free(struct LDKShutdown this_obj);
25632
25633 /**
25634  * The channel ID
25635  */
25636 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
25637
25638 /**
25639  * The channel ID
25640  */
25641 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25642
25643 /**
25644  * The destination of this peer's funds on closing.
25645  *
25646  * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR.
25647  */
25648 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
25649
25650 /**
25651  * The destination of this peer's funds on closing.
25652  *
25653  * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR.
25654  */
25655 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
25656
25657 /**
25658  * Constructs a new Shutdown given each field
25659  */
25660 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
25661
25662 /**
25663  * Creates a copy of the Shutdown
25664  */
25665 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
25666
25667 /**
25668  * Checks if two Shutdowns contain equal inner contents.
25669  * This ignores pointers and is_owned flags and looks at the values in fields.
25670  * Two objects with NULL inner values will be considered "equal" here.
25671  */
25672 bool Shutdown_eq(const struct LDKShutdown *NONNULL_PTR a, const struct LDKShutdown *NONNULL_PTR b);
25673
25674 /**
25675  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
25676  */
25677 void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
25678
25679 /**
25680  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
25681  * transaction.
25682  */
25683 uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
25684
25685 /**
25686  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
25687  * transaction.
25688  */
25689 void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
25690
25691 /**
25692  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
25693  * transaction.
25694  */
25695 uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
25696
25697 /**
25698  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
25699  * transaction.
25700  */
25701 void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
25702
25703 /**
25704  * Constructs a new ClosingSignedFeeRange given each field
25705  */
25706 MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
25707
25708 /**
25709  * Creates a copy of the ClosingSignedFeeRange
25710  */
25711 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
25712
25713 /**
25714  * Checks if two ClosingSignedFeeRanges contain equal inner contents.
25715  * This ignores pointers and is_owned flags and looks at the values in fields.
25716  * Two objects with NULL inner values will be considered "equal" here.
25717  */
25718 bool ClosingSignedFeeRange_eq(const struct LDKClosingSignedFeeRange *NONNULL_PTR a, const struct LDKClosingSignedFeeRange *NONNULL_PTR b);
25719
25720 /**
25721  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
25722  */
25723 void ClosingSigned_free(struct LDKClosingSigned this_obj);
25724
25725 /**
25726  * The channel ID
25727  */
25728 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
25729
25730 /**
25731  * The channel ID
25732  */
25733 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25734
25735 /**
25736  * The proposed total fee for the closing transaction
25737  */
25738 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
25739
25740 /**
25741  * The proposed total fee for the closing transaction
25742  */
25743 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
25744
25745 /**
25746  * A signature on the closing transaction
25747  */
25748 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
25749
25750 /**
25751  * A signature on the closing transaction
25752  */
25753 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
25754
25755 /**
25756  * The minimum and maximum fees which the sender is willing to accept, provided only by new
25757  * nodes.
25758  *
25759  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25760  */
25761 struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
25762
25763 /**
25764  * The minimum and maximum fees which the sender is willing to accept, provided only by new
25765  * nodes.
25766  *
25767  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25768  */
25769 void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
25770
25771 /**
25772  * Constructs a new ClosingSigned given each field
25773  */
25774 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);
25775
25776 /**
25777  * Creates a copy of the ClosingSigned
25778  */
25779 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
25780
25781 /**
25782  * Checks if two ClosingSigneds contain equal inner contents.
25783  * This ignores pointers and is_owned flags and looks at the values in fields.
25784  * Two objects with NULL inner values will be considered "equal" here.
25785  */
25786 bool ClosingSigned_eq(const struct LDKClosingSigned *NONNULL_PTR a, const struct LDKClosingSigned *NONNULL_PTR b);
25787
25788 /**
25789  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
25790  */
25791 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
25792
25793 /**
25794  * The channel ID
25795  */
25796 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
25797
25798 /**
25799  * The channel ID
25800  */
25801 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25802
25803 /**
25804  * The HTLC ID
25805  */
25806 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
25807
25808 /**
25809  * The HTLC ID
25810  */
25811 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
25812
25813 /**
25814  * The HTLC value in milli-satoshi
25815  */
25816 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
25817
25818 /**
25819  * The HTLC value in milli-satoshi
25820  */
25821 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
25822
25823 /**
25824  * The payment hash, the pre-image of which controls HTLC redemption
25825  */
25826 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
25827
25828 /**
25829  * The payment hash, the pre-image of which controls HTLC redemption
25830  */
25831 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25832
25833 /**
25834  * The expiry height of the HTLC
25835  */
25836 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
25837
25838 /**
25839  * The expiry height of the HTLC
25840  */
25841 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
25842
25843 /**
25844  * Creates a copy of the UpdateAddHTLC
25845  */
25846 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
25847
25848 /**
25849  * Checks if two UpdateAddHTLCs contain equal inner contents.
25850  * This ignores pointers and is_owned flags and looks at the values in fields.
25851  * Two objects with NULL inner values will be considered "equal" here.
25852  */
25853 bool UpdateAddHTLC_eq(const struct LDKUpdateAddHTLC *NONNULL_PTR a, const struct LDKUpdateAddHTLC *NONNULL_PTR b);
25854
25855 /**
25856  * Frees any resources used by the OnionMessage, if is_owned is set and inner is non-NULL.
25857  */
25858 void OnionMessage_free(struct LDKOnionMessage this_obj);
25859
25860 /**
25861  * Used in decrypting the onion packet's payload.
25862  */
25863 struct LDKPublicKey OnionMessage_get_blinding_point(const struct LDKOnionMessage *NONNULL_PTR this_ptr);
25864
25865 /**
25866  * Used in decrypting the onion packet's payload.
25867  */
25868 void OnionMessage_set_blinding_point(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25869
25870 /**
25871  * Creates a copy of the OnionMessage
25872  */
25873 struct LDKOnionMessage OnionMessage_clone(const struct LDKOnionMessage *NONNULL_PTR orig);
25874
25875 /**
25876  * Checks if two OnionMessages contain equal inner contents.
25877  * This ignores pointers and is_owned flags and looks at the values in fields.
25878  * Two objects with NULL inner values will be considered "equal" here.
25879  */
25880 bool OnionMessage_eq(const struct LDKOnionMessage *NONNULL_PTR a, const struct LDKOnionMessage *NONNULL_PTR b);
25881
25882 /**
25883  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
25884  */
25885 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
25886
25887 /**
25888  * The channel ID
25889  */
25890 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
25891
25892 /**
25893  * The channel ID
25894  */
25895 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25896
25897 /**
25898  * The HTLC ID
25899  */
25900 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
25901
25902 /**
25903  * The HTLC ID
25904  */
25905 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
25906
25907 /**
25908  * The pre-image of the payment hash, allowing HTLC redemption
25909  */
25910 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
25911
25912 /**
25913  * The pre-image of the payment hash, allowing HTLC redemption
25914  */
25915 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25916
25917 /**
25918  * Constructs a new UpdateFulfillHTLC given each field
25919  */
25920 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
25921
25922 /**
25923  * Creates a copy of the UpdateFulfillHTLC
25924  */
25925 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
25926
25927 /**
25928  * Checks if two UpdateFulfillHTLCs contain equal inner contents.
25929  * This ignores pointers and is_owned flags and looks at the values in fields.
25930  * Two objects with NULL inner values will be considered "equal" here.
25931  */
25932 bool UpdateFulfillHTLC_eq(const struct LDKUpdateFulfillHTLC *NONNULL_PTR a, const struct LDKUpdateFulfillHTLC *NONNULL_PTR b);
25933
25934 /**
25935  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
25936  */
25937 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
25938
25939 /**
25940  * The channel ID
25941  */
25942 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
25943
25944 /**
25945  * The channel ID
25946  */
25947 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25948
25949 /**
25950  * The HTLC ID
25951  */
25952 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
25953
25954 /**
25955  * The HTLC ID
25956  */
25957 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
25958
25959 /**
25960  * Creates a copy of the UpdateFailHTLC
25961  */
25962 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
25963
25964 /**
25965  * Checks if two UpdateFailHTLCs contain equal inner contents.
25966  * This ignores pointers and is_owned flags and looks at the values in fields.
25967  * Two objects with NULL inner values will be considered "equal" here.
25968  */
25969 bool UpdateFailHTLC_eq(const struct LDKUpdateFailHTLC *NONNULL_PTR a, const struct LDKUpdateFailHTLC *NONNULL_PTR b);
25970
25971 /**
25972  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
25973  */
25974 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
25975
25976 /**
25977  * The channel ID
25978  */
25979 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
25980
25981 /**
25982  * The channel ID
25983  */
25984 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25985
25986 /**
25987  * The HTLC ID
25988  */
25989 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
25990
25991 /**
25992  * The HTLC ID
25993  */
25994 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
25995
25996 /**
25997  * The failure code
25998  */
25999 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
26000
26001 /**
26002  * The failure code
26003  */
26004 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
26005
26006 /**
26007  * Creates a copy of the UpdateFailMalformedHTLC
26008  */
26009 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
26010
26011 /**
26012  * Checks if two UpdateFailMalformedHTLCs contain equal inner contents.
26013  * This ignores pointers and is_owned flags and looks at the values in fields.
26014  * Two objects with NULL inner values will be considered "equal" here.
26015  */
26016 bool UpdateFailMalformedHTLC_eq(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR a, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR b);
26017
26018 /**
26019  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
26020  */
26021 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
26022
26023 /**
26024  * The channel ID
26025  */
26026 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
26027
26028 /**
26029  * The channel ID
26030  */
26031 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26032
26033 /**
26034  * A signature on the commitment transaction
26035  */
26036 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
26037
26038 /**
26039  * A signature on the commitment transaction
26040  */
26041 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
26042
26043 /**
26044  * Signatures on the HTLC transactions
26045  *
26046  * Returns a copy of the field.
26047  */
26048 struct LDKCVec_SignatureZ CommitmentSigned_get_htlc_signatures(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
26049
26050 /**
26051  * Signatures on the HTLC transactions
26052  */
26053 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
26054
26055 /**
26056  * Constructs a new CommitmentSigned given each field
26057  */
26058 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
26059
26060 /**
26061  * Creates a copy of the CommitmentSigned
26062  */
26063 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
26064
26065 /**
26066  * Checks if two CommitmentSigneds contain equal inner contents.
26067  * This ignores pointers and is_owned flags and looks at the values in fields.
26068  * Two objects with NULL inner values will be considered "equal" here.
26069  */
26070 bool CommitmentSigned_eq(const struct LDKCommitmentSigned *NONNULL_PTR a, const struct LDKCommitmentSigned *NONNULL_PTR b);
26071
26072 /**
26073  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
26074  */
26075 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
26076
26077 /**
26078  * The channel ID
26079  */
26080 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
26081
26082 /**
26083  * The channel ID
26084  */
26085 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26086
26087 /**
26088  * The secret corresponding to the per-commitment point
26089  */
26090 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
26091
26092 /**
26093  * The secret corresponding to the per-commitment point
26094  */
26095 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26096
26097 /**
26098  * The next sender-broadcast commitment transaction's per-commitment point
26099  */
26100 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
26101
26102 /**
26103  * The next sender-broadcast commitment transaction's per-commitment point
26104  */
26105 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26106
26107 /**
26108  * Constructs a new RevokeAndACK given each field
26109  */
26110 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);
26111
26112 /**
26113  * Creates a copy of the RevokeAndACK
26114  */
26115 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
26116
26117 /**
26118  * Checks if two RevokeAndACKs contain equal inner contents.
26119  * This ignores pointers and is_owned flags and looks at the values in fields.
26120  * Two objects with NULL inner values will be considered "equal" here.
26121  */
26122 bool RevokeAndACK_eq(const struct LDKRevokeAndACK *NONNULL_PTR a, const struct LDKRevokeAndACK *NONNULL_PTR b);
26123
26124 /**
26125  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
26126  */
26127 void UpdateFee_free(struct LDKUpdateFee this_obj);
26128
26129 /**
26130  * The channel ID
26131  */
26132 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
26133
26134 /**
26135  * The channel ID
26136  */
26137 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26138
26139 /**
26140  * Fee rate per 1000-weight of the transaction
26141  */
26142 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
26143
26144 /**
26145  * Fee rate per 1000-weight of the transaction
26146  */
26147 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
26148
26149 /**
26150  * Constructs a new UpdateFee given each field
26151  */
26152 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
26153
26154 /**
26155  * Creates a copy of the UpdateFee
26156  */
26157 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
26158
26159 /**
26160  * Checks if two UpdateFees contain equal inner contents.
26161  * This ignores pointers and is_owned flags and looks at the values in fields.
26162  * Two objects with NULL inner values will be considered "equal" here.
26163  */
26164 bool UpdateFee_eq(const struct LDKUpdateFee *NONNULL_PTR a, const struct LDKUpdateFee *NONNULL_PTR b);
26165
26166 /**
26167  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
26168  */
26169 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
26170
26171 /**
26172  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
26173  * belonging to the recipient
26174  */
26175 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
26176
26177 /**
26178  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
26179  * belonging to the recipient
26180  */
26181 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26182
26183 /**
26184  * The sender's per-commitment point for their current commitment transaction
26185  */
26186 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
26187
26188 /**
26189  * The sender's per-commitment point for their current commitment transaction
26190  */
26191 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26192
26193 /**
26194  * Constructs a new DataLossProtect given each field
26195  */
26196 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
26197
26198 /**
26199  * Creates a copy of the DataLossProtect
26200  */
26201 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
26202
26203 /**
26204  * Checks if two DataLossProtects contain equal inner contents.
26205  * This ignores pointers and is_owned flags and looks at the values in fields.
26206  * Two objects with NULL inner values will be considered "equal" here.
26207  */
26208 bool DataLossProtect_eq(const struct LDKDataLossProtect *NONNULL_PTR a, const struct LDKDataLossProtect *NONNULL_PTR b);
26209
26210 /**
26211  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
26212  */
26213 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
26214
26215 /**
26216  * The channel ID
26217  */
26218 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
26219
26220 /**
26221  * The channel ID
26222  */
26223 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26224
26225 /**
26226  * The next commitment number for the sender
26227  */
26228 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
26229
26230 /**
26231  * The next commitment number for the sender
26232  */
26233 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
26234
26235 /**
26236  * The next commitment number for the recipient
26237  */
26238 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
26239
26240 /**
26241  * The next commitment number for the recipient
26242  */
26243 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
26244
26245 /**
26246  * Creates a copy of the ChannelReestablish
26247  */
26248 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
26249
26250 /**
26251  * Checks if two ChannelReestablishs contain equal inner contents.
26252  * This ignores pointers and is_owned flags and looks at the values in fields.
26253  * Two objects with NULL inner values will be considered "equal" here.
26254  */
26255 bool ChannelReestablish_eq(const struct LDKChannelReestablish *NONNULL_PTR a, const struct LDKChannelReestablish *NONNULL_PTR b);
26256
26257 /**
26258  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
26259  */
26260 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
26261
26262 /**
26263  * The channel ID
26264  */
26265 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
26266
26267 /**
26268  * The channel ID
26269  */
26270 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26271
26272 /**
26273  * The short channel ID
26274  */
26275 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
26276
26277 /**
26278  * The short channel ID
26279  */
26280 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
26281
26282 /**
26283  * A signature by the node key
26284  */
26285 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
26286
26287 /**
26288  * A signature by the node key
26289  */
26290 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
26291
26292 /**
26293  * A signature by the funding key
26294  */
26295 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
26296
26297 /**
26298  * A signature by the funding key
26299  */
26300 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
26301
26302 /**
26303  * Constructs a new AnnouncementSignatures given each field
26304  */
26305 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);
26306
26307 /**
26308  * Creates a copy of the AnnouncementSignatures
26309  */
26310 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
26311
26312 /**
26313  * Checks if two AnnouncementSignaturess contain equal inner contents.
26314  * This ignores pointers and is_owned flags and looks at the values in fields.
26315  * Two objects with NULL inner values will be considered "equal" here.
26316  */
26317 bool AnnouncementSignatures_eq(const struct LDKAnnouncementSignatures *NONNULL_PTR a, const struct LDKAnnouncementSignatures *NONNULL_PTR b);
26318
26319 /**
26320  * Frees any resources used by the NetAddress
26321  */
26322 void NetAddress_free(struct LDKNetAddress this_ptr);
26323
26324 /**
26325  * Creates a copy of the NetAddress
26326  */
26327 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
26328
26329 /**
26330  * Utility method to constructs a new IPv4-variant NetAddress
26331  */
26332 struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port);
26333
26334 /**
26335  * Utility method to constructs a new IPv6-variant NetAddress
26336  */
26337 struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port);
26338
26339 /**
26340  * Utility method to constructs a new OnionV2-variant NetAddress
26341  */
26342 struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a);
26343
26344 /**
26345  * Utility method to constructs a new OnionV3-variant NetAddress
26346  */
26347 struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port);
26348
26349 /**
26350  * Utility method to constructs a new Hostname-variant NetAddress
26351  */
26352 struct LDKNetAddress NetAddress_hostname(struct LDKHostname hostname, uint16_t port);
26353
26354 /**
26355  * Checks if two NetAddresss contain equal inner contents.
26356  * This ignores pointers and is_owned flags and looks at the values in fields.
26357  */
26358 bool NetAddress_eq(const struct LDKNetAddress *NONNULL_PTR a, const struct LDKNetAddress *NONNULL_PTR b);
26359
26360 /**
26361  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
26362  */
26363 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
26364
26365 /**
26366  * Read a NetAddress from a byte array, created by NetAddress_write
26367  */
26368 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
26369
26370 /**
26371  * Frees any resources used by the UnsignedGossipMessage
26372  */
26373 void UnsignedGossipMessage_free(struct LDKUnsignedGossipMessage this_ptr);
26374
26375 /**
26376  * Creates a copy of the UnsignedGossipMessage
26377  */
26378 struct LDKUnsignedGossipMessage UnsignedGossipMessage_clone(const struct LDKUnsignedGossipMessage *NONNULL_PTR orig);
26379
26380 /**
26381  * Utility method to constructs a new ChannelAnnouncement-variant UnsignedGossipMessage
26382  */
26383 struct LDKUnsignedGossipMessage UnsignedGossipMessage_channel_announcement(struct LDKUnsignedChannelAnnouncement a);
26384
26385 /**
26386  * Utility method to constructs a new ChannelUpdate-variant UnsignedGossipMessage
26387  */
26388 struct LDKUnsignedGossipMessage UnsignedGossipMessage_channel_update(struct LDKUnsignedChannelUpdate a);
26389
26390 /**
26391  * Utility method to constructs a new NodeAnnouncement-variant UnsignedGossipMessage
26392  */
26393 struct LDKUnsignedGossipMessage UnsignedGossipMessage_node_announcement(struct LDKUnsignedNodeAnnouncement a);
26394
26395 /**
26396  * Serialize the UnsignedGossipMessage object into a byte array which can be read by UnsignedGossipMessage_read
26397  */
26398 struct LDKCVec_u8Z UnsignedGossipMessage_write(const struct LDKUnsignedGossipMessage *NONNULL_PTR obj);
26399
26400 /**
26401  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
26402  */
26403 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
26404
26405 /**
26406  * The advertised features
26407  */
26408 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
26409
26410 /**
26411  * The advertised features
26412  */
26413 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
26414
26415 /**
26416  * A strictly monotonic announcement counter, with gaps allowed
26417  */
26418 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
26419
26420 /**
26421  * A strictly monotonic announcement counter, with gaps allowed
26422  */
26423 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
26424
26425 /**
26426  * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back
26427  * to this node).
26428  */
26429 struct LDKNodeId UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
26430
26431 /**
26432  * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back
26433  * to this node).
26434  */
26435 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val);
26436
26437 /**
26438  * An RGB color for UI purposes
26439  */
26440 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
26441
26442 /**
26443  * An RGB color for UI purposes
26444  */
26445 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
26446
26447 /**
26448  * An alias, for UI purposes.
26449  *
26450  * This should be sanitized before use. There is no guarantee of uniqueness.
26451  */
26452 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
26453
26454 /**
26455  * An alias, for UI purposes.
26456  *
26457  * This should be sanitized before use. There is no guarantee of uniqueness.
26458  */
26459 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26460
26461 /**
26462  * List of addresses on which this node is reachable
26463  *
26464  * Returns a copy of the field.
26465  */
26466 struct LDKCVec_NetAddressZ UnsignedNodeAnnouncement_get_addresses(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
26467
26468 /**
26469  * List of addresses on which this node is reachable
26470  */
26471 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
26472
26473 /**
26474  * Creates a copy of the UnsignedNodeAnnouncement
26475  */
26476 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
26477
26478 /**
26479  * Checks if two UnsignedNodeAnnouncements contain equal inner contents.
26480  * This ignores pointers and is_owned flags and looks at the values in fields.
26481  * Two objects with NULL inner values will be considered "equal" here.
26482  */
26483 bool UnsignedNodeAnnouncement_eq(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR a, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR b);
26484
26485 /**
26486  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
26487  */
26488 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
26489
26490 /**
26491  * The signature by the node key
26492  */
26493 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
26494
26495 /**
26496  * The signature by the node key
26497  */
26498 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
26499
26500 /**
26501  * The actual content of the announcement
26502  */
26503 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
26504
26505 /**
26506  * The actual content of the announcement
26507  */
26508 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
26509
26510 /**
26511  * Constructs a new NodeAnnouncement given each field
26512  */
26513 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
26514
26515 /**
26516  * Creates a copy of the NodeAnnouncement
26517  */
26518 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
26519
26520 /**
26521  * Checks if two NodeAnnouncements contain equal inner contents.
26522  * This ignores pointers and is_owned flags and looks at the values in fields.
26523  * Two objects with NULL inner values will be considered "equal" here.
26524  */
26525 bool NodeAnnouncement_eq(const struct LDKNodeAnnouncement *NONNULL_PTR a, const struct LDKNodeAnnouncement *NONNULL_PTR b);
26526
26527 /**
26528  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
26529  */
26530 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
26531
26532 /**
26533  * The advertised channel features
26534  */
26535 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
26536
26537 /**
26538  * The advertised channel features
26539  */
26540 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
26541
26542 /**
26543  * The genesis hash of the blockchain where the channel is to be opened
26544  */
26545 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
26546
26547 /**
26548  * The genesis hash of the blockchain where the channel is to be opened
26549  */
26550 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26551
26552 /**
26553  * The short channel ID
26554  */
26555 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
26556
26557 /**
26558  * The short channel ID
26559  */
26560 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
26561
26562 /**
26563  * One of the two `node_id`s which are endpoints of this channel
26564  */
26565 struct LDKNodeId UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
26566
26567 /**
26568  * One of the two `node_id`s which are endpoints of this channel
26569  */
26570 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val);
26571
26572 /**
26573  * The other of the two `node_id`s which are endpoints of this channel
26574  */
26575 struct LDKNodeId UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
26576
26577 /**
26578  * The other of the two `node_id`s which are endpoints of this channel
26579  */
26580 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val);
26581
26582 /**
26583  * The funding key for the first node
26584  */
26585 struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
26586
26587 /**
26588  * The funding key for the first node
26589  */
26590 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val);
26591
26592 /**
26593  * The funding key for the second node
26594  */
26595 struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
26596
26597 /**
26598  * The funding key for the second node
26599  */
26600 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val);
26601
26602 /**
26603  * Creates a copy of the UnsignedChannelAnnouncement
26604  */
26605 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
26606
26607 /**
26608  * Checks if two UnsignedChannelAnnouncements contain equal inner contents.
26609  * This ignores pointers and is_owned flags and looks at the values in fields.
26610  * Two objects with NULL inner values will be considered "equal" here.
26611  */
26612 bool UnsignedChannelAnnouncement_eq(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR a, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR b);
26613
26614 /**
26615  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
26616  */
26617 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
26618
26619 /**
26620  * Authentication of the announcement by the first public node
26621  */
26622 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
26623
26624 /**
26625  * Authentication of the announcement by the first public node
26626  */
26627 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
26628
26629 /**
26630  * Authentication of the announcement by the second public node
26631  */
26632 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
26633
26634 /**
26635  * Authentication of the announcement by the second public node
26636  */
26637 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
26638
26639 /**
26640  * Proof of funding UTXO ownership by the first public node
26641  */
26642 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
26643
26644 /**
26645  * Proof of funding UTXO ownership by the first public node
26646  */
26647 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
26648
26649 /**
26650  * Proof of funding UTXO ownership by the second public node
26651  */
26652 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
26653
26654 /**
26655  * Proof of funding UTXO ownership by the second public node
26656  */
26657 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
26658
26659 /**
26660  * The actual announcement
26661  */
26662 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
26663
26664 /**
26665  * The actual announcement
26666  */
26667 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
26668
26669 /**
26670  * Constructs a new ChannelAnnouncement given each field
26671  */
26672 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);
26673
26674 /**
26675  * Creates a copy of the ChannelAnnouncement
26676  */
26677 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
26678
26679 /**
26680  * Checks if two ChannelAnnouncements contain equal inner contents.
26681  * This ignores pointers and is_owned flags and looks at the values in fields.
26682  * Two objects with NULL inner values will be considered "equal" here.
26683  */
26684 bool ChannelAnnouncement_eq(const struct LDKChannelAnnouncement *NONNULL_PTR a, const struct LDKChannelAnnouncement *NONNULL_PTR b);
26685
26686 /**
26687  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
26688  */
26689 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
26690
26691 /**
26692  * The genesis hash of the blockchain where the channel is to be opened
26693  */
26694 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
26695
26696 /**
26697  * The genesis hash of the blockchain where the channel is to be opened
26698  */
26699 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26700
26701 /**
26702  * The short channel ID
26703  */
26704 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
26705
26706 /**
26707  * The short channel ID
26708  */
26709 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
26710
26711 /**
26712  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
26713  */
26714 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
26715
26716 /**
26717  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
26718  */
26719 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
26720
26721 /**
26722  * Channel flags
26723  */
26724 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
26725
26726 /**
26727  * Channel flags
26728  */
26729 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
26730
26731 /**
26732  * The number of blocks such that if:
26733  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
26734  * then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines
26735  * the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a
26736  * `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10,
26737  * then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before
26738  * forwarding. Note that the HTLC sender is the one who originally sets this value when
26739  * constructing the route.
26740  */
26741 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
26742
26743 /**
26744  * The number of blocks such that if:
26745  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
26746  * then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines
26747  * the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a
26748  * `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10,
26749  * then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before
26750  * forwarding. Note that the HTLC sender is the one who originally sets this value when
26751  * constructing the route.
26752  */
26753 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
26754
26755 /**
26756  * The minimum HTLC size incoming to sender, in milli-satoshi
26757  */
26758 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
26759
26760 /**
26761  * The minimum HTLC size incoming to sender, in milli-satoshi
26762  */
26763 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
26764
26765 /**
26766  * The maximum HTLC value incoming to sender, in milli-satoshi.
26767  *
26768  * This used to be optional.
26769  */
26770 uint64_t UnsignedChannelUpdate_get_htlc_maximum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
26771
26772 /**
26773  * The maximum HTLC value incoming to sender, in milli-satoshi.
26774  *
26775  * This used to be optional.
26776  */
26777 void UnsignedChannelUpdate_set_htlc_maximum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
26778
26779 /**
26780  * The base HTLC fee charged by sender, in milli-satoshi
26781  */
26782 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
26783
26784 /**
26785  * The base HTLC fee charged by sender, in milli-satoshi
26786  */
26787 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
26788
26789 /**
26790  * The amount to fee multiplier, in micro-satoshi
26791  */
26792 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
26793
26794 /**
26795  * The amount to fee multiplier, in micro-satoshi
26796  */
26797 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
26798
26799 /**
26800  * Excess data which was signed as a part of the message which we do not (yet) understand how
26801  * to decode.
26802  *
26803  * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol.
26804  *
26805  * Returns a copy of the field.
26806  */
26807 struct LDKCVec_u8Z UnsignedChannelUpdate_get_excess_data(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
26808
26809 /**
26810  * Excess data which was signed as a part of the message which we do not (yet) understand how
26811  * to decode.
26812  *
26813  * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol.
26814  */
26815 void UnsignedChannelUpdate_set_excess_data(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
26816
26817 /**
26818  * Constructs a new UnsignedChannelUpdate given each field
26819  */
26820 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);
26821
26822 /**
26823  * Creates a copy of the UnsignedChannelUpdate
26824  */
26825 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
26826
26827 /**
26828  * Checks if two UnsignedChannelUpdates contain equal inner contents.
26829  * This ignores pointers and is_owned flags and looks at the values in fields.
26830  * Two objects with NULL inner values will be considered "equal" here.
26831  */
26832 bool UnsignedChannelUpdate_eq(const struct LDKUnsignedChannelUpdate *NONNULL_PTR a, const struct LDKUnsignedChannelUpdate *NONNULL_PTR b);
26833
26834 /**
26835  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
26836  */
26837 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
26838
26839 /**
26840  * A signature of the channel update
26841  */
26842 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
26843
26844 /**
26845  * A signature of the channel update
26846  */
26847 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
26848
26849 /**
26850  * The actual channel update
26851  */
26852 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
26853
26854 /**
26855  * The actual channel update
26856  */
26857 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
26858
26859 /**
26860  * Constructs a new ChannelUpdate given each field
26861  */
26862 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
26863
26864 /**
26865  * Creates a copy of the ChannelUpdate
26866  */
26867 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
26868
26869 /**
26870  * Checks if two ChannelUpdates contain equal inner contents.
26871  * This ignores pointers and is_owned flags and looks at the values in fields.
26872  * Two objects with NULL inner values will be considered "equal" here.
26873  */
26874 bool ChannelUpdate_eq(const struct LDKChannelUpdate *NONNULL_PTR a, const struct LDKChannelUpdate *NONNULL_PTR b);
26875
26876 /**
26877  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
26878  */
26879 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
26880
26881 /**
26882  * The genesis hash of the blockchain being queried
26883  */
26884 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
26885
26886 /**
26887  * The genesis hash of the blockchain being queried
26888  */
26889 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26890
26891 /**
26892  * The height of the first block for the channel UTXOs being queried
26893  */
26894 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
26895
26896 /**
26897  * The height of the first block for the channel UTXOs being queried
26898  */
26899 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
26900
26901 /**
26902  * The number of blocks to include in the query results
26903  */
26904 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
26905
26906 /**
26907  * The number of blocks to include in the query results
26908  */
26909 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
26910
26911 /**
26912  * Constructs a new QueryChannelRange given each field
26913  */
26914 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
26915
26916 /**
26917  * Creates a copy of the QueryChannelRange
26918  */
26919 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
26920
26921 /**
26922  * Checks if two QueryChannelRanges contain equal inner contents.
26923  * This ignores pointers and is_owned flags and looks at the values in fields.
26924  * Two objects with NULL inner values will be considered "equal" here.
26925  */
26926 bool QueryChannelRange_eq(const struct LDKQueryChannelRange *NONNULL_PTR a, const struct LDKQueryChannelRange *NONNULL_PTR b);
26927
26928 /**
26929  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
26930  */
26931 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
26932
26933 /**
26934  * The genesis hash of the blockchain being queried
26935  */
26936 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
26937
26938 /**
26939  * The genesis hash of the blockchain being queried
26940  */
26941 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26942
26943 /**
26944  * The height of the first block in the range of the reply
26945  */
26946 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
26947
26948 /**
26949  * The height of the first block in the range of the reply
26950  */
26951 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
26952
26953 /**
26954  * The number of blocks included in the range of the reply
26955  */
26956 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
26957
26958 /**
26959  * The number of blocks included in the range of the reply
26960  */
26961 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
26962
26963 /**
26964  * True when this is the final reply for a query
26965  */
26966 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
26967
26968 /**
26969  * True when this is the final reply for a query
26970  */
26971 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
26972
26973 /**
26974  * The `short_channel_id`s in the channel range
26975  *
26976  * Returns a copy of the field.
26977  */
26978 struct LDKCVec_u64Z ReplyChannelRange_get_short_channel_ids(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
26979
26980 /**
26981  * The `short_channel_id`s in the channel range
26982  */
26983 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
26984
26985 /**
26986  * Constructs a new ReplyChannelRange given each field
26987  */
26988 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);
26989
26990 /**
26991  * Creates a copy of the ReplyChannelRange
26992  */
26993 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
26994
26995 /**
26996  * Checks if two ReplyChannelRanges contain equal inner contents.
26997  * This ignores pointers and is_owned flags and looks at the values in fields.
26998  * Two objects with NULL inner values will be considered "equal" here.
26999  */
27000 bool ReplyChannelRange_eq(const struct LDKReplyChannelRange *NONNULL_PTR a, const struct LDKReplyChannelRange *NONNULL_PTR b);
27001
27002 /**
27003  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
27004  */
27005 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
27006
27007 /**
27008  * The genesis hash of the blockchain being queried
27009  */
27010 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
27011
27012 /**
27013  * The genesis hash of the blockchain being queried
27014  */
27015 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
27016
27017 /**
27018  * The short_channel_ids that are being queried
27019  *
27020  * Returns a copy of the field.
27021  */
27022 struct LDKCVec_u64Z QueryShortChannelIds_get_short_channel_ids(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr);
27023
27024 /**
27025  * The short_channel_ids that are being queried
27026  */
27027 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
27028
27029 /**
27030  * Constructs a new QueryShortChannelIds given each field
27031  */
27032 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
27033
27034 /**
27035  * Creates a copy of the QueryShortChannelIds
27036  */
27037 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
27038
27039 /**
27040  * Checks if two QueryShortChannelIdss contain equal inner contents.
27041  * This ignores pointers and is_owned flags and looks at the values in fields.
27042  * Two objects with NULL inner values will be considered "equal" here.
27043  */
27044 bool QueryShortChannelIds_eq(const struct LDKQueryShortChannelIds *NONNULL_PTR a, const struct LDKQueryShortChannelIds *NONNULL_PTR b);
27045
27046 /**
27047  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
27048  */
27049 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
27050
27051 /**
27052  * The genesis hash of the blockchain that was queried
27053  */
27054 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
27055
27056 /**
27057  * The genesis hash of the blockchain that was queried
27058  */
27059 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
27060
27061 /**
27062  * Indicates if the query recipient maintains up-to-date channel
27063  * information for the `chain_hash`
27064  */
27065 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
27066
27067 /**
27068  * Indicates if the query recipient maintains up-to-date channel
27069  * information for the `chain_hash`
27070  */
27071 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
27072
27073 /**
27074  * Constructs a new ReplyShortChannelIdsEnd given each field
27075  */
27076 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
27077
27078 /**
27079  * Creates a copy of the ReplyShortChannelIdsEnd
27080  */
27081 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
27082
27083 /**
27084  * Checks if two ReplyShortChannelIdsEnds contain equal inner contents.
27085  * This ignores pointers and is_owned flags and looks at the values in fields.
27086  * Two objects with NULL inner values will be considered "equal" here.
27087  */
27088 bool ReplyShortChannelIdsEnd_eq(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR a, const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR b);
27089
27090 /**
27091  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
27092  */
27093 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
27094
27095 /**
27096  * The genesis hash of the blockchain for channel and node information
27097  */
27098 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
27099
27100 /**
27101  * The genesis hash of the blockchain for channel and node information
27102  */
27103 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
27104
27105 /**
27106  * The starting unix timestamp
27107  */
27108 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
27109
27110 /**
27111  * The starting unix timestamp
27112  */
27113 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
27114
27115 /**
27116  * The range of information in seconds
27117  */
27118 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
27119
27120 /**
27121  * The range of information in seconds
27122  */
27123 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
27124
27125 /**
27126  * Constructs a new GossipTimestampFilter given each field
27127  */
27128 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
27129
27130 /**
27131  * Creates a copy of the GossipTimestampFilter
27132  */
27133 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
27134
27135 /**
27136  * Checks if two GossipTimestampFilters contain equal inner contents.
27137  * This ignores pointers and is_owned flags and looks at the values in fields.
27138  * Two objects with NULL inner values will be considered "equal" here.
27139  */
27140 bool GossipTimestampFilter_eq(const struct LDKGossipTimestampFilter *NONNULL_PTR a, const struct LDKGossipTimestampFilter *NONNULL_PTR b);
27141
27142 /**
27143  * Frees any resources used by the ErrorAction
27144  */
27145 void ErrorAction_free(struct LDKErrorAction this_ptr);
27146
27147 /**
27148  * Creates a copy of the ErrorAction
27149  */
27150 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
27151
27152 /**
27153  * Utility method to constructs a new DisconnectPeer-variant ErrorAction
27154  */
27155 struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg);
27156
27157 /**
27158  * Utility method to constructs a new IgnoreError-variant ErrorAction
27159  */
27160 struct LDKErrorAction ErrorAction_ignore_error(void);
27161
27162 /**
27163  * Utility method to constructs a new IgnoreAndLog-variant ErrorAction
27164  */
27165 struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
27166
27167 /**
27168  * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction
27169  */
27170 struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void);
27171
27172 /**
27173  * Utility method to constructs a new SendErrorMessage-variant ErrorAction
27174  */
27175 struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg);
27176
27177 /**
27178  * Utility method to constructs a new SendWarningMessage-variant ErrorAction
27179  */
27180 struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level);
27181
27182 /**
27183  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
27184  */
27185 void LightningError_free(struct LDKLightningError this_obj);
27186
27187 /**
27188  * A human-readable message describing the error
27189  */
27190 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
27191
27192 /**
27193  * A human-readable message describing the error
27194  */
27195 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
27196
27197 /**
27198  * The action which should be taken against the offending peer.
27199  */
27200 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
27201
27202 /**
27203  * The action which should be taken against the offending peer.
27204  */
27205 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
27206
27207 /**
27208  * Constructs a new LightningError given each field
27209  */
27210 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
27211
27212 /**
27213  * Creates a copy of the LightningError
27214  */
27215 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
27216
27217 /**
27218  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
27219  */
27220 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
27221
27222 /**
27223  * `update_add_htlc` messages which should be sent
27224  */
27225 struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
27226
27227 /**
27228  * `update_add_htlc` messages which should be sent
27229  */
27230 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
27231
27232 /**
27233  * `update_fulfill_htlc` messages which should be sent
27234  */
27235 struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
27236
27237 /**
27238  * `update_fulfill_htlc` messages which should be sent
27239  */
27240 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
27241
27242 /**
27243  * `update_fail_htlc` messages which should be sent
27244  */
27245 struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
27246
27247 /**
27248  * `update_fail_htlc` messages which should be sent
27249  */
27250 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
27251
27252 /**
27253  * `update_fail_malformed_htlc` messages which should be sent
27254  */
27255 struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
27256
27257 /**
27258  * `update_fail_malformed_htlc` messages which should be sent
27259  */
27260 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
27261
27262 /**
27263  * An `update_fee` message which should be sent
27264  *
27265  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27266  */
27267 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
27268
27269 /**
27270  * An `update_fee` message which should be sent
27271  *
27272  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
27273  */
27274 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
27275
27276 /**
27277  * A `commitment_signed` message which should be sent
27278  */
27279 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
27280
27281 /**
27282  * A `commitment_signed` message which should be sent
27283  */
27284 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
27285
27286 /**
27287  * Constructs a new CommitmentUpdate given each field
27288  */
27289 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);
27290
27291 /**
27292  * Creates a copy of the CommitmentUpdate
27293  */
27294 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
27295
27296 /**
27297  * Checks if two CommitmentUpdates contain equal inner contents.
27298  * This ignores pointers and is_owned flags and looks at the values in fields.
27299  * Two objects with NULL inner values will be considered "equal" here.
27300  */
27301 bool CommitmentUpdate_eq(const struct LDKCommitmentUpdate *NONNULL_PTR a, const struct LDKCommitmentUpdate *NONNULL_PTR b);
27302
27303 /**
27304  * Calls the free function if one is set
27305  */
27306 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
27307
27308 /**
27309  * Calls the free function if one is set
27310  */
27311 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
27312
27313 /**
27314  * Calls the free function if one is set
27315  */
27316 void OnionMessageHandler_free(struct LDKOnionMessageHandler this_ptr);
27317
27318 /**
27319  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
27320  */
27321 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
27322
27323 /**
27324  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
27325  */
27326 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
27327
27328 /**
27329  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
27330  */
27331 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
27332
27333 /**
27334  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
27335  */
27336 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
27337
27338 /**
27339  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
27340  */
27341 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
27342
27343 /**
27344  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
27345  */
27346 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
27347
27348 /**
27349  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
27350  */
27351 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
27352
27353 /**
27354  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
27355  */
27356 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
27357
27358 /**
27359  * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
27360  */
27361 struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
27362
27363 /**
27364  * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
27365  */
27366 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
27367
27368 /**
27369  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
27370  */
27371 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
27372
27373 /**
27374  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
27375  */
27376 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
27377
27378 /**
27379  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
27380  */
27381 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
27382
27383 /**
27384  * Read a FundingCreated from a byte array, created by FundingCreated_write
27385  */
27386 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
27387
27388 /**
27389  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
27390  */
27391 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
27392
27393 /**
27394  * Read a FundingSigned from a byte array, created by FundingSigned_write
27395  */
27396 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
27397
27398 /**
27399  * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read
27400  */
27401 struct LDKCVec_u8Z ChannelReady_write(const struct LDKChannelReady *NONNULL_PTR obj);
27402
27403 /**
27404  * Read a ChannelReady from a byte array, created by ChannelReady_write
27405  */
27406 struct LDKCResult_ChannelReadyDecodeErrorZ ChannelReady_read(struct LDKu8slice ser);
27407
27408 /**
27409  * Serialize the Init object into a byte array which can be read by Init_read
27410  */
27411 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
27412
27413 /**
27414  * Read a Init from a byte array, created by Init_write
27415  */
27416 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
27417
27418 /**
27419  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
27420  */
27421 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
27422
27423 /**
27424  * Read a OpenChannel from a byte array, created by OpenChannel_write
27425  */
27426 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
27427
27428 /**
27429  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
27430  */
27431 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
27432
27433 /**
27434  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
27435  */
27436 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
27437
27438 /**
27439  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
27440  */
27441 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
27442
27443 /**
27444  * Read a Shutdown from a byte array, created by Shutdown_write
27445  */
27446 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
27447
27448 /**
27449  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
27450  */
27451 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
27452
27453 /**
27454  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
27455  */
27456 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
27457
27458 /**
27459  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
27460  */
27461 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
27462
27463 /**
27464  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
27465  */
27466 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
27467
27468 /**
27469  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
27470  */
27471 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
27472
27473 /**
27474  * Read a UpdateFee from a byte array, created by UpdateFee_write
27475  */
27476 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
27477
27478 /**
27479  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
27480  */
27481 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
27482
27483 /**
27484  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
27485  */
27486 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
27487
27488 /**
27489  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
27490  */
27491 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
27492
27493 /**
27494  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
27495  */
27496 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
27497
27498 /**
27499  * Read a OnionMessage from a byte array, created by OnionMessage_write
27500  */
27501 struct LDKCResult_OnionMessageDecodeErrorZ OnionMessage_read(struct LDKu8slice ser);
27502
27503 /**
27504  * Serialize the OnionMessage object into a byte array which can be read by OnionMessage_read
27505  */
27506 struct LDKCVec_u8Z OnionMessage_write(const struct LDKOnionMessage *NONNULL_PTR obj);
27507
27508 /**
27509  * Serialize the Ping object into a byte array which can be read by Ping_read
27510  */
27511 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
27512
27513 /**
27514  * Read a Ping from a byte array, created by Ping_write
27515  */
27516 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
27517
27518 /**
27519  * Serialize the Pong object into a byte array which can be read by Pong_read
27520  */
27521 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
27522
27523 /**
27524  * Read a Pong from a byte array, created by Pong_write
27525  */
27526 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
27527
27528 /**
27529  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
27530  */
27531 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
27532
27533 /**
27534  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
27535  */
27536 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
27537
27538 /**
27539  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
27540  */
27541 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
27542
27543 /**
27544  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
27545  */
27546 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
27547
27548 /**
27549  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
27550  */
27551 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
27552
27553 /**
27554  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
27555  */
27556 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
27557
27558 /**
27559  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
27560  */
27561 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
27562
27563 /**
27564  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
27565  */
27566 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
27567
27568 /**
27569  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
27570  */
27571 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
27572
27573 /**
27574  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
27575  */
27576 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
27577
27578 /**
27579  * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read
27580  */
27581 struct LDKCVec_u8Z WarningMessage_write(const struct LDKWarningMessage *NONNULL_PTR obj);
27582
27583 /**
27584  * Read a WarningMessage from a byte array, created by WarningMessage_write
27585  */
27586 struct LDKCResult_WarningMessageDecodeErrorZ WarningMessage_read(struct LDKu8slice ser);
27587
27588 /**
27589  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
27590  */
27591 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
27592
27593 /**
27594  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
27595  */
27596 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
27597
27598 /**
27599  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
27600  */
27601 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
27602
27603 /**
27604  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
27605  */
27606 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
27607
27608 /**
27609  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
27610  */
27611 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
27612
27613 /**
27614  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
27615  */
27616 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
27617
27618 /**
27619  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
27620  */
27621 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
27622
27623 /**
27624  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
27625  */
27626 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
27627
27628 /**
27629  * Calculates the overflow safe ending block height for the query.
27630  *
27631  * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`.
27632  */
27633 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
27634
27635 /**
27636  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
27637  */
27638 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
27639
27640 /**
27641  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
27642  */
27643 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
27644
27645 /**
27646  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
27647  */
27648 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
27649
27650 /**
27651  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
27652  */
27653 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
27654
27655 /**
27656  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
27657  */
27658 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
27659
27660 /**
27661  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
27662  */
27663 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
27664
27665 /**
27666  * Calls the free function if one is set
27667  */
27668 void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
27669
27670 /**
27671  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
27672  */
27673 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
27674
27675 /**
27676  * Constructs a new IgnoringMessageHandler given each field
27677  */
27678 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
27679
27680 /**
27681  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
27682  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
27683  */
27684 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
27685
27686 /**
27687  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
27688  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
27689  */
27690 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
27691
27692 /**
27693  * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg.
27694  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is
27695  */
27696 struct LDKOnionMessageProvider IgnoringMessageHandler_as_OnionMessageProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
27697
27698 /**
27699  * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg.
27700  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is
27701  */
27702 struct LDKOnionMessageHandler IgnoringMessageHandler_as_OnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
27703
27704 /**
27705  * Constructs a new CustomOnionMessageHandler which calls the relevant methods on this_arg.
27706  * This copies the `inner` pointer in this_arg and thus the returned CustomOnionMessageHandler must be freed before this_arg is
27707  */
27708 struct LDKCustomOnionMessageHandler IgnoringMessageHandler_as_CustomOnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
27709
27710 /**
27711  * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
27712  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
27713  */
27714 struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
27715
27716 /**
27717  * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg.
27718  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is
27719  */
27720 struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
27721
27722 /**
27723  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
27724  */
27725 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
27726
27727 /**
27728  * Constructs a new ErroringMessageHandler
27729  */
27730 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
27731
27732 /**
27733  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
27734  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
27735  */
27736 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
27737
27738 /**
27739  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
27740  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
27741  */
27742 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
27743
27744 /**
27745  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
27746  */
27747 void MessageHandler_free(struct LDKMessageHandler this_obj);
27748
27749 /**
27750  * A message handler which handles messages specific to channels. Usually this is just a
27751  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
27752  *
27753  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
27754  */
27755 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
27756
27757 /**
27758  * A message handler which handles messages specific to channels. Usually this is just a
27759  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
27760  *
27761  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
27762  */
27763 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
27764
27765 /**
27766  * A message handler which handles messages updating our knowledge of the network channel
27767  * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
27768  *
27769  * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
27770  */
27771 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
27772
27773 /**
27774  * A message handler which handles messages updating our knowledge of the network channel
27775  * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
27776  *
27777  * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
27778  */
27779 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
27780
27781 /**
27782  * A message handler which handles onion messages. For now, this can only be an
27783  * [`IgnoringMessageHandler`].
27784  */
27785 const struct LDKOnionMessageHandler *MessageHandler_get_onion_message_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
27786
27787 /**
27788  * A message handler which handles onion messages. For now, this can only be an
27789  * [`IgnoringMessageHandler`].
27790  */
27791 void MessageHandler_set_onion_message_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKOnionMessageHandler val);
27792
27793 /**
27794  * Constructs a new MessageHandler given each field
27795  */
27796 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg, struct LDKOnionMessageHandler onion_message_handler_arg);
27797
27798 /**
27799  * Creates a copy of a SocketDescriptor
27800  */
27801 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
27802
27803 /**
27804  * Calls the free function if one is set
27805  */
27806 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
27807
27808 /**
27809  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
27810  */
27811 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
27812
27813 /**
27814  * Constructs a new PeerHandleError given each field
27815  */
27816 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(void);
27817
27818 /**
27819  * Creates a copy of the PeerHandleError
27820  */
27821 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
27822
27823 /**
27824  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
27825  */
27826 void PeerManager_free(struct LDKPeerManager this_obj);
27827
27828 /**
27829  * Constructs a new PeerManager with the given message handlers and node_id secret key
27830  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
27831  * cryptographically secure random bytes.
27832  *
27833  * `current_time` is used as an always-increasing counter that survives across restarts and is
27834  * incremented irregularly internally. In general it is best to simply use the current UNIX
27835  * timestamp, however if it is not available a persistent counter that increases once per
27836  * minute should suffice.
27837  */
27838 MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, uint32_t current_time, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger, struct LDKCustomMessageHandler custom_message_handler, struct LDKNodeSigner node_signer);
27839
27840 /**
27841  * Get a list of tuples mapping from node id to network addresses for peers which have
27842  * completed the initial handshake.
27843  *
27844  * For outbound connections, the [`PublicKey`] will be the same as the `their_node_id` parameter
27845  * passed in to [`Self::new_outbound_connection`], however entries will only appear once the initial
27846  * handshake has completed and we are sure the remote peer has the private key for the given
27847  * [`PublicKey`].
27848  *
27849  * The returned `Option`s will only be `Some` if an address had been previously given via
27850  * [`Self::new_outbound_connection`] or [`Self::new_inbound_connection`].
27851  */
27852 MUST_USE_RES struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
27853
27854 /**
27855  * Indicates a new outbound connection has been established to a node with the given `node_id`
27856  * and an optional remote network address.
27857  *
27858  * The remote network address adds the option to report a remote IP address back to a connecting
27859  * peer using the init message.
27860  * The user should pass the remote network address of the host they are connected to.
27861  *
27862  * If an `Err` is returned here you must disconnect the connection immediately.
27863  *
27864  * Returns a small number of bytes to send to the remote node (currently always 50).
27865  *
27866  * Panics if descriptor is duplicative with some other descriptor which has not yet been
27867  * [`socket_disconnected()`].
27868  *
27869  * [`socket_disconnected()`]: PeerManager::socket_disconnected
27870  */
27871 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);
27872
27873 /**
27874  * Indicates a new inbound connection has been established to a node with an optional remote
27875  * network address.
27876  *
27877  * The remote network address adds the option to report a remote IP address back to a connecting
27878  * peer using the init message.
27879  * The user should pass the remote network address of the host they are connected to.
27880  *
27881  * May refuse the connection by returning an Err, but will never write bytes to the remote end
27882  * (outbound connector always speaks first). If an `Err` is returned here you must disconnect
27883  * the connection immediately.
27884  *
27885  * Panics if descriptor is duplicative with some other descriptor which has not yet been
27886  * [`socket_disconnected()`].
27887  *
27888  * [`socket_disconnected()`]: PeerManager::socket_disconnected
27889  */
27890 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);
27891
27892 /**
27893  * Indicates that there is room to write data to the given socket descriptor.
27894  *
27895  * May return an Err to indicate that the connection should be closed.
27896  *
27897  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
27898  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
27899  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
27900  * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't
27901  * sufficient!
27902  *
27903  * [`send_data`]: SocketDescriptor::send_data
27904  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
27905  */
27906 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
27907
27908 /**
27909  * Indicates that data was read from the given socket descriptor.
27910  *
27911  * May return an Err to indicate that the connection should be closed.
27912  *
27913  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
27914  * Thus, however, you should call [`process_events`] after any `read_event` to generate
27915  * [`send_data`] calls to handle responses.
27916  *
27917  * If `Ok(true)` is returned, further read_events should not be triggered until a
27918  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
27919  * send buffer).
27920  *
27921  * In order to avoid processing too many messages at once per peer, `data` should be on the
27922  * order of 4KiB.
27923  *
27924  * [`send_data`]: SocketDescriptor::send_data
27925  * [`process_events`]: PeerManager::process_events
27926  */
27927 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);
27928
27929 /**
27930  * Checks for any events generated by our handlers and processes them. Includes sending most
27931  * response messages as well as messages generated by calls to handler functions directly (eg
27932  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
27933  *
27934  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
27935  * issues!
27936  *
27937  * You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
27938  * or one of the other clients provided in our language bindings.
27939  *
27940  * Note that if there are any other calls to this function waiting on lock(s) this may return
27941  * without doing any work. All available events that need handling will be handled before the
27942  * other calls return.
27943  *
27944  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
27945  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
27946  * [`send_data`]: SocketDescriptor::send_data
27947  */
27948 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
27949
27950 /**
27951  * Indicates that the given socket descriptor's connection is now closed.
27952  */
27953 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
27954
27955 /**
27956  * Disconnect a peer given its node id.
27957  *
27958  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
27959  * peer. Thus, be very careful about reentrancy issues.
27960  *
27961  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
27962  */
27963 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id);
27964
27965 /**
27966  * Disconnects all currently-connected peers. This is useful on platforms where there may be
27967  * an indication that TCP sockets have stalled even if we weren't around to time them out
27968  * using regular ping/pongs.
27969  */
27970 void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg);
27971
27972 /**
27973  * Send pings to each peer and disconnect those which did not respond to the last round of
27974  * pings.
27975  *
27976  * This may be called on any timescale you want, however, roughly once every ten seconds is
27977  * preferred. The call rate determines both how often we send a ping to our peers and how much
27978  * time they have to respond before we disconnect them.
27979  *
27980  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
27981  * issues!
27982  *
27983  * [`send_data`]: SocketDescriptor::send_data
27984  */
27985 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
27986
27987 /**
27988  * Generates a signed node_announcement from the given arguments, sending it to all connected
27989  * peers. Note that peers will likely ignore this message unless we have at least one public
27990  * channel which has at least six confirmations on-chain.
27991  *
27992  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
27993  * node to humans. They carry no in-protocol meaning.
27994  *
27995  * `addresses` represent the set (possibly empty) of socket addresses on which this node
27996  * accepts incoming connections. These will be included in the node_announcement, publicly
27997  * tying these addresses together and to this node. If you wish to preserve user privacy,
27998  * addresses should likely contain only Tor Onion addresses.
27999  *
28000  * Panics if `addresses` is absurdly large (more than 100).
28001  *
28002  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
28003  */
28004 void PeerManager_broadcast_node_announcement(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
28005
28006 /**
28007  * Gets the weight for an HTLC-Success transaction.
28008  */
28009 uint64_t htlc_success_tx_weight(bool opt_anchors);
28010
28011 /**
28012  * Gets the weight for an HTLC-Timeout transaction.
28013  */
28014 uint64_t htlc_timeout_tx_weight(bool opt_anchors);
28015
28016 /**
28017  * Creates a copy of the HTLCClaim
28018  */
28019 enum LDKHTLCClaim HTLCClaim_clone(const enum LDKHTLCClaim *NONNULL_PTR orig);
28020
28021 /**
28022  * Utility method to constructs a new OfferedTimeout-variant HTLCClaim
28023  */
28024 enum LDKHTLCClaim HTLCClaim_offered_timeout(void);
28025
28026 /**
28027  * Utility method to constructs a new OfferedPreimage-variant HTLCClaim
28028  */
28029 enum LDKHTLCClaim HTLCClaim_offered_preimage(void);
28030
28031 /**
28032  * Utility method to constructs a new AcceptedTimeout-variant HTLCClaim
28033  */
28034 enum LDKHTLCClaim HTLCClaim_accepted_timeout(void);
28035
28036 /**
28037  * Utility method to constructs a new AcceptedPreimage-variant HTLCClaim
28038  */
28039 enum LDKHTLCClaim HTLCClaim_accepted_preimage(void);
28040
28041 /**
28042  * Utility method to constructs a new Revocation-variant HTLCClaim
28043  */
28044 enum LDKHTLCClaim HTLCClaim_revocation(void);
28045
28046 /**
28047  * Checks if two HTLCClaims contain equal inner contents.
28048  * This ignores pointers and is_owned flags and looks at the values in fields.
28049  */
28050 bool HTLCClaim_eq(const enum LDKHTLCClaim *NONNULL_PTR a, const enum LDKHTLCClaim *NONNULL_PTR b);
28051
28052 /**
28053  * Check if a given input witness attempts to claim a HTLC.
28054  */
28055 MUST_USE_RES struct LDKCOption_HTLCClaimZ HTLCClaim_from_witness(struct LDKWitness witness);
28056
28057 /**
28058  * Build the commitment secret from the seed and the commitment number
28059  */
28060 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
28061
28062 /**
28063  * Build a closing transaction
28064  */
28065 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);
28066
28067 /**
28068  * Frees any resources used by the CounterpartyCommitmentSecrets, if is_owned is set and inner is non-NULL.
28069  */
28070 void CounterpartyCommitmentSecrets_free(struct LDKCounterpartyCommitmentSecrets this_obj);
28071
28072 /**
28073  * Creates a copy of the CounterpartyCommitmentSecrets
28074  */
28075 struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_clone(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR orig);
28076
28077 /**
28078  * Creates a new empty `CounterpartyCommitmentSecrets` structure.
28079  */
28080 MUST_USE_RES struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_new(void);
28081
28082 /**
28083  * Returns the minimum index of all stored secrets. Note that indexes start
28084  * at 1 << 48 and get decremented by one for each new secret.
28085  */
28086 MUST_USE_RES uint64_t CounterpartyCommitmentSecrets_get_min_seen_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg);
28087
28088 /**
28089  * Inserts the `secret` at `idx`. Returns `Ok(())` if the secret
28090  * was generated in accordance with BOLT 3 and is consistent with previous secrets.
28091  */
28092 MUST_USE_RES struct LDKCResult_NoneNoneZ CounterpartyCommitmentSecrets_provide_secret(struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx, struct LDKThirtyTwoBytes secret);
28093
28094 /**
28095  * Returns the secret at `idx`.
28096  * Returns `None` if `idx` is < [`CounterpartyCommitmentSecrets::get_min_seen_secret`].
28097  *
28098  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28099  */
28100 MUST_USE_RES struct LDKThirtyTwoBytes CounterpartyCommitmentSecrets_get_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx);
28101
28102 /**
28103  * Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read
28104  */
28105 struct LDKCVec_u8Z CounterpartyCommitmentSecrets_write(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR obj);
28106
28107 /**
28108  * Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write
28109  */
28110 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitmentSecrets_read(struct LDKu8slice ser);
28111
28112 /**
28113  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
28114  * from the base secret and the per_commitment_point.
28115  */
28116 struct LDKSecretKey derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
28117
28118 /**
28119  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
28120  * from the base point and the per_commitment_key. This is the public equivalent of
28121  * derive_private_key - using only public keys to derive a public key instead of private keys.
28122  */
28123 struct LDKPublicKey derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
28124
28125 /**
28126  * Derives a per-commitment-transaction revocation key from its constituent parts.
28127  *
28128  * Only the cheating participant owns a valid witness to propagate a revoked
28129  * commitment transaction, thus per_commitment_secret always come from cheater
28130  * and revocation_base_secret always come from punisher, which is the broadcaster
28131  * of the transaction spending with this key knowledge.
28132  */
28133 struct LDKSecretKey derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
28134
28135 /**
28136  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
28137  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
28138  * public key instead of private keys.
28139  *
28140  * Only the cheating participant owns a valid witness to propagate a revoked
28141  * commitment transaction, thus per_commitment_point always come from cheater
28142  * and revocation_base_point always come from punisher, which is the broadcaster
28143  * of the transaction spending with this key knowledge.
28144  *
28145  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
28146  * generated (ie our own).
28147  */
28148 struct LDKPublicKey derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
28149
28150 /**
28151  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
28152  */
28153 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
28154
28155 /**
28156  * The broadcaster's per-commitment public key which was used to derive the other keys.
28157  */
28158 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
28159
28160 /**
28161  * The broadcaster's per-commitment public key which was used to derive the other keys.
28162  */
28163 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
28164
28165 /**
28166  * The revocation key which is used to allow the broadcaster of the commitment
28167  * transaction to provide their counterparty the ability to punish them if they broadcast
28168  * an old state.
28169  */
28170 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
28171
28172 /**
28173  * The revocation key which is used to allow the broadcaster of the commitment
28174  * transaction to provide their counterparty the ability to punish them if they broadcast
28175  * an old state.
28176  */
28177 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
28178
28179 /**
28180  * Broadcaster's HTLC Key
28181  */
28182 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
28183
28184 /**
28185  * Broadcaster's HTLC Key
28186  */
28187 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
28188
28189 /**
28190  * Countersignatory's HTLC Key
28191  */
28192 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
28193
28194 /**
28195  * Countersignatory's HTLC Key
28196  */
28197 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
28198
28199 /**
28200  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
28201  */
28202 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
28203
28204 /**
28205  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
28206  */
28207 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
28208
28209 /**
28210  * Constructs a new TxCreationKeys given each field
28211  */
28212 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);
28213
28214 /**
28215  * Checks if two TxCreationKeyss contain equal inner contents.
28216  * This ignores pointers and is_owned flags and looks at the values in fields.
28217  * Two objects with NULL inner values will be considered "equal" here.
28218  */
28219 bool TxCreationKeys_eq(const struct LDKTxCreationKeys *NONNULL_PTR a, const struct LDKTxCreationKeys *NONNULL_PTR b);
28220
28221 /**
28222  * Creates a copy of the TxCreationKeys
28223  */
28224 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
28225
28226 /**
28227  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
28228  */
28229 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
28230
28231 /**
28232  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
28233  */
28234 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
28235
28236 /**
28237  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
28238  */
28239 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
28240
28241 /**
28242  * The public key which is used to sign all commitment transactions, as it appears in the
28243  * on-chain channel lock-in 2-of-2 multisig output.
28244  */
28245 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
28246
28247 /**
28248  * The public key which is used to sign all commitment transactions, as it appears in the
28249  * on-chain channel lock-in 2-of-2 multisig output.
28250  */
28251 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
28252
28253 /**
28254  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
28255  * revocation keys. This is combined with the per-commitment-secret generated by the
28256  * counterparty to create a secret which the counterparty can reveal to revoke previous
28257  * states.
28258  */
28259 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
28260
28261 /**
28262  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
28263  * revocation keys. This is combined with the per-commitment-secret generated by the
28264  * counterparty to create a secret which the counterparty can reveal to revoke previous
28265  * states.
28266  */
28267 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
28268
28269 /**
28270  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
28271  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
28272  * static across every commitment transaction.
28273  */
28274 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
28275
28276 /**
28277  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
28278  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
28279  * static across every commitment transaction.
28280  */
28281 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
28282
28283 /**
28284  * The base point which is used (with derive_public_key) to derive a per-commitment payment
28285  * public key which receives non-HTLC-encumbered funds which are only available for spending
28286  * after some delay (or can be claimed via the revocation path).
28287  */
28288 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
28289
28290 /**
28291  * The base point which is used (with derive_public_key) to derive a per-commitment payment
28292  * public key which receives non-HTLC-encumbered funds which are only available for spending
28293  * after some delay (or can be claimed via the revocation path).
28294  */
28295 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
28296
28297 /**
28298  * The base point which is used (with derive_public_key) to derive a per-commitment public key
28299  * which is used to encumber HTLC-in-flight outputs.
28300  */
28301 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
28302
28303 /**
28304  * The base point which is used (with derive_public_key) to derive a per-commitment public key
28305  * which is used to encumber HTLC-in-flight outputs.
28306  */
28307 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
28308
28309 /**
28310  * Constructs a new ChannelPublicKeys given each field
28311  */
28312 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);
28313
28314 /**
28315  * Creates a copy of the ChannelPublicKeys
28316  */
28317 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
28318
28319 /**
28320  * Checks if two ChannelPublicKeyss contain equal inner contents.
28321  * This ignores pointers and is_owned flags and looks at the values in fields.
28322  * Two objects with NULL inner values will be considered "equal" here.
28323  */
28324 bool ChannelPublicKeys_eq(const struct LDKChannelPublicKeys *NONNULL_PTR a, const struct LDKChannelPublicKeys *NONNULL_PTR b);
28325
28326 /**
28327  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
28328  */
28329 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
28330
28331 /**
28332  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
28333  */
28334 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
28335
28336 /**
28337  * Create per-state keys from channel base points and the per-commitment point.
28338  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
28339  */
28340 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);
28341
28342 /**
28343  * Generate per-state keys from channel static keys.
28344  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
28345  */
28346 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);
28347
28348 /**
28349  * A script either spendable by the revocation
28350  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
28351  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
28352  */
28353 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
28354
28355 /**
28356  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
28357  */
28358 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
28359
28360 /**
28361  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
28362  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
28363  * need to compare this value to whether the commitment transaction in question is that of
28364  * the counterparty or our own.
28365  */
28366 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
28367
28368 /**
28369  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
28370  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
28371  * need to compare this value to whether the commitment transaction in question is that of
28372  * the counterparty or our own.
28373  */
28374 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
28375
28376 /**
28377  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
28378  * this divided by 1000.
28379  */
28380 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
28381
28382 /**
28383  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
28384  * this divided by 1000.
28385  */
28386 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
28387
28388 /**
28389  * The CLTV lock-time at which this HTLC expires.
28390  */
28391 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
28392
28393 /**
28394  * The CLTV lock-time at which this HTLC expires.
28395  */
28396 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
28397
28398 /**
28399  * The hash of the preimage which unlocks this HTLC.
28400  */
28401 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
28402
28403 /**
28404  * The hash of the preimage which unlocks this HTLC.
28405  */
28406 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
28407
28408 /**
28409  * The position within the commitment transactions' outputs. This may be None if the value is
28410  * below the dust limit (in which case no output appears in the commitment transaction and the
28411  * value is spent to additional transaction fees).
28412  */
28413 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
28414
28415 /**
28416  * The position within the commitment transactions' outputs. This may be None if the value is
28417  * below the dust limit (in which case no output appears in the commitment transaction and the
28418  * value is spent to additional transaction fees).
28419  */
28420 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
28421
28422 /**
28423  * Constructs a new HTLCOutputInCommitment given each field
28424  */
28425 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);
28426
28427 /**
28428  * Creates a copy of the HTLCOutputInCommitment
28429  */
28430 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
28431
28432 /**
28433  * Checks if two HTLCOutputInCommitments contain equal inner contents.
28434  * This ignores pointers and is_owned flags and looks at the values in fields.
28435  * Two objects with NULL inner values will be considered "equal" here.
28436  */
28437 bool HTLCOutputInCommitment_eq(const struct LDKHTLCOutputInCommitment *NONNULL_PTR a, const struct LDKHTLCOutputInCommitment *NONNULL_PTR b);
28438
28439 /**
28440  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
28441  */
28442 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
28443
28444 /**
28445  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
28446  */
28447 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
28448
28449 /**
28450  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
28451  * does not need to have its previous_output_index filled.
28452  */
28453 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, const struct LDKTxCreationKeys *NONNULL_PTR keys);
28454
28455 /**
28456  * Gets the redeemscript for a funding output from the two funding public keys.
28457  * Note that the order of funding public keys does not matter.
28458  */
28459 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
28460
28461 /**
28462  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
28463  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
28464  * transaction which needs signing, and can be used to construct an HTLC transaction which is
28465  * broadcastable given a counterparty HTLC signature.
28466  *
28467  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
28468  * commitment transaction).
28469  */
28470 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);
28471
28472 /**
28473  * Returns the witness required to satisfy and spend a HTLC input.
28474  *
28475  * Note that preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
28476  */
28477 struct LDKWitness build_htlc_input_witness(struct LDKSignature local_sig, struct LDKSignature remote_sig, struct LDKThirtyTwoBytes preimage, struct LDKu8slice redeem_script, bool opt_anchors);
28478
28479 /**
28480  * Gets the witnessScript for the to_remote output when anchors are enabled.
28481  */
28482 struct LDKCVec_u8Z get_to_countersignatory_with_anchors_redeemscript(struct LDKPublicKey payment_point);
28483
28484 /**
28485  * Gets the witnessScript for an anchor output from the funding public key.
28486  * The witness in the spending input must be:
28487  * <BIP 143 funding_signature>
28488  * After 16 blocks of confirmation, an alternative satisfying witness could be:
28489  * <>
28490  * (empty vector required to satisfy compliance with MINIMALIF-standard rule)
28491  */
28492 struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey);
28493
28494 /**
28495  * Returns the witness required to satisfy and spend an anchor input.
28496  */
28497 struct LDKWitness build_anchor_input_witness(struct LDKPublicKey funding_key, struct LDKSignature funding_sig);
28498
28499 /**
28500  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
28501  */
28502 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
28503
28504 /**
28505  * Holder public keys
28506  */
28507 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
28508
28509 /**
28510  * Holder public keys
28511  */
28512 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
28513
28514 /**
28515  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
28516  */
28517 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
28518
28519 /**
28520  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
28521  */
28522 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
28523
28524 /**
28525  * Whether the holder is the initiator of this channel.
28526  * This is an input to the commitment number obscure factor computation.
28527  */
28528 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
28529
28530 /**
28531  * Whether the holder is the initiator of this channel.
28532  * This is an input to the commitment number obscure factor computation.
28533  */
28534 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
28535
28536 /**
28537  * The late-bound counterparty channel transaction parameters.
28538  * These parameters are populated at the point in the protocol where the counterparty provides them.
28539  *
28540  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28541  */
28542 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
28543
28544 /**
28545  * The late-bound counterparty channel transaction parameters.
28546  * These parameters are populated at the point in the protocol where the counterparty provides them.
28547  *
28548  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
28549  */
28550 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
28551
28552 /**
28553  * The late-bound funding outpoint
28554  *
28555  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28556  */
28557 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
28558
28559 /**
28560  * The late-bound funding outpoint
28561  *
28562  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
28563  */
28564 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
28565
28566 /**
28567  * Are anchors (zero fee HTLC transaction variant) used for this channel. Boolean is
28568  * serialization backwards-compatible.
28569  */
28570 enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
28571
28572 /**
28573  * Are anchors (zero fee HTLC transaction variant) used for this channel. Boolean is
28574  * serialization backwards-compatible.
28575  */
28576 void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
28577
28578 /**
28579  * Are non-zero-fee anchors are enabled (used in conjuction with opt_anchors)
28580  * It is intended merely for backwards compatibility with signers that need it.
28581  * There is no support for this feature in LDK channel negotiation.
28582  */
28583 enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_non_zero_fee_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
28584
28585 /**
28586  * Are non-zero-fee anchors are enabled (used in conjuction with opt_anchors)
28587  * It is intended merely for backwards compatibility with signers that need it.
28588  * There is no support for this feature in LDK channel negotiation.
28589  */
28590 void ChannelTransactionParameters_set_opt_non_zero_fee_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
28591
28592 /**
28593  * Constructs a new ChannelTransactionParameters given each field
28594  */
28595 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);
28596
28597 /**
28598  * Creates a copy of the ChannelTransactionParameters
28599  */
28600 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
28601
28602 /**
28603  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
28604  */
28605 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
28606
28607 /**
28608  * Counter-party public keys
28609  */
28610 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
28611
28612 /**
28613  * Counter-party public keys
28614  */
28615 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
28616
28617 /**
28618  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
28619  */
28620 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
28621
28622 /**
28623  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
28624  */
28625 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
28626
28627 /**
28628  * Constructs a new CounterpartyChannelTransactionParameters given each field
28629  */
28630 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
28631
28632 /**
28633  * Creates a copy of the CounterpartyChannelTransactionParameters
28634  */
28635 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
28636
28637 /**
28638  * Whether the late bound parameters are populated.
28639  */
28640 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
28641
28642 /**
28643  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
28644  * given that the holder is the broadcaster.
28645  *
28646  * self.is_populated() must be true before calling this function.
28647  */
28648 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
28649
28650 /**
28651  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
28652  * given that the counterparty is the broadcaster.
28653  *
28654  * self.is_populated() must be true before calling this function.
28655  */
28656 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
28657
28658 /**
28659  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
28660  */
28661 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
28662
28663 /**
28664  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
28665  */
28666 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
28667
28668 /**
28669  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
28670  */
28671 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
28672
28673 /**
28674  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
28675  */
28676 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
28677
28678 /**
28679  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
28680  */
28681 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
28682
28683 /**
28684  * Get the channel pubkeys for the broadcaster
28685  */
28686 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
28687
28688 /**
28689  * Get the channel pubkeys for the countersignatory
28690  */
28691 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
28692
28693 /**
28694  * Get the contest delay applicable to the transactions.
28695  * Note that the contest delay was selected by the countersignatory.
28696  */
28697 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
28698
28699 /**
28700  * Whether the channel is outbound from the broadcaster.
28701  *
28702  * The boolean representing the side that initiated the channel is
28703  * an input to the commitment number obscure factor computation.
28704  */
28705 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
28706
28707 /**
28708  * The funding outpoint
28709  */
28710 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
28711
28712 /**
28713  * Whether to use anchors for this channel
28714  */
28715 MUST_USE_RES bool DirectedChannelTransactionParameters_opt_anchors(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
28716
28717 /**
28718  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
28719  */
28720 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
28721
28722 /**
28723  * Our counterparty's signature for the transaction
28724  */
28725 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
28726
28727 /**
28728  * Our counterparty's signature for the transaction
28729  */
28730 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
28731
28732 /**
28733  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
28734  *
28735  * Returns a copy of the field.
28736  */
28737 struct LDKCVec_SignatureZ HolderCommitmentTransaction_get_counterparty_htlc_sigs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
28738
28739 /**
28740  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
28741  */
28742 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
28743
28744 /**
28745  * Creates a copy of the HolderCommitmentTransaction
28746  */
28747 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
28748
28749 /**
28750  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
28751  */
28752 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
28753
28754 /**
28755  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
28756  */
28757 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
28758
28759 /**
28760  * Create a new holder transaction with the given counterparty signatures.
28761  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
28762  */
28763 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);
28764
28765 /**
28766  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
28767  */
28768 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
28769
28770 /**
28771  * The commitment transaction
28772  */
28773 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
28774
28775 /**
28776  * The commitment transaction
28777  */
28778 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
28779
28780 /**
28781  * The txid for the commitment transaction.
28782  *
28783  * This is provided as a performance optimization, instead of calling transaction.txid()
28784  * multiple times.
28785  */
28786 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
28787
28788 /**
28789  * The txid for the commitment transaction.
28790  *
28791  * This is provided as a performance optimization, instead of calling transaction.txid()
28792  * multiple times.
28793  */
28794 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
28795
28796 /**
28797  * Constructs a new BuiltCommitmentTransaction given each field
28798  */
28799 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
28800
28801 /**
28802  * Creates a copy of the BuiltCommitmentTransaction
28803  */
28804 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
28805
28806 /**
28807  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
28808  */
28809 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
28810
28811 /**
28812  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
28813  */
28814 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
28815
28816 /**
28817  * Get the SIGHASH_ALL sighash value of the transaction.
28818  *
28819  * This can be used to verify a signature.
28820  */
28821 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);
28822
28823 /**
28824  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
28825  * because we are about to broadcast a holder transaction.
28826  */
28827 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);
28828
28829 /**
28830  * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL.
28831  */
28832 void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
28833
28834 /**
28835  * Creates a copy of the ClosingTransaction
28836  */
28837 struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig);
28838
28839 /**
28840  * Checks if two ClosingTransactions contain equal inner contents.
28841  */
28842 uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o);
28843
28844 /**
28845  * Checks if two ClosingTransactions contain equal inner contents.
28846  * This ignores pointers and is_owned flags and looks at the values in fields.
28847  * Two objects with NULL inner values will be considered "equal" here.
28848  */
28849 bool ClosingTransaction_eq(const struct LDKClosingTransaction *NONNULL_PTR a, const struct LDKClosingTransaction *NONNULL_PTR b);
28850
28851 /**
28852  * Construct an object of the class
28853  */
28854 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);
28855
28856 /**
28857  * Trust our pre-built transaction.
28858  *
28859  * Applies a wrapper which allows access to the transaction.
28860  *
28861  * This should only be used if you fully trust the builder of this object. It should not
28862  * be used by an external signer - instead use the verify function.
28863  */
28864 MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
28865
28866 /**
28867  * Verify our pre-built transaction.
28868  *
28869  * Applies a wrapper which allows access to the transaction.
28870  *
28871  * An external validating signer must call this method before signing
28872  * or using the built transaction.
28873  */
28874 MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
28875
28876 /**
28877  * The value to be sent to the holder, or zero if the output will be omitted
28878  */
28879 MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
28880
28881 /**
28882  * The value to be sent to the counterparty, or zero if the output will be omitted
28883  */
28884 MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
28885
28886 /**
28887  * The destination of the holder's output
28888  */
28889 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
28890
28891 /**
28892  * The destination of the counterparty's output
28893  */
28894 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
28895
28896 /**
28897  * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL.
28898  */
28899 void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
28900
28901 /**
28902  * The pre-built Bitcoin commitment transaction
28903  */
28904 MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
28905
28906 /**
28907  * Get the SIGHASH_ALL sighash value of the transaction.
28908  *
28909  * This can be used to verify a signature.
28910  */
28911 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);
28912
28913 /**
28914  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
28915  * because we are about to broadcast a holder transaction.
28916  */
28917 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);
28918
28919 /**
28920  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
28921  */
28922 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
28923
28924 /**
28925  * Creates a copy of the CommitmentTransaction
28926  */
28927 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
28928
28929 /**
28930  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
28931  */
28932 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
28933
28934 /**
28935  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
28936  */
28937 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
28938
28939 /**
28940  * The backwards-counting commitment number
28941  */
28942 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
28943
28944 /**
28945  * The value to be sent to the broadcaster
28946  */
28947 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
28948
28949 /**
28950  * The value to be sent to the counterparty
28951  */
28952 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
28953
28954 /**
28955  * The feerate paid per 1000-weight-unit in this commitment transaction.
28956  */
28957 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
28958
28959 /**
28960  * Trust our pre-built transaction and derived transaction creation public keys.
28961  *
28962  * Applies a wrapper which allows access to these fields.
28963  *
28964  * This should only be used if you fully trust the builder of this object.  It should not
28965  * be used by an external signer - instead use the verify function.
28966  */
28967 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
28968
28969 /**
28970  * Verify our pre-built transaction and derived transaction creation public keys.
28971  *
28972  * Applies a wrapper which allows access to these fields.
28973  *
28974  * An external validating signer must call this method before signing
28975  * or using the built transaction.
28976  */
28977 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);
28978
28979 /**
28980  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
28981  */
28982 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
28983
28984 /**
28985  * The transaction ID of the built Bitcoin transaction
28986  */
28987 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
28988
28989 /**
28990  * The pre-built Bitcoin commitment transaction
28991  */
28992 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
28993
28994 /**
28995  * The pre-calculated transaction creation public keys.
28996  */
28997 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
28998
28999 /**
29000  * Should anchors be used.
29001  */
29002 MUST_USE_RES bool TrustedCommitmentTransaction_opt_anchors(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
29003
29004 /**
29005  * Get a signature for each HTLC which was included in the commitment transaction (ie for
29006  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
29007  *
29008  * The returned Vec has one entry for each HTLC, and in the same order.
29009  *
29010  * This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All.
29011  */
29012 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);
29013
29014 /**
29015  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
29016  * shared secret first. This prevents on-chain observers from discovering how many commitment
29017  * transactions occurred in a channel before it was closed.
29018  *
29019  * This function gets the shared secret from relevant channel public keys and can be used to
29020  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
29021  */
29022 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
29023
29024 /**
29025  * Checks if two InitFeaturess contain equal inner contents.
29026  * This ignores pointers and is_owned flags and looks at the values in fields.
29027  * Two objects with NULL inner values will be considered "equal" here.
29028  */
29029 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
29030
29031 /**
29032  * Checks if two NodeFeaturess contain equal inner contents.
29033  * This ignores pointers and is_owned flags and looks at the values in fields.
29034  * Two objects with NULL inner values will be considered "equal" here.
29035  */
29036 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
29037
29038 /**
29039  * Checks if two ChannelFeaturess contain equal inner contents.
29040  * This ignores pointers and is_owned flags and looks at the values in fields.
29041  * Two objects with NULL inner values will be considered "equal" here.
29042  */
29043 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
29044
29045 /**
29046  * Checks if two InvoiceFeaturess contain equal inner contents.
29047  * This ignores pointers and is_owned flags and looks at the values in fields.
29048  * Two objects with NULL inner values will be considered "equal" here.
29049  */
29050 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
29051
29052 /**
29053  * Checks if two OfferFeaturess contain equal inner contents.
29054  * This ignores pointers and is_owned flags and looks at the values in fields.
29055  * Two objects with NULL inner values will be considered "equal" here.
29056  */
29057 bool OfferFeatures_eq(const struct LDKOfferFeatures *NONNULL_PTR a, const struct LDKOfferFeatures *NONNULL_PTR b);
29058
29059 /**
29060  * Checks if two InvoiceRequestFeaturess contain equal inner contents.
29061  * This ignores pointers and is_owned flags and looks at the values in fields.
29062  * Two objects with NULL inner values will be considered "equal" here.
29063  */
29064 bool InvoiceRequestFeatures_eq(const struct LDKInvoiceRequestFeatures *NONNULL_PTR a, const struct LDKInvoiceRequestFeatures *NONNULL_PTR b);
29065
29066 /**
29067  * Checks if two Bolt12InvoiceFeaturess contain equal inner contents.
29068  * This ignores pointers and is_owned flags and looks at the values in fields.
29069  * Two objects with NULL inner values will be considered "equal" here.
29070  */
29071 bool Bolt12InvoiceFeatures_eq(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR a, const struct LDKBolt12InvoiceFeatures *NONNULL_PTR b);
29072
29073 /**
29074  * Checks if two BlindedHopFeaturess contain equal inner contents.
29075  * This ignores pointers and is_owned flags and looks at the values in fields.
29076  * Two objects with NULL inner values will be considered "equal" here.
29077  */
29078 bool BlindedHopFeatures_eq(const struct LDKBlindedHopFeatures *NONNULL_PTR a, const struct LDKBlindedHopFeatures *NONNULL_PTR b);
29079
29080 /**
29081  * Checks if two ChannelTypeFeaturess contain equal inner contents.
29082  * This ignores pointers and is_owned flags and looks at the values in fields.
29083  * Two objects with NULL inner values will be considered "equal" here.
29084  */
29085 bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b);
29086
29087 /**
29088  * Creates a copy of the InitFeatures
29089  */
29090 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
29091
29092 /**
29093  * Creates a copy of the NodeFeatures
29094  */
29095 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
29096
29097 /**
29098  * Creates a copy of the ChannelFeatures
29099  */
29100 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
29101
29102 /**
29103  * Creates a copy of the InvoiceFeatures
29104  */
29105 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
29106
29107 /**
29108  * Creates a copy of the OfferFeatures
29109  */
29110 struct LDKOfferFeatures OfferFeatures_clone(const struct LDKOfferFeatures *NONNULL_PTR orig);
29111
29112 /**
29113  * Creates a copy of the InvoiceRequestFeatures
29114  */
29115 struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_clone(const struct LDKInvoiceRequestFeatures *NONNULL_PTR orig);
29116
29117 /**
29118  * Creates a copy of the Bolt12InvoiceFeatures
29119  */
29120 struct LDKBolt12InvoiceFeatures Bolt12InvoiceFeatures_clone(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR orig);
29121
29122 /**
29123  * Creates a copy of the BlindedHopFeatures
29124  */
29125 struct LDKBlindedHopFeatures BlindedHopFeatures_clone(const struct LDKBlindedHopFeatures *NONNULL_PTR orig);
29126
29127 /**
29128  * Creates a copy of the ChannelTypeFeatures
29129  */
29130 struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig);
29131
29132 /**
29133  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
29134  */
29135 void InitFeatures_free(struct LDKInitFeatures this_obj);
29136
29137 /**
29138  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
29139  */
29140 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
29141
29142 /**
29143  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
29144  */
29145 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
29146
29147 /**
29148  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
29149  */
29150 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
29151
29152 /**
29153  * Frees any resources used by the OfferFeatures, if is_owned is set and inner is non-NULL.
29154  */
29155 void OfferFeatures_free(struct LDKOfferFeatures this_obj);
29156
29157 /**
29158  * Frees any resources used by the InvoiceRequestFeatures, if is_owned is set and inner is non-NULL.
29159  */
29160 void InvoiceRequestFeatures_free(struct LDKInvoiceRequestFeatures this_obj);
29161
29162 /**
29163  * Frees any resources used by the Bolt12InvoiceFeatures, if is_owned is set and inner is non-NULL.
29164  */
29165 void Bolt12InvoiceFeatures_free(struct LDKBolt12InvoiceFeatures this_obj);
29166
29167 /**
29168  * Frees any resources used by the BlindedHopFeatures, if is_owned is set and inner is non-NULL.
29169  */
29170 void BlindedHopFeatures_free(struct LDKBlindedHopFeatures this_obj);
29171
29172 /**
29173  * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL.
29174  */
29175 void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj);
29176
29177 /**
29178  * Create a blank Features with no features set
29179  */
29180 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
29181
29182 /**
29183  * Returns true if this `Features` object contains unknown feature flags which are set as
29184  * \"required\".
29185  */
29186 MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29187
29188 /**
29189  * Create a blank Features with no features set
29190  */
29191 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
29192
29193 /**
29194  * Returns true if this `Features` object contains unknown feature flags which are set as
29195  * \"required\".
29196  */
29197 MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29198
29199 /**
29200  * Create a blank Features with no features set
29201  */
29202 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
29203
29204 /**
29205  * Returns true if this `Features` object contains unknown feature flags which are set as
29206  * \"required\".
29207  */
29208 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
29209
29210 /**
29211  * Create a blank Features with no features set
29212  */
29213 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
29214
29215 /**
29216  * Returns true if this `Features` object contains unknown feature flags which are set as
29217  * \"required\".
29218  */
29219 MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
29220
29221 /**
29222  * Create a blank Features with no features set
29223  */
29224 MUST_USE_RES struct LDKOfferFeatures OfferFeatures_empty(void);
29225
29226 /**
29227  * Returns true if this `Features` object contains unknown feature flags which are set as
29228  * \"required\".
29229  */
29230 MUST_USE_RES bool OfferFeatures_requires_unknown_bits(const struct LDKOfferFeatures *NONNULL_PTR this_arg);
29231
29232 /**
29233  * Create a blank Features with no features set
29234  */
29235 MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_empty(void);
29236
29237 /**
29238  * Returns true if this `Features` object contains unknown feature flags which are set as
29239  * \"required\".
29240  */
29241 MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg);
29242
29243 /**
29244  * Create a blank Features with no features set
29245  */
29246 MUST_USE_RES struct LDKBolt12InvoiceFeatures Bolt12InvoiceFeatures_empty(void);
29247
29248 /**
29249  * Returns true if this `Features` object contains unknown feature flags which are set as
29250  * \"required\".
29251  */
29252 MUST_USE_RES bool Bolt12InvoiceFeatures_requires_unknown_bits(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg);
29253
29254 /**
29255  * Create a blank Features with no features set
29256  */
29257 MUST_USE_RES struct LDKBlindedHopFeatures BlindedHopFeatures_empty(void);
29258
29259 /**
29260  * Returns true if this `Features` object contains unknown feature flags which are set as
29261  * \"required\".
29262  */
29263 MUST_USE_RES bool BlindedHopFeatures_requires_unknown_bits(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg);
29264
29265 /**
29266  * Create a blank Features with no features set
29267  */
29268 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void);
29269
29270 /**
29271  * Returns true if this `Features` object contains unknown feature flags which are set as
29272  * \"required\".
29273  */
29274 MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
29275
29276 /**
29277  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
29278  */
29279 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
29280
29281 /**
29282  * Read a InitFeatures from a byte array, created by InitFeatures_write
29283  */
29284 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
29285
29286 /**
29287  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
29288  */
29289 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
29290
29291 /**
29292  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
29293  */
29294 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
29295
29296 /**
29297  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
29298  */
29299 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
29300
29301 /**
29302  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
29303  */
29304 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
29305
29306 /**
29307  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
29308  */
29309 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
29310
29311 /**
29312  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
29313  */
29314 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
29315
29316 /**
29317  * Serialize the BlindedHopFeatures object into a byte array which can be read by BlindedHopFeatures_read
29318  */
29319 struct LDKCVec_u8Z BlindedHopFeatures_write(const struct LDKBlindedHopFeatures *NONNULL_PTR obj);
29320
29321 /**
29322  * Read a BlindedHopFeatures from a byte array, created by BlindedHopFeatures_write
29323  */
29324 struct LDKCResult_BlindedHopFeaturesDecodeErrorZ BlindedHopFeatures_read(struct LDKu8slice ser);
29325
29326 /**
29327  * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
29328  */
29329 struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj);
29330
29331 /**
29332  * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
29333  */
29334 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser);
29335
29336 /**
29337  * Set this feature as optional.
29338  */
29339 void InitFeatures_set_data_loss_protect_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
29340
29341 /**
29342  * Set this feature as required.
29343  */
29344 void InitFeatures_set_data_loss_protect_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
29345
29346 /**
29347  * Checks if this feature is supported.
29348  */
29349 MUST_USE_RES bool InitFeatures_supports_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29350
29351 /**
29352  * Set this feature as optional.
29353  */
29354 void NodeFeatures_set_data_loss_protect_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29355
29356 /**
29357  * Set this feature as required.
29358  */
29359 void NodeFeatures_set_data_loss_protect_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29360
29361 /**
29362  * Checks if this feature is supported.
29363  */
29364 MUST_USE_RES bool NodeFeatures_supports_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29365
29366 /**
29367  * Checks if this feature is required.
29368  */
29369 MUST_USE_RES bool InitFeatures_requires_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29370
29371 /**
29372  * Checks if this feature is required.
29373  */
29374 MUST_USE_RES bool NodeFeatures_requires_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29375
29376 /**
29377  * Set this feature as optional.
29378  */
29379 void InitFeatures_set_initial_routing_sync_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
29380
29381 /**
29382  * Set this feature as required.
29383  */
29384 void InitFeatures_set_initial_routing_sync_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
29385
29386 /**
29387  * Checks if this feature is supported.
29388  */
29389 MUST_USE_RES bool InitFeatures_initial_routing_sync(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29390
29391 /**
29392  * Set this feature as optional.
29393  */
29394 void InitFeatures_set_upfront_shutdown_script_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
29395
29396 /**
29397  * Set this feature as required.
29398  */
29399 void InitFeatures_set_upfront_shutdown_script_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
29400
29401 /**
29402  * Checks if this feature is supported.
29403  */
29404 MUST_USE_RES bool InitFeatures_supports_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29405
29406 /**
29407  * Set this feature as optional.
29408  */
29409 void NodeFeatures_set_upfront_shutdown_script_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29410
29411 /**
29412  * Set this feature as required.
29413  */
29414 void NodeFeatures_set_upfront_shutdown_script_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29415
29416 /**
29417  * Checks if this feature is supported.
29418  */
29419 MUST_USE_RES bool NodeFeatures_supports_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29420
29421 /**
29422  * Checks if this feature is required.
29423  */
29424 MUST_USE_RES bool InitFeatures_requires_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29425
29426 /**
29427  * Checks if this feature is required.
29428  */
29429 MUST_USE_RES bool NodeFeatures_requires_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29430
29431 /**
29432  * Set this feature as optional.
29433  */
29434 void InitFeatures_set_gossip_queries_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
29435
29436 /**
29437  * Set this feature as required.
29438  */
29439 void InitFeatures_set_gossip_queries_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
29440
29441 /**
29442  * Checks if this feature is supported.
29443  */
29444 MUST_USE_RES bool InitFeatures_supports_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29445
29446 /**
29447  * Set this feature as optional.
29448  */
29449 void NodeFeatures_set_gossip_queries_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29450
29451 /**
29452  * Set this feature as required.
29453  */
29454 void NodeFeatures_set_gossip_queries_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29455
29456 /**
29457  * Checks if this feature is supported.
29458  */
29459 MUST_USE_RES bool NodeFeatures_supports_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29460
29461 /**
29462  * Checks if this feature is required.
29463  */
29464 MUST_USE_RES bool InitFeatures_requires_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29465
29466 /**
29467  * Checks if this feature is required.
29468  */
29469 MUST_USE_RES bool NodeFeatures_requires_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29470
29471 /**
29472  * Set this feature as optional.
29473  */
29474 void InitFeatures_set_variable_length_onion_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
29475
29476 /**
29477  * Set this feature as required.
29478  */
29479 void InitFeatures_set_variable_length_onion_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
29480
29481 /**
29482  * Checks if this feature is supported.
29483  */
29484 MUST_USE_RES bool InitFeatures_supports_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29485
29486 /**
29487  * Set this feature as optional.
29488  */
29489 void NodeFeatures_set_variable_length_onion_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29490
29491 /**
29492  * Set this feature as required.
29493  */
29494 void NodeFeatures_set_variable_length_onion_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29495
29496 /**
29497  * Checks if this feature is supported.
29498  */
29499 MUST_USE_RES bool NodeFeatures_supports_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29500
29501 /**
29502  * Set this feature as optional.
29503  */
29504 void InvoiceFeatures_set_variable_length_onion_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
29505
29506 /**
29507  * Set this feature as required.
29508  */
29509 void InvoiceFeatures_set_variable_length_onion_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
29510
29511 /**
29512  * Checks if this feature is supported.
29513  */
29514 MUST_USE_RES bool InvoiceFeatures_supports_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
29515
29516 /**
29517  * Checks if this feature is required.
29518  */
29519 MUST_USE_RES bool InitFeatures_requires_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29520
29521 /**
29522  * Checks if this feature is required.
29523  */
29524 MUST_USE_RES bool NodeFeatures_requires_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29525
29526 /**
29527  * Checks if this feature is required.
29528  */
29529 MUST_USE_RES bool InvoiceFeatures_requires_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
29530
29531 /**
29532  * Set this feature as optional.
29533  */
29534 void InitFeatures_set_static_remote_key_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
29535
29536 /**
29537  * Set this feature as required.
29538  */
29539 void InitFeatures_set_static_remote_key_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
29540
29541 /**
29542  * Checks if this feature is supported.
29543  */
29544 MUST_USE_RES bool InitFeatures_supports_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29545
29546 /**
29547  * Set this feature as optional.
29548  */
29549 void NodeFeatures_set_static_remote_key_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29550
29551 /**
29552  * Set this feature as required.
29553  */
29554 void NodeFeatures_set_static_remote_key_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29555
29556 /**
29557  * Checks if this feature is supported.
29558  */
29559 MUST_USE_RES bool NodeFeatures_supports_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29560
29561 /**
29562  * Set this feature as optional.
29563  */
29564 void ChannelTypeFeatures_set_static_remote_key_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
29565
29566 /**
29567  * Set this feature as required.
29568  */
29569 void ChannelTypeFeatures_set_static_remote_key_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
29570
29571 /**
29572  * Checks if this feature is supported.
29573  */
29574 MUST_USE_RES bool ChannelTypeFeatures_supports_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
29575
29576 /**
29577  * Checks if this feature is required.
29578  */
29579 MUST_USE_RES bool InitFeatures_requires_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29580
29581 /**
29582  * Checks if this feature is required.
29583  */
29584 MUST_USE_RES bool NodeFeatures_requires_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29585
29586 /**
29587  * Checks if this feature is required.
29588  */
29589 MUST_USE_RES bool ChannelTypeFeatures_requires_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
29590
29591 /**
29592  * Set this feature as optional.
29593  */
29594 void InitFeatures_set_payment_secret_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
29595
29596 /**
29597  * Set this feature as required.
29598  */
29599 void InitFeatures_set_payment_secret_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
29600
29601 /**
29602  * Checks if this feature is supported.
29603  */
29604 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29605
29606 /**
29607  * Set this feature as optional.
29608  */
29609 void NodeFeatures_set_payment_secret_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29610
29611 /**
29612  * Set this feature as required.
29613  */
29614 void NodeFeatures_set_payment_secret_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29615
29616 /**
29617  * Checks if this feature is supported.
29618  */
29619 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29620
29621 /**
29622  * Set this feature as optional.
29623  */
29624 void InvoiceFeatures_set_payment_secret_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
29625
29626 /**
29627  * Set this feature as required.
29628  */
29629 void InvoiceFeatures_set_payment_secret_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
29630
29631 /**
29632  * Checks if this feature is supported.
29633  */
29634 MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
29635
29636 /**
29637  * Checks if this feature is required.
29638  */
29639 MUST_USE_RES bool InitFeatures_requires_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29640
29641 /**
29642  * Checks if this feature is required.
29643  */
29644 MUST_USE_RES bool NodeFeatures_requires_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29645
29646 /**
29647  * Checks if this feature is required.
29648  */
29649 MUST_USE_RES bool InvoiceFeatures_requires_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
29650
29651 /**
29652  * Set this feature as optional.
29653  */
29654 void InitFeatures_set_basic_mpp_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
29655
29656 /**
29657  * Set this feature as required.
29658  */
29659 void InitFeatures_set_basic_mpp_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
29660
29661 /**
29662  * Checks if this feature is supported.
29663  */
29664 MUST_USE_RES bool InitFeatures_supports_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29665
29666 /**
29667  * Set this feature as optional.
29668  */
29669 void NodeFeatures_set_basic_mpp_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29670
29671 /**
29672  * Set this feature as required.
29673  */
29674 void NodeFeatures_set_basic_mpp_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29675
29676 /**
29677  * Checks if this feature is supported.
29678  */
29679 MUST_USE_RES bool NodeFeatures_supports_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29680
29681 /**
29682  * Set this feature as optional.
29683  */
29684 void InvoiceFeatures_set_basic_mpp_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
29685
29686 /**
29687  * Set this feature as required.
29688  */
29689 void InvoiceFeatures_set_basic_mpp_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
29690
29691 /**
29692  * Checks if this feature is supported.
29693  */
29694 MUST_USE_RES bool InvoiceFeatures_supports_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
29695
29696 /**
29697  * Set this feature as optional.
29698  */
29699 void Bolt12InvoiceFeatures_set_basic_mpp_optional(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg);
29700
29701 /**
29702  * Set this feature as required.
29703  */
29704 void Bolt12InvoiceFeatures_set_basic_mpp_required(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg);
29705
29706 /**
29707  * Checks if this feature is supported.
29708  */
29709 MUST_USE_RES bool Bolt12InvoiceFeatures_supports_basic_mpp(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg);
29710
29711 /**
29712  * Checks if this feature is required.
29713  */
29714 MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29715
29716 /**
29717  * Checks if this feature is required.
29718  */
29719 MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29720
29721 /**
29722  * Checks if this feature is required.
29723  */
29724 MUST_USE_RES bool InvoiceFeatures_requires_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
29725
29726 /**
29727  * Checks if this feature is required.
29728  */
29729 MUST_USE_RES bool Bolt12InvoiceFeatures_requires_basic_mpp(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg);
29730
29731 /**
29732  * Set this feature as optional.
29733  */
29734 void InitFeatures_set_wumbo_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
29735
29736 /**
29737  * Set this feature as required.
29738  */
29739 void InitFeatures_set_wumbo_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
29740
29741 /**
29742  * Checks if this feature is supported.
29743  */
29744 MUST_USE_RES bool InitFeatures_supports_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29745
29746 /**
29747  * Set this feature as optional.
29748  */
29749 void NodeFeatures_set_wumbo_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29750
29751 /**
29752  * Set this feature as required.
29753  */
29754 void NodeFeatures_set_wumbo_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29755
29756 /**
29757  * Checks if this feature is supported.
29758  */
29759 MUST_USE_RES bool NodeFeatures_supports_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29760
29761 /**
29762  * Checks if this feature is required.
29763  */
29764 MUST_USE_RES bool InitFeatures_requires_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29765
29766 /**
29767  * Checks if this feature is required.
29768  */
29769 MUST_USE_RES bool NodeFeatures_requires_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29770
29771 /**
29772  * Set this feature as optional.
29773  */
29774 void InitFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
29775
29776 /**
29777  * Set this feature as required.
29778  */
29779 void InitFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
29780
29781 /**
29782  * Checks if this feature is supported.
29783  */
29784 MUST_USE_RES bool InitFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29785
29786 /**
29787  * Set this feature as optional.
29788  */
29789 void NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29790
29791 /**
29792  * Set this feature as required.
29793  */
29794 void NodeFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29795
29796 /**
29797  * Checks if this feature is supported.
29798  */
29799 MUST_USE_RES bool NodeFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29800
29801 /**
29802  * Set this feature as optional.
29803  */
29804 void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
29805
29806 /**
29807  * Set this feature as required.
29808  */
29809 void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
29810
29811 /**
29812  * Checks if this feature is supported.
29813  */
29814 MUST_USE_RES bool ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
29815
29816 /**
29817  * Checks if this feature is required.
29818  */
29819 MUST_USE_RES bool InitFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29820
29821 /**
29822  * Checks if this feature is required.
29823  */
29824 MUST_USE_RES bool NodeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29825
29826 /**
29827  * Checks if this feature is required.
29828  */
29829 MUST_USE_RES bool ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
29830
29831 /**
29832  * Set this feature as optional.
29833  */
29834 void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
29835
29836 /**
29837  * Set this feature as required.
29838  */
29839 void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
29840
29841 /**
29842  * Checks if this feature is supported.
29843  */
29844 MUST_USE_RES bool InitFeatures_supports_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29845
29846 /**
29847  * Set this feature as optional.
29848  */
29849 void NodeFeatures_set_shutdown_any_segwit_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29850
29851 /**
29852  * Set this feature as required.
29853  */
29854 void NodeFeatures_set_shutdown_any_segwit_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29855
29856 /**
29857  * Checks if this feature is supported.
29858  */
29859 MUST_USE_RES bool NodeFeatures_supports_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29860
29861 /**
29862  * Checks if this feature is required.
29863  */
29864 MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29865
29866 /**
29867  * Checks if this feature is required.
29868  */
29869 MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29870
29871 /**
29872  * Set this feature as optional.
29873  */
29874 void InitFeatures_set_onion_messages_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
29875
29876 /**
29877  * Set this feature as required.
29878  */
29879 void InitFeatures_set_onion_messages_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
29880
29881 /**
29882  * Checks if this feature is supported.
29883  */
29884 MUST_USE_RES bool InitFeatures_supports_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29885
29886 /**
29887  * Set this feature as optional.
29888  */
29889 void NodeFeatures_set_onion_messages_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29890
29891 /**
29892  * Set this feature as required.
29893  */
29894 void NodeFeatures_set_onion_messages_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29895
29896 /**
29897  * Checks if this feature is supported.
29898  */
29899 MUST_USE_RES bool NodeFeatures_supports_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29900
29901 /**
29902  * Checks if this feature is required.
29903  */
29904 MUST_USE_RES bool InitFeatures_requires_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29905
29906 /**
29907  * Checks if this feature is required.
29908  */
29909 MUST_USE_RES bool NodeFeatures_requires_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29910
29911 /**
29912  * Set this feature as optional.
29913  */
29914 void InitFeatures_set_channel_type_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
29915
29916 /**
29917  * Set this feature as required.
29918  */
29919 void InitFeatures_set_channel_type_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
29920
29921 /**
29922  * Checks if this feature is supported.
29923  */
29924 MUST_USE_RES bool InitFeatures_supports_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29925
29926 /**
29927  * Set this feature as optional.
29928  */
29929 void NodeFeatures_set_channel_type_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29930
29931 /**
29932  * Set this feature as required.
29933  */
29934 void NodeFeatures_set_channel_type_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29935
29936 /**
29937  * Checks if this feature is supported.
29938  */
29939 MUST_USE_RES bool NodeFeatures_supports_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29940
29941 /**
29942  * Checks if this feature is required.
29943  */
29944 MUST_USE_RES bool InitFeatures_requires_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29945
29946 /**
29947  * Checks if this feature is required.
29948  */
29949 MUST_USE_RES bool NodeFeatures_requires_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29950
29951 /**
29952  * Set this feature as optional.
29953  */
29954 void InitFeatures_set_scid_privacy_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
29955
29956 /**
29957  * Set this feature as required.
29958  */
29959 void InitFeatures_set_scid_privacy_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
29960
29961 /**
29962  * Checks if this feature is supported.
29963  */
29964 MUST_USE_RES bool InitFeatures_supports_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
29965
29966 /**
29967  * Set this feature as optional.
29968  */
29969 void NodeFeatures_set_scid_privacy_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29970
29971 /**
29972  * Set this feature as required.
29973  */
29974 void NodeFeatures_set_scid_privacy_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
29975
29976 /**
29977  * Checks if this feature is supported.
29978  */
29979 MUST_USE_RES bool NodeFeatures_supports_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
29980
29981 /**
29982  * Set this feature as optional.
29983  */
29984 void ChannelTypeFeatures_set_scid_privacy_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
29985
29986 /**
29987  * Set this feature as required.
29988  */
29989 void ChannelTypeFeatures_set_scid_privacy_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
29990
29991 /**
29992  * Checks if this feature is supported.
29993  */
29994 MUST_USE_RES bool ChannelTypeFeatures_supports_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
29995
29996 /**
29997  * Checks if this feature is required.
29998  */
29999 MUST_USE_RES bool InitFeatures_requires_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30000
30001 /**
30002  * Checks if this feature is required.
30003  */
30004 MUST_USE_RES bool NodeFeatures_requires_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30005
30006 /**
30007  * Checks if this feature is required.
30008  */
30009 MUST_USE_RES bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
30010
30011 /**
30012  * Set this feature as optional.
30013  */
30014 void InitFeatures_set_zero_conf_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
30015
30016 /**
30017  * Set this feature as required.
30018  */
30019 void InitFeatures_set_zero_conf_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
30020
30021 /**
30022  * Checks if this feature is supported.
30023  */
30024 MUST_USE_RES bool InitFeatures_supports_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30025
30026 /**
30027  * Set this feature as optional.
30028  */
30029 void NodeFeatures_set_zero_conf_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30030
30031 /**
30032  * Set this feature as required.
30033  */
30034 void NodeFeatures_set_zero_conf_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30035
30036 /**
30037  * Checks if this feature is supported.
30038  */
30039 MUST_USE_RES bool NodeFeatures_supports_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30040
30041 /**
30042  * Set this feature as optional.
30043  */
30044 void ChannelTypeFeatures_set_zero_conf_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
30045
30046 /**
30047  * Set this feature as required.
30048  */
30049 void ChannelTypeFeatures_set_zero_conf_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
30050
30051 /**
30052  * Checks if this feature is supported.
30053  */
30054 MUST_USE_RES bool ChannelTypeFeatures_supports_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
30055
30056 /**
30057  * Checks if this feature is required.
30058  */
30059 MUST_USE_RES bool InitFeatures_requires_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
30060
30061 /**
30062  * Checks if this feature is required.
30063  */
30064 MUST_USE_RES bool NodeFeatures_requires_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30065
30066 /**
30067  * Checks if this feature is required.
30068  */
30069 MUST_USE_RES bool ChannelTypeFeatures_requires_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
30070
30071 /**
30072  * Set this feature as optional.
30073  */
30074 void NodeFeatures_set_keysend_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30075
30076 /**
30077  * Set this feature as required.
30078  */
30079 void NodeFeatures_set_keysend_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
30080
30081 /**
30082  * Checks if this feature is supported.
30083  */
30084 MUST_USE_RES bool NodeFeatures_supports_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30085
30086 /**
30087  * Checks if this feature is required.
30088  */
30089 MUST_USE_RES bool NodeFeatures_requires_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
30090
30091 /**
30092  * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
30093  */
30094 void ShutdownScript_free(struct LDKShutdownScript this_obj);
30095
30096 /**
30097  * Creates a copy of the ShutdownScript
30098  */
30099 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
30100
30101 /**
30102  * Checks if two ShutdownScripts contain equal inner contents.
30103  * This ignores pointers and is_owned flags and looks at the values in fields.
30104  * Two objects with NULL inner values will be considered "equal" here.
30105  */
30106 bool ShutdownScript_eq(const struct LDKShutdownScript *NONNULL_PTR a, const struct LDKShutdownScript *NONNULL_PTR b);
30107
30108 /**
30109  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
30110  */
30111 void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
30112
30113 /**
30114  * The script that did not meet the requirements from [BOLT #2].
30115  *
30116  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
30117  */
30118 struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
30119
30120 /**
30121  * The script that did not meet the requirements from [BOLT #2].
30122  *
30123  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
30124  */
30125 void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
30126
30127 /**
30128  * Constructs a new InvalidShutdownScript given each field
30129  */
30130 MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
30131
30132 /**
30133  * Creates a copy of the InvalidShutdownScript
30134  */
30135 struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig);
30136
30137 /**
30138  * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
30139  */
30140 struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
30141
30142 /**
30143  * Read a ShutdownScript from a byte array, created by ShutdownScript_write
30144  */
30145 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
30146
30147 /**
30148  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
30149  */
30150 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
30151
30152 /**
30153  * Generates a P2WSH script pubkey from the given [`WScriptHash`].
30154  */
30155 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
30156
30157 /**
30158  * Generates a witness script pubkey from the given segwit version and program.
30159  *
30160  * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
30161  * [`ShutdownScript::new_p2wsh`] instead.
30162  *
30163  * # Errors
30164  *
30165  * This function may return an error if `program` is invalid for the segwit `version`.
30166  */
30167 MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(struct LDKWitnessVersion version, struct LDKu8slice program);
30168
30169 /**
30170  * Converts the shutdown script into the underlying [`Script`].
30171  */
30172 MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
30173
30174 /**
30175  * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
30176  *
30177  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30178  */
30179 MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
30180
30181 /**
30182  * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
30183  *
30184  * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
30185  */
30186 MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
30187
30188 /**
30189  * Frees any resources used by the Retry
30190  */
30191 void Retry_free(struct LDKRetry this_ptr);
30192
30193 /**
30194  * Creates a copy of the Retry
30195  */
30196 struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig);
30197
30198 /**
30199  * Utility method to constructs a new Attempts-variant Retry
30200  */
30201 struct LDKRetry Retry_attempts(uintptr_t a);
30202
30203 /**
30204  * Utility method to constructs a new Timeout-variant Retry
30205  */
30206 struct LDKRetry Retry_timeout(uint64_t a);
30207
30208 /**
30209  * Checks if two Retrys contain equal inner contents.
30210  * This ignores pointers and is_owned flags and looks at the values in fields.
30211  */
30212 bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b);
30213
30214 /**
30215  * Checks if two Retrys contain equal inner contents.
30216  */
30217 uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o);
30218
30219 /**
30220  * Creates a copy of the RetryableSendFailure
30221  */
30222 enum LDKRetryableSendFailure RetryableSendFailure_clone(const enum LDKRetryableSendFailure *NONNULL_PTR orig);
30223
30224 /**
30225  * Utility method to constructs a new PaymentExpired-variant RetryableSendFailure
30226  */
30227 enum LDKRetryableSendFailure RetryableSendFailure_payment_expired(void);
30228
30229 /**
30230  * Utility method to constructs a new RouteNotFound-variant RetryableSendFailure
30231  */
30232 enum LDKRetryableSendFailure RetryableSendFailure_route_not_found(void);
30233
30234 /**
30235  * Utility method to constructs a new DuplicatePayment-variant RetryableSendFailure
30236  */
30237 enum LDKRetryableSendFailure RetryableSendFailure_duplicate_payment(void);
30238
30239 /**
30240  * Frees any resources used by the PaymentSendFailure
30241  */
30242 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
30243
30244 /**
30245  * Creates a copy of the PaymentSendFailure
30246  */
30247 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
30248
30249 /**
30250  * Utility method to constructs a new ParameterError-variant PaymentSendFailure
30251  */
30252 struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a);
30253
30254 /**
30255  * Utility method to constructs a new PathParameterError-variant PaymentSendFailure
30256  */
30257 struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a);
30258
30259 /**
30260  * Utility method to constructs a new AllFailedResendSafe-variant PaymentSendFailure
30261  */
30262 struct LDKPaymentSendFailure PaymentSendFailure_all_failed_resend_safe(struct LDKCVec_APIErrorZ a);
30263
30264 /**
30265  * Utility method to constructs a new DuplicatePayment-variant PaymentSendFailure
30266  */
30267 struct LDKPaymentSendFailure PaymentSendFailure_duplicate_payment(void);
30268
30269 /**
30270  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
30271  */
30272 struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id);
30273
30274 /**
30275  * Calls the free function if one is set
30276  */
30277 void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
30278
30279 /**
30280  * Calls the free function if one is set
30281  */
30282 void Type_free(struct LDKType this_ptr);
30283
30284 /**
30285  * Creates a copy of the UtxoLookupError
30286  */
30287 enum LDKUtxoLookupError UtxoLookupError_clone(const enum LDKUtxoLookupError *NONNULL_PTR orig);
30288
30289 /**
30290  * Utility method to constructs a new UnknownChain-variant UtxoLookupError
30291  */
30292 enum LDKUtxoLookupError UtxoLookupError_unknown_chain(void);
30293
30294 /**
30295  * Utility method to constructs a new UnknownTx-variant UtxoLookupError
30296  */
30297 enum LDKUtxoLookupError UtxoLookupError_unknown_tx(void);
30298
30299 /**
30300  * Frees any resources used by the UtxoResult
30301  */
30302 void UtxoResult_free(struct LDKUtxoResult this_ptr);
30303
30304 /**
30305  * Creates a copy of the UtxoResult
30306  */
30307 struct LDKUtxoResult UtxoResult_clone(const struct LDKUtxoResult *NONNULL_PTR orig);
30308
30309 /**
30310  * Utility method to constructs a new Sync-variant UtxoResult
30311  */
30312 struct LDKUtxoResult UtxoResult_sync(struct LDKCResult_TxOutUtxoLookupErrorZ a);
30313
30314 /**
30315  * Utility method to constructs a new Async-variant UtxoResult
30316  */
30317 struct LDKUtxoResult UtxoResult_async(struct LDKUtxoFuture a);
30318
30319 /**
30320  * Calls the free function if one is set
30321  */
30322 void UtxoLookup_free(struct LDKUtxoLookup this_ptr);
30323
30324 /**
30325  * Frees any resources used by the UtxoFuture, if is_owned is set and inner is non-NULL.
30326  */
30327 void UtxoFuture_free(struct LDKUtxoFuture this_obj);
30328
30329 /**
30330  * Creates a copy of the UtxoFuture
30331  */
30332 struct LDKUtxoFuture UtxoFuture_clone(const struct LDKUtxoFuture *NONNULL_PTR orig);
30333
30334 /**
30335  * Builds a new future for later resolution.
30336  */
30337 MUST_USE_RES struct LDKUtxoFuture UtxoFuture_new(void);
30338
30339 /**
30340  * Resolves this future against the given `graph` and with the given `result`.
30341  *
30342  * This is identical to calling [`UtxoFuture::resolve`] with a dummy `gossip`, disabling
30343  * forwarding the validated gossip message onwards to peers.
30344  *
30345  * Because this may cause the [`NetworkGraph`]'s [`processing_queue_high`] to flip, in order
30346  * to allow us to interact with peers again, you should call [`PeerManager::process_events`]
30347  * after this.
30348  *
30349  * [`processing_queue_high`]: crate::ln::msgs::RoutingMessageHandler::processing_queue_high
30350  * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
30351  */
30352 void UtxoFuture_resolve_without_forwarding(const struct LDKUtxoFuture *NONNULL_PTR this_arg, const struct LDKNetworkGraph *NONNULL_PTR graph, struct LDKCResult_TxOutUtxoLookupErrorZ result);
30353
30354 /**
30355  * Resolves this future against the given `graph` and with the given `result`.
30356  *
30357  * The given `gossip` is used to broadcast any validated messages onwards to all peers which
30358  * have available buffer space.
30359  *
30360  * Because this may cause the [`NetworkGraph`]'s [`processing_queue_high`] to flip, in order
30361  * to allow us to interact with peers again, you should call [`PeerManager::process_events`]
30362  * after this.
30363  *
30364  * [`processing_queue_high`]: crate::ln::msgs::RoutingMessageHandler::processing_queue_high
30365  * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
30366  */
30367 void UtxoFuture_resolve(const struct LDKUtxoFuture *NONNULL_PTR this_arg, const struct LDKNetworkGraph *NONNULL_PTR graph, const struct LDKP2PGossipSync *NONNULL_PTR gossip, struct LDKCResult_TxOutUtxoLookupErrorZ result);
30368
30369 /**
30370  * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
30371  */
30372 void NodeId_free(struct LDKNodeId this_obj);
30373
30374 /**
30375  * Creates a copy of the NodeId
30376  */
30377 struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig);
30378
30379 /**
30380  * Create a new NodeId from a public key
30381  */
30382 MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey);
30383
30384 /**
30385  * Get the public key slice from this NodeId
30386  */
30387 MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
30388
30389 /**
30390  * Checks if two NodeIds contain equal inner contents.
30391  */
30392 uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
30393
30394 /**
30395  * Serialize the NodeId object into a byte array which can be read by NodeId_read
30396  */
30397 struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj);
30398
30399 /**
30400  * Read a NodeId from a byte array, created by NodeId_write
30401  */
30402 struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser);
30403
30404 /**
30405  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
30406  */
30407 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
30408
30409 /**
30410  * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
30411  */
30412 void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
30413
30414 /**
30415  * Frees any resources used by the NetworkUpdate
30416  */
30417 void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
30418
30419 /**
30420  * Creates a copy of the NetworkUpdate
30421  */
30422 struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
30423
30424 /**
30425  * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
30426  */
30427 struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
30428
30429 /**
30430  * Utility method to constructs a new ChannelFailure-variant NetworkUpdate
30431  */
30432 struct LDKNetworkUpdate NetworkUpdate_channel_failure(uint64_t short_channel_id, bool is_permanent);
30433
30434 /**
30435  * Utility method to constructs a new NodeFailure-variant NetworkUpdate
30436  */
30437 struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
30438
30439 /**
30440  * Checks if two NetworkUpdates contain equal inner contents.
30441  * This ignores pointers and is_owned flags and looks at the values in fields.
30442  */
30443 bool NetworkUpdate_eq(const struct LDKNetworkUpdate *NONNULL_PTR a, const struct LDKNetworkUpdate *NONNULL_PTR b);
30444
30445 /**
30446  * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
30447  */
30448 struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
30449
30450 /**
30451  * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
30452  */
30453 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser);
30454
30455 /**
30456  * Frees any resources used by the P2PGossipSync, if is_owned is set and inner is non-NULL.
30457  */
30458 void P2PGossipSync_free(struct LDKP2PGossipSync this_obj);
30459
30460 /**
30461  * Creates a new tracker of the actual state of the network of channels and nodes,
30462  * assuming an existing Network Graph.
30463  * UTXO lookup is used to make sure announced channels exist on-chain, channel data is
30464  * correct, and the announcement is signed with channel owners' keys.
30465  */
30466 MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_UtxoLookupZ utxo_lookup, struct LDKLogger logger);
30467
30468 /**
30469  * Adds a provider used to check new announcements. Does not affect
30470  * existing announcements unless they are updated.
30471  * Add, update or remove the provider would replace the current one.
30472  */
30473 void P2PGossipSync_add_utxo_lookup(struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_UtxoLookupZ utxo_lookup);
30474
30475 /**
30476  * Handles any network updates originating from [`Event`]s.
30477  *
30478  * [`Event`]: crate::util::events::Event
30479  */
30480 void NetworkGraph_handle_network_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNetworkUpdate *NONNULL_PTR network_update);
30481
30482 /**
30483  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
30484  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
30485  */
30486 struct LDKRoutingMessageHandler P2PGossipSync_as_RoutingMessageHandler(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
30487
30488 /**
30489  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
30490  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
30491  */
30492 struct LDKMessageSendEventsProvider P2PGossipSync_as_MessageSendEventsProvider(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
30493
30494 /**
30495  * Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL.
30496  */
30497 void ChannelUpdateInfo_free(struct LDKChannelUpdateInfo this_obj);
30498
30499 /**
30500  * When the last update to the channel direction was issued.
30501  * Value is opaque, as set in the announcement.
30502  */
30503 uint32_t ChannelUpdateInfo_get_last_update(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
30504
30505 /**
30506  * When the last update to the channel direction was issued.
30507  * Value is opaque, as set in the announcement.
30508  */
30509 void ChannelUpdateInfo_set_last_update(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint32_t val);
30510
30511 /**
30512  * Whether the channel can be currently used for payments (in this one direction).
30513  */
30514 bool ChannelUpdateInfo_get_enabled(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
30515
30516 /**
30517  * Whether the channel can be currently used for payments (in this one direction).
30518  */
30519 void ChannelUpdateInfo_set_enabled(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, bool val);
30520
30521 /**
30522  * The difference in CLTV values that you must have when routing through this channel.
30523  */
30524 uint16_t ChannelUpdateInfo_get_cltv_expiry_delta(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
30525
30526 /**
30527  * The difference in CLTV values that you must have when routing through this channel.
30528  */
30529 void ChannelUpdateInfo_set_cltv_expiry_delta(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint16_t val);
30530
30531 /**
30532  * The minimum value, which must be relayed to the next hop via the channel
30533  */
30534 uint64_t ChannelUpdateInfo_get_htlc_minimum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
30535
30536 /**
30537  * The minimum value, which must be relayed to the next hop via the channel
30538  */
30539 void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
30540
30541 /**
30542  * The maximum value which may be relayed to the next hop via the channel.
30543  */
30544 uint64_t ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
30545
30546 /**
30547  * The maximum value which may be relayed to the next hop via the channel.
30548  */
30549 void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
30550
30551 /**
30552  * Fees charged when the channel is used for routing
30553  */
30554 struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
30555
30556 /**
30557  * Fees charged when the channel is used for routing
30558  */
30559 void ChannelUpdateInfo_set_fees(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
30560
30561 /**
30562  * Most recent update for the channel received from the network
30563  * Mostly redundant with the data we store in fields explicitly.
30564  * Everything else is useful only for sending out for initial routing sync.
30565  * Not stored if contains excess data to prevent DoS.
30566  *
30567  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30568  */
30569 struct LDKChannelUpdate ChannelUpdateInfo_get_last_update_message(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
30570
30571 /**
30572  * Most recent update for the channel received from the network
30573  * Mostly redundant with the data we store in fields explicitly.
30574  * Everything else is useful only for sending out for initial routing sync.
30575  * Not stored if contains excess data to prevent DoS.
30576  *
30577  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
30578  */
30579 void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
30580
30581 /**
30582  * Constructs a new ChannelUpdateInfo given each field
30583  */
30584 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);
30585
30586 /**
30587  * Creates a copy of the ChannelUpdateInfo
30588  */
30589 struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig);
30590
30591 /**
30592  * Checks if two ChannelUpdateInfos contain equal inner contents.
30593  * This ignores pointers and is_owned flags and looks at the values in fields.
30594  * Two objects with NULL inner values will be considered "equal" here.
30595  */
30596 bool ChannelUpdateInfo_eq(const struct LDKChannelUpdateInfo *NONNULL_PTR a, const struct LDKChannelUpdateInfo *NONNULL_PTR b);
30597
30598 /**
30599  * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read
30600  */
30601 struct LDKCVec_u8Z ChannelUpdateInfo_write(const struct LDKChannelUpdateInfo *NONNULL_PTR obj);
30602
30603 /**
30604  * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write
30605  */
30606 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ ChannelUpdateInfo_read(struct LDKu8slice ser);
30607
30608 /**
30609  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
30610  */
30611 void ChannelInfo_free(struct LDKChannelInfo this_obj);
30612
30613 /**
30614  * Protocol features of a channel communicated during its announcement
30615  */
30616 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
30617
30618 /**
30619  * Protocol features of a channel communicated during its announcement
30620  */
30621 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
30622
30623 /**
30624  * Source node of the first direction of a channel
30625  */
30626 struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
30627
30628 /**
30629  * Source node of the first direction of a channel
30630  */
30631 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
30632
30633 /**
30634  * Details about the first direction of a channel
30635  *
30636  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30637  */
30638 struct LDKChannelUpdateInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
30639
30640 /**
30641  * Details about the first direction of a channel
30642  *
30643  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
30644  */
30645 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
30646
30647 /**
30648  * Source node of the second direction of a channel
30649  */
30650 struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
30651
30652 /**
30653  * Source node of the second direction of a channel
30654  */
30655 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
30656
30657 /**
30658  * Details about the second direction of a channel
30659  *
30660  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30661  */
30662 struct LDKChannelUpdateInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
30663
30664 /**
30665  * Details about the second direction of a channel
30666  *
30667  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
30668  */
30669 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
30670
30671 /**
30672  * The channel capacity as seen on-chain, if chain lookup is available.
30673  */
30674 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
30675
30676 /**
30677  * The channel capacity as seen on-chain, if chain lookup is available.
30678  */
30679 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
30680
30681 /**
30682  * An initial announcement of the channel
30683  * Mostly redundant with the data we store in fields explicitly.
30684  * Everything else is useful only for sending out for initial routing sync.
30685  * Not stored if contains excess data to prevent DoS.
30686  *
30687  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30688  */
30689 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
30690
30691 /**
30692  * An initial announcement of the channel
30693  * Mostly redundant with the data we store in fields explicitly.
30694  * Everything else is useful only for sending out for initial routing sync.
30695  * Not stored if contains excess data to prevent DoS.
30696  *
30697  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
30698  */
30699 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
30700
30701 /**
30702  * Creates a copy of the ChannelInfo
30703  */
30704 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
30705
30706 /**
30707  * Checks if two ChannelInfos contain equal inner contents.
30708  * This ignores pointers and is_owned flags and looks at the values in fields.
30709  * Two objects with NULL inner values will be considered "equal" here.
30710  */
30711 bool ChannelInfo_eq(const struct LDKChannelInfo *NONNULL_PTR a, const struct LDKChannelInfo *NONNULL_PTR b);
30712
30713 /**
30714  * Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag.
30715  *
30716  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30717  */
30718 MUST_USE_RES struct LDKChannelUpdateInfo ChannelInfo_get_directional_info(const struct LDKChannelInfo *NONNULL_PTR this_arg, uint8_t channel_flags);
30719
30720 /**
30721  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
30722  */
30723 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
30724
30725 /**
30726  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
30727  */
30728 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
30729
30730 /**
30731  * Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL.
30732  */
30733 void DirectedChannelInfo_free(struct LDKDirectedChannelInfo this_obj);
30734
30735 /**
30736  * Creates a copy of the DirectedChannelInfo
30737  */
30738 struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirectedChannelInfo *NONNULL_PTR orig);
30739
30740 /**
30741  * Returns information for the channel.
30742  */
30743 MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
30744
30745 /**
30746  * Returns the maximum HTLC amount allowed over the channel in the direction.
30747  */
30748 MUST_USE_RES uint64_t DirectedChannelInfo_htlc_maximum_msat(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
30749
30750 /**
30751  * Returns the [`EffectiveCapacity`] of the channel in the direction.
30752  *
30753  * This is either the total capacity from the funding transaction, if known, or the
30754  * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
30755  * otherwise.
30756  */
30757 MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
30758
30759 /**
30760  * Frees any resources used by the EffectiveCapacity
30761  */
30762 void EffectiveCapacity_free(struct LDKEffectiveCapacity this_ptr);
30763
30764 /**
30765  * Creates a copy of the EffectiveCapacity
30766  */
30767 struct LDKEffectiveCapacity EffectiveCapacity_clone(const struct LDKEffectiveCapacity *NONNULL_PTR orig);
30768
30769 /**
30770  * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity
30771  */
30772 struct LDKEffectiveCapacity EffectiveCapacity_exact_liquidity(uint64_t liquidity_msat);
30773
30774 /**
30775  * Utility method to constructs a new MaximumHTLC-variant EffectiveCapacity
30776  */
30777 struct LDKEffectiveCapacity EffectiveCapacity_maximum_htlc(uint64_t amount_msat);
30778
30779 /**
30780  * Utility method to constructs a new Total-variant EffectiveCapacity
30781  */
30782 struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat, uint64_t htlc_maximum_msat);
30783
30784 /**
30785  * Utility method to constructs a new Infinite-variant EffectiveCapacity
30786  */
30787 struct LDKEffectiveCapacity EffectiveCapacity_infinite(void);
30788
30789 /**
30790  * Utility method to constructs a new Unknown-variant EffectiveCapacity
30791  */
30792 struct LDKEffectiveCapacity EffectiveCapacity_unknown(void);
30793
30794 /**
30795  * Returns the effective capacity denominated in millisatoshi.
30796  */
30797 MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacity *NONNULL_PTR this_arg);
30798
30799 /**
30800  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
30801  */
30802 void RoutingFees_free(struct LDKRoutingFees this_obj);
30803
30804 /**
30805  * Flat routing fee in millisatoshis.
30806  */
30807 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
30808
30809 /**
30810  * Flat routing fee in millisatoshis.
30811  */
30812 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
30813
30814 /**
30815  * Liquidity-based routing fee in millionths of a routed amount.
30816  * In other words, 10000 is 1%.
30817  */
30818 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
30819
30820 /**
30821  * Liquidity-based routing fee in millionths of a routed amount.
30822  * In other words, 10000 is 1%.
30823  */
30824 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
30825
30826 /**
30827  * Constructs a new RoutingFees given each field
30828  */
30829 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
30830
30831 /**
30832  * Checks if two RoutingFeess contain equal inner contents.
30833  * This ignores pointers and is_owned flags and looks at the values in fields.
30834  * Two objects with NULL inner values will be considered "equal" here.
30835  */
30836 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
30837
30838 /**
30839  * Creates a copy of the RoutingFees
30840  */
30841 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
30842
30843 /**
30844  * Checks if two RoutingFeess contain equal inner contents.
30845  */
30846 uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
30847
30848 /**
30849  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
30850  */
30851 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
30852
30853 /**
30854  * Read a RoutingFees from a byte array, created by RoutingFees_write
30855  */
30856 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
30857
30858 /**
30859  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
30860  */
30861 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
30862
30863 /**
30864  * Protocol features the node announced support for
30865  */
30866 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
30867
30868 /**
30869  * Protocol features the node announced support for
30870  */
30871 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
30872
30873 /**
30874  * When the last known update to the node state was issued.
30875  * Value is opaque, as set in the announcement.
30876  */
30877 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
30878
30879 /**
30880  * When the last known update to the node state was issued.
30881  * Value is opaque, as set in the announcement.
30882  */
30883 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
30884
30885 /**
30886  * Color assigned to the node
30887  */
30888 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
30889
30890 /**
30891  * Color assigned to the node
30892  */
30893 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
30894
30895 /**
30896  * Moniker assigned to the node.
30897  * May be invalid or malicious (eg control chars),
30898  * should not be exposed to the user.
30899  */
30900 struct LDKNodeAlias NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
30901
30902 /**
30903  * Moniker assigned to the node.
30904  * May be invalid or malicious (eg control chars),
30905  * should not be exposed to the user.
30906  */
30907 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAlias val);
30908
30909 /**
30910  * Internet-level addresses via which one can connect to the node
30911  *
30912  * Returns a copy of the field.
30913  */
30914 struct LDKCVec_NetAddressZ NodeAnnouncementInfo_get_addresses(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
30915
30916 /**
30917  * Internet-level addresses via which one can connect to the node
30918  */
30919 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
30920
30921 /**
30922  * An initial announcement of the node
30923  * Mostly redundant with the data we store in fields explicitly.
30924  * Everything else is useful only for sending out for initial routing sync.
30925  * Not stored if contains excess data to prevent DoS.
30926  *
30927  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
30928  */
30929 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
30930
30931 /**
30932  * An initial announcement of the node
30933  * Mostly redundant with the data we store in fields explicitly.
30934  * Everything else is useful only for sending out for initial routing sync.
30935  * Not stored if contains excess data to prevent DoS.
30936  *
30937  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
30938  */
30939 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
30940
30941 /**
30942  * Constructs a new NodeAnnouncementInfo given each field
30943  */
30944 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);
30945
30946 /**
30947  * Creates a copy of the NodeAnnouncementInfo
30948  */
30949 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
30950
30951 /**
30952  * Checks if two NodeAnnouncementInfos contain equal inner contents.
30953  * This ignores pointers and is_owned flags and looks at the values in fields.
30954  * Two objects with NULL inner values will be considered "equal" here.
30955  */
30956 bool NodeAnnouncementInfo_eq(const struct LDKNodeAnnouncementInfo *NONNULL_PTR a, const struct LDKNodeAnnouncementInfo *NONNULL_PTR b);
30957
30958 /**
30959  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
30960  */
30961 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
30962
30963 /**
30964  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
30965  */
30966 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
30967
30968 /**
30969  * Frees any resources used by the NodeAlias, if is_owned is set and inner is non-NULL.
30970  */
30971 void NodeAlias_free(struct LDKNodeAlias this_obj);
30972
30973 const uint8_t (*NodeAlias_get_a(const struct LDKNodeAlias *NONNULL_PTR this_ptr))[32];
30974
30975 void NodeAlias_set_a(struct LDKNodeAlias *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
30976
30977 /**
30978  * Constructs a new NodeAlias given each field
30979  */
30980 MUST_USE_RES struct LDKNodeAlias NodeAlias_new(struct LDKThirtyTwoBytes a_arg);
30981
30982 /**
30983  * Creates a copy of the NodeAlias
30984  */
30985 struct LDKNodeAlias NodeAlias_clone(const struct LDKNodeAlias *NONNULL_PTR orig);
30986
30987 /**
30988  * Checks if two NodeAliass contain equal inner contents.
30989  * This ignores pointers and is_owned flags and looks at the values in fields.
30990  * Two objects with NULL inner values will be considered "equal" here.
30991  */
30992 bool NodeAlias_eq(const struct LDKNodeAlias *NONNULL_PTR a, const struct LDKNodeAlias *NONNULL_PTR b);
30993
30994 /**
30995  * Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read
30996  */
30997 struct LDKCVec_u8Z NodeAlias_write(const struct LDKNodeAlias *NONNULL_PTR obj);
30998
30999 /**
31000  * Read a NodeAlias from a byte array, created by NodeAlias_write
31001  */
31002 struct LDKCResult_NodeAliasDecodeErrorZ NodeAlias_read(struct LDKu8slice ser);
31003
31004 /**
31005  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
31006  */
31007 void NodeInfo_free(struct LDKNodeInfo this_obj);
31008
31009 /**
31010  * All valid channels a node has announced
31011  *
31012  * Returns a copy of the field.
31013  */
31014 struct LDKCVec_u64Z NodeInfo_get_channels(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
31015
31016 /**
31017  * All valid channels a node has announced
31018  */
31019 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
31020
31021 /**
31022  * More information about a node from node_announcement.
31023  * Optional because we store a Node entry after learning about it from
31024  * a channel announcement, but before receiving a node announcement.
31025  *
31026  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31027  */
31028 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
31029
31030 /**
31031  * More information about a node from node_announcement.
31032  * Optional because we store a Node entry after learning about it from
31033  * a channel announcement, but before receiving a node announcement.
31034  *
31035  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
31036  */
31037 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
31038
31039 /**
31040  * Constructs a new NodeInfo given each field
31041  */
31042 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
31043
31044 /**
31045  * Creates a copy of the NodeInfo
31046  */
31047 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
31048
31049 /**
31050  * Checks if two NodeInfos contain equal inner contents.
31051  * This ignores pointers and is_owned flags and looks at the values in fields.
31052  * Two objects with NULL inner values will be considered "equal" here.
31053  */
31054 bool NodeInfo_eq(const struct LDKNodeInfo *NONNULL_PTR a, const struct LDKNodeInfo *NONNULL_PTR b);
31055
31056 /**
31057  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
31058  */
31059 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
31060
31061 /**
31062  * Read a NodeInfo from a byte array, created by NodeInfo_write
31063  */
31064 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
31065
31066 /**
31067  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
31068  */
31069 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
31070
31071 /**
31072  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
31073  */
31074 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser, struct LDKLogger arg);
31075
31076 /**
31077  * Creates a new, empty, network graph.
31078  */
31079 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(enum LDKNetwork network, struct LDKLogger logger);
31080
31081 /**
31082  * Returns a read-only view of the network graph.
31083  */
31084 MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
31085
31086 /**
31087  * The unix timestamp provided by the most recent rapid gossip sync.
31088  * It will be set by the rapid sync process after every sync completion.
31089  */
31090 MUST_USE_RES struct LDKCOption_u32Z NetworkGraph_get_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
31091
31092 /**
31093  * Update the unix timestamp provided by the most recent rapid gossip sync.
31094  * This should be done automatically by the rapid sync process after every sync completion.
31095  */
31096 void NetworkGraph_set_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint32_t last_rapid_gossip_sync_timestamp);
31097
31098 /**
31099  * For an already known node (from channel announcements), update its stored properties from a
31100  * given node announcement.
31101  *
31102  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
31103  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
31104  * routing messages from a source using a protocol other than the lightning P2P protocol.
31105  */
31106 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
31107
31108 /**
31109  * For an already known node (from channel announcements), update its stored properties from a
31110  * given node announcement without verifying the associated signatures. Because we aren't
31111  * given the associated signatures here we cannot relay the node announcement to any of our
31112  * peers.
31113  */
31114 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);
31115
31116 /**
31117  * Store or update channel info from a channel announcement.
31118  *
31119  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
31120  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
31121  * routing messages from a source using a protocol other than the lightning P2P protocol.
31122  *
31123  * If a [`UtxoLookup`] object is provided via `utxo_lookup`, it will be called to verify
31124  * the corresponding UTXO exists on chain and is correctly-formatted.
31125  */
31126 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_UtxoLookupZ utxo_lookup);
31127
31128 /**
31129  * Store or update channel info from a channel announcement without verifying the associated
31130  * signatures. Because we aren't given the associated signatures here we cannot relay the
31131  * channel announcement to any of our peers.
31132  *
31133  * If a [`UtxoLookup`] object is provided via `utxo_lookup`, it will be called to verify
31134  * the corresponding UTXO exists on chain and is correctly-formatted.
31135  */
31136 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_UtxoLookupZ utxo_lookup);
31137
31138 /**
31139  * Update channel from partial announcement data received via rapid gossip sync
31140  *
31141  * `timestamp: u64`: Timestamp emulating the backdated original announcement receipt (by the
31142  * rapid gossip sync server)
31143  *
31144  * All other parameters as used in [`msgs::UnsignedChannelAnnouncement`] fields.
31145  */
31146 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);
31147
31148 /**
31149  * Marks a channel in the graph as failed if a corresponding HTLC fail was sent.
31150  * If permanent, removes a channel from the local storage.
31151  * May cause the removal of nodes too, if this was their last channel.
31152  * If not permanent, makes channels unavailable for routing.
31153  */
31154 void NetworkGraph_channel_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
31155
31156 /**
31157  * Marks a node in the graph as permanently failed, effectively removing it and its channels
31158  * from local storage.
31159  */
31160 void NetworkGraph_node_failed_permanent(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey node_id);
31161
31162 /**
31163  * Removes information about channels that we haven't heard any updates about in some time.
31164  * This can be used regularly to prune the network graph of channels that likely no longer
31165  * exist.
31166  *
31167  * While there is no formal requirement that nodes regularly re-broadcast their channel
31168  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
31169  * pruning occur for updates which are at least two weeks old, which we implement here.
31170  *
31171  * Note that for users of the `lightning-background-processor` crate this method may be
31172  * automatically called regularly for you.
31173  *
31174  * This method will also cause us to stop tracking removed nodes and channels if they have been
31175  * in the map for a while so that these can be resynced from gossip in the future.
31176  *
31177  * This method is only available with the `std` feature. See
31178  * [`NetworkGraph::remove_stale_channels_and_tracking_with_time`] for `no-std` use.
31179  */
31180 void NetworkGraph_remove_stale_channels_and_tracking(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
31181
31182 /**
31183  * Removes information about channels that we haven't heard any updates about in some time.
31184  * This can be used regularly to prune the network graph of channels that likely no longer
31185  * exist.
31186  *
31187  * While there is no formal requirement that nodes regularly re-broadcast their channel
31188  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
31189  * pruning occur for updates which are at least two weeks old, which we implement here.
31190  *
31191  * This method will also cause us to stop tracking removed nodes and channels if they have been
31192  * in the map for a while so that these can be resynced from gossip in the future.
31193  *
31194  * This function takes the current unix time as an argument. For users with the `std` feature
31195  * enabled, [`NetworkGraph::remove_stale_channels_and_tracking`] may be preferable.
31196  */
31197 void NetworkGraph_remove_stale_channels_and_tracking_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix);
31198
31199 /**
31200  * For an already known (from announcement) channel, update info about one of the directions
31201  * of the channel.
31202  *
31203  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
31204  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
31205  * routing messages from a source using a protocol other than the lightning P2P protocol.
31206  *
31207  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
31208  * materially in the future will be rejected.
31209  */
31210 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
31211
31212 /**
31213  * For an already known (from announcement) channel, update info about one of the directions
31214  * of the channel without verifying the associated signatures. Because we aren't given the
31215  * associated signatures here we cannot relay the channel update to any of our peers.
31216  *
31217  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
31218  * materially in the future will be rejected.
31219  */
31220 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
31221
31222 /**
31223  * Returns information on a channel with the given id.
31224  *
31225  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31226  */
31227 MUST_USE_RES struct LDKChannelInfo ReadOnlyNetworkGraph_channel(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id);
31228
31229 /**
31230  * Returns the list of channels in the graph
31231  */
31232 MUST_USE_RES struct LDKCVec_u64Z ReadOnlyNetworkGraph_list_channels(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg);
31233
31234 /**
31235  * Returns information on a node with the given id.
31236  *
31237  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31238  */
31239 MUST_USE_RES struct LDKNodeInfo ReadOnlyNetworkGraph_node(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
31240
31241 /**
31242  * Returns the list of nodes in the graph
31243  */
31244 MUST_USE_RES struct LDKCVec_NodeIdZ ReadOnlyNetworkGraph_list_nodes(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg);
31245
31246 /**
31247  * Get network addresses by node id.
31248  * Returns None if the requested node is completely unknown,
31249  * or if node announcement for the node was never received.
31250  */
31251 MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey);
31252
31253 /**
31254  * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
31255  */
31256 void DefaultRouter_free(struct LDKDefaultRouter this_obj);
31257
31258 /**
31259  * Creates a new router.
31260  */
31261 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);
31262
31263 /**
31264  * Constructs a new Router which calls the relevant methods on this_arg.
31265  * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
31266  */
31267 struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg);
31268
31269 /**
31270  * Calls the free function if one is set
31271  */
31272 void Router_free(struct LDKRouter this_ptr);
31273
31274 /**
31275  * Frees any resources used by the ScorerAccountingForInFlightHtlcs, if is_owned is set and inner is non-NULL.
31276  */
31277 void ScorerAccountingForInFlightHtlcs_free(struct LDKScorerAccountingForInFlightHtlcs this_obj);
31278
31279 /**
31280  * Initialize a new `ScorerAccountingForInFlightHtlcs`.
31281  */
31282 MUST_USE_RES struct LDKScorerAccountingForInFlightHtlcs ScorerAccountingForInFlightHtlcs_new(struct LDKScore scorer, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs);
31283
31284 /**
31285  * Serialize the ScorerAccountingForInFlightHtlcs object into a byte array which can be read by ScorerAccountingForInFlightHtlcs_read
31286  */
31287 struct LDKCVec_u8Z ScorerAccountingForInFlightHtlcs_write(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR obj);
31288
31289 /**
31290  * Constructs a new Score which calls the relevant methods on this_arg.
31291  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
31292  */
31293 struct LDKScore ScorerAccountingForInFlightHtlcs_as_Score(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR this_arg);
31294
31295 /**
31296  * Frees any resources used by the InFlightHtlcs, if is_owned is set and inner is non-NULL.
31297  */
31298 void InFlightHtlcs_free(struct LDKInFlightHtlcs this_obj);
31299
31300 /**
31301  * Creates a copy of the InFlightHtlcs
31302  */
31303 struct LDKInFlightHtlcs InFlightHtlcs_clone(const struct LDKInFlightHtlcs *NONNULL_PTR orig);
31304
31305 /**
31306  * Constructs an empty `InFlightHtlcs`.
31307  */
31308 MUST_USE_RES struct LDKInFlightHtlcs InFlightHtlcs_new(void);
31309
31310 /**
31311  * Returns liquidity in msat given the public key of the HTLC source, target, and short channel
31312  * id.
31313  */
31314 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);
31315
31316 /**
31317  * Serialize the InFlightHtlcs object into a byte array which can be read by InFlightHtlcs_read
31318  */
31319 struct LDKCVec_u8Z InFlightHtlcs_write(const struct LDKInFlightHtlcs *NONNULL_PTR obj);
31320
31321 /**
31322  * Read a InFlightHtlcs from a byte array, created by InFlightHtlcs_write
31323  */
31324 struct LDKCResult_InFlightHtlcsDecodeErrorZ InFlightHtlcs_read(struct LDKu8slice ser);
31325
31326 /**
31327  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
31328  */
31329 void RouteHop_free(struct LDKRouteHop this_obj);
31330
31331 /**
31332  * The node_id of the node at this hop.
31333  */
31334 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
31335
31336 /**
31337  * The node_id of the node at this hop.
31338  */
31339 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
31340
31341 /**
31342  * The node_announcement features of the node at this hop. For the last hop, these may be
31343  * amended to match the features present in the invoice this node generated.
31344  */
31345 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
31346
31347 /**
31348  * The node_announcement features of the node at this hop. For the last hop, these may be
31349  * amended to match the features present in the invoice this node generated.
31350  */
31351 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
31352
31353 /**
31354  * The channel that should be used from the previous hop to reach this node.
31355  */
31356 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
31357
31358 /**
31359  * The channel that should be used from the previous hop to reach this node.
31360  */
31361 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
31362
31363 /**
31364  * The channel_announcement features of the channel that should be used from the previous hop
31365  * to reach this node.
31366  */
31367 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
31368
31369 /**
31370  * The channel_announcement features of the channel that should be used from the previous hop
31371  * to reach this node.
31372  */
31373 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
31374
31375 /**
31376  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
31377  * For the last hop, this should be the full value of the payment (might be more than
31378  * requested if we had to match htlc_minimum_msat).
31379  */
31380 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
31381
31382 /**
31383  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
31384  * For the last hop, this should be the full value of the payment (might be more than
31385  * requested if we had to match htlc_minimum_msat).
31386  */
31387 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
31388
31389 /**
31390  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
31391  * expected at the destination, in excess of the current block height.
31392  */
31393 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
31394
31395 /**
31396  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
31397  * expected at the destination, in excess of the current block height.
31398  */
31399 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
31400
31401 /**
31402  * Constructs a new RouteHop given each field
31403  */
31404 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);
31405
31406 /**
31407  * Creates a copy of the RouteHop
31408  */
31409 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
31410
31411 /**
31412  * Checks if two RouteHops contain equal inner contents.
31413  */
31414 uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
31415
31416 /**
31417  * Checks if two RouteHops contain equal inner contents.
31418  * This ignores pointers and is_owned flags and looks at the values in fields.
31419  * Two objects with NULL inner values will be considered "equal" here.
31420  */
31421 bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
31422
31423 /**
31424  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
31425  */
31426 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
31427
31428 /**
31429  * Read a RouteHop from a byte array, created by RouteHop_write
31430  */
31431 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
31432
31433 /**
31434  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
31435  */
31436 void Route_free(struct LDKRoute this_obj);
31437
31438 /**
31439  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
31440  * last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
31441  * INCLUDING our own, where the last hop is the destination. Thus, this must always be at
31442  * least length one. While the maximum length of any given path is variable, keeping the length
31443  * of any path less or equal to 19 should currently ensure it is viable.
31444  */
31445 struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
31446
31447 /**
31448  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
31449  * last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
31450  * INCLUDING our own, where the last hop is the destination. Thus, this must always be at
31451  * least length one. While the maximum length of any given path is variable, keeping the length
31452  * of any path less or equal to 19 should currently ensure it is viable.
31453  */
31454 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
31455
31456 /**
31457  * The `payment_params` parameter passed to [`find_route`].
31458  * This is used by `ChannelManager` to track information which may be required for retries,
31459  * provided back to you via [`Event::PaymentPathFailed`].
31460  *
31461  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
31462  *
31463  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31464  */
31465 struct LDKPaymentParameters Route_get_payment_params(const struct LDKRoute *NONNULL_PTR this_ptr);
31466
31467 /**
31468  * The `payment_params` parameter passed to [`find_route`].
31469  * This is used by `ChannelManager` to track information which may be required for retries,
31470  * provided back to you via [`Event::PaymentPathFailed`].
31471  *
31472  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
31473  *
31474  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
31475  */
31476 void Route_set_payment_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
31477
31478 /**
31479  * Constructs a new Route given each field
31480  */
31481 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPaymentParameters payment_params_arg);
31482
31483 /**
31484  * Creates a copy of the Route
31485  */
31486 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
31487
31488 /**
31489  * Checks if two Routes contain equal inner contents.
31490  */
31491 uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
31492
31493 /**
31494  * Checks if two Routes contain equal inner contents.
31495  * This ignores pointers and is_owned flags and looks at the values in fields.
31496  * Two objects with NULL inner values will be considered "equal" here.
31497  */
31498 bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
31499
31500 /**
31501  * Returns the total amount of fees paid on this [`Route`].
31502  *
31503  * This doesn't include any extra payment made to the recipient, which can happen in excess of
31504  * the amount passed to [`find_route`]'s `params.final_value_msat`.
31505  */
31506 MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
31507
31508 /**
31509  * Returns the total amount paid on this [`Route`], excluding the fees.
31510  */
31511 MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
31512
31513 /**
31514  * Serialize the Route object into a byte array which can be read by Route_read
31515  */
31516 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
31517
31518 /**
31519  * Read a Route from a byte array, created by Route_write
31520  */
31521 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
31522
31523 /**
31524  * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL.
31525  */
31526 void RouteParameters_free(struct LDKRouteParameters this_obj);
31527
31528 /**
31529  * The parameters of the failed payment path.
31530  */
31531 struct LDKPaymentParameters RouteParameters_get_payment_params(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
31532
31533 /**
31534  * The parameters of the failed payment path.
31535  */
31536 void RouteParameters_set_payment_params(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
31537
31538 /**
31539  * The amount in msats sent on the failed payment path.
31540  */
31541 uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
31542
31543 /**
31544  * The amount in msats sent on the failed payment path.
31545  */
31546 void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val);
31547
31548 /**
31549  * Constructs a new RouteParameters given each field
31550  */
31551 MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPaymentParameters payment_params_arg, uint64_t final_value_msat_arg);
31552
31553 /**
31554  * Creates a copy of the RouteParameters
31555  */
31556 struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig);
31557
31558 /**
31559  * Checks if two RouteParameterss contain equal inner contents.
31560  * This ignores pointers and is_owned flags and looks at the values in fields.
31561  * Two objects with NULL inner values will be considered "equal" here.
31562  */
31563 bool RouteParameters_eq(const struct LDKRouteParameters *NONNULL_PTR a, const struct LDKRouteParameters *NONNULL_PTR b);
31564
31565 /**
31566  * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
31567  */
31568 struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj);
31569
31570 /**
31571  * Read a RouteParameters from a byte array, created by RouteParameters_write
31572  */
31573 struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser);
31574
31575 /**
31576  * Frees any resources used by the PaymentParameters, if is_owned is set and inner is non-NULL.
31577  */
31578 void PaymentParameters_free(struct LDKPaymentParameters this_obj);
31579
31580 /**
31581  * The node id of the payee.
31582  */
31583 struct LDKPublicKey PaymentParameters_get_payee_pubkey(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
31584
31585 /**
31586  * The node id of the payee.
31587  */
31588 void PaymentParameters_set_payee_pubkey(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKPublicKey val);
31589
31590 /**
31591  * Features supported by the payee.
31592  *
31593  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
31594  * does not contain any features.
31595  *
31596  * [`for_keysend`]: Self::for_keysend
31597  *
31598  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
31599  */
31600 struct LDKInvoiceFeatures PaymentParameters_get_features(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
31601
31602 /**
31603  * Features supported by the payee.
31604  *
31605  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
31606  * does not contain any features.
31607  *
31608  * [`for_keysend`]: Self::for_keysend
31609  *
31610  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
31611  */
31612 void PaymentParameters_set_features(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val);
31613
31614 /**
31615  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
31616  */
31617 struct LDKCVec_RouteHintZ PaymentParameters_get_route_hints(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
31618
31619 /**
31620  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
31621  */
31622 void PaymentParameters_set_route_hints(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val);
31623
31624 /**
31625  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
31626  */
31627 struct LDKCOption_u64Z PaymentParameters_get_expiry_time(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
31628
31629 /**
31630  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
31631  */
31632 void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
31633
31634 /**
31635  * The maximum total CLTV delta we accept for the route.
31636  * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`].
31637  */
31638 uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
31639
31640 /**
31641  * The maximum total CLTV delta we accept for the route.
31642  * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`].
31643  */
31644 void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val);
31645
31646 /**
31647  * The maximum number of paths that may be used by (MPP) payments.
31648  * Defaults to [`DEFAULT_MAX_PATH_COUNT`].
31649  */
31650 uint8_t PaymentParameters_get_max_path_count(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
31651
31652 /**
31653  * The maximum number of paths that may be used by (MPP) payments.
31654  * Defaults to [`DEFAULT_MAX_PATH_COUNT`].
31655  */
31656 void PaymentParameters_set_max_path_count(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val);
31657
31658 /**
31659  * Selects the maximum share of a channel's total capacity which will be sent over a channel,
31660  * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas
31661  * a lower value prefers to send larger MPP parts, potentially saturating channels and
31662  * increasing failure probability for those paths.
31663  *
31664  * Note that this restriction will be relaxed during pathfinding after paths which meet this
31665  * restriction have been found. While paths which meet this criteria will be searched for, it
31666  * is ultimately up to the scorer to select them over other paths.
31667  *
31668  * A value of 0 will allow payments up to and including a channel's total announced usable
31669  * capacity, a value of one will only use up to half its capacity, two 1/4, etc.
31670  *
31671  * Default value: 2
31672  */
31673 uint8_t PaymentParameters_get_max_channel_saturation_power_of_half(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
31674
31675 /**
31676  * Selects the maximum share of a channel's total capacity which will be sent over a channel,
31677  * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas
31678  * a lower value prefers to send larger MPP parts, potentially saturating channels and
31679  * increasing failure probability for those paths.
31680  *
31681  * Note that this restriction will be relaxed during pathfinding after paths which meet this
31682  * restriction have been found. While paths which meet this criteria will be searched for, it
31683  * is ultimately up to the scorer to select them over other paths.
31684  *
31685  * A value of 0 will allow payments up to and including a channel's total announced usable
31686  * capacity, a value of one will only use up to half its capacity, two 1/4, etc.
31687  *
31688  * Default value: 2
31689  */
31690 void PaymentParameters_set_max_channel_saturation_power_of_half(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val);
31691
31692 /**
31693  * A list of SCIDs which this payment was previously attempted over and which caused the
31694  * payment to fail. Future attempts for the same payment shouldn't be relayed through any of
31695  * these SCIDs.
31696  *
31697  * Returns a copy of the field.
31698  */
31699 struct LDKCVec_u64Z PaymentParameters_get_previously_failed_channels(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
31700
31701 /**
31702  * A list of SCIDs which this payment was previously attempted over and which caused the
31703  * payment to fail. Future attempts for the same payment shouldn't be relayed through any of
31704  * these SCIDs.
31705  */
31706 void PaymentParameters_set_previously_failed_channels(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
31707
31708 /**
31709  * The minimum CLTV delta at the end of the route. This value must not be zero.
31710  */
31711 uint32_t PaymentParameters_get_final_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
31712
31713 /**
31714  * The minimum CLTV delta at the end of the route. This value must not be zero.
31715  */
31716 void PaymentParameters_set_final_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val);
31717
31718 /**
31719  * Constructs a new PaymentParameters given each field
31720  */
31721 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, uint32_t final_cltv_expiry_delta_arg);
31722
31723 /**
31724  * Creates a copy of the PaymentParameters
31725  */
31726 struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig);
31727
31728 /**
31729  * Checks if two PaymentParameterss contain equal inner contents.
31730  */
31731 uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o);
31732
31733 /**
31734  * Checks if two PaymentParameterss contain equal inner contents.
31735  * This ignores pointers and is_owned flags and looks at the values in fields.
31736  * Two objects with NULL inner values will be considered "equal" here.
31737  */
31738 bool PaymentParameters_eq(const struct LDKPaymentParameters *NONNULL_PTR a, const struct LDKPaymentParameters *NONNULL_PTR b);
31739
31740 /**
31741  * Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read
31742  */
31743 struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NONNULL_PTR obj);
31744
31745 /**
31746  * Read a PaymentParameters from a byte array, created by PaymentParameters_write
31747  */
31748 struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser, uint32_t arg);
31749
31750 /**
31751  * Creates a payee with the node id of the given `pubkey`.
31752  *
31753  * The `final_cltv_expiry_delta` should match the expected final CLTV delta the recipient has
31754  * provided.
31755  */
31756 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta);
31757
31758 /**
31759  * Creates a payee with the node id of the given `pubkey` to use for keysend payments.
31760  *
31761  * The `final_cltv_expiry_delta` should match the expected final CLTV delta the recipient has
31762  * provided.
31763  */
31764 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta);
31765
31766 /**
31767  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
31768  */
31769 void RouteHint_free(struct LDKRouteHint this_obj);
31770
31771 struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr);
31772
31773 void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val);
31774
31775 /**
31776  * Constructs a new RouteHint given each field
31777  */
31778 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg);
31779
31780 /**
31781  * Creates a copy of the RouteHint
31782  */
31783 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
31784
31785 /**
31786  * Checks if two RouteHints contain equal inner contents.
31787  */
31788 uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
31789
31790 /**
31791  * Checks if two RouteHints contain equal inner contents.
31792  * This ignores pointers and is_owned flags and looks at the values in fields.
31793  * Two objects with NULL inner values will be considered "equal" here.
31794  */
31795 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
31796
31797 /**
31798  * Serialize the RouteHint object into a byte array which can be read by RouteHint_read
31799  */
31800 struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj);
31801
31802 /**
31803  * Read a RouteHint from a byte array, created by RouteHint_write
31804  */
31805 struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser);
31806
31807 /**
31808  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
31809  */
31810 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
31811
31812 /**
31813  * The node_id of the non-target end of the route
31814  */
31815 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
31816
31817 /**
31818  * The node_id of the non-target end of the route
31819  */
31820 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
31821
31822 /**
31823  * The short_channel_id of this channel
31824  */
31825 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
31826
31827 /**
31828  * The short_channel_id of this channel
31829  */
31830 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
31831
31832 /**
31833  * The fees which must be paid to use this channel
31834  */
31835 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
31836
31837 /**
31838  * The fees which must be paid to use this channel
31839  */
31840 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
31841
31842 /**
31843  * The difference in CLTV values between this node and the next node.
31844  */
31845 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
31846
31847 /**
31848  * The difference in CLTV values between this node and the next node.
31849  */
31850 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
31851
31852 /**
31853  * The minimum value, in msat, which must be relayed to the next hop.
31854  */
31855 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
31856
31857 /**
31858  * The minimum value, in msat, which must be relayed to the next hop.
31859  */
31860 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
31861
31862 /**
31863  * The maximum value in msat available for routing with a single HTLC.
31864  */
31865 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
31866
31867 /**
31868  * The maximum value in msat available for routing with a single HTLC.
31869  */
31870 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
31871
31872 /**
31873  * Constructs a new RouteHintHop given each field
31874  */
31875 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);
31876
31877 /**
31878  * Creates a copy of the RouteHintHop
31879  */
31880 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
31881
31882 /**
31883  * Checks if two RouteHintHops contain equal inner contents.
31884  */
31885 uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
31886
31887 /**
31888  * Checks if two RouteHintHops contain equal inner contents.
31889  * This ignores pointers and is_owned flags and looks at the values in fields.
31890  * Two objects with NULL inner values will be considered "equal" here.
31891  */
31892 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
31893
31894 /**
31895  * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
31896  */
31897 struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj);
31898
31899 /**
31900  * Read a RouteHintHop from a byte array, created by RouteHintHop_write
31901  */
31902 struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser);
31903
31904 /**
31905  * Finds a route from us (payer) to the given target node (payee).
31906  *
31907  * If the payee provided features in their invoice, they should be provided via `params.payee`.
31908  * Without this, MPP will only be used if the payee's features are available in the network graph.
31909  *
31910  * Private routing paths between a public node and the target may be included in `params.payee`.
31911  *
31912  * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
31913  * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels
31914  * from `network_graph` will be ignored, and only those in `first_hops` will be used.
31915  *
31916  * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
31917  * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
31918  * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
31919  *
31920  * # Note
31921  *
31922  * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
31923  * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
31924  * function.
31925  *
31926  * # Panics
31927  *
31928  * Panics if first_hops contains channels without short_channel_ids;
31929  * [`ChannelManager::list_usable_channels`] will never include such channels.
31930  *
31931  * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
31932  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
31933  * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
31934  *
31935  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
31936  */
31937 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]);
31938
31939 /**
31940  * Construct a route from us (payer) to the target node (payee) via the given hops (which should
31941  * exclude the payer, but include the payee). This may be useful, e.g., for probing the chosen path.
31942  *
31943  * Re-uses logic from `find_route`, so the restrictions described there also apply here.
31944  */
31945 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]);
31946
31947 /**
31948  * Calls the free function if one is set
31949  */
31950 void Score_free(struct LDKScore this_ptr);
31951
31952 /**
31953  * Calls the free function if one is set
31954  */
31955 void LockableScore_free(struct LDKLockableScore this_ptr);
31956
31957 /**
31958  * Calls the free function if one is set
31959  */
31960 void WriteableScore_free(struct LDKWriteableScore this_ptr);
31961
31962 /**
31963  * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL.
31964  */
31965 void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj);
31966
31967 /**
31968  * Frees any resources used by the MultiThreadedScoreLock, if is_owned is set and inner is non-NULL.
31969  */
31970 void MultiThreadedScoreLock_free(struct LDKMultiThreadedScoreLock this_obj);
31971
31972 /**
31973  * Constructs a new Score which calls the relevant methods on this_arg.
31974  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
31975  */
31976 struct LDKScore MultiThreadedScoreLock_as_Score(const struct LDKMultiThreadedScoreLock *NONNULL_PTR this_arg);
31977
31978 /**
31979  * Serialize the MultiThreadedScoreLock object into a byte array which can be read by MultiThreadedScoreLock_read
31980  */
31981 struct LDKCVec_u8Z MultiThreadedScoreLock_write(const struct LDKMultiThreadedScoreLock *NONNULL_PTR obj);
31982
31983 /**
31984  * Constructs a new LockableScore which calls the relevant methods on this_arg.
31985  * This copies the `inner` pointer in this_arg and thus the returned LockableScore must be freed before this_arg is
31986  */
31987 struct LDKLockableScore MultiThreadedLockableScore_as_LockableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg);
31988
31989 /**
31990  * Serialize the MultiThreadedLockableScore object into a byte array which can be read by MultiThreadedLockableScore_read
31991  */
31992 struct LDKCVec_u8Z MultiThreadedLockableScore_write(const struct LDKMultiThreadedLockableScore *NONNULL_PTR obj);
31993
31994 /**
31995  * Constructs a new WriteableScore which calls the relevant methods on this_arg.
31996  * This copies the `inner` pointer in this_arg and thus the returned WriteableScore must be freed before this_arg is
31997  */
31998 struct LDKWriteableScore MultiThreadedLockableScore_as_WriteableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg);
31999
32000 /**
32001  * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
32002  */
32003 MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score);
32004
32005 /**
32006  * Frees any resources used by the ChannelUsage, if is_owned is set and inner is non-NULL.
32007  */
32008 void ChannelUsage_free(struct LDKChannelUsage this_obj);
32009
32010 /**
32011  * The amount to send through the channel, denominated in millisatoshis.
32012  */
32013 uint64_t ChannelUsage_get_amount_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
32014
32015 /**
32016  * The amount to send through the channel, denominated in millisatoshis.
32017  */
32018 void ChannelUsage_set_amount_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
32019
32020 /**
32021  * Total amount, denominated in millisatoshis, already allocated to send through the channel
32022  * as part of a multi-path payment.
32023  */
32024 uint64_t ChannelUsage_get_inflight_htlc_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
32025
32026 /**
32027  * Total amount, denominated in millisatoshis, already allocated to send through the channel
32028  * as part of a multi-path payment.
32029  */
32030 void ChannelUsage_set_inflight_htlc_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
32031
32032 /**
32033  * The effective capacity of the channel.
32034  */
32035 struct LDKEffectiveCapacity ChannelUsage_get_effective_capacity(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
32036
32037 /**
32038  * The effective capacity of the channel.
32039  */
32040 void ChannelUsage_set_effective_capacity(struct LDKChannelUsage *NONNULL_PTR this_ptr, struct LDKEffectiveCapacity val);
32041
32042 /**
32043  * Constructs a new ChannelUsage given each field
32044  */
32045 MUST_USE_RES struct LDKChannelUsage ChannelUsage_new(uint64_t amount_msat_arg, uint64_t inflight_htlc_msat_arg, struct LDKEffectiveCapacity effective_capacity_arg);
32046
32047 /**
32048  * Creates a copy of the ChannelUsage
32049  */
32050 struct LDKChannelUsage ChannelUsage_clone(const struct LDKChannelUsage *NONNULL_PTR orig);
32051
32052 /**
32053  * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL.
32054  */
32055 void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj);
32056
32057 /**
32058  * Creates a copy of the FixedPenaltyScorer
32059  */
32060 struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig);
32061
32062 /**
32063  * Creates a new scorer using `penalty_msat`.
32064  */
32065 MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat);
32066
32067 /**
32068  * Constructs a new Score which calls the relevant methods on this_arg.
32069  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
32070  */
32071 struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg);
32072
32073 /**
32074  * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
32075  */
32076 struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj);
32077
32078 /**
32079  * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
32080  */
32081 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg);
32082
32083 /**
32084  * Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL.
32085  */
32086 void ProbabilisticScorer_free(struct LDKProbabilisticScorer this_obj);
32087
32088 /**
32089  * Frees any resources used by the ProbabilisticScoringParameters, if is_owned is set and inner is non-NULL.
32090  */
32091 void ProbabilisticScoringParameters_free(struct LDKProbabilisticScoringParameters this_obj);
32092
32093 /**
32094  * A fixed penalty in msats to apply to each channel.
32095  *
32096  * Default value: 500 msat
32097  */
32098 uint64_t ProbabilisticScoringParameters_get_base_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
32099
32100 /**
32101  * A fixed penalty in msats to apply to each channel.
32102  *
32103  * Default value: 500 msat
32104  */
32105 void ProbabilisticScoringParameters_set_base_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
32106
32107 /**
32108  * A multiplier used with the payment amount to calculate a fixed penalty applied to each
32109  * channel, in excess of the [`base_penalty_msat`].
32110  *
32111  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
32112  * fees plus penalty) for large payments. The penalty is computed as the product of this
32113  * multiplier and `2^30`ths of the payment amount.
32114  *
32115  * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30`
32116  *
32117  * Default value: 8,192 msat
32118  *
32119  * [`base_penalty_msat`]: Self::base_penalty_msat
32120  */
32121 uint64_t ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
32122
32123 /**
32124  * A multiplier used with the payment amount to calculate a fixed penalty applied to each
32125  * channel, in excess of the [`base_penalty_msat`].
32126  *
32127  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
32128  * fees plus penalty) for large payments. The penalty is computed as the product of this
32129  * multiplier and `2^30`ths of the payment amount.
32130  *
32131  * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30`
32132  *
32133  * Default value: 8,192 msat
32134  *
32135  * [`base_penalty_msat`]: Self::base_penalty_msat
32136  */
32137 void ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
32138
32139 /**
32140  * A multiplier used in conjunction with the negative `log10` of the channel's success
32141  * probability for a payment, as determined by our latest estimates of the channel's
32142  * liquidity, to determine the liquidity penalty.
32143  *
32144  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
32145  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
32146  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
32147  * lower bounding the success probability to `0.01`) when the amount falls within the
32148  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
32149  * result in a `u64::max_value` penalty, however.
32150  *
32151  * `-log10(success_probability) * liquidity_penalty_multiplier_msat`
32152  *
32153  * Default value: 30,000 msat
32154  *
32155  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
32156  */
32157 uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
32158
32159 /**
32160  * A multiplier used in conjunction with the negative `log10` of the channel's success
32161  * probability for a payment, as determined by our latest estimates of the channel's
32162  * liquidity, to determine the liquidity penalty.
32163  *
32164  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
32165  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
32166  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
32167  * lower bounding the success probability to `0.01`) when the amount falls within the
32168  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
32169  * result in a `u64::max_value` penalty, however.
32170  *
32171  * `-log10(success_probability) * liquidity_penalty_multiplier_msat`
32172  *
32173  * Default value: 30,000 msat
32174  *
32175  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
32176  */
32177 void ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
32178
32179 /**
32180  * Whenever this amount of time elapses since the last update to a channel's liquidity bounds,
32181  * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on
32182  * the available liquidity is halved and the upper-bound moves half-way to the channel's total
32183  * capacity.
32184  *
32185  * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity,
32186  * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`]
32187  * struct documentation for more info on the way the liquidity bounds are used.
32188  *
32189  * For example, if the channel's capacity is 1 million sats, and the current upper and lower
32190  * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper
32191  * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats.
32192  *
32193  * Default value: 6 hours
32194  *
32195  * # Note
32196  *
32197  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
32198  * liquidity knowledge will never decay except when the bounds cross.
32199  */
32200 uint64_t ProbabilisticScoringParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
32201
32202 /**
32203  * Whenever this amount of time elapses since the last update to a channel's liquidity bounds,
32204  * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on
32205  * the available liquidity is halved and the upper-bound moves half-way to the channel's total
32206  * capacity.
32207  *
32208  * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity,
32209  * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`]
32210  * struct documentation for more info on the way the liquidity bounds are used.
32211  *
32212  * For example, if the channel's capacity is 1 million sats, and the current upper and lower
32213  * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper
32214  * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats.
32215  *
32216  * Default value: 6 hours
32217  *
32218  * # Note
32219  *
32220  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
32221  * liquidity knowledge will never decay except when the bounds cross.
32222  */
32223 void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
32224
32225 /**
32226  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
32227  * channel's success probability for the payment, as determined by our latest estimates of the
32228  * channel's liquidity, to determine the amount penalty.
32229  *
32230  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
32231  * fees plus penalty) for large payments. The penalty is computed as the product of this
32232  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
32233  * success probability.
32234  *
32235  * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20`
32236  *
32237  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
32238  * the amount will result in a penalty of the multiplier. And, as the success probability
32239  * decreases, the negative `log10` weighting will increase dramatically. For higher success
32240  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
32241  * fall below `1`.
32242  *
32243  * Default value: 192 msat
32244  */
32245 uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
32246
32247 /**
32248  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
32249  * channel's success probability for the payment, as determined by our latest estimates of the
32250  * channel's liquidity, to determine the amount penalty.
32251  *
32252  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
32253  * fees plus penalty) for large payments. The penalty is computed as the product of this
32254  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
32255  * success probability.
32256  *
32257  * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20`
32258  *
32259  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
32260  * the amount will result in a penalty of the multiplier. And, as the success probability
32261  * decreases, the negative `log10` weighting will increase dramatically. For higher success
32262  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
32263  * fall below `1`.
32264  *
32265  * Default value: 192 msat
32266  */
32267 void ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
32268
32269 /**
32270  * A multiplier used in conjunction with the negative `log10` of the channel's success
32271  * probability for the payment, as determined based on the history of our estimates of the
32272  * channel's available liquidity, to determine a penalty.
32273  *
32274  * This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using
32275  * only our latest estimate for the current liquidity available in the channel, it estimates
32276  * success probability based on the estimated liquidity available in the channel through
32277  * history. Specifically, every time we update our liquidity bounds on a given channel, we
32278  * track which of several buckets those bounds fall into, exponentially decaying the
32279  * probability of each bucket as new samples are added.
32280  *
32281  * Default value: 10,000 msat
32282  *
32283  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
32284  */
32285 uint64_t ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
32286
32287 /**
32288  * A multiplier used in conjunction with the negative `log10` of the channel's success
32289  * probability for the payment, as determined based on the history of our estimates of the
32290  * channel's available liquidity, to determine a penalty.
32291  *
32292  * This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using
32293  * only our latest estimate for the current liquidity available in the channel, it estimates
32294  * success probability based on the estimated liquidity available in the channel through
32295  * history. Specifically, every time we update our liquidity bounds on a given channel, we
32296  * track which of several buckets those bounds fall into, exponentially decaying the
32297  * probability of each bucket as new samples are added.
32298  *
32299  * Default value: 10,000 msat
32300  *
32301  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
32302  */
32303 void ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
32304
32305 /**
32306  * A multiplier used in conjunction with the payment amount and the negative `log10` of the
32307  * channel's success probability for the payment, as determined based on the history of our
32308  * estimates of the channel's available liquidity, to determine a penalty.
32309  *
32310  * The purpose of the amount penalty is to avoid having fees dominate the channel cost for
32311  * large payments. The penalty is computed as the product of this multiplier and the `2^20`ths
32312  * of the payment amount, weighted by the negative `log10` of the success probability.
32313  *
32314  * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead
32315  * of using only our latest estimate for the current liquidity available in the channel, it
32316  * estimates success probability based on the estimated liquidity available in the channel
32317  * through history. Specifically, every time we update our liquidity bounds on a given
32318  * channel, we track which of several buckets those bounds fall into, exponentially decaying
32319  * the probability of each bucket as new samples are added.
32320  *
32321  * Default value: 64 msat
32322  *
32323  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
32324  */
32325 uint64_t ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
32326
32327 /**
32328  * A multiplier used in conjunction with the payment amount and the negative `log10` of the
32329  * channel's success probability for the payment, as determined based on the history of our
32330  * estimates of the channel's available liquidity, to determine a penalty.
32331  *
32332  * The purpose of the amount penalty is to avoid having fees dominate the channel cost for
32333  * large payments. The penalty is computed as the product of this multiplier and the `2^20`ths
32334  * of the payment amount, weighted by the negative `log10` of the success probability.
32335  *
32336  * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead
32337  * of using only our latest estimate for the current liquidity available in the channel, it
32338  * estimates success probability based on the estimated liquidity available in the channel
32339  * through history. Specifically, every time we update our liquidity bounds on a given
32340  * channel, we track which of several buckets those bounds fall into, exponentially decaying
32341  * the probability of each bucket as new samples are added.
32342  *
32343  * Default value: 64 msat
32344  *
32345  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
32346  */
32347 void ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
32348
32349 /**
32350  * If we aren't learning any new datapoints for a channel, the historical liquidity bounds
32351  * tracking can simply live on with increasingly stale data. Instead, when a channel has not
32352  * seen a liquidity estimate update for this amount of time, the historical datapoints are
32353  * decayed by half.
32354  *
32355  * Note that after 16 or more half lives all historical data will be completely gone.
32356  *
32357  * Default value: 14 days
32358  */
32359 uint64_t ProbabilisticScoringParameters_get_historical_no_updates_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
32360
32361 /**
32362  * If we aren't learning any new datapoints for a channel, the historical liquidity bounds
32363  * tracking can simply live on with increasingly stale data. Instead, when a channel has not
32364  * seen a liquidity estimate update for this amount of time, the historical datapoints are
32365  * decayed by half.
32366  *
32367  * Note that after 16 or more half lives all historical data will be completely gone.
32368  *
32369  * Default value: 14 days
32370  */
32371 void ProbabilisticScoringParameters_set_historical_no_updates_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
32372
32373 /**
32374  * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the
32375  * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We
32376  * treat such nodes preferentially as this makes balance discovery attacks harder to execute,
32377  * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy.
32378  *
32379  * Default value: 250 msat
32380  */
32381 uint64_t ProbabilisticScoringParameters_get_anti_probing_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
32382
32383 /**
32384  * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the
32385  * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We
32386  * treat such nodes preferentially as this makes balance discovery attacks harder to execute,
32387  * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy.
32388  *
32389  * Default value: 250 msat
32390  */
32391 void ProbabilisticScoringParameters_set_anti_probing_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
32392
32393 /**
32394  * This penalty is applied when the amount we're attempting to send over a channel exceeds our
32395  * current estimate of the channel's available liquidity.
32396  *
32397  * Note that in this case all other penalties, including the
32398  * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based
32399  * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if
32400  * applicable, are still included in the overall penalty.
32401  *
32402  * If you wish to avoid creating paths with such channels entirely, setting this to a value of
32403  * `u64::max_value()` will guarantee that.
32404  *
32405  * Default value: 1_0000_0000_000 msat (1 Bitcoin)
32406  *
32407  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
32408  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
32409  * [`base_penalty_msat`]: Self::base_penalty_msat
32410  * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat
32411  */
32412 uint64_t ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
32413
32414 /**
32415  * This penalty is applied when the amount we're attempting to send over a channel exceeds our
32416  * current estimate of the channel's available liquidity.
32417  *
32418  * Note that in this case all other penalties, including the
32419  * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based
32420  * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if
32421  * applicable, are still included in the overall penalty.
32422  *
32423  * If you wish to avoid creating paths with such channels entirely, setting this to a value of
32424  * `u64::max_value()` will guarantee that.
32425  *
32426  * Default value: 1_0000_0000_000 msat (1 Bitcoin)
32427  *
32428  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
32429  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
32430  * [`base_penalty_msat`]: Self::base_penalty_msat
32431  * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat
32432  */
32433 void ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
32434
32435 /**
32436  * Creates a copy of the ProbabilisticScoringParameters
32437  */
32438 struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_clone(const struct LDKProbabilisticScoringParameters *NONNULL_PTR orig);
32439
32440 /**
32441  * Creates a new scorer using the given scoring parameters for sending payments from a node
32442  * through a network graph.
32443  */
32444 MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringParameters params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
32445
32446 /**
32447  * Dump the contents of this scorer into the configured logger.
32448  *
32449  * Note that this writes roughly one line per channel for which we have a liquidity estimate,
32450  * which may be a substantial amount of log output.
32451  */
32452 void ProbabilisticScorer_debug_log_liquidity_stats(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
32453
32454 /**
32455  * Query the estimated minimum and maximum liquidity available for sending a payment over the
32456  * channel with `scid` towards the given `target` node.
32457  */
32458 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);
32459
32460 /**
32461  * Query the historical estimated minimum and maximum liquidity available for sending a
32462  * payment over the channel with `scid` towards the given `target` node.
32463  *
32464  * Returns two sets of 8 buckets. The first set describes the octiles for lower-bound
32465  * liquidity estimates, the second set describes the octiles for upper-bound liquidity
32466  * estimates. Each bucket describes the relative frequency at which we've seen a liquidity
32467  * bound in the octile relative to the channel's total capacity, on an arbitrary scale.
32468  * Because the values are slowly decayed, more recent data points are weighted more heavily
32469  * than older datapoints.
32470  *
32471  * When scoring, the estimated probability that an upper-/lower-bound lies in a given octile
32472  * relative to the channel's total capacity is calculated by dividing that bucket's value with
32473  * the total of all buckets for the given bound.
32474  *
32475  * For example, a value of `[0, 0, 0, 0, 0, 0, 32]` indicates that we believe the probability
32476  * of a bound being in the top octile to be 100%, and have never (recently) seen it in any
32477  * other octiles. A value of `[31, 0, 0, 0, 0, 0, 0, 32]` indicates we've seen the bound being
32478  * both in the top and bottom octile, and roughly with similar (recent) frequency.
32479  *
32480  * Because the datapoints are decayed slowly over time, values will eventually return to
32481  * `Some(([0; 8], [0; 8]))`.
32482  */
32483 MUST_USE_RES struct LDKCOption_C2Tuple_EightU16sEightU16sZZ ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target);
32484
32485 /**
32486  * Marks the node with the given `node_id` as banned, i.e.,
32487  * it will be avoided during path finding.
32488  */
32489 void ProbabilisticScorer_add_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
32490
32491 /**
32492  * Removes the node with the given `node_id` from the list of nodes to avoid.
32493  */
32494 void ProbabilisticScorer_remove_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
32495
32496 /**
32497  * Sets a manual penalty for the given node.
32498  */
32499 void ProbabilisticScorer_set_manual_penalty(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id, uint64_t penalty);
32500
32501 /**
32502  * Removes the node with the given `node_id` from the list of manual penalties.
32503  */
32504 void ProbabilisticScorer_remove_manual_penalty(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
32505
32506 /**
32507  * Clears the list of manual penalties that are applied during path finding.
32508  */
32509 void ProbabilisticScorer_clear_manual_penalties(struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
32510
32511 /**
32512  * Marks all nodes in the given list as banned, i.e.,
32513  * they will be avoided during path finding.
32514  */
32515 void ProbabilisticScoringParameters_add_banned_from_list(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_arg, struct LDKCVec_NodeIdZ node_ids);
32516
32517 /**
32518  * Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used.
32519  */
32520 MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_default(void);
32521
32522 /**
32523  * Constructs a new Score which calls the relevant methods on this_arg.
32524  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
32525  */
32526 struct LDKScore ProbabilisticScorer_as_Score(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
32527
32528 /**
32529  * Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read
32530  */
32531 struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj);
32532
32533 /**
32534  * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write
32535  */
32536 struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b, struct LDKLogger arg_c);
32537
32538 /**
32539  * Frees any resources used by the BlindedPath, if is_owned is set and inner is non-NULL.
32540  */
32541 void BlindedPath_free(struct LDKBlindedPath this_obj);
32542
32543 /**
32544  * Creates a copy of the BlindedPath
32545  */
32546 struct LDKBlindedPath BlindedPath_clone(const struct LDKBlindedPath *NONNULL_PTR orig);
32547
32548 /**
32549  * Frees any resources used by the BlindedHop, if is_owned is set and inner is non-NULL.
32550  */
32551 void BlindedHop_free(struct LDKBlindedHop this_obj);
32552
32553 /**
32554  * Creates a copy of the BlindedHop
32555  */
32556 struct LDKBlindedHop BlindedHop_clone(const struct LDKBlindedHop *NONNULL_PTR orig);
32557
32558 /**
32559  * Create a blinded path to be forwarded along `node_pks`. The last node pubkey in `node_pks`
32560  * will be the destination node.
32561  *
32562  * Errors if less than two hops are provided or if `node_pk`(s) are invalid.
32563  */
32564 MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_new(struct LDKCVec_PublicKeyZ node_pks, const struct LDKEntropySource *NONNULL_PTR entropy_source);
32565
32566 /**
32567  * Serialize the BlindedPath object into a byte array which can be read by BlindedPath_read
32568  */
32569 struct LDKCVec_u8Z BlindedPath_write(const struct LDKBlindedPath *NONNULL_PTR obj);
32570
32571 /**
32572  * Read a BlindedPath from a byte array, created by BlindedPath_write
32573  */
32574 struct LDKCResult_BlindedPathDecodeErrorZ BlindedPath_read(struct LDKu8slice ser);
32575
32576 /**
32577  * Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read
32578  */
32579 struct LDKCVec_u8Z BlindedHop_write(const struct LDKBlindedHop *NONNULL_PTR obj);
32580
32581 /**
32582  * Read a BlindedHop from a byte array, created by BlindedHop_write
32583  */
32584 struct LDKCResult_BlindedHopDecodeErrorZ BlindedHop_read(struct LDKu8slice ser);
32585
32586 /**
32587  * Frees any resources used by the OnionMessenger, if is_owned is set and inner is non-NULL.
32588  */
32589 void OnionMessenger_free(struct LDKOnionMessenger this_obj);
32590
32591 /**
32592  * Frees any resources used by the Destination
32593  */
32594 void Destination_free(struct LDKDestination this_ptr);
32595
32596 /**
32597  * Creates a copy of the Destination
32598  */
32599 struct LDKDestination Destination_clone(const struct LDKDestination *NONNULL_PTR orig);
32600
32601 /**
32602  * Utility method to constructs a new Node-variant Destination
32603  */
32604 struct LDKDestination Destination_node(struct LDKPublicKey a);
32605
32606 /**
32607  * Utility method to constructs a new BlindedPath-variant Destination
32608  */
32609 struct LDKDestination Destination_blinded_path(struct LDKBlindedPath a);
32610
32611 /**
32612  * Frees any resources used by the SendError
32613  */
32614 void SendError_free(struct LDKSendError this_ptr);
32615
32616 /**
32617  * Creates a copy of the SendError
32618  */
32619 struct LDKSendError SendError_clone(const struct LDKSendError *NONNULL_PTR orig);
32620
32621 /**
32622  * Utility method to constructs a new Secp256k1-variant SendError
32623  */
32624 struct LDKSendError SendError_secp256k1(enum LDKSecp256k1Error a);
32625
32626 /**
32627  * Utility method to constructs a new TooBigPacket-variant SendError
32628  */
32629 struct LDKSendError SendError_too_big_packet(void);
32630
32631 /**
32632  * Utility method to constructs a new TooFewBlindedHops-variant SendError
32633  */
32634 struct LDKSendError SendError_too_few_blinded_hops(void);
32635
32636 /**
32637  * Utility method to constructs a new InvalidFirstHop-variant SendError
32638  */
32639 struct LDKSendError SendError_invalid_first_hop(void);
32640
32641 /**
32642  * Utility method to constructs a new InvalidMessage-variant SendError
32643  */
32644 struct LDKSendError SendError_invalid_message(void);
32645
32646 /**
32647  * Utility method to constructs a new BufferFull-variant SendError
32648  */
32649 struct LDKSendError SendError_buffer_full(void);
32650
32651 /**
32652  * Utility method to constructs a new GetNodeIdFailed-variant SendError
32653  */
32654 struct LDKSendError SendError_get_node_id_failed(void);
32655
32656 /**
32657  * Utility method to constructs a new BlindedPathAdvanceFailed-variant SendError
32658  */
32659 struct LDKSendError SendError_blinded_path_advance_failed(void);
32660
32661 /**
32662  * Checks if two SendErrors contain equal inner contents.
32663  * This ignores pointers and is_owned flags and looks at the values in fields.
32664  */
32665 bool SendError_eq(const struct LDKSendError *NONNULL_PTR a, const struct LDKSendError *NONNULL_PTR b);
32666
32667 /**
32668  * Calls the free function if one is set
32669  */
32670 void CustomOnionMessageHandler_free(struct LDKCustomOnionMessageHandler this_ptr);
32671
32672 /**
32673  * Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to
32674  * their respective handlers.
32675  */
32676 MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKCustomOnionMessageHandler custom_handler);
32677
32678 /**
32679  * Send an onion message with contents `message` to `destination`, routing it through `intermediate_nodes`.
32680  * See [`OnionMessenger`] for example usage.
32681  *
32682  * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None
32683  */
32684 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);
32685
32686 /**
32687  * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg.
32688  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is
32689  */
32690 struct LDKOnionMessageHandler OnionMessenger_as_OnionMessageHandler(const struct LDKOnionMessenger *NONNULL_PTR this_arg);
32691
32692 /**
32693  * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg.
32694  * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is
32695  */
32696 struct LDKOnionMessageProvider OnionMessenger_as_OnionMessageProvider(const struct LDKOnionMessenger *NONNULL_PTR this_arg);
32697
32698 /**
32699  * Frees any resources used by the OnionMessageContents
32700  */
32701 void OnionMessageContents_free(struct LDKOnionMessageContents this_ptr);
32702
32703 /**
32704  * Utility method to constructs a new Custom-variant OnionMessageContents
32705  */
32706 struct LDKOnionMessageContents OnionMessageContents_custom(struct LDKCustomOnionMessageContents a);
32707
32708 /**
32709  * Calls the free function if one is set
32710  */
32711 void CustomOnionMessageContents_free(struct LDKCustomOnionMessageContents this_ptr);
32712
32713 /**
32714  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
32715  */
32716 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
32717
32718 /**
32719  * Initialize a new FilesystemPersister and set the path to the individual channels'
32720  * files.
32721  */
32722 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
32723
32724 /**
32725  * Get the directory which was provided when this persister was initialized.
32726  */
32727 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
32728
32729 /**
32730  * Read `ChannelMonitor`s from disk.
32731  */
32732 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKEntropySource entropy_source, const struct LDKSignerProvider *NONNULL_PTR signer_provider);
32733
32734 /**
32735  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
32736  */
32737 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
32738
32739 /**
32740  * Frees any resources used by the GossipSync
32741  */
32742 void GossipSync_free(struct LDKGossipSync this_ptr);
32743
32744 /**
32745  * Utility method to constructs a new P2P-variant GossipSync
32746  */
32747 struct LDKGossipSync GossipSync_p2_p(const struct LDKP2PGossipSync *NONNULL_PTR a);
32748
32749 /**
32750  * Utility method to constructs a new Rapid-variant GossipSync
32751  */
32752 struct LDKGossipSync GossipSync_rapid(const struct LDKRapidGossipSync *NONNULL_PTR a);
32753
32754 /**
32755  * Utility method to constructs a new None-variant GossipSync
32756  */
32757 struct LDKGossipSync GossipSync_none(void);
32758
32759 /**
32760  * Start a background thread that takes care of responsibilities enumerated in the [top-level
32761  * documentation].
32762  *
32763  * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
32764  * [`Persister::persist_manager`] returns an error. In case of an error, the error is retrieved by calling
32765  * either [`join`] or [`stop`].
32766  *
32767  * # Data Persistence
32768  *
32769  * [`Persister::persist_manager`] is responsible for writing out the [`ChannelManager`] to disk, and/or
32770  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
32771  * [`ChannelManager`]. See the `lightning-persister` crate for LDK's
32772  * provided implementation.
32773  *
32774  * [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk, if
32775  * [`GossipSync`] is supplied. See [`NetworkGraph::write`] for writing out a [`NetworkGraph`].
32776  * See the `lightning-persister` crate for LDK's provided implementation.
32777  *
32778  * Typically, users should either implement [`Persister::persist_manager`] to never return an
32779  * error or call [`join`] and handle any error that may arise. For the latter case,
32780  * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
32781  *
32782  * # Event Handling
32783  *
32784  * `event_handler` is responsible for handling events that users should be notified of (e.g.,
32785  * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
32786  * functionality implemented by other handlers.
32787  * * [`P2PGossipSync`] if given will update the [`NetworkGraph`] based on payment failures.
32788  *
32789  * # Rapid Gossip Sync
32790  *
32791  * If rapid gossip sync is meant to run at startup, pass [`RapidGossipSync`] via `gossip_sync`
32792  * to indicate that the [`BackgroundProcessor`] should not prune the [`NetworkGraph`] instance
32793  * until the [`RapidGossipSync`] instance completes its first sync.
32794  *
32795  * [top-level documentation]: BackgroundProcessor
32796  * [`join`]: Self::join
32797  * [`stop`]: Self::stop
32798  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
32799  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
32800  * [`Persister::persist_manager`]: lightning::util::persist::Persister::persist_manager
32801  * [`Persister::persist_graph`]: lightning::util::persist::Persister::persist_graph
32802  * [`NetworkGraph`]: lightning::routing::gossip::NetworkGraph
32803  * [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable
32804  */
32805 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);
32806
32807 /**
32808  * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
32809  * [`ChannelManager`].
32810  *
32811  * # Panics
32812  *
32813  * This function panics if the background thread has panicked such as while persisting or
32814  * handling events.
32815  *
32816  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
32817  */
32818 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
32819
32820 /**
32821  * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
32822  * [`ChannelManager`].
32823  *
32824  * # Panics
32825  *
32826  * This function panics if the background thread has panicked such as while persisting or
32827  * handling events.
32828  *
32829  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
32830  */
32831 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
32832
32833 /**
32834  * Frees any resources used by the ParseError
32835  */
32836 void ParseError_free(struct LDKParseError this_ptr);
32837
32838 /**
32839  * Creates a copy of the ParseError
32840  */
32841 struct LDKParseError ParseError_clone(const struct LDKParseError *NONNULL_PTR orig);
32842
32843 /**
32844  * Utility method to constructs a new Bech32Error-variant ParseError
32845  */
32846 struct LDKParseError ParseError_bech32_error(struct LDKBech32Error a);
32847
32848 /**
32849  * Utility method to constructs a new ParseAmountError-variant ParseError
32850  */
32851 struct LDKParseError ParseError_parse_amount_error(struct LDKError a);
32852
32853 /**
32854  * Utility method to constructs a new MalformedSignature-variant ParseError
32855  */
32856 struct LDKParseError ParseError_malformed_signature(enum LDKSecp256k1Error a);
32857
32858 /**
32859  * Utility method to constructs a new BadPrefix-variant ParseError
32860  */
32861 struct LDKParseError ParseError_bad_prefix(void);
32862
32863 /**
32864  * Utility method to constructs a new UnknownCurrency-variant ParseError
32865  */
32866 struct LDKParseError ParseError_unknown_currency(void);
32867
32868 /**
32869  * Utility method to constructs a new UnknownSiPrefix-variant ParseError
32870  */
32871 struct LDKParseError ParseError_unknown_si_prefix(void);
32872
32873 /**
32874  * Utility method to constructs a new MalformedHRP-variant ParseError
32875  */
32876 struct LDKParseError ParseError_malformed_hrp(void);
32877
32878 /**
32879  * Utility method to constructs a new TooShortDataPart-variant ParseError
32880  */
32881 struct LDKParseError ParseError_too_short_data_part(void);
32882
32883 /**
32884  * Utility method to constructs a new UnexpectedEndOfTaggedFields-variant ParseError
32885  */
32886 struct LDKParseError ParseError_unexpected_end_of_tagged_fields(void);
32887
32888 /**
32889  * Utility method to constructs a new DescriptionDecodeError-variant ParseError
32890  */
32891 struct LDKParseError ParseError_description_decode_error(struct LDKError a);
32892
32893 /**
32894  * Utility method to constructs a new PaddingError-variant ParseError
32895  */
32896 struct LDKParseError ParseError_padding_error(void);
32897
32898 /**
32899  * Utility method to constructs a new IntegerOverflowError-variant ParseError
32900  */
32901 struct LDKParseError ParseError_integer_overflow_error(void);
32902
32903 /**
32904  * Utility method to constructs a new InvalidSegWitProgramLength-variant ParseError
32905  */
32906 struct LDKParseError ParseError_invalid_seg_wit_program_length(void);
32907
32908 /**
32909  * Utility method to constructs a new InvalidPubKeyHashLength-variant ParseError
32910  */
32911 struct LDKParseError ParseError_invalid_pub_key_hash_length(void);
32912
32913 /**
32914  * Utility method to constructs a new InvalidScriptHashLength-variant ParseError
32915  */
32916 struct LDKParseError ParseError_invalid_script_hash_length(void);
32917
32918 /**
32919  * Utility method to constructs a new InvalidRecoveryId-variant ParseError
32920  */
32921 struct LDKParseError ParseError_invalid_recovery_id(void);
32922
32923 /**
32924  * Utility method to constructs a new InvalidSliceLength-variant ParseError
32925  */
32926 struct LDKParseError ParseError_invalid_slice_length(struct LDKStr a);
32927
32928 /**
32929  * Utility method to constructs a new Skip-variant ParseError
32930  */
32931 struct LDKParseError ParseError_skip(void);
32932
32933 /**
32934  * Checks if two ParseErrors contain equal inner contents.
32935  * This ignores pointers and is_owned flags and looks at the values in fields.
32936  */
32937 bool ParseError_eq(const struct LDKParseError *NONNULL_PTR a, const struct LDKParseError *NONNULL_PTR b);
32938
32939 /**
32940  * Frees any resources used by the ParseOrSemanticError
32941  */
32942 void ParseOrSemanticError_free(struct LDKParseOrSemanticError this_ptr);
32943
32944 /**
32945  * Creates a copy of the ParseOrSemanticError
32946  */
32947 struct LDKParseOrSemanticError ParseOrSemanticError_clone(const struct LDKParseOrSemanticError *NONNULL_PTR orig);
32948
32949 /**
32950  * Utility method to constructs a new ParseError-variant ParseOrSemanticError
32951  */
32952 struct LDKParseOrSemanticError ParseOrSemanticError_parse_error(struct LDKParseError a);
32953
32954 /**
32955  * Utility method to constructs a new SemanticError-variant ParseOrSemanticError
32956  */
32957 struct LDKParseOrSemanticError ParseOrSemanticError_semantic_error(enum LDKSemanticError a);
32958
32959 /**
32960  * Checks if two ParseOrSemanticErrors contain equal inner contents.
32961  * This ignores pointers and is_owned flags and looks at the values in fields.
32962  */
32963 bool ParseOrSemanticError_eq(const struct LDKParseOrSemanticError *NONNULL_PTR a, const struct LDKParseOrSemanticError *NONNULL_PTR b);
32964
32965 /**
32966  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
32967  */
32968 void Invoice_free(struct LDKInvoice this_obj);
32969
32970 /**
32971  * Checks if two Invoices contain equal inner contents.
32972  * This ignores pointers and is_owned flags and looks at the values in fields.
32973  * Two objects with NULL inner values will be considered "equal" here.
32974  */
32975 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
32976
32977 /**
32978  * Creates a copy of the Invoice
32979  */
32980 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
32981
32982 /**
32983  * Checks if two Invoices contain equal inner contents.
32984  */
32985 uint64_t Invoice_hash(const struct LDKInvoice *NONNULL_PTR o);
32986
32987 /**
32988  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
32989  */
32990 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
32991
32992 /**
32993  * Checks if two SignedRawInvoices contain equal inner contents.
32994  * This ignores pointers and is_owned flags and looks at the values in fields.
32995  * Two objects with NULL inner values will be considered "equal" here.
32996  */
32997 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
32998
32999 /**
33000  * Creates a copy of the SignedRawInvoice
33001  */
33002 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
33003
33004 /**
33005  * Checks if two SignedRawInvoices contain equal inner contents.
33006  */
33007 uint64_t SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR o);
33008
33009 /**
33010  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
33011  */
33012 void RawInvoice_free(struct LDKRawInvoice this_obj);
33013
33014 /**
33015  * data part
33016  */
33017 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
33018
33019 /**
33020  * data part
33021  */
33022 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
33023
33024 /**
33025  * Checks if two RawInvoices contain equal inner contents.
33026  * This ignores pointers and is_owned flags and looks at the values in fields.
33027  * Two objects with NULL inner values will be considered "equal" here.
33028  */
33029 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
33030
33031 /**
33032  * Creates a copy of the RawInvoice
33033  */
33034 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
33035
33036 /**
33037  * Checks if two RawInvoices contain equal inner contents.
33038  */
33039 uint64_t RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR o);
33040
33041 /**
33042  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
33043  */
33044 void RawDataPart_free(struct LDKRawDataPart this_obj);
33045
33046 /**
33047  * generation time of the invoice
33048  */
33049 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
33050
33051 /**
33052  * generation time of the invoice
33053  */
33054 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
33055
33056 /**
33057  * Checks if two RawDataParts contain equal inner contents.
33058  * This ignores pointers and is_owned flags and looks at the values in fields.
33059  * Two objects with NULL inner values will be considered "equal" here.
33060  */
33061 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
33062
33063 /**
33064  * Creates a copy of the RawDataPart
33065  */
33066 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
33067
33068 /**
33069  * Checks if two RawDataParts contain equal inner contents.
33070  */
33071 uint64_t RawDataPart_hash(const struct LDKRawDataPart *NONNULL_PTR o);
33072
33073 /**
33074  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
33075  */
33076 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
33077
33078 /**
33079  * Checks if two PositiveTimestamps contain equal inner contents.
33080  * This ignores pointers and is_owned flags and looks at the values in fields.
33081  * Two objects with NULL inner values will be considered "equal" here.
33082  */
33083 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
33084
33085 /**
33086  * Creates a copy of the PositiveTimestamp
33087  */
33088 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
33089
33090 /**
33091  * Checks if two PositiveTimestamps contain equal inner contents.
33092  */
33093 uint64_t PositiveTimestamp_hash(const struct LDKPositiveTimestamp *NONNULL_PTR o);
33094
33095 /**
33096  * Creates a copy of the SiPrefix
33097  */
33098 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
33099
33100 /**
33101  * Utility method to constructs a new Milli-variant SiPrefix
33102  */
33103 enum LDKSiPrefix SiPrefix_milli(void);
33104
33105 /**
33106  * Utility method to constructs a new Micro-variant SiPrefix
33107  */
33108 enum LDKSiPrefix SiPrefix_micro(void);
33109
33110 /**
33111  * Utility method to constructs a new Nano-variant SiPrefix
33112  */
33113 enum LDKSiPrefix SiPrefix_nano(void);
33114
33115 /**
33116  * Utility method to constructs a new Pico-variant SiPrefix
33117  */
33118 enum LDKSiPrefix SiPrefix_pico(void);
33119
33120 /**
33121  * Checks if two SiPrefixs contain equal inner contents.
33122  * This ignores pointers and is_owned flags and looks at the values in fields.
33123  */
33124 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
33125
33126 /**
33127  * Checks if two SiPrefixs contain equal inner contents.
33128  */
33129 uint64_t SiPrefix_hash(const enum LDKSiPrefix *NONNULL_PTR o);
33130
33131 /**
33132  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
33133  * This is effectively 10^12 * the prefix multiplier
33134  */
33135 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
33136
33137 /**
33138  * Creates a copy of the Currency
33139  */
33140 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
33141
33142 /**
33143  * Utility method to constructs a new Bitcoin-variant Currency
33144  */
33145 enum LDKCurrency Currency_bitcoin(void);
33146
33147 /**
33148  * Utility method to constructs a new BitcoinTestnet-variant Currency
33149  */
33150 enum LDKCurrency Currency_bitcoin_testnet(void);
33151
33152 /**
33153  * Utility method to constructs a new Regtest-variant Currency
33154  */
33155 enum LDKCurrency Currency_regtest(void);
33156
33157 /**
33158  * Utility method to constructs a new Simnet-variant Currency
33159  */
33160 enum LDKCurrency Currency_simnet(void);
33161
33162 /**
33163  * Utility method to constructs a new Signet-variant Currency
33164  */
33165 enum LDKCurrency Currency_signet(void);
33166
33167 /**
33168  * Checks if two Currencys contain equal inner contents.
33169  */
33170 uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
33171
33172 /**
33173  * Checks if two Currencys contain equal inner contents.
33174  * This ignores pointers and is_owned flags and looks at the values in fields.
33175  */
33176 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
33177
33178 /**
33179  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
33180  */
33181 void Sha256_free(struct LDKSha256 this_obj);
33182
33183 /**
33184  * Creates a copy of the Sha256
33185  */
33186 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
33187
33188 /**
33189  * Checks if two Sha256s contain equal inner contents.
33190  */
33191 uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
33192
33193 /**
33194  * Checks if two Sha256s contain equal inner contents.
33195  * This ignores pointers and is_owned flags and looks at the values in fields.
33196  * Two objects with NULL inner values will be considered "equal" here.
33197  */
33198 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
33199
33200 /**
33201  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
33202  */
33203 void Description_free(struct LDKDescription this_obj);
33204
33205 /**
33206  * Creates a copy of the Description
33207  */
33208 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
33209
33210 /**
33211  * Checks if two Descriptions contain equal inner contents.
33212  */
33213 uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
33214
33215 /**
33216  * Checks if two Descriptions contain equal inner contents.
33217  * This ignores pointers and is_owned flags and looks at the values in fields.
33218  * Two objects with NULL inner values will be considered "equal" here.
33219  */
33220 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
33221
33222 /**
33223  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
33224  */
33225 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
33226
33227 struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr);
33228
33229 void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
33230
33231 /**
33232  * Constructs a new PayeePubKey given each field
33233  */
33234 MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg);
33235
33236 /**
33237  * Creates a copy of the PayeePubKey
33238  */
33239 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
33240
33241 /**
33242  * Checks if two PayeePubKeys contain equal inner contents.
33243  */
33244 uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
33245
33246 /**
33247  * Checks if two PayeePubKeys contain equal inner contents.
33248  * This ignores pointers and is_owned flags and looks at the values in fields.
33249  * Two objects with NULL inner values will be considered "equal" here.
33250  */
33251 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
33252
33253 /**
33254  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
33255  */
33256 void ExpiryTime_free(struct LDKExpiryTime this_obj);
33257
33258 /**
33259  * Creates a copy of the ExpiryTime
33260  */
33261 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
33262
33263 /**
33264  * Checks if two ExpiryTimes contain equal inner contents.
33265  */
33266 uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
33267
33268 /**
33269  * Checks if two ExpiryTimes contain equal inner contents.
33270  * This ignores pointers and is_owned flags and looks at the values in fields.
33271  * Two objects with NULL inner values will be considered "equal" here.
33272  */
33273 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
33274
33275 /**
33276  * Frees any resources used by the MinFinalCltvExpiryDelta, if is_owned is set and inner is non-NULL.
33277  */
33278 void MinFinalCltvExpiryDelta_free(struct LDKMinFinalCltvExpiryDelta this_obj);
33279
33280 uint64_t MinFinalCltvExpiryDelta_get_a(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR this_ptr);
33281
33282 void MinFinalCltvExpiryDelta_set_a(struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR this_ptr, uint64_t val);
33283
33284 /**
33285  * Constructs a new MinFinalCltvExpiryDelta given each field
33286  */
33287 MUST_USE_RES struct LDKMinFinalCltvExpiryDelta MinFinalCltvExpiryDelta_new(uint64_t a_arg);
33288
33289 /**
33290  * Creates a copy of the MinFinalCltvExpiryDelta
33291  */
33292 struct LDKMinFinalCltvExpiryDelta MinFinalCltvExpiryDelta_clone(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR orig);
33293
33294 /**
33295  * Checks if two MinFinalCltvExpiryDeltas contain equal inner contents.
33296  */
33297 uint64_t MinFinalCltvExpiryDelta_hash(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR o);
33298
33299 /**
33300  * Checks if two MinFinalCltvExpiryDeltas contain equal inner contents.
33301  * This ignores pointers and is_owned flags and looks at the values in fields.
33302  * Two objects with NULL inner values will be considered "equal" here.
33303  */
33304 bool MinFinalCltvExpiryDelta_eq(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR a, const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR b);
33305
33306 /**
33307  * Frees any resources used by the Fallback
33308  */
33309 void Fallback_free(struct LDKFallback this_ptr);
33310
33311 /**
33312  * Creates a copy of the Fallback
33313  */
33314 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
33315
33316 /**
33317  * Utility method to constructs a new SegWitProgram-variant Fallback
33318  */
33319 struct LDKFallback Fallback_seg_wit_program(struct LDKU5 version, struct LDKCVec_u8Z program);
33320
33321 /**
33322  * Utility method to constructs a new PubKeyHash-variant Fallback
33323  */
33324 struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a);
33325
33326 /**
33327  * Utility method to constructs a new ScriptHash-variant Fallback
33328  */
33329 struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
33330
33331 /**
33332  * Checks if two Fallbacks contain equal inner contents.
33333  */
33334 uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
33335
33336 /**
33337  * Checks if two Fallbacks contain equal inner contents.
33338  * This ignores pointers and is_owned flags and looks at the values in fields.
33339  */
33340 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
33341
33342 /**
33343  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
33344  */
33345 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
33346
33347 /**
33348  * Creates a copy of the InvoiceSignature
33349  */
33350 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
33351
33352 /**
33353  * Checks if two InvoiceSignatures contain equal inner contents.
33354  */
33355 uint64_t InvoiceSignature_hash(const struct LDKInvoiceSignature *NONNULL_PTR o);
33356
33357 /**
33358  * Checks if two InvoiceSignatures contain equal inner contents.
33359  * This ignores pointers and is_owned flags and looks at the values in fields.
33360  * Two objects with NULL inner values will be considered "equal" here.
33361  */
33362 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
33363
33364 /**
33365  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
33366  */
33367 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
33368
33369 /**
33370  * Creates a copy of the PrivateRoute
33371  */
33372 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
33373
33374 /**
33375  * Checks if two PrivateRoutes contain equal inner contents.
33376  */
33377 uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
33378
33379 /**
33380  * Checks if two PrivateRoutes contain equal inner contents.
33381  * This ignores pointers and is_owned flags and looks at the values in fields.
33382  * Two objects with NULL inner values will be considered "equal" here.
33383  */
33384 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
33385
33386 /**
33387  * Disassembles the `SignedRawInvoice` into its three parts:
33388  *  1. raw invoice
33389  *  2. hash of the raw invoice
33390  *  3. signature
33391  */
33392 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
33393
33394 /**
33395  * The `RawInvoice` which was signed.
33396  */
33397 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
33398
33399 /**
33400  * The hash of the `RawInvoice` that was signed.
33401  */
33402 MUST_USE_RES const uint8_t (*SignedRawInvoice_signable_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
33403
33404 /**
33405  * InvoiceSignature for the invoice.
33406  */
33407 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
33408
33409 /**
33410  * Recovers the public key used for signing the invoice from the recoverable signature.
33411  */
33412 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
33413
33414 /**
33415  * Checks if the signature is valid for the included payee public key or if none exists if it's
33416  * valid for the recovered signature (which should always be true?).
33417  */
33418 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
33419
33420 /**
33421  * Calculate the hash of the encoded `RawInvoice` which should be signed.
33422  */
33423 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_signable_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
33424
33425 /**
33426  *
33427  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
33428  */
33429 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
33430
33431 /**
33432  *
33433  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
33434  */
33435 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
33436
33437 /**
33438  *
33439  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
33440  */
33441 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
33442
33443 /**
33444  *
33445  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
33446  */
33447 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
33448
33449 /**
33450  *
33451  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
33452  */
33453 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
33454
33455 /**
33456  *
33457  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
33458  */
33459 MUST_USE_RES struct LDKMinFinalCltvExpiryDelta RawInvoice_min_final_cltv_expiry_delta(const struct LDKRawInvoice *NONNULL_PTR this_arg);
33460
33461 /**
33462  *
33463  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
33464  */
33465 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
33466
33467 /**
33468  *
33469  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
33470  */
33471 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
33472
33473 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
33474
33475 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
33476
33477 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
33478
33479 /**
33480  * Creates a `PositiveTimestamp` from a Unix timestamp in the range `0..=MAX_TIMESTAMP`.
33481  *
33482  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
33483  */
33484 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
33485
33486 /**
33487  * Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding Unix timestamp in
33488  * the range `0..=MAX_TIMESTAMP`.
33489  *
33490  * Note that the subsecond part is dropped as it is not representable in BOLT 11 invoices.
33491  *
33492  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
33493  */
33494 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
33495
33496 /**
33497  * Creates a `PositiveTimestamp` from a [`Duration`] since the Unix epoch in the range
33498  * `0..=MAX_TIMESTAMP`.
33499  *
33500  * Note that the subsecond part is dropped as it is not representable in BOLT 11 invoices.
33501  *
33502  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
33503  */
33504 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_duration_since_epoch(uint64_t duration);
33505
33506 /**
33507  * Returns the Unix timestamp representing the stored time
33508  */
33509 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
33510
33511 /**
33512  * Returns the duration of the stored time since the Unix epoch
33513  */
33514 MUST_USE_RES uint64_t PositiveTimestamp_as_duration_since_epoch(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
33515
33516 /**
33517  * Returns the [`SystemTime`] representing the stored time
33518  */
33519 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
33520
33521 /**
33522  * Transform the `Invoice` into it's unchecked version
33523  */
33524 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
33525
33526 /**
33527  * Check that the invoice is signed correctly and that key recovery works
33528  */
33529 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
33530
33531 /**
33532  * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
33533  * ```
33534  * use lightning_invoice::*;
33535  *
33536  * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\
33537  * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\
33538  * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\
33539  * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\
33540  * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\
33541  * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\
33542  * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\
33543  * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\
33544  * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\
33545  * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\
33546  * j5r6drg6k6zcqj0fcwg\";
33547  *
33548  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
33549  *
33550  * assert!(Invoice::from_signed(signed).is_ok());
33551  * ```
33552  */
33553 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
33554
33555 /**
33556  * Returns the `Invoice`'s timestamp (should equal its creation time)
33557  */
33558 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
33559
33560 /**
33561  * Returns the `Invoice`'s timestamp as a duration since the Unix epoch
33562  */
33563 MUST_USE_RES uint64_t Invoice_duration_since_epoch(const struct LDKInvoice *NONNULL_PTR this_arg);
33564
33565 /**
33566  * Returns the hash to which we will receive the preimage on completion of the payment
33567  */
33568 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
33569
33570 /**
33571  * Get the payee's public key if one was included in the invoice
33572  *
33573  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
33574  */
33575 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
33576
33577 /**
33578  * Get the payment secret if one was included in the invoice
33579  */
33580 MUST_USE_RES const uint8_t (*Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
33581
33582 /**
33583  * Get the invoice features if they were included in the invoice
33584  *
33585  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
33586  */
33587 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
33588
33589 /**
33590  * Recover the payee's public key (only to be used if none was included in the invoice)
33591  */
33592 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
33593
33594 /**
33595  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
33596  */
33597 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
33598
33599 /**
33600  * Returns whether the invoice has expired.
33601  */
33602 MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg);
33603
33604 /**
33605  * Returns whether the expiry time would pass at the given point in time.
33606  * `at_time` is the timestamp as a duration since the Unix epoch.
33607  */
33608 MUST_USE_RES bool Invoice_would_expire(const struct LDKInvoice *NONNULL_PTR this_arg, uint64_t at_time);
33609
33610 /**
33611  * Returns the invoice's `min_final_cltv_expiry_delta` time, if present, otherwise
33612  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA`].
33613  */
33614 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry_delta(const struct LDKInvoice *NONNULL_PTR this_arg);
33615
33616 /**
33617  * Returns a list of all routes included in the invoice
33618  */
33619 MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
33620
33621 /**
33622  * Returns a list of all routes included in the invoice as the underlying hints
33623  */
33624 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
33625
33626 /**
33627  * Returns the currency for which the invoice was issued
33628  */
33629 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
33630
33631 /**
33632  * Returns the amount if specified in the invoice as millisatoshis.
33633  */
33634 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_milli_satoshis(const struct LDKInvoice *NONNULL_PTR this_arg);
33635
33636 /**
33637  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
33638  * returns `CreationError::DescriptionTooLong` otherwise
33639  *
33640  * Please note that single characters may use more than one byte due to UTF8 encoding.
33641  */
33642 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
33643
33644 /**
33645  * Returns the underlying description `String`
33646  */
33647 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
33648
33649 /**
33650  * Construct an `ExpiryTime` from seconds.
33651  */
33652 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_seconds(uint64_t seconds);
33653
33654 /**
33655  * Construct an `ExpiryTime` from a `Duration`, dropping the sub-second part.
33656  */
33657 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_duration(uint64_t duration);
33658
33659 /**
33660  * Returns the expiry time in seconds
33661  */
33662 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
33663
33664 /**
33665  * Returns a reference to the underlying `Duration` (=expiry time)
33666  */
33667 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
33668
33669 /**
33670  * Creates a new (partial) route from a list of hops
33671  */
33672 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
33673
33674 /**
33675  * Returns the underlying list of hops
33676  */
33677 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
33678
33679 /**
33680  * Creates a copy of the CreationError
33681  */
33682 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
33683
33684 /**
33685  * Utility method to constructs a new DescriptionTooLong-variant CreationError
33686  */
33687 enum LDKCreationError CreationError_description_too_long(void);
33688
33689 /**
33690  * Utility method to constructs a new RouteTooLong-variant CreationError
33691  */
33692 enum LDKCreationError CreationError_route_too_long(void);
33693
33694 /**
33695  * Utility method to constructs a new TimestampOutOfBounds-variant CreationError
33696  */
33697 enum LDKCreationError CreationError_timestamp_out_of_bounds(void);
33698
33699 /**
33700  * Utility method to constructs a new InvalidAmount-variant CreationError
33701  */
33702 enum LDKCreationError CreationError_invalid_amount(void);
33703
33704 /**
33705  * Utility method to constructs a new MissingRouteHints-variant CreationError
33706  */
33707 enum LDKCreationError CreationError_missing_route_hints(void);
33708
33709 /**
33710  * Utility method to constructs a new MinFinalCltvExpiryDeltaTooShort-variant CreationError
33711  */
33712 enum LDKCreationError CreationError_min_final_cltv_expiry_delta_too_short(void);
33713
33714 /**
33715  * Checks if two CreationErrors contain equal inner contents.
33716  * This ignores pointers and is_owned flags and looks at the values in fields.
33717  */
33718 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
33719
33720 /**
33721  * Get the string representation of a CreationError object
33722  */
33723 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
33724
33725 /**
33726  * Creates a copy of the SemanticError
33727  */
33728 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
33729
33730 /**
33731  * Utility method to constructs a new NoPaymentHash-variant SemanticError
33732  */
33733 enum LDKSemanticError SemanticError_no_payment_hash(void);
33734
33735 /**
33736  * Utility method to constructs a new MultiplePaymentHashes-variant SemanticError
33737  */
33738 enum LDKSemanticError SemanticError_multiple_payment_hashes(void);
33739
33740 /**
33741  * Utility method to constructs a new NoDescription-variant SemanticError
33742  */
33743 enum LDKSemanticError SemanticError_no_description(void);
33744
33745 /**
33746  * Utility method to constructs a new MultipleDescriptions-variant SemanticError
33747  */
33748 enum LDKSemanticError SemanticError_multiple_descriptions(void);
33749
33750 /**
33751  * Utility method to constructs a new NoPaymentSecret-variant SemanticError
33752  */
33753 enum LDKSemanticError SemanticError_no_payment_secret(void);
33754
33755 /**
33756  * Utility method to constructs a new MultiplePaymentSecrets-variant SemanticError
33757  */
33758 enum LDKSemanticError SemanticError_multiple_payment_secrets(void);
33759
33760 /**
33761  * Utility method to constructs a new InvalidFeatures-variant SemanticError
33762  */
33763 enum LDKSemanticError SemanticError_invalid_features(void);
33764
33765 /**
33766  * Utility method to constructs a new InvalidRecoveryId-variant SemanticError
33767  */
33768 enum LDKSemanticError SemanticError_invalid_recovery_id(void);
33769
33770 /**
33771  * Utility method to constructs a new InvalidSignature-variant SemanticError
33772  */
33773 enum LDKSemanticError SemanticError_invalid_signature(void);
33774
33775 /**
33776  * Utility method to constructs a new ImpreciseAmount-variant SemanticError
33777  */
33778 enum LDKSemanticError SemanticError_imprecise_amount(void);
33779
33780 /**
33781  * Checks if two SemanticErrors contain equal inner contents.
33782  * This ignores pointers and is_owned flags and looks at the values in fields.
33783  */
33784 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
33785
33786 /**
33787  * Get the string representation of a SemanticError object
33788  */
33789 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
33790
33791 /**
33792  * Frees any resources used by the SignOrCreationError
33793  */
33794 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
33795
33796 /**
33797  * Creates a copy of the SignOrCreationError
33798  */
33799 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
33800
33801 /**
33802  * Utility method to constructs a new SignError-variant SignOrCreationError
33803  */
33804 struct LDKSignOrCreationError SignOrCreationError_sign_error(void);
33805
33806 /**
33807  * Utility method to constructs a new CreationError-variant SignOrCreationError
33808  */
33809 struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a);
33810
33811 /**
33812  * Checks if two SignOrCreationErrors contain equal inner contents.
33813  * This ignores pointers and is_owned flags and looks at the values in fields.
33814  */
33815 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
33816
33817 /**
33818  * Get the string representation of a SignOrCreationError object
33819  */
33820 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
33821
33822 /**
33823  * Pays the given [`Invoice`], retrying if needed based on [`Retry`].
33824  *
33825  * [`Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long
33826  * as the payment is still pending. Once the payment completes or fails, you must ensure that
33827  * a second payment with the same [`PaymentHash`] is never sent.
33828  *
33829  * If you wish to use a different payment idempotency token, see [`pay_invoice_with_id`].
33830  */
33831 struct LDKCResult_PaymentIdPaymentErrorZ pay_invoice(const struct LDKInvoice *NONNULL_PTR invoice, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager);
33832
33833 /**
33834  * Pays the given [`Invoice`] with a custom idempotency key, retrying if needed based on [`Retry`].
33835  *
33836  * Note that idempotency is only guaranteed as long as the payment is still pending. Once the
33837  * payment completes or fails, no idempotency guarantees are made.
33838  *
33839  * You should ensure that the [`Invoice::payment_hash`] is unique and the same [`PaymentHash`]
33840  * has never been paid before.
33841  *
33842  * See [`pay_invoice`] for a variant which uses the [`PaymentHash`] for the idempotency token.
33843  */
33844 struct LDKCResult_NonePaymentErrorZ pay_invoice_with_id(const struct LDKInvoice *NONNULL_PTR invoice, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager);
33845
33846 /**
33847  * Pays the given zero-value [`Invoice`] using the given amount, retrying if needed based on
33848  * [`Retry`].
33849  *
33850  * [`Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long
33851  * as the payment is still pending. Once the payment completes or fails, you must ensure that
33852  * a second payment with the same [`PaymentHash`] is never sent.
33853  *
33854  * If you wish to use a different payment idempotency token, see
33855  * [`pay_zero_value_invoice_with_id`].
33856  */
33857 struct LDKCResult_PaymentIdPaymentErrorZ pay_zero_value_invoice(const struct LDKInvoice *NONNULL_PTR invoice, uint64_t amount_msats, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager);
33858
33859 /**
33860  * Pays the given zero-value [`Invoice`] using the given amount and custom idempotency key,
33861  * , retrying if needed based on [`Retry`].
33862  *
33863  * Note that idempotency is only guaranteed as long as the payment is still pending. Once the
33864  * payment completes or fails, no idempotency guarantees are made.
33865  *
33866  * You should ensure that the [`Invoice::payment_hash`] is unique and the same [`PaymentHash`]
33867  * has never been paid before.
33868  *
33869  * See [`pay_zero_value_invoice`] for a variant which uses the [`PaymentHash`] for the
33870  * idempotency token.
33871  */
33872 struct LDKCResult_NonePaymentErrorZ pay_zero_value_invoice_with_id(const struct LDKInvoice *NONNULL_PTR invoice, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager);
33873
33874 /**
33875  * Frees any resources used by the PaymentError
33876  */
33877 void PaymentError_free(struct LDKPaymentError this_ptr);
33878
33879 /**
33880  * Creates a copy of the PaymentError
33881  */
33882 struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig);
33883
33884 /**
33885  * Utility method to constructs a new Invoice-variant PaymentError
33886  */
33887 struct LDKPaymentError PaymentError_invoice(struct LDKStr a);
33888
33889 /**
33890  * Utility method to constructs a new Sending-variant PaymentError
33891  */
33892 struct LDKPaymentError PaymentError_sending(enum LDKRetryableSendFailure a);
33893
33894 /**
33895  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
33896  * See [`PhantomKeysManager`] for more information on phantom node payments.
33897  *
33898  * `phantom_route_hints` parameter:
33899  * * Contains channel info for all nodes participating in the phantom invoice
33900  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
33901  *   participating node
33902  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
33903  *   updated when a channel becomes disabled or closes
33904  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
33905  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
33906  *   down
33907  *
33908  * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
33909  * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
33910  * If `None` is provided for `payment_hash`, then one will be created.
33911  *
33912  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
33913  * in excess of the current time.
33914  *
33915  * `duration_since_epoch` is the current time since epoch in seconds.
33916  *
33917  * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to
33918  * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`] - 3.
33919  * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block
33920  * confirmations during routing.
33921  *
33922  * Note that the provided `keys_manager`'s `NodeSigner` implementation must support phantom
33923  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
33924  * requirement).
33925  *
33926  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
33927  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
33928  * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
33929  * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
33930  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
33931  * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
33932  *
33933  * This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
33934  * available and the current time is supplied by the caller.
33935  *
33936  * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
33937  */
33938 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 LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u16Z min_final_cltv_expiry_delta, uint64_t duration_since_epoch);
33939
33940 /**
33941  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
33942  * See [`PhantomKeysManager`] for more information on phantom node payments.
33943  *
33944  * `phantom_route_hints` parameter:
33945  * * Contains channel info for all nodes participating in the phantom invoice
33946  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
33947  *   participating node
33948  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
33949  *   updated when a channel becomes disabled or closes
33950  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
33951  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
33952  *   down
33953  *
33954  * `description_hash` is a SHA-256 hash of the description text
33955  *
33956  * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
33957  * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
33958  * If `None` is provided for `payment_hash`, then one will be created.
33959  *
33960  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
33961  * in excess of the current time.
33962  *
33963  * `duration_since_epoch` is the current time since epoch in seconds.
33964  *
33965  * Note that the provided `keys_manager`'s `NodeSigner` implementation must support phantom
33966  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
33967  * requirement).
33968  *
33969  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
33970  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
33971  * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
33972  * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
33973  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
33974  *
33975  * This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
33976  * available and the current time is supplied by the caller.
33977  *
33978  * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
33979  */
33980 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 LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u16Z min_final_cltv_expiry_delta, uint64_t duration_since_epoch);
33981
33982 /**
33983  * Utility to construct an invoice. Generally, unless you want to do something like a custom
33984  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
33985  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
33986  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
33987  * that the payment secret is valid when the invoice is paid.
33988  *
33989  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
33990  * in excess of the current time.
33991  *
33992  * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to
33993  * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
33994  * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block
33995  * confirmations during routing.
33996  *
33997  * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
33998  */
33999 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta);
34000
34001 /**
34002  * Utility to construct an invoice. Generally, unless you want to do something like a custom
34003  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
34004  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
34005  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
34006  * that the payment secret is valid when the invoice is paid.
34007  * Use this variant if you want to pass the `description_hash` to the invoice.
34008  *
34009  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
34010  * in excess of the current time.
34011  *
34012  * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to
34013  * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
34014  * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block
34015  * confirmations during routing.
34016  *
34017  * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
34018  */
34019 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta);
34020
34021 /**
34022  * See [`create_invoice_from_channelmanager_with_description_hash`]
34023  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
34024  * available and the current time is supplied by the caller.
34025  */
34026 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, 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, struct LDKCOption_u16Z min_final_cltv_expiry_delta);
34027
34028 /**
34029  * See [`create_invoice_from_channelmanager`]
34030  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
34031  * available and the current time is supplied by the caller.
34032  */
34033 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, 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 LDKCOption_u16Z min_final_cltv_expiry_delta);
34034
34035 /**
34036  * See [`create_invoice_from_channelmanager_and_duration_since_epoch`]
34037  * This version allows for providing a custom [`PaymentHash`] for the invoice.
34038  * This may be useful if you're building an on-chain swap or involving another protocol where
34039  * the payment hash is also involved outside the scope of lightning.
34040  */
34041 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, 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, struct LDKCOption_u16Z min_final_cltv_expiry_delta);
34042
34043 /**
34044  * Read a SiPrefix object from a string
34045  */
34046 struct LDKCResult_SiPrefixParseErrorZ SiPrefix_from_str(struct LDKStr s);
34047
34048 /**
34049  * Read a Invoice object from a string
34050  */
34051 struct LDKCResult_InvoiceParseOrSemanticErrorZ Invoice_from_str(struct LDKStr s);
34052
34053 /**
34054  * Read a SignedRawInvoice object from a string
34055  */
34056 struct LDKCResult_SignedRawInvoiceParseErrorZ SignedRawInvoice_from_str(struct LDKStr s);
34057
34058 /**
34059  * Get the string representation of a ParseError object
34060  */
34061 struct LDKStr ParseError_to_str(const struct LDKParseError *NONNULL_PTR o);
34062
34063 /**
34064  * Get the string representation of a ParseOrSemanticError object
34065  */
34066 struct LDKStr ParseOrSemanticError_to_str(const struct LDKParseOrSemanticError *NONNULL_PTR o);
34067
34068 /**
34069  * Get the string representation of a Invoice object
34070  */
34071 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
34072
34073 /**
34074  * Get the string representation of a SignedRawInvoice object
34075  */
34076 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
34077
34078 /**
34079  * Get the string representation of a Currency object
34080  */
34081 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
34082
34083 /**
34084  * Get the string representation of a SiPrefix object
34085  */
34086 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
34087
34088 /**
34089  * Frees any resources used by the RapidGossipSync, if is_owned is set and inner is non-NULL.
34090  */
34091 void RapidGossipSync_free(struct LDKRapidGossipSync this_obj);
34092
34093 /**
34094  * Instantiate a new [`RapidGossipSync`] instance.
34095  */
34096 MUST_USE_RES struct LDKRapidGossipSync RapidGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
34097
34098 /**
34099  * Update network graph from binary data.
34100  * Returns the last sync timestamp to be used the next time rapid sync data is queried.
34101  *
34102  * `update_data`: `&[u8]` binary stream that comprises the update data
34103  */
34104 MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data);
34105
34106 /**
34107  * Update network graph from binary data.
34108  * Returns the last sync timestamp to be used the next time rapid sync data is queried.
34109  *
34110  * `update_data`: `&[u8]` binary stream that comprises the update data
34111  * `current_time_unix`: `Option<u64>` optional current timestamp to verify data age
34112  */
34113 MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph_no_std(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data, struct LDKCOption_u64Z current_time_unix);
34114
34115 /**
34116  * Returns whether a rapid gossip sync has completed at least once.
34117  */
34118 MUST_USE_RES bool RapidGossipSync_is_initial_sync_complete(const struct LDKRapidGossipSync *NONNULL_PTR this_arg);
34119
34120 /**
34121  * Frees any resources used by the GraphSyncError
34122  */
34123 void GraphSyncError_free(struct LDKGraphSyncError this_ptr);
34124
34125 /**
34126  * Creates a copy of the GraphSyncError
34127  */
34128 struct LDKGraphSyncError GraphSyncError_clone(const struct LDKGraphSyncError *NONNULL_PTR orig);
34129
34130 /**
34131  * Utility method to constructs a new DecodeError-variant GraphSyncError
34132  */
34133 struct LDKGraphSyncError GraphSyncError_decode_error(struct LDKDecodeError a);
34134
34135 /**
34136  * Utility method to constructs a new LightningError-variant GraphSyncError
34137  */
34138 struct LDKGraphSyncError GraphSyncError_lightning_error(struct LDKLightningError a);
34139
34140 #endif /* LDK_C_BINDINGS_H */
34141
34142 #include "ldk_ver.h"