Merge pull request #67 from TheBlueMatt/main
[ldk-c-bindings] / lightning-c-bindings / include / lightning.h
1 #ifndef LDK_C_BINDINGS_H
2 #define LDK_C_BINDINGS_H
3
4 /* Generated with cbindgen:0.20.0 */
5
6 /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
7
8 #include <stdarg.h>
9 #include <stdbool.h>
10 #include <stdint.h>
11 #include "ldk_rust_types.h"
12
13 /**
14  * An error when accessing the chain via [`Access`].
15  */
16 typedef enum LDKAccessError {
17    /**
18     * The requested chain is unknown.
19     */
20    LDKAccessError_UnknownChain,
21    /**
22     * The requested transaction doesn't exist or hasn't confirmed.
23     */
24    LDKAccessError_UnknownTx,
25    /**
26     * Must be last for serialization purposes
27     */
28    LDKAccessError_Sentinel,
29 } LDKAccessError;
30
31 /**
32  * An enum which can either contain a  or not
33  */
34 typedef enum LDKCOption_NoneZ {
35    /**
36     * When we're in this state, this COption_NoneZ contains a
37     */
38    LDKCOption_NoneZ_Some,
39    /**
40     * When we're in this state, this COption_NoneZ contains nothing
41     */
42    LDKCOption_NoneZ_None,
43    /**
44     * Must be last for serialization purposes
45     */
46    LDKCOption_NoneZ_Sentinel,
47 } LDKCOption_NoneZ;
48
49 /**
50  * An error enum representing a failure to persist a channel monitor update.
51  */
52 typedef enum LDKChannelMonitorUpdateErr {
53    /**
54     * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
55     * our state failed, but is expected to succeed at some point in the future).
56     *
57     * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
58     * submitting new commitment transactions to the counterparty. Once the update(s) that failed
59     * have been successfully applied, a [`MonitorEvent::UpdateCompleted`] event should be returned
60     * via [`Watch::release_pending_monitor_events`] which will then restore the channel to an
61     * operational state.
62     *
63     * Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
64     * you return a TemporaryFailure you must ensure that it is written to disk safely before
65     * writing out the latest ChannelManager state.
66     *
67     * Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
68     * (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
69     * to claim it on this channel) and those updates must be applied wherever they can be. At
70     * least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
71     * be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
72     * the channel which would invalidate previous ChannelMonitors are not made when a channel has
73     * been \"frozen\".
74     *
75     * Note that even if updates made after TemporaryFailure succeed you must still provide a
76     * [`MonitorEvent::UpdateCompleted`] to ensure you have the latest monitor and re-enable
77     * normal channel operation. Note that this is normally generated through a call to
78     * [`ChainMonitor::channel_monitor_updated`].
79     *
80     * Note that the update being processed here will not be replayed for you when you return a
81     * [`MonitorEvent::UpdateCompleted`] event via [`Watch::release_pending_monitor_events`], so
82     * you must store the update itself on your own local disk prior to returning a
83     * TemporaryFailure. You may, of course, employ a journaling approach, storing only the
84     * ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
85     * reload-time.
86     *
87     * For deployments where a copy of ChannelMonitors and other local state are backed up in a
88     * remote location (with local copies persisted immediately), it is anticipated that all
89     * updates will return TemporaryFailure until the remote copies could be updated.
90     *
91     * [`ChainMonitor::channel_monitor_updated`]: chainmonitor::ChainMonitor::channel_monitor_updated
92     */
93    LDKChannelMonitorUpdateErr_TemporaryFailure,
94    /**
95     * Used to indicate no further channel monitor updates will be allowed (eg we've moved on to a
96     * different watchtower and cannot update with all watchtowers that were previously informed
97     * of this channel).
98     *
99     * At reception of this error, ChannelManager will force-close the channel and return at
100     * least a final ChannelMonitorUpdate::ChannelForceClosed which must be delivered to at
101     * least one ChannelMonitor copy. Revocation secret MUST NOT be released and offchain channel
102     * update must be rejected.
103     *
104     * This failure may also signal a failure to update the local persisted copy of one of
105     * the channel monitor instance.
106     *
107     * Note that even when you fail a holder commitment transaction update, you must store the
108     * update to ensure you can claim from it in case of a duplicate copy of this ChannelMonitor
109     * broadcasts it (e.g distributed channel-monitor deployment)
110     *
111     * In case of distributed watchtowers deployment, the new version must be written to disk, as
112     * state may have been stored but rejected due to a block forcing a commitment broadcast. This
113     * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
114     * lagging behind on block processing.
115     */
116    LDKChannelMonitorUpdateErr_PermanentFailure,
117    /**
118     * Must be last for serialization purposes
119     */
120    LDKChannelMonitorUpdateErr_Sentinel,
121 } LDKChannelMonitorUpdateErr;
122
123 /**
124  * An enum that represents the speed at which we want a transaction to confirm used for feerate
125  * estimation.
126  */
127 typedef enum LDKConfirmationTarget {
128    /**
129     * We are happy with this transaction confirming slowly when feerate drops some.
130     */
131    LDKConfirmationTarget_Background,
132    /**
133     * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
134     */
135    LDKConfirmationTarget_Normal,
136    /**
137     * We'd like this transaction to confirm in the next few blocks.
138     */
139    LDKConfirmationTarget_HighPriority,
140    /**
141     * Must be last for serialization purposes
142     */
143    LDKConfirmationTarget_Sentinel,
144 } LDKConfirmationTarget;
145
146 /**
147  * Errors that may occur when constructing a new `RawInvoice` or `Invoice`
148  */
149 typedef enum LDKCreationError {
150    /**
151     * The supplied description string was longer than 639 __bytes__ (see [`Description::new(…)`](./struct.Description.html#method.new))
152     */
153    LDKCreationError_DescriptionTooLong,
154    /**
155     * The specified route has too many hops and can't be encoded
156     */
157    LDKCreationError_RouteTooLong,
158    /**
159     * The Unix timestamp of the supplied date is less than zero or greater than 35-bits
160     */
161    LDKCreationError_TimestampOutOfBounds,
162    /**
163     * The supplied millisatoshi amount was greater than the total bitcoin supply.
164     */
165    LDKCreationError_InvalidAmount,
166    /**
167     * Route hints were required for this invoice and were missing. Applies to
168     * [phantom invoices].
169     *
170     * [phantom invoices]: crate::utils::create_phantom_invoice
171     */
172    LDKCreationError_MissingRouteHints,
173    /**
174     * Must be last for serialization purposes
175     */
176    LDKCreationError_Sentinel,
177 } LDKCreationError;
178
179 /**
180  * Enum representing the crypto currencies (or networks) supported by this library
181  */
182 typedef enum LDKCurrency {
183    /**
184     * Bitcoin mainnet
185     */
186    LDKCurrency_Bitcoin,
187    /**
188     * Bitcoin testnet
189     */
190    LDKCurrency_BitcoinTestnet,
191    /**
192     * Bitcoin regtest
193     */
194    LDKCurrency_Regtest,
195    /**
196     * Bitcoin simnet
197     */
198    LDKCurrency_Simnet,
199    /**
200     * Bitcoin signet
201     */
202    LDKCurrency_Signet,
203    /**
204     * Must be last for serialization purposes
205     */
206    LDKCurrency_Sentinel,
207 } LDKCurrency;
208
209 /**
210  * Represents an IO Error. Note that some information is lost in the conversion from Rust.
211  */
212 typedef enum LDKIOError {
213    LDKIOError_NotFound,
214    LDKIOError_PermissionDenied,
215    LDKIOError_ConnectionRefused,
216    LDKIOError_ConnectionReset,
217    LDKIOError_ConnectionAborted,
218    LDKIOError_NotConnected,
219    LDKIOError_AddrInUse,
220    LDKIOError_AddrNotAvailable,
221    LDKIOError_BrokenPipe,
222    LDKIOError_AlreadyExists,
223    LDKIOError_WouldBlock,
224    LDKIOError_InvalidInput,
225    LDKIOError_InvalidData,
226    LDKIOError_TimedOut,
227    LDKIOError_WriteZero,
228    LDKIOError_Interrupted,
229    LDKIOError_Other,
230    LDKIOError_UnexpectedEof,
231    /**
232     * Must be last for serialization purposes
233     */
234    LDKIOError_Sentinel,
235 } LDKIOError;
236
237 /**
238  * An enum representing the available verbosity levels of the logger.
239  */
240 typedef enum LDKLevel {
241    /**
242     * Designates extremely verbose information, including gossip-induced messages
243     */
244    LDKLevel_Gossip,
245    /**
246     * Designates very low priority, often extremely verbose, information
247     */
248    LDKLevel_Trace,
249    /**
250     * Designates lower priority information
251     */
252    LDKLevel_Debug,
253    /**
254     * Designates useful information
255     */
256    LDKLevel_Info,
257    /**
258     * Designates hazardous situations
259     */
260    LDKLevel_Warn,
261    /**
262     * Designates very serious errors
263     */
264    LDKLevel_Error,
265    /**
266     * Must be last for serialization purposes
267     */
268    LDKLevel_Sentinel,
269 } LDKLevel;
270
271 /**
272  * An enum representing the possible Bitcoin or test networks which we can run on
273  */
274 typedef enum LDKNetwork {
275    /**
276     * The main Bitcoin blockchain.
277     */
278    LDKNetwork_Bitcoin,
279    /**
280     * The testnet3 blockchain.
281     */
282    LDKNetwork_Testnet,
283    /**
284     * A local test blockchain.
285     */
286    LDKNetwork_Regtest,
287    /**
288     * A blockchain on which blocks are signed instead of mined.
289     */
290    LDKNetwork_Signet,
291    /**
292     * Must be last for serialization purposes
293     */
294    LDKNetwork_Sentinel,
295 } LDKNetwork;
296
297 /**
298  * Specifies the recipient of an invoice, to indicate to [`KeysInterface::sign_invoice`] what node
299  * secret key should be used to sign the invoice.
300  */
301 typedef enum LDKRecipient {
302    /**
303     * The invoice should be signed with the local node secret key.
304     */
305    LDKRecipient_Node,
306    /**
307     * The invoice should be signed with the phantom node secret key. This secret key must be the
308     * same for all nodes participating in the [phantom node payment].
309     *
310     * [phantom node payment]: PhantomKeysManager
311     */
312    LDKRecipient_PhantomNode,
313    /**
314     * Must be last for serialization purposes
315     */
316    LDKRecipient_Sentinel,
317 } LDKRecipient;
318
319 /**
320  * Represents an error returned from libsecp256k1 during validation of some secp256k1 data
321  */
322 typedef enum LDKSecp256k1Error {
323    /**
324     * Signature failed verification
325     */
326    LDKSecp256k1Error_IncorrectSignature,
327    /**
328     * Badly sized message ("messages" are actually fixed-sized digests; see the MESSAGE_SIZE constant)
329     */
330    LDKSecp256k1Error_InvalidMessage,
331    /**
332     * Bad public key
333     */
334    LDKSecp256k1Error_InvalidPublicKey,
335    /**
336     * Bad signature
337     */
338    LDKSecp256k1Error_InvalidSignature,
339    /**
340     * Bad secret key
341     */
342    LDKSecp256k1Error_InvalidSecretKey,
343    /**
344     * Bad recovery id
345     */
346    LDKSecp256k1Error_InvalidRecoveryId,
347    /**
348     * Invalid tweak for add_assign or mul_assign
349     */
350    LDKSecp256k1Error_InvalidTweak,
351    /**
352     * tweak_add_check failed on an xonly public key
353     */
354    LDKSecp256k1Error_TweakCheckFailed,
355    /**
356     * Didn't pass enough memory to context creation with preallocated memory
357     */
358    LDKSecp256k1Error_NotEnoughMemory,
359    /**
360     * Must be last for serialization purposes
361     */
362    LDKSecp256k1Error_Sentinel,
363 } LDKSecp256k1Error;
364
365 /**
366  * Errors that may occur when converting a `RawInvoice` to an `Invoice`. They relate to the
367  * requirements sections in BOLT #11
368  */
369 typedef enum LDKSemanticError {
370    /**
371     * The invoice is missing the mandatory payment hash
372     */
373    LDKSemanticError_NoPaymentHash,
374    /**
375     * The invoice has multiple payment hashes which isn't allowed
376     */
377    LDKSemanticError_MultiplePaymentHashes,
378    /**
379     * No description or description hash are part of the invoice
380     */
381    LDKSemanticError_NoDescription,
382    /**
383     * The invoice contains multiple descriptions and/or description hashes which isn't allowed
384     */
385    LDKSemanticError_MultipleDescriptions,
386    /**
387     * The invoice is missing the mandatory payment secret, which all modern lightning nodes
388     * should provide.
389     */
390    LDKSemanticError_NoPaymentSecret,
391    /**
392     * The invoice contains multiple payment secrets
393     */
394    LDKSemanticError_MultiplePaymentSecrets,
395    /**
396     * The invoice's features are invalid
397     */
398    LDKSemanticError_InvalidFeatures,
399    /**
400     * The recovery id doesn't fit the signature/pub key
401     */
402    LDKSemanticError_InvalidRecoveryId,
403    /**
404     * The invoice's signature is invalid
405     */
406    LDKSemanticError_InvalidSignature,
407    /**
408     * The invoice's amount was not a whole number of millisatoshis
409     */
410    LDKSemanticError_ImpreciseAmount,
411    /**
412     * Must be last for serialization purposes
413     */
414    LDKSemanticError_Sentinel,
415 } LDKSemanticError;
416
417 /**
418  * SI prefixes for the human readable part
419  */
420 typedef enum LDKSiPrefix {
421    /**
422     * 10^-3
423     */
424    LDKSiPrefix_Milli,
425    /**
426     * 10^-6
427     */
428    LDKSiPrefix_Micro,
429    /**
430     * 10^-9
431     */
432    LDKSiPrefix_Nano,
433    /**
434     * 10^-12
435     */
436    LDKSiPrefix_Pico,
437    /**
438     * Must be last for serialization purposes
439     */
440    LDKSiPrefix_Sentinel,
441 } LDKSiPrefix;
442
443 /**
444  * A Rust str object, ie a reference to a UTF8-valid string.
445  * This is *not* null-terminated so cannot be used directly as a C string!
446  */
447 typedef struct LDKStr {
448    /**
449     * A pointer to the string's bytes, in UTF8 encoding
450     */
451    const uint8_t *chars;
452    /**
453     * The number of bytes (not characters!) pointed to by `chars`
454     */
455    uintptr_t len;
456    /**
457     * Whether the data pointed to by `chars` should be freed or not.
458     */
459    bool chars_is_owned;
460 } LDKStr;
461
462 /**
463  * A serialized transaction, in (pointer, length) form.
464  *
465  * This type optionally owns its own memory, and thus the semantics around access change based on
466  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
467  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
468  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
469  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
470  * you would be invalid.
471  *
472  * Note that, while it may change in the future, because transactions on the Rust side are stored
473  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
474  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
475  * `data_is_owned` either set or unset at your discretion.
476  */
477 typedef struct LDKTransaction {
478    /**
479     * The serialized transaction data.
480     *
481     * This is non-const for your convenience, an object passed to Rust is never written to.
482     */
483    uint8_t *data;
484    /**
485     * The length of the serialized transaction
486     */
487    uintptr_t datalen;
488    /**
489     * Whether the data pointed to by `data` should be freed or not.
490     */
491    bool data_is_owned;
492 } LDKTransaction;
493
494 /**
495  * A dynamically-allocated array of u8s of arbitrary size.
496  * This corresponds to std::vector in C++
497  */
498 typedef struct LDKCVec_u8Z {
499    /**
500     * The elements in the array.
501     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
502     */
503    uint8_t *data;
504    /**
505     * The number of elements pointed to by `data`.
506     */
507    uintptr_t datalen;
508 } LDKCVec_u8Z;
509
510 /**
511  * A transaction output including a scriptPubKey and value.
512  * This type *does* own its own memory, so must be free'd appropriately.
513  */
514 typedef struct LDKTxOut {
515    /**
516     * The script_pubkey in this output
517     */
518    struct LDKCVec_u8Z script_pubkey;
519    /**
520     * The value, in satoshis, of this output
521     */
522    uint64_t value;
523 } LDKTxOut;
524
525 /**
526  * The contents of CResult_NoneNoneZ
527  */
528 typedef union LDKCResult_NoneNoneZPtr {
529    /**
530     * Note that this value is always NULL, as there are no contents in the OK variant
531     */
532    void *result;
533    /**
534     * Note that this value is always NULL, as there are no contents in the Err variant
535     */
536    void *err;
537 } LDKCResult_NoneNoneZPtr;
538
539 /**
540  * A CResult_NoneNoneZ represents the result of a fallible operation,
541  * containing a () on success and a () on failure.
542  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
543  */
544 typedef struct LDKCResult_NoneNoneZ {
545    /**
546     * The contents of this CResult_NoneNoneZ, accessible via either
547     * `err` or `result` depending on the state of `result_ok`.
548     */
549    union LDKCResult_NoneNoneZPtr contents;
550    /**
551     * Whether this CResult_NoneNoneZ represents a success state.
552     */
553    bool result_ok;
554 } LDKCResult_NoneNoneZ;
555
556
557
558 /**
559  * Implements the per-commitment secret storage scheme from
560  * [BOLT 3](https://github.com/lightningnetwork/lightning-rfc/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage).
561  *
562  * Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes
563  * or so.
564  */
565 typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets {
566    /**
567     * A pointer to the opaque Rust object.
568     * Nearly everywhere, inner must be non-null, however in places where
569     * the Rust equivalent takes an Option, it may be set to null to indicate None.
570     */
571    LDKnativeCounterpartyCommitmentSecrets *inner;
572    /**
573     * Indicates that this is the only struct which contains the same pointer.
574     * Rust functions which take ownership of an object provided via an argument require
575     * this to be true and invalidate the object pointed to by inner.
576     */
577    bool is_owned;
578 } LDKCounterpartyCommitmentSecrets;
579
580
581
582 /**
583  * An error in decoding a message or struct.
584  */
585 typedef struct MUST_USE_STRUCT LDKDecodeError {
586    /**
587     * A pointer to the opaque Rust object.
588     * Nearly everywhere, inner must be non-null, however in places where
589     * the Rust equivalent takes an Option, it may be set to null to indicate None.
590     */
591    LDKnativeDecodeError *inner;
592    /**
593     * Indicates that this is the only struct which contains the same pointer.
594     * Rust functions which take ownership of an object provided via an argument require
595     * this to be true and invalidate the object pointed to by inner.
596     */
597    bool is_owned;
598 } LDKDecodeError;
599
600 /**
601  * The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
602  */
603 typedef union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
604    /**
605     * A pointer to the contents in the success state.
606     * Reading from this pointer when `result_ok` is not set is undefined.
607     */
608    struct LDKCounterpartyCommitmentSecrets *result;
609    /**
610     * A pointer to the contents in the error state.
611     * Reading from this pointer when `result_ok` is set is undefined.
612     */
613    struct LDKDecodeError *err;
614 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr;
615
616 /**
617  * A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
618  * containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
619  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
620  */
621 typedef struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ {
622    /**
623     * The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
624     * `err` or `result` depending on the state of `result_ok`.
625     */
626    union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr contents;
627    /**
628     * Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
629     */
630    bool result_ok;
631 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ;
632
633 /**
634  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
635  */
636 typedef struct LDKSecretKey {
637    /**
638     * The bytes of the secret key
639     */
640    uint8_t bytes[32];
641 } LDKSecretKey;
642
643 /**
644  * The contents of CResult_SecretKeyErrorZ
645  */
646 typedef union LDKCResult_SecretKeyErrorZPtr {
647    /**
648     * A pointer to the contents in the success state.
649     * Reading from this pointer when `result_ok` is not set is undefined.
650     */
651    struct LDKSecretKey *result;
652    /**
653     * A pointer to the contents in the error state.
654     * Reading from this pointer when `result_ok` is set is undefined.
655     */
656    enum LDKSecp256k1Error *err;
657 } LDKCResult_SecretKeyErrorZPtr;
658
659 /**
660  * A CResult_SecretKeyErrorZ represents the result of a fallible operation,
661  * containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
662  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
663  */
664 typedef struct LDKCResult_SecretKeyErrorZ {
665    /**
666     * The contents of this CResult_SecretKeyErrorZ, accessible via either
667     * `err` or `result` depending on the state of `result_ok`.
668     */
669    union LDKCResult_SecretKeyErrorZPtr contents;
670    /**
671     * Whether this CResult_SecretKeyErrorZ represents a success state.
672     */
673    bool result_ok;
674 } LDKCResult_SecretKeyErrorZ;
675
676 /**
677  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
678  */
679 typedef struct LDKPublicKey {
680    /**
681     * The bytes of the public key
682     */
683    uint8_t compressed_form[33];
684 } LDKPublicKey;
685
686 /**
687  * The contents of CResult_PublicKeyErrorZ
688  */
689 typedef union LDKCResult_PublicKeyErrorZPtr {
690    /**
691     * A pointer to the contents in the success state.
692     * Reading from this pointer when `result_ok` is not set is undefined.
693     */
694    struct LDKPublicKey *result;
695    /**
696     * A pointer to the contents in the error state.
697     * Reading from this pointer when `result_ok` is set is undefined.
698     */
699    enum LDKSecp256k1Error *err;
700 } LDKCResult_PublicKeyErrorZPtr;
701
702 /**
703  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
704  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
705  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
706  */
707 typedef struct LDKCResult_PublicKeyErrorZ {
708    /**
709     * The contents of this CResult_PublicKeyErrorZ, accessible via either
710     * `err` or `result` depending on the state of `result_ok`.
711     */
712    union LDKCResult_PublicKeyErrorZPtr contents;
713    /**
714     * Whether this CResult_PublicKeyErrorZ represents a success state.
715     */
716    bool result_ok;
717 } LDKCResult_PublicKeyErrorZ;
718
719
720
721 /**
722  * The set of public keys which are used in the creation of one commitment transaction.
723  * These are derived from the channel base keys and per-commitment data.
724  *
725  * A broadcaster key is provided from potential broadcaster of the computed transaction.
726  * A countersignatory key is coming from a protocol participant unable to broadcast the
727  * transaction.
728  *
729  * These keys are assumed to be good, either because the code derived them from
730  * channel basepoints via the new function, or they were obtained via
731  * CommitmentTransaction.trust().keys() because we trusted the source of the
732  * pre-calculated keys.
733  */
734 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
735    /**
736     * A pointer to the opaque Rust object.
737     * Nearly everywhere, inner must be non-null, however in places where
738     * the Rust equivalent takes an Option, it may be set to null to indicate None.
739     */
740    LDKnativeTxCreationKeys *inner;
741    /**
742     * Indicates that this is the only struct which contains the same pointer.
743     * Rust functions which take ownership of an object provided via an argument require
744     * this to be true and invalidate the object pointed to by inner.
745     */
746    bool is_owned;
747 } LDKTxCreationKeys;
748
749 /**
750  * The contents of CResult_TxCreationKeysDecodeErrorZ
751  */
752 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
753    /**
754     * A pointer to the contents in the success state.
755     * Reading from this pointer when `result_ok` is not set is undefined.
756     */
757    struct LDKTxCreationKeys *result;
758    /**
759     * A pointer to the contents in the error state.
760     * Reading from this pointer when `result_ok` is set is undefined.
761     */
762    struct LDKDecodeError *err;
763 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
764
765 /**
766  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
767  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
768  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
769  */
770 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
771    /**
772     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
773     * `err` or `result` depending on the state of `result_ok`.
774     */
775    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
776    /**
777     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
778     */
779    bool result_ok;
780 } LDKCResult_TxCreationKeysDecodeErrorZ;
781
782
783
784 /**
785  * One counterparty's public keys which do not change over the life of a channel.
786  */
787 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
788    /**
789     * A pointer to the opaque Rust object.
790     * Nearly everywhere, inner must be non-null, however in places where
791     * the Rust equivalent takes an Option, it may be set to null to indicate None.
792     */
793    LDKnativeChannelPublicKeys *inner;
794    /**
795     * Indicates that this is the only struct which contains the same pointer.
796     * Rust functions which take ownership of an object provided via an argument require
797     * this to be true and invalidate the object pointed to by inner.
798     */
799    bool is_owned;
800 } LDKChannelPublicKeys;
801
802 /**
803  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
804  */
805 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
806    /**
807     * A pointer to the contents in the success state.
808     * Reading from this pointer when `result_ok` is not set is undefined.
809     */
810    struct LDKChannelPublicKeys *result;
811    /**
812     * A pointer to the contents in the error state.
813     * Reading from this pointer when `result_ok` is set is undefined.
814     */
815    struct LDKDecodeError *err;
816 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
817
818 /**
819  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
820  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
821  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
822  */
823 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
824    /**
825     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
826     * `err` or `result` depending on the state of `result_ok`.
827     */
828    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
829    /**
830     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
831     */
832    bool result_ok;
833 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
834
835 /**
836  * The contents of CResult_TxCreationKeysErrorZ
837  */
838 typedef union LDKCResult_TxCreationKeysErrorZPtr {
839    /**
840     * A pointer to the contents in the success state.
841     * Reading from this pointer when `result_ok` is not set is undefined.
842     */
843    struct LDKTxCreationKeys *result;
844    /**
845     * A pointer to the contents in the error state.
846     * Reading from this pointer when `result_ok` is set is undefined.
847     */
848    enum LDKSecp256k1Error *err;
849 } LDKCResult_TxCreationKeysErrorZPtr;
850
851 /**
852  * A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
853  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
854  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
855  */
856 typedef struct LDKCResult_TxCreationKeysErrorZ {
857    /**
858     * The contents of this CResult_TxCreationKeysErrorZ, accessible via either
859     * `err` or `result` depending on the state of `result_ok`.
860     */
861    union LDKCResult_TxCreationKeysErrorZPtr contents;
862    /**
863     * Whether this CResult_TxCreationKeysErrorZ represents a success state.
864     */
865    bool result_ok;
866 } LDKCResult_TxCreationKeysErrorZ;
867
868 /**
869  * An enum which can either contain a u32 or not
870  */
871 typedef enum LDKCOption_u32Z_Tag {
872    /**
873     * When we're in this state, this COption_u32Z contains a u32
874     */
875    LDKCOption_u32Z_Some,
876    /**
877     * When we're in this state, this COption_u32Z contains nothing
878     */
879    LDKCOption_u32Z_None,
880    /**
881     * Must be last for serialization purposes
882     */
883    LDKCOption_u32Z_Sentinel,
884 } LDKCOption_u32Z_Tag;
885
886 typedef struct LDKCOption_u32Z {
887    LDKCOption_u32Z_Tag tag;
888    union {
889       struct {
890          uint32_t some;
891       };
892    };
893 } LDKCOption_u32Z;
894
895
896
897 /**
898  * Information about an HTLC as it appears in a commitment transaction
899  */
900 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
901    /**
902     * A pointer to the opaque Rust object.
903     * Nearly everywhere, inner must be non-null, however in places where
904     * the Rust equivalent takes an Option, it may be set to null to indicate None.
905     */
906    LDKnativeHTLCOutputInCommitment *inner;
907    /**
908     * Indicates that this is the only struct which contains the same pointer.
909     * Rust functions which take ownership of an object provided via an argument require
910     * this to be true and invalidate the object pointed to by inner.
911     */
912    bool is_owned;
913 } LDKHTLCOutputInCommitment;
914
915 /**
916  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
917  */
918 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
919    /**
920     * A pointer to the contents in the success state.
921     * Reading from this pointer when `result_ok` is not set is undefined.
922     */
923    struct LDKHTLCOutputInCommitment *result;
924    /**
925     * A pointer to the contents in the error state.
926     * Reading from this pointer when `result_ok` is set is undefined.
927     */
928    struct LDKDecodeError *err;
929 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
930
931 /**
932  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
933  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
934  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
935  */
936 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
937    /**
938     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
939     * `err` or `result` depending on the state of `result_ok`.
940     */
941    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
942    /**
943     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
944     */
945    bool result_ok;
946 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
947
948
949
950 /**
951  * Late-bound per-channel counterparty data used to build transactions.
952  */
953 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
954    /**
955     * A pointer to the opaque Rust object.
956     * Nearly everywhere, inner must be non-null, however in places where
957     * the Rust equivalent takes an Option, it may be set to null to indicate None.
958     */
959    LDKnativeCounterpartyChannelTransactionParameters *inner;
960    /**
961     * Indicates that this is the only struct which contains the same pointer.
962     * Rust functions which take ownership of an object provided via an argument require
963     * this to be true and invalidate the object pointed to by inner.
964     */
965    bool is_owned;
966 } LDKCounterpartyChannelTransactionParameters;
967
968 /**
969  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
970  */
971 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
972    /**
973     * A pointer to the contents in the success state.
974     * Reading from this pointer when `result_ok` is not set is undefined.
975     */
976    struct LDKCounterpartyChannelTransactionParameters *result;
977    /**
978     * A pointer to the contents in the error state.
979     * Reading from this pointer when `result_ok` is set is undefined.
980     */
981    struct LDKDecodeError *err;
982 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
983
984 /**
985  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
986  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
987  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
988  */
989 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
990    /**
991     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
992     * `err` or `result` depending on the state of `result_ok`.
993     */
994    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
995    /**
996     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
997     */
998    bool result_ok;
999 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
1000
1001
1002
1003 /**
1004  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
1005  * The fields are organized by holder/counterparty.
1006  *
1007  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
1008  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
1009  */
1010 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
1011    /**
1012     * A pointer to the opaque Rust object.
1013     * Nearly everywhere, inner must be non-null, however in places where
1014     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1015     */
1016    LDKnativeChannelTransactionParameters *inner;
1017    /**
1018     * Indicates that this is the only struct which contains the same pointer.
1019     * Rust functions which take ownership of an object provided via an argument require
1020     * this to be true and invalidate the object pointed to by inner.
1021     */
1022    bool is_owned;
1023 } LDKChannelTransactionParameters;
1024
1025 /**
1026  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
1027  */
1028 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
1029    /**
1030     * A pointer to the contents in the success state.
1031     * Reading from this pointer when `result_ok` is not set is undefined.
1032     */
1033    struct LDKChannelTransactionParameters *result;
1034    /**
1035     * A pointer to the contents in the error state.
1036     * Reading from this pointer when `result_ok` is set is undefined.
1037     */
1038    struct LDKDecodeError *err;
1039 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
1040
1041 /**
1042  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1043  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1044  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1045  */
1046 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
1047    /**
1048     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
1049     * `err` or `result` depending on the state of `result_ok`.
1050     */
1051    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
1052    /**
1053     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
1054     */
1055    bool result_ok;
1056 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
1057
1058 /**
1059  * Represents a secp256k1 signature serialized as two 32-byte numbers
1060  */
1061 typedef struct LDKSignature {
1062    /**
1063     * The bytes of the signature in "compact" form
1064     */
1065    uint8_t compact_form[64];
1066 } LDKSignature;
1067
1068 /**
1069  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1070  * This corresponds to std::vector in C++
1071  */
1072 typedef struct LDKCVec_SignatureZ {
1073    /**
1074     * The elements in the array.
1075     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1076     */
1077    struct LDKSignature *data;
1078    /**
1079     * The number of elements pointed to by `data`.
1080     */
1081    uintptr_t datalen;
1082 } LDKCVec_SignatureZ;
1083
1084
1085
1086 /**
1087  * Information needed to build and sign a holder's commitment transaction.
1088  *
1089  * The transaction is only signed once we are ready to broadcast.
1090  */
1091 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
1092    /**
1093     * A pointer to the opaque Rust object.
1094     * Nearly everywhere, inner must be non-null, however in places where
1095     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1096     */
1097    LDKnativeHolderCommitmentTransaction *inner;
1098    /**
1099     * Indicates that this is the only struct which contains the same pointer.
1100     * Rust functions which take ownership of an object provided via an argument require
1101     * this to be true and invalidate the object pointed to by inner.
1102     */
1103    bool is_owned;
1104 } LDKHolderCommitmentTransaction;
1105
1106 /**
1107  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1108  */
1109 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
1110    /**
1111     * A pointer to the contents in the success state.
1112     * Reading from this pointer when `result_ok` is not set is undefined.
1113     */
1114    struct LDKHolderCommitmentTransaction *result;
1115    /**
1116     * A pointer to the contents in the error state.
1117     * Reading from this pointer when `result_ok` is set is undefined.
1118     */
1119    struct LDKDecodeError *err;
1120 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
1121
1122 /**
1123  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1124  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1125  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1126  */
1127 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
1128    /**
1129     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1130     * `err` or `result` depending on the state of `result_ok`.
1131     */
1132    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
1133    /**
1134     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1135     */
1136    bool result_ok;
1137 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
1138
1139
1140
1141 /**
1142  * A pre-built Bitcoin commitment transaction and its txid.
1143  */
1144 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
1145    /**
1146     * A pointer to the opaque Rust object.
1147     * Nearly everywhere, inner must be non-null, however in places where
1148     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1149     */
1150    LDKnativeBuiltCommitmentTransaction *inner;
1151    /**
1152     * Indicates that this is the only struct which contains the same pointer.
1153     * Rust functions which take ownership of an object provided via an argument require
1154     * this to be true and invalidate the object pointed to by inner.
1155     */
1156    bool is_owned;
1157 } LDKBuiltCommitmentTransaction;
1158
1159 /**
1160  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1161  */
1162 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1163    /**
1164     * A pointer to the contents in the success state.
1165     * Reading from this pointer when `result_ok` is not set is undefined.
1166     */
1167    struct LDKBuiltCommitmentTransaction *result;
1168    /**
1169     * A pointer to the contents in the error state.
1170     * Reading from this pointer when `result_ok` is set is undefined.
1171     */
1172    struct LDKDecodeError *err;
1173 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
1174
1175 /**
1176  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1177  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1178  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1179  */
1180 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
1181    /**
1182     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1183     * `err` or `result` depending on the state of `result_ok`.
1184     */
1185    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
1186    /**
1187     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1188     */
1189    bool result_ok;
1190 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
1191
1192
1193
1194 /**
1195  * A wrapper on ClosingTransaction indicating that the built bitcoin
1196  * transaction is trusted.
1197  *
1198  * See trust() and verify() functions on CommitmentTransaction.
1199  *
1200  * This structure implements Deref.
1201  */
1202 typedef struct MUST_USE_STRUCT LDKTrustedClosingTransaction {
1203    /**
1204     * A pointer to the opaque Rust object.
1205     * Nearly everywhere, inner must be non-null, however in places where
1206     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1207     */
1208    LDKnativeTrustedClosingTransaction *inner;
1209    /**
1210     * Indicates that this is the only struct which contains the same pointer.
1211     * Rust functions which take ownership of an object provided via an argument require
1212     * this to be true and invalidate the object pointed to by inner.
1213     */
1214    bool is_owned;
1215 } LDKTrustedClosingTransaction;
1216
1217 /**
1218  * The contents of CResult_TrustedClosingTransactionNoneZ
1219  */
1220 typedef union LDKCResult_TrustedClosingTransactionNoneZPtr {
1221    /**
1222     * A pointer to the contents in the success state.
1223     * Reading from this pointer when `result_ok` is not set is undefined.
1224     */
1225    struct LDKTrustedClosingTransaction *result;
1226    /**
1227     * Note that this value is always NULL, as there are no contents in the Err variant
1228     */
1229    void *err;
1230 } LDKCResult_TrustedClosingTransactionNoneZPtr;
1231
1232 /**
1233  * A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1234  * containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1235  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1236  */
1237 typedef struct LDKCResult_TrustedClosingTransactionNoneZ {
1238    /**
1239     * The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1240     * `err` or `result` depending on the state of `result_ok`.
1241     */
1242    union LDKCResult_TrustedClosingTransactionNoneZPtr contents;
1243    /**
1244     * Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1245     */
1246    bool result_ok;
1247 } LDKCResult_TrustedClosingTransactionNoneZ;
1248
1249
1250
1251 /**
1252  * This class tracks the per-transaction information needed to build a commitment transaction and will
1253  * actually build it and sign.  It is used for holder transactions that we sign only when needed
1254  * and for transactions we sign for the counterparty.
1255  *
1256  * This class can be used inside a signer implementation to generate a signature given the relevant
1257  * secret key.
1258  */
1259 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1260    /**
1261     * A pointer to the opaque Rust object.
1262     * Nearly everywhere, inner must be non-null, however in places where
1263     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1264     */
1265    LDKnativeCommitmentTransaction *inner;
1266    /**
1267     * Indicates that this is the only struct which contains the same pointer.
1268     * Rust functions which take ownership of an object provided via an argument require
1269     * this to be true and invalidate the object pointed to by inner.
1270     */
1271    bool is_owned;
1272 } LDKCommitmentTransaction;
1273
1274 /**
1275  * The contents of CResult_CommitmentTransactionDecodeErrorZ
1276  */
1277 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
1278    /**
1279     * A pointer to the contents in the success state.
1280     * Reading from this pointer when `result_ok` is not set is undefined.
1281     */
1282    struct LDKCommitmentTransaction *result;
1283    /**
1284     * A pointer to the contents in the error state.
1285     * Reading from this pointer when `result_ok` is set is undefined.
1286     */
1287    struct LDKDecodeError *err;
1288 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
1289
1290 /**
1291  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1292  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1293  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1294  */
1295 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
1296    /**
1297     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1298     * `err` or `result` depending on the state of `result_ok`.
1299     */
1300    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
1301    /**
1302     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1303     */
1304    bool result_ok;
1305 } LDKCResult_CommitmentTransactionDecodeErrorZ;
1306
1307
1308
1309 /**
1310  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1311  * transaction and the transaction creation keys) are trusted.
1312  *
1313  * See trust() and verify() functions on CommitmentTransaction.
1314  *
1315  * This structure implements Deref.
1316  */
1317 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
1318    /**
1319     * A pointer to the opaque Rust object.
1320     * Nearly everywhere, inner must be non-null, however in places where
1321     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1322     */
1323    LDKnativeTrustedCommitmentTransaction *inner;
1324    /**
1325     * Indicates that this is the only struct which contains the same pointer.
1326     * Rust functions which take ownership of an object provided via an argument require
1327     * this to be true and invalidate the object pointed to by inner.
1328     */
1329    bool is_owned;
1330 } LDKTrustedCommitmentTransaction;
1331
1332 /**
1333  * The contents of CResult_TrustedCommitmentTransactionNoneZ
1334  */
1335 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
1336    /**
1337     * A pointer to the contents in the success state.
1338     * Reading from this pointer when `result_ok` is not set is undefined.
1339     */
1340    struct LDKTrustedCommitmentTransaction *result;
1341    /**
1342     * Note that this value is always NULL, as there are no contents in the Err variant
1343     */
1344    void *err;
1345 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
1346
1347 /**
1348  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1349  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1350  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1351  */
1352 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
1353    /**
1354     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1355     * `err` or `result` depending on the state of `result_ok`.
1356     */
1357    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
1358    /**
1359     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1360     */
1361    bool result_ok;
1362 } LDKCResult_TrustedCommitmentTransactionNoneZ;
1363
1364 /**
1365  * The contents of CResult_CVec_SignatureZNoneZ
1366  */
1367 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
1368    /**
1369     * A pointer to the contents in the success state.
1370     * Reading from this pointer when `result_ok` is not set is undefined.
1371     */
1372    struct LDKCVec_SignatureZ *result;
1373    /**
1374     * Note that this value is always NULL, as there are no contents in the Err variant
1375     */
1376    void *err;
1377 } LDKCResult_CVec_SignatureZNoneZPtr;
1378
1379 /**
1380  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1381  * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1382  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1383  */
1384 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1385    /**
1386     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1387     * `err` or `result` depending on the state of `result_ok`.
1388     */
1389    union LDKCResult_CVec_SignatureZNoneZPtr contents;
1390    /**
1391     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1392     */
1393    bool result_ok;
1394 } LDKCResult_CVec_SignatureZNoneZ;
1395
1396
1397
1398 /**
1399  * A script pubkey for shutting down a channel as defined by [BOLT #2].
1400  *
1401  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
1402  */
1403 typedef struct MUST_USE_STRUCT LDKShutdownScript {
1404    /**
1405     * A pointer to the opaque Rust object.
1406     * Nearly everywhere, inner must be non-null, however in places where
1407     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1408     */
1409    LDKnativeShutdownScript *inner;
1410    /**
1411     * Indicates that this is the only struct which contains the same pointer.
1412     * Rust functions which take ownership of an object provided via an argument require
1413     * this to be true and invalidate the object pointed to by inner.
1414     */
1415    bool is_owned;
1416 } LDKShutdownScript;
1417
1418 /**
1419  * The contents of CResult_ShutdownScriptDecodeErrorZ
1420  */
1421 typedef union LDKCResult_ShutdownScriptDecodeErrorZPtr {
1422    /**
1423     * A pointer to the contents in the success state.
1424     * Reading from this pointer when `result_ok` is not set is undefined.
1425     */
1426    struct LDKShutdownScript *result;
1427    /**
1428     * A pointer to the contents in the error state.
1429     * Reading from this pointer when `result_ok` is set is undefined.
1430     */
1431    struct LDKDecodeError *err;
1432 } LDKCResult_ShutdownScriptDecodeErrorZPtr;
1433
1434 /**
1435  * A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1436  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1437  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1438  */
1439 typedef struct LDKCResult_ShutdownScriptDecodeErrorZ {
1440    /**
1441     * The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1442     * `err` or `result` depending on the state of `result_ok`.
1443     */
1444    union LDKCResult_ShutdownScriptDecodeErrorZPtr contents;
1445    /**
1446     * Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1447     */
1448    bool result_ok;
1449 } LDKCResult_ShutdownScriptDecodeErrorZ;
1450
1451
1452
1453 /**
1454  * An error occurring when converting from [`Script`] to [`ShutdownScript`].
1455  */
1456 typedef struct MUST_USE_STRUCT LDKInvalidShutdownScript {
1457    /**
1458     * A pointer to the opaque Rust object.
1459     * Nearly everywhere, inner must be non-null, however in places where
1460     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1461     */
1462    LDKnativeInvalidShutdownScript *inner;
1463    /**
1464     * Indicates that this is the only struct which contains the same pointer.
1465     * Rust functions which take ownership of an object provided via an argument require
1466     * this to be true and invalidate the object pointed to by inner.
1467     */
1468    bool is_owned;
1469 } LDKInvalidShutdownScript;
1470
1471 /**
1472  * The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1473  */
1474 typedef union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr {
1475    /**
1476     * A pointer to the contents in the success state.
1477     * Reading from this pointer when `result_ok` is not set is undefined.
1478     */
1479    struct LDKShutdownScript *result;
1480    /**
1481     * A pointer to the contents in the error state.
1482     * Reading from this pointer when `result_ok` is set is undefined.
1483     */
1484    struct LDKInvalidShutdownScript *err;
1485 } LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr;
1486
1487 /**
1488  * A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1489  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1490  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1491  */
1492 typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ {
1493    /**
1494     * The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1495     * `err` or `result` depending on the state of `result_ok`.
1496     */
1497    union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr contents;
1498    /**
1499     * Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1500     */
1501    bool result_ok;
1502 } LDKCResult_ShutdownScriptInvalidShutdownScriptZ;
1503
1504 /**
1505  * The contents of CResult_NoneErrorZ
1506  */
1507 typedef union LDKCResult_NoneErrorZPtr {
1508    /**
1509     * Note that this value is always NULL, as there are no contents in the OK variant
1510     */
1511    void *result;
1512    /**
1513     * A pointer to the contents in the error state.
1514     * Reading from this pointer when `result_ok` is set is undefined.
1515     */
1516    enum LDKIOError *err;
1517 } LDKCResult_NoneErrorZPtr;
1518
1519 /**
1520  * A CResult_NoneErrorZ represents the result of a fallible operation,
1521  * containing a () on success and a crate::c_types::IOError on failure.
1522  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1523  */
1524 typedef struct LDKCResult_NoneErrorZ {
1525    /**
1526     * The contents of this CResult_NoneErrorZ, accessible via either
1527     * `err` or `result` depending on the state of `result_ok`.
1528     */
1529    union LDKCResult_NoneErrorZPtr contents;
1530    /**
1531     * Whether this CResult_NoneErrorZ represents a success state.
1532     */
1533    bool result_ok;
1534 } LDKCResult_NoneErrorZ;
1535
1536
1537
1538 /**
1539  * A hop in a route
1540  */
1541 typedef struct MUST_USE_STRUCT LDKRouteHop {
1542    /**
1543     * A pointer to the opaque Rust object.
1544     * Nearly everywhere, inner must be non-null, however in places where
1545     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1546     */
1547    LDKnativeRouteHop *inner;
1548    /**
1549     * Indicates that this is the only struct which contains the same pointer.
1550     * Rust functions which take ownership of an object provided via an argument require
1551     * this to be true and invalidate the object pointed to by inner.
1552     */
1553    bool is_owned;
1554 } LDKRouteHop;
1555
1556 /**
1557  * The contents of CResult_RouteHopDecodeErrorZ
1558  */
1559 typedef union LDKCResult_RouteHopDecodeErrorZPtr {
1560    /**
1561     * A pointer to the contents in the success state.
1562     * Reading from this pointer when `result_ok` is not set is undefined.
1563     */
1564    struct LDKRouteHop *result;
1565    /**
1566     * A pointer to the contents in the error state.
1567     * Reading from this pointer when `result_ok` is set is undefined.
1568     */
1569    struct LDKDecodeError *err;
1570 } LDKCResult_RouteHopDecodeErrorZPtr;
1571
1572 /**
1573  * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1574  * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1575  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1576  */
1577 typedef struct LDKCResult_RouteHopDecodeErrorZ {
1578    /**
1579     * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1580     * `err` or `result` depending on the state of `result_ok`.
1581     */
1582    union LDKCResult_RouteHopDecodeErrorZPtr contents;
1583    /**
1584     * Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1585     */
1586    bool result_ok;
1587 } LDKCResult_RouteHopDecodeErrorZ;
1588
1589 /**
1590  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1591  * This corresponds to std::vector in C++
1592  */
1593 typedef struct LDKCVec_RouteHopZ {
1594    /**
1595     * The elements in the array.
1596     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1597     */
1598    struct LDKRouteHop *data;
1599    /**
1600     * The number of elements pointed to by `data`.
1601     */
1602    uintptr_t datalen;
1603 } LDKCVec_RouteHopZ;
1604
1605 /**
1606  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1607  * This corresponds to std::vector in C++
1608  */
1609 typedef struct LDKCVec_CVec_RouteHopZZ {
1610    /**
1611     * The elements in the array.
1612     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1613     */
1614    struct LDKCVec_RouteHopZ *data;
1615    /**
1616     * The number of elements pointed to by `data`.
1617     */
1618    uintptr_t datalen;
1619 } LDKCVec_CVec_RouteHopZZ;
1620
1621
1622
1623 /**
1624  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
1625  * it can take multiple paths. Each path is composed of one or more hops through the network.
1626  */
1627 typedef struct MUST_USE_STRUCT LDKRoute {
1628    /**
1629     * A pointer to the opaque Rust object.
1630     * Nearly everywhere, inner must be non-null, however in places where
1631     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1632     */
1633    LDKnativeRoute *inner;
1634    /**
1635     * Indicates that this is the only struct which contains the same pointer.
1636     * Rust functions which take ownership of an object provided via an argument require
1637     * this to be true and invalidate the object pointed to by inner.
1638     */
1639    bool is_owned;
1640 } LDKRoute;
1641
1642 /**
1643  * The contents of CResult_RouteDecodeErrorZ
1644  */
1645 typedef union LDKCResult_RouteDecodeErrorZPtr {
1646    /**
1647     * A pointer to the contents in the success state.
1648     * Reading from this pointer when `result_ok` is not set is undefined.
1649     */
1650    struct LDKRoute *result;
1651    /**
1652     * A pointer to the contents in the error state.
1653     * Reading from this pointer when `result_ok` is set is undefined.
1654     */
1655    struct LDKDecodeError *err;
1656 } LDKCResult_RouteDecodeErrorZPtr;
1657
1658 /**
1659  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1660  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1661  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1662  */
1663 typedef struct LDKCResult_RouteDecodeErrorZ {
1664    /**
1665     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
1666     * `err` or `result` depending on the state of `result_ok`.
1667     */
1668    union LDKCResult_RouteDecodeErrorZPtr contents;
1669    /**
1670     * Whether this CResult_RouteDecodeErrorZ represents a success state.
1671     */
1672    bool result_ok;
1673 } LDKCResult_RouteDecodeErrorZ;
1674
1675
1676
1677 /**
1678  * Parameters needed to find a [`Route`].
1679  *
1680  * Passed to [`find_route`] and also provided in [`Event::PaymentPathFailed`] for retrying a failed
1681  * payment path.
1682  *
1683  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
1684  */
1685 typedef struct MUST_USE_STRUCT LDKRouteParameters {
1686    /**
1687     * A pointer to the opaque Rust object.
1688     * Nearly everywhere, inner must be non-null, however in places where
1689     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1690     */
1691    LDKnativeRouteParameters *inner;
1692    /**
1693     * Indicates that this is the only struct which contains the same pointer.
1694     * Rust functions which take ownership of an object provided via an argument require
1695     * this to be true and invalidate the object pointed to by inner.
1696     */
1697    bool is_owned;
1698 } LDKRouteParameters;
1699
1700 /**
1701  * The contents of CResult_RouteParametersDecodeErrorZ
1702  */
1703 typedef union LDKCResult_RouteParametersDecodeErrorZPtr {
1704    /**
1705     * A pointer to the contents in the success state.
1706     * Reading from this pointer when `result_ok` is not set is undefined.
1707     */
1708    struct LDKRouteParameters *result;
1709    /**
1710     * A pointer to the contents in the error state.
1711     * Reading from this pointer when `result_ok` is set is undefined.
1712     */
1713    struct LDKDecodeError *err;
1714 } LDKCResult_RouteParametersDecodeErrorZPtr;
1715
1716 /**
1717  * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
1718  * containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1719  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1720  */
1721 typedef struct LDKCResult_RouteParametersDecodeErrorZ {
1722    /**
1723     * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
1724     * `err` or `result` depending on the state of `result_ok`.
1725     */
1726    union LDKCResult_RouteParametersDecodeErrorZPtr contents;
1727    /**
1728     * Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
1729     */
1730    bool result_ok;
1731 } LDKCResult_RouteParametersDecodeErrorZ;
1732
1733
1734
1735 /**
1736  * A list of hops along a payment path terminating with a channel to the recipient.
1737  */
1738 typedef struct MUST_USE_STRUCT LDKRouteHint {
1739    /**
1740     * A pointer to the opaque Rust object.
1741     * Nearly everywhere, inner must be non-null, however in places where
1742     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1743     */
1744    LDKnativeRouteHint *inner;
1745    /**
1746     * Indicates that this is the only struct which contains the same pointer.
1747     * Rust functions which take ownership of an object provided via an argument require
1748     * this to be true and invalidate the object pointed to by inner.
1749     */
1750    bool is_owned;
1751 } LDKRouteHint;
1752
1753 /**
1754  * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1755  * This corresponds to std::vector in C++
1756  */
1757 typedef struct LDKCVec_RouteHintZ {
1758    /**
1759     * The elements in the array.
1760     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1761     */
1762    struct LDKRouteHint *data;
1763    /**
1764     * The number of elements pointed to by `data`.
1765     */
1766    uintptr_t datalen;
1767 } LDKCVec_RouteHintZ;
1768
1769 /**
1770  * An enum which can either contain a u64 or not
1771  */
1772 typedef enum LDKCOption_u64Z_Tag {
1773    /**
1774     * When we're in this state, this COption_u64Z contains a u64
1775     */
1776    LDKCOption_u64Z_Some,
1777    /**
1778     * When we're in this state, this COption_u64Z contains nothing
1779     */
1780    LDKCOption_u64Z_None,
1781    /**
1782     * Must be last for serialization purposes
1783     */
1784    LDKCOption_u64Z_Sentinel,
1785 } LDKCOption_u64Z_Tag;
1786
1787 typedef struct LDKCOption_u64Z {
1788    LDKCOption_u64Z_Tag tag;
1789    union {
1790       struct {
1791          uint64_t some;
1792       };
1793    };
1794 } LDKCOption_u64Z;
1795
1796
1797
1798 /**
1799  * The recipient of a payment.
1800  */
1801 typedef struct MUST_USE_STRUCT LDKPaymentParameters {
1802    /**
1803     * A pointer to the opaque Rust object.
1804     * Nearly everywhere, inner must be non-null, however in places where
1805     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1806     */
1807    LDKnativePaymentParameters *inner;
1808    /**
1809     * Indicates that this is the only struct which contains the same pointer.
1810     * Rust functions which take ownership of an object provided via an argument require
1811     * this to be true and invalidate the object pointed to by inner.
1812     */
1813    bool is_owned;
1814 } LDKPaymentParameters;
1815
1816 /**
1817  * The contents of CResult_PaymentParametersDecodeErrorZ
1818  */
1819 typedef union LDKCResult_PaymentParametersDecodeErrorZPtr {
1820    /**
1821     * A pointer to the contents in the success state.
1822     * Reading from this pointer when `result_ok` is not set is undefined.
1823     */
1824    struct LDKPaymentParameters *result;
1825    /**
1826     * A pointer to the contents in the error state.
1827     * Reading from this pointer when `result_ok` is set is undefined.
1828     */
1829    struct LDKDecodeError *err;
1830 } LDKCResult_PaymentParametersDecodeErrorZPtr;
1831
1832 /**
1833  * A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
1834  * containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1835  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1836  */
1837 typedef struct LDKCResult_PaymentParametersDecodeErrorZ {
1838    /**
1839     * The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
1840     * `err` or `result` depending on the state of `result_ok`.
1841     */
1842    union LDKCResult_PaymentParametersDecodeErrorZPtr contents;
1843    /**
1844     * Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
1845     */
1846    bool result_ok;
1847 } LDKCResult_PaymentParametersDecodeErrorZ;
1848
1849
1850
1851 /**
1852  * A channel descriptor for a hop along a payment path.
1853  */
1854 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
1855    /**
1856     * A pointer to the opaque Rust object.
1857     * Nearly everywhere, inner must be non-null, however in places where
1858     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1859     */
1860    LDKnativeRouteHintHop *inner;
1861    /**
1862     * Indicates that this is the only struct which contains the same pointer.
1863     * Rust functions which take ownership of an object provided via an argument require
1864     * this to be true and invalidate the object pointed to by inner.
1865     */
1866    bool is_owned;
1867 } LDKRouteHintHop;
1868
1869 /**
1870  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
1871  * This corresponds to std::vector in C++
1872  */
1873 typedef struct LDKCVec_RouteHintHopZ {
1874    /**
1875     * The elements in the array.
1876     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1877     */
1878    struct LDKRouteHintHop *data;
1879    /**
1880     * The number of elements pointed to by `data`.
1881     */
1882    uintptr_t datalen;
1883 } LDKCVec_RouteHintHopZ;
1884
1885 /**
1886  * The contents of CResult_RouteHintDecodeErrorZ
1887  */
1888 typedef union LDKCResult_RouteHintDecodeErrorZPtr {
1889    /**
1890     * A pointer to the contents in the success state.
1891     * Reading from this pointer when `result_ok` is not set is undefined.
1892     */
1893    struct LDKRouteHint *result;
1894    /**
1895     * A pointer to the contents in the error state.
1896     * Reading from this pointer when `result_ok` is set is undefined.
1897     */
1898    struct LDKDecodeError *err;
1899 } LDKCResult_RouteHintDecodeErrorZPtr;
1900
1901 /**
1902  * A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
1903  * containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
1904  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1905  */
1906 typedef struct LDKCResult_RouteHintDecodeErrorZ {
1907    /**
1908     * The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
1909     * `err` or `result` depending on the state of `result_ok`.
1910     */
1911    union LDKCResult_RouteHintDecodeErrorZPtr contents;
1912    /**
1913     * Whether this CResult_RouteHintDecodeErrorZ represents a success state.
1914     */
1915    bool result_ok;
1916 } LDKCResult_RouteHintDecodeErrorZ;
1917
1918 /**
1919  * The contents of CResult_RouteHintHopDecodeErrorZ
1920  */
1921 typedef union LDKCResult_RouteHintHopDecodeErrorZPtr {
1922    /**
1923     * A pointer to the contents in the success state.
1924     * Reading from this pointer when `result_ok` is not set is undefined.
1925     */
1926    struct LDKRouteHintHop *result;
1927    /**
1928     * A pointer to the contents in the error state.
1929     * Reading from this pointer when `result_ok` is set is undefined.
1930     */
1931    struct LDKDecodeError *err;
1932 } LDKCResult_RouteHintHopDecodeErrorZPtr;
1933
1934 /**
1935  * A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
1936  * containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1937  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1938  */
1939 typedef struct LDKCResult_RouteHintHopDecodeErrorZ {
1940    /**
1941     * The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
1942     * `err` or `result` depending on the state of `result_ok`.
1943     */
1944    union LDKCResult_RouteHintHopDecodeErrorZPtr contents;
1945    /**
1946     * Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
1947     */
1948    bool result_ok;
1949 } LDKCResult_RouteHintHopDecodeErrorZ;
1950
1951
1952
1953 /**
1954  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
1955  */
1956 typedef struct MUST_USE_STRUCT LDKChannelDetails {
1957    /**
1958     * A pointer to the opaque Rust object.
1959     * Nearly everywhere, inner must be non-null, however in places where
1960     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1961     */
1962    LDKnativeChannelDetails *inner;
1963    /**
1964     * Indicates that this is the only struct which contains the same pointer.
1965     * Rust functions which take ownership of an object provided via an argument require
1966     * this to be true and invalidate the object pointed to by inner.
1967     */
1968    bool is_owned;
1969 } LDKChannelDetails;
1970
1971 /**
1972  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
1973  * This corresponds to std::vector in C++
1974  */
1975 typedef struct LDKCVec_ChannelDetailsZ {
1976    /**
1977     * The elements in the array.
1978     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1979     */
1980    struct LDKChannelDetails *data;
1981    /**
1982     * The number of elements pointed to by `data`.
1983     */
1984    uintptr_t datalen;
1985 } LDKCVec_ChannelDetailsZ;
1986
1987
1988
1989 /**
1990  * An Err type for failure to process messages.
1991  */
1992 typedef struct MUST_USE_STRUCT LDKLightningError {
1993    /**
1994     * A pointer to the opaque Rust object.
1995     * Nearly everywhere, inner must be non-null, however in places where
1996     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1997     */
1998    LDKnativeLightningError *inner;
1999    /**
2000     * Indicates that this is the only struct which contains the same pointer.
2001     * Rust functions which take ownership of an object provided via an argument require
2002     * this to be true and invalidate the object pointed to by inner.
2003     */
2004    bool is_owned;
2005 } LDKLightningError;
2006
2007 /**
2008  * The contents of CResult_RouteLightningErrorZ
2009  */
2010 typedef union LDKCResult_RouteLightningErrorZPtr {
2011    /**
2012     * A pointer to the contents in the success state.
2013     * Reading from this pointer when `result_ok` is not set is undefined.
2014     */
2015    struct LDKRoute *result;
2016    /**
2017     * A pointer to the contents in the error state.
2018     * Reading from this pointer when `result_ok` is set is undefined.
2019     */
2020    struct LDKLightningError *err;
2021 } LDKCResult_RouteLightningErrorZPtr;
2022
2023 /**
2024  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2025  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2026  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2027  */
2028 typedef struct LDKCResult_RouteLightningErrorZ {
2029    /**
2030     * The contents of this CResult_RouteLightningErrorZ, accessible via either
2031     * `err` or `result` depending on the state of `result_ok`.
2032     */
2033    union LDKCResult_RouteLightningErrorZPtr contents;
2034    /**
2035     * Whether this CResult_RouteLightningErrorZ represents a success state.
2036     */
2037    bool result_ok;
2038 } LDKCResult_RouteLightningErrorZ;
2039
2040 /**
2041  * The contents of CResult_TxOutAccessErrorZ
2042  */
2043 typedef union LDKCResult_TxOutAccessErrorZPtr {
2044    /**
2045     * A pointer to the contents in the success state.
2046     * Reading from this pointer when `result_ok` is not set is undefined.
2047     */
2048    struct LDKTxOut *result;
2049    /**
2050     * A pointer to the contents in the error state.
2051     * Reading from this pointer when `result_ok` is set is undefined.
2052     */
2053    enum LDKAccessError *err;
2054 } LDKCResult_TxOutAccessErrorZPtr;
2055
2056 /**
2057  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2058  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2059  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2060  */
2061 typedef struct LDKCResult_TxOutAccessErrorZ {
2062    /**
2063     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
2064     * `err` or `result` depending on the state of `result_ok`.
2065     */
2066    union LDKCResult_TxOutAccessErrorZPtr contents;
2067    /**
2068     * Whether this CResult_TxOutAccessErrorZ represents a success state.
2069     */
2070    bool result_ok;
2071 } LDKCResult_TxOutAccessErrorZ;
2072
2073 /**
2074  * A tuple of 2 elements. See the individual fields for the types contained.
2075  */
2076 typedef struct LDKC2Tuple_usizeTransactionZ {
2077    /**
2078     * The element at position 0
2079     */
2080    uintptr_t a;
2081    /**
2082     * The element at position 1
2083     */
2084    struct LDKTransaction b;
2085 } LDKC2Tuple_usizeTransactionZ;
2086
2087 /**
2088  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2089  * This corresponds to std::vector in C++
2090  */
2091 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
2092    /**
2093     * The elements in the array.
2094     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2095     */
2096    struct LDKC2Tuple_usizeTransactionZ *data;
2097    /**
2098     * The number of elements pointed to by `data`.
2099     */
2100    uintptr_t datalen;
2101 } LDKCVec_C2Tuple_usizeTransactionZZ;
2102
2103 /**
2104  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
2105  * look up the corresponding function in rust-lightning's docs.
2106  */
2107 typedef struct LDKThirtyTwoBytes {
2108    /**
2109     * The thirty-two bytes
2110     */
2111    uint8_t data[32];
2112 } LDKThirtyTwoBytes;
2113
2114 /**
2115  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2116  * This corresponds to std::vector in C++
2117  */
2118 typedef struct LDKCVec_TxidZ {
2119    /**
2120     * The elements in the array.
2121     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2122     */
2123    struct LDKThirtyTwoBytes *data;
2124    /**
2125     * The number of elements pointed to by `data`.
2126     */
2127    uintptr_t datalen;
2128 } LDKCVec_TxidZ;
2129
2130 /**
2131  * The contents of CResult_NoneChannelMonitorUpdateErrZ
2132  */
2133 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
2134    /**
2135     * Note that this value is always NULL, as there are no contents in the OK variant
2136     */
2137    void *result;
2138    /**
2139     * A pointer to the contents in the error state.
2140     * Reading from this pointer when `result_ok` is set is undefined.
2141     */
2142    enum LDKChannelMonitorUpdateErr *err;
2143 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
2144
2145 /**
2146  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2147  * containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
2148  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2149  */
2150 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
2151    /**
2152     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2153     * `err` or `result` depending on the state of `result_ok`.
2154     */
2155    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
2156    /**
2157     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2158     */
2159    bool result_ok;
2160 } LDKCResult_NoneChannelMonitorUpdateErrZ;
2161
2162
2163
2164 /**
2165  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
2166  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
2167  * preimage claim backward will lead to loss of funds.
2168  */
2169 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
2170    /**
2171     * A pointer to the opaque Rust object.
2172     * Nearly everywhere, inner must be non-null, however in places where
2173     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2174     */
2175    LDKnativeHTLCUpdate *inner;
2176    /**
2177     * Indicates that this is the only struct which contains the same pointer.
2178     * Rust functions which take ownership of an object provided via an argument require
2179     * this to be true and invalidate the object pointed to by inner.
2180     */
2181    bool is_owned;
2182 } LDKHTLCUpdate;
2183
2184
2185
2186 /**
2187  * A reference to a transaction output.
2188  *
2189  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
2190  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
2191  */
2192 typedef struct MUST_USE_STRUCT LDKOutPoint {
2193    /**
2194     * A pointer to the opaque Rust object.
2195     * Nearly everywhere, inner must be non-null, however in places where
2196     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2197     */
2198    LDKnativeOutPoint *inner;
2199    /**
2200     * Indicates that this is the only struct which contains the same pointer.
2201     * Rust functions which take ownership of an object provided via an argument require
2202     * this to be true and invalidate the object pointed to by inner.
2203     */
2204    bool is_owned;
2205 } LDKOutPoint;
2206
2207 /**
2208  * An event to be processed by the ChannelManager.
2209  */
2210 typedef enum LDKMonitorEvent_Tag {
2211    /**
2212     * A monitor event containing an HTLCUpdate.
2213     */
2214    LDKMonitorEvent_HTLCEvent,
2215    /**
2216     * A monitor event that the Channel's commitment transaction was confirmed.
2217     */
2218    LDKMonitorEvent_CommitmentTxConfirmed,
2219    /**
2220     * Indicates a [`ChannelMonitor`] update has completed. See
2221     * [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used.
2222     *
2223     * [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure
2224     */
2225    LDKMonitorEvent_UpdateCompleted,
2226    /**
2227     * Indicates a [`ChannelMonitor`] update has failed. See
2228     * [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used.
2229     *
2230     * [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
2231     */
2232    LDKMonitorEvent_UpdateFailed,
2233    /**
2234     * Must be last for serialization purposes
2235     */
2236    LDKMonitorEvent_Sentinel,
2237 } LDKMonitorEvent_Tag;
2238
2239 typedef struct LDKMonitorEvent_LDKUpdateCompleted_Body {
2240    /**
2241     * The funding outpoint of the [`ChannelMonitor`] that was updated
2242     */
2243    struct LDKOutPoint funding_txo;
2244    /**
2245     * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
2246     * [`ChannelMonitor::get_latest_update_id`].
2247     *
2248     * Note that this should only be set to a given update's ID if all previous updates for the
2249     * same [`ChannelMonitor`] have been applied and persisted.
2250     */
2251    uint64_t monitor_update_id;
2252 } LDKMonitorEvent_LDKUpdateCompleted_Body;
2253
2254 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
2255    LDKMonitorEvent_Tag tag;
2256    union {
2257       struct {
2258          struct LDKHTLCUpdate htlc_event;
2259       };
2260       struct {
2261          struct LDKOutPoint commitment_tx_confirmed;
2262       };
2263       LDKMonitorEvent_LDKUpdateCompleted_Body update_completed;
2264       struct {
2265          struct LDKOutPoint update_failed;
2266       };
2267    };
2268 } LDKMonitorEvent;
2269
2270 /**
2271  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2272  * This corresponds to std::vector in C++
2273  */
2274 typedef struct LDKCVec_MonitorEventZ {
2275    /**
2276     * The elements in the array.
2277     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2278     */
2279    struct LDKMonitorEvent *data;
2280    /**
2281     * The number of elements pointed to by `data`.
2282     */
2283    uintptr_t datalen;
2284 } LDKCVec_MonitorEventZ;
2285
2286 /**
2287  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
2288  */
2289 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
2290    /**
2291     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
2292     */
2293    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
2294    /**
2295     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
2296     */
2297    LDKCOption_C2Tuple_usizeTransactionZZ_None,
2298    /**
2299     * Must be last for serialization purposes
2300     */
2301    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
2302 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
2303
2304 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
2305    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
2306    union {
2307       struct {
2308          struct LDKC2Tuple_usizeTransactionZ some;
2309       };
2310    };
2311 } LDKCOption_C2Tuple_usizeTransactionZZ;
2312
2313 /**
2314  * The reason the channel was closed. See individual variants more details.
2315  */
2316 typedef enum LDKClosureReason_Tag {
2317    /**
2318     * Closure generated from receiving a peer error message.
2319     *
2320     * Our counterparty may have broadcasted their latest commitment state, and we have
2321     * as well.
2322     */
2323    LDKClosureReason_CounterpartyForceClosed,
2324    /**
2325     * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
2326     *
2327     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
2328     */
2329    LDKClosureReason_HolderForceClosed,
2330    /**
2331     * The channel was closed after negotiating a cooperative close and we've now broadcasted
2332     * the cooperative close transaction. Note the shutdown may have been initiated by us.
2333     */
2334    LDKClosureReason_CooperativeClosure,
2335    /**
2336     * A commitment transaction was confirmed on chain, closing the channel. Most likely this
2337     * commitment transaction came from our counterparty, but it may also have come from
2338     * a copy of our own `ChannelMonitor`.
2339     */
2340    LDKClosureReason_CommitmentTxConfirmed,
2341    /**
2342     * The funding transaction failed to confirm in a timely manner on an inbound channel.
2343     */
2344    LDKClosureReason_FundingTimedOut,
2345    /**
2346     * Closure generated from processing an event, likely a HTLC forward/relay/reception.
2347     */
2348    LDKClosureReason_ProcessingError,
2349    /**
2350     * The `PeerManager` informed us that we've disconnected from the peer. We close channels
2351     * if the `PeerManager` informed us that it is unlikely we'll be able to connect to the
2352     * peer again in the future or if the peer disconnected before we finished negotiating
2353     * the channel open. The first case may be caused by incompatible features which our
2354     * counterparty, or we, require.
2355     */
2356    LDKClosureReason_DisconnectedPeer,
2357    /**
2358     * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than
2359     * the ChannelManager deserialized.
2360     */
2361    LDKClosureReason_OutdatedChannelManager,
2362    /**
2363     * Must be last for serialization purposes
2364     */
2365    LDKClosureReason_Sentinel,
2366 } LDKClosureReason_Tag;
2367
2368 typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
2369    /**
2370     * The error which the peer sent us.
2371     *
2372     * The string should be sanitized before it is used (e.g emitted to logs
2373     * or printed to stdout). Otherwise, a well crafted error message may exploit
2374     * a security vulnerability in the terminal emulator or the logging subsystem.
2375     */
2376    struct LDKStr peer_msg;
2377 } LDKClosureReason_LDKCounterpartyForceClosed_Body;
2378
2379 typedef struct LDKClosureReason_LDKProcessingError_Body {
2380    /**
2381     * A developer-readable error message which we generated.
2382     */
2383    struct LDKStr err;
2384 } LDKClosureReason_LDKProcessingError_Body;
2385
2386 typedef struct MUST_USE_STRUCT LDKClosureReason {
2387    LDKClosureReason_Tag tag;
2388    union {
2389       LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
2390       LDKClosureReason_LDKProcessingError_Body processing_error;
2391    };
2392 } LDKClosureReason;
2393
2394 /**
2395  * An enum which can either contain a crate::lightning::util::events::ClosureReason or not
2396  */
2397 typedef enum LDKCOption_ClosureReasonZ_Tag {
2398    /**
2399     * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
2400     */
2401    LDKCOption_ClosureReasonZ_Some,
2402    /**
2403     * When we're in this state, this COption_ClosureReasonZ contains nothing
2404     */
2405    LDKCOption_ClosureReasonZ_None,
2406    /**
2407     * Must be last for serialization purposes
2408     */
2409    LDKCOption_ClosureReasonZ_Sentinel,
2410 } LDKCOption_ClosureReasonZ_Tag;
2411
2412 typedef struct LDKCOption_ClosureReasonZ {
2413    LDKCOption_ClosureReasonZ_Tag tag;
2414    union {
2415       struct {
2416          struct LDKClosureReason some;
2417       };
2418    };
2419 } LDKCOption_ClosureReasonZ;
2420
2421 /**
2422  * The contents of CResult_COption_ClosureReasonZDecodeErrorZ
2423  */
2424 typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr {
2425    /**
2426     * A pointer to the contents in the success state.
2427     * Reading from this pointer when `result_ok` is not set is undefined.
2428     */
2429    struct LDKCOption_ClosureReasonZ *result;
2430    /**
2431     * A pointer to the contents in the error state.
2432     * Reading from this pointer when `result_ok` is set is undefined.
2433     */
2434    struct LDKDecodeError *err;
2435 } LDKCResult_COption_ClosureReasonZDecodeErrorZPtr;
2436
2437 /**
2438  * A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
2439  * containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2440  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2441  */
2442 typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ {
2443    /**
2444     * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
2445     * `err` or `result` depending on the state of `result_ok`.
2446     */
2447    union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents;
2448    /**
2449     * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
2450     */
2451    bool result_ok;
2452 } LDKCResult_COption_ClosureReasonZDecodeErrorZ;
2453
2454
2455
2456 /**
2457  * A channel_update message to be sent or received from a peer
2458  */
2459 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
2460    /**
2461     * A pointer to the opaque Rust object.
2462     * Nearly everywhere, inner must be non-null, however in places where
2463     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2464     */
2465    LDKnativeChannelUpdate *inner;
2466    /**
2467     * Indicates that this is the only struct which contains the same pointer.
2468     * Rust functions which take ownership of an object provided via an argument require
2469     * this to be true and invalidate the object pointed to by inner.
2470     */
2471    bool is_owned;
2472 } LDKChannelUpdate;
2473
2474 /**
2475  * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
2476  * return packet by a node along the route. See [BOLT #4] for details.
2477  *
2478  * [BOLT #4]: https://github.com/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md
2479  */
2480 typedef enum LDKNetworkUpdate_Tag {
2481    /**
2482     * An error indicating a `channel_update` messages should be applied via
2483     * [`NetworkGraph::update_channel`].
2484     */
2485    LDKNetworkUpdate_ChannelUpdateMessage,
2486    /**
2487     * An error indicating only that a channel has been closed, which should be applied via
2488     * [`NetworkGraph::close_channel_from_update`].
2489     */
2490    LDKNetworkUpdate_ChannelClosed,
2491    /**
2492     * An error indicating only that a node has failed, which should be applied via
2493     * [`NetworkGraph::fail_node`].
2494     */
2495    LDKNetworkUpdate_NodeFailure,
2496    /**
2497     * Must be last for serialization purposes
2498     */
2499    LDKNetworkUpdate_Sentinel,
2500 } LDKNetworkUpdate_Tag;
2501
2502 typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body {
2503    /**
2504     * The update to apply via [`NetworkGraph::update_channel`].
2505     */
2506    struct LDKChannelUpdate msg;
2507 } LDKNetworkUpdate_LDKChannelUpdateMessage_Body;
2508
2509 typedef struct LDKNetworkUpdate_LDKChannelClosed_Body {
2510    /**
2511     * The short channel id of the closed channel.
2512     */
2513    uint64_t short_channel_id;
2514    /**
2515     * Whether the channel should be permanently removed or temporarily disabled until a new
2516     * `channel_update` message is received.
2517     */
2518    bool is_permanent;
2519 } LDKNetworkUpdate_LDKChannelClosed_Body;
2520
2521 typedef struct LDKNetworkUpdate_LDKNodeFailure_Body {
2522    /**
2523     * The node id of the failed node.
2524     */
2525    struct LDKPublicKey node_id;
2526    /**
2527     * Whether the node should be permanently removed from consideration or can be restored
2528     * when a new `channel_update` message is received.
2529     */
2530    bool is_permanent;
2531 } LDKNetworkUpdate_LDKNodeFailure_Body;
2532
2533 typedef struct MUST_USE_STRUCT LDKNetworkUpdate {
2534    LDKNetworkUpdate_Tag tag;
2535    union {
2536       LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message;
2537       LDKNetworkUpdate_LDKChannelClosed_Body channel_closed;
2538       LDKNetworkUpdate_LDKNodeFailure_Body node_failure;
2539    };
2540 } LDKNetworkUpdate;
2541
2542 /**
2543  * An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
2544  */
2545 typedef enum LDKCOption_NetworkUpdateZ_Tag {
2546    /**
2547     * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
2548     */
2549    LDKCOption_NetworkUpdateZ_Some,
2550    /**
2551     * When we're in this state, this COption_NetworkUpdateZ contains nothing
2552     */
2553    LDKCOption_NetworkUpdateZ_None,
2554    /**
2555     * Must be last for serialization purposes
2556     */
2557    LDKCOption_NetworkUpdateZ_Sentinel,
2558 } LDKCOption_NetworkUpdateZ_Tag;
2559
2560 typedef struct LDKCOption_NetworkUpdateZ {
2561    LDKCOption_NetworkUpdateZ_Tag tag;
2562    union {
2563       struct {
2564          struct LDKNetworkUpdate some;
2565       };
2566    };
2567 } LDKCOption_NetworkUpdateZ;
2568
2569
2570
2571 /**
2572  * Information about a spendable output to a P2WSH script. See
2573  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
2574  */
2575 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
2576    /**
2577     * A pointer to the opaque Rust object.
2578     * Nearly everywhere, inner must be non-null, however in places where
2579     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2580     */
2581    LDKnativeDelayedPaymentOutputDescriptor *inner;
2582    /**
2583     * Indicates that this is the only struct which contains the same pointer.
2584     * Rust functions which take ownership of an object provided via an argument require
2585     * this to be true and invalidate the object pointed to by inner.
2586     */
2587    bool is_owned;
2588 } LDKDelayedPaymentOutputDescriptor;
2589
2590
2591
2592 /**
2593  * Information about a spendable output to our \"payment key\". See
2594  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
2595  */
2596 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
2597    /**
2598     * A pointer to the opaque Rust object.
2599     * Nearly everywhere, inner must be non-null, however in places where
2600     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2601     */
2602    LDKnativeStaticPaymentOutputDescriptor *inner;
2603    /**
2604     * Indicates that this is the only struct which contains the same pointer.
2605     * Rust functions which take ownership of an object provided via an argument require
2606     * this to be true and invalidate the object pointed to by inner.
2607     */
2608    bool is_owned;
2609 } LDKStaticPaymentOutputDescriptor;
2610
2611 /**
2612  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
2613  * claim at any point in the future) an event is generated which you must track and be able to
2614  * spend on-chain. The information needed to do this is provided in this enum, including the
2615  * outpoint describing which txid and output index is available, the full output which exists at
2616  * that txid/index, and any keys or other information required to sign.
2617  */
2618 typedef enum LDKSpendableOutputDescriptor_Tag {
2619    /**
2620     * An output to a script which was provided via KeysInterface directly, either from
2621     * `get_destination_script()` or `get_shutdown_scriptpubkey()`, thus you should already know
2622     * how to spend it. No secret keys are provided as rust-lightning was never given any key.
2623     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
2624     * on-chain using the payment preimage or after it has timed out.
2625     */
2626    LDKSpendableOutputDescriptor_StaticOutput,
2627    /**
2628     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
2629     *
2630     * The witness in the spending input should be:
2631     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
2632     *
2633     * Note that the nSequence field in the spending input must be set to to_self_delay
2634     * (which means the transaction is not broadcastable until at least to_self_delay
2635     * blocks after the outpoint confirms).
2636     *
2637     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
2638     * it is an output from an old state which we broadcast (which should never happen).
2639     *
2640     * To derive the delayed_payment key which is used to sign for this input, you must pass the
2641     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
2642     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
2643     * chan_utils::derive_private_key. The public key can be generated without the secret key
2644     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
2645     * Sign::pubkeys().
2646     *
2647     * To derive the revocation_pubkey provided here (which is used in the witness
2648     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
2649     * call to Sign::ready_channel) and the provided per_commitment point
2650     * to chan_utils::derive_public_revocation_key.
2651     *
2652     * The witness script which is hashed and included in the output script_pubkey may be
2653     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
2654     * (derived as above), and the to_self_delay contained here to
2655     * chan_utils::get_revokeable_redeemscript.
2656     */
2657    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
2658    /**
2659     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
2660     * corresponds to the public key in Sign::pubkeys().payment_point).
2661     * The witness in the spending input, is, thus, simply:
2662     * <BIP 143 signature> <payment key>
2663     *
2664     * These are generally the result of our counterparty having broadcast the current state,
2665     * allowing us to claim the non-HTLC-encumbered outputs immediately.
2666     */
2667    LDKSpendableOutputDescriptor_StaticPaymentOutput,
2668    /**
2669     * Must be last for serialization purposes
2670     */
2671    LDKSpendableOutputDescriptor_Sentinel,
2672 } LDKSpendableOutputDescriptor_Tag;
2673
2674 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
2675    /**
2676     * The outpoint which is spendable
2677     */
2678    struct LDKOutPoint outpoint;
2679    /**
2680     * The output which is referenced by the given outpoint.
2681     */
2682    struct LDKTxOut output;
2683 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
2684
2685 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
2686    LDKSpendableOutputDescriptor_Tag tag;
2687    union {
2688       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
2689       struct {
2690          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
2691       };
2692       struct {
2693          struct LDKStaticPaymentOutputDescriptor static_payment_output;
2694       };
2695    };
2696 } LDKSpendableOutputDescriptor;
2697
2698 /**
2699  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2700  * This corresponds to std::vector in C++
2701  */
2702 typedef struct LDKCVec_SpendableOutputDescriptorZ {
2703    /**
2704     * The elements in the array.
2705     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2706     */
2707    struct LDKSpendableOutputDescriptor *data;
2708    /**
2709     * The number of elements pointed to by `data`.
2710     */
2711    uintptr_t datalen;
2712 } LDKCVec_SpendableOutputDescriptorZ;
2713
2714 /**
2715  * Some information provided on receipt of payment depends on whether the payment received is a
2716  * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
2717  */
2718 typedef enum LDKPaymentPurpose_Tag {
2719    /**
2720     * Information for receiving a payment that we generated an invoice for.
2721     */
2722    LDKPaymentPurpose_InvoicePayment,
2723    /**
2724     * Because this is a spontaneous payment, the payer generated their own preimage rather than us
2725     * (the payee) providing a preimage.
2726     */
2727    LDKPaymentPurpose_SpontaneousPayment,
2728    /**
2729     * Must be last for serialization purposes
2730     */
2731    LDKPaymentPurpose_Sentinel,
2732 } LDKPaymentPurpose_Tag;
2733
2734 typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
2735    /**
2736     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
2737     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
2738     * [`ChannelManager::claim_funds`].
2739     *
2740     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2741     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2742     *
2743     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2744     */
2745    struct LDKThirtyTwoBytes payment_preimage;
2746    /**
2747     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
2748     * number of deanonymization attacks during the routing process.
2749     * It is provided here for your reference, however its accuracy is enforced directly by
2750     * [`ChannelManager`] using the values you previously provided to
2751     * [`ChannelManager::create_inbound_payment`] or
2752     * [`ChannelManager::create_inbound_payment_for_hash`].
2753     *
2754     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2755     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2756     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
2757     */
2758    struct LDKThirtyTwoBytes payment_secret;
2759 } LDKPaymentPurpose_LDKInvoicePayment_Body;
2760
2761 typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
2762    LDKPaymentPurpose_Tag tag;
2763    union {
2764       LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
2765       struct {
2766          struct LDKThirtyTwoBytes spontaneous_payment;
2767       };
2768    };
2769 } LDKPaymentPurpose;
2770
2771 /**
2772  * An Event which you should probably take some action in response to.
2773  *
2774  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
2775  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
2776  * written as it makes no sense to respond to it after reconnecting to peers).
2777  */
2778 typedef enum LDKEvent_Tag {
2779    /**
2780     * Used to indicate that the client should generate a funding transaction with the given
2781     * parameters and then call [`ChannelManager::funding_transaction_generated`].
2782     * Generated in [`ChannelManager`] message handling.
2783     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
2784     * counterparty can steal your funds!
2785     *
2786     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2787     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
2788     */
2789    LDKEvent_FundingGenerationReady,
2790    /**
2791     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
2792     * [`ChannelManager::claim_funds`] to get it....
2793     * Note that if the preimage is not known, you should call
2794     * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
2795     * network congestion.
2796     * If you fail to call either [`ChannelManager::claim_funds`] or
2797     * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
2798     * automatically failed.
2799     *
2800     * # Note
2801     * LDK will not stop an inbound payment from being paid multiple times, so multiple
2802     * `PaymentReceived` events may be generated for the same payment.
2803     *
2804     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2805     * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
2806     */
2807    LDKEvent_PaymentReceived,
2808    /**
2809     * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
2810     * and we got back the payment preimage for it).
2811     *
2812     * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
2813     * event. In this situation, you SHOULD treat this payment as having succeeded.
2814     */
2815    LDKEvent_PaymentSent,
2816    /**
2817     * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped
2818     * something. You may wish to retry with a different route.
2819     *
2820     * Note that this does *not* indicate that all paths for an MPP payment have failed, see
2821     * [`Event::PaymentFailed`] and [`all_paths_failed`].
2822     *
2823     * [`all_paths_failed`]: Self::PaymentPathFailed::all_paths_failed
2824     */
2825    LDKEvent_PaymentPathFailed,
2826    /**
2827     * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
2828     * provide failure information for each MPP part in the payment.
2829     *
2830     * This event is provided once there are no further pending HTLCs for the payment and the
2831     * payment is no longer retryable, either due to a several-block timeout or because
2832     * [`ChannelManager::abandon_payment`] was previously called for the corresponding payment.
2833     *
2834     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
2835     */
2836    LDKEvent_PaymentFailed,
2837    /**
2838     * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
2839     * a time in the future.
2840     *
2841     * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
2842     */
2843    LDKEvent_PendingHTLCsForwardable,
2844    /**
2845     * Used to indicate that an output which you should know how to spend was confirmed on chain
2846     * and is now spendable.
2847     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
2848     * counterparty spending them due to some kind of timeout. Thus, you need to store them
2849     * somewhere and spend them when you create on-chain transactions.
2850     */
2851    LDKEvent_SpendableOutputs,
2852    /**
2853     * This event is generated when a payment has been successfully forwarded through us and a
2854     * forwarding fee earned.
2855     */
2856    LDKEvent_PaymentForwarded,
2857    /**
2858     * Used to indicate that a channel with the given `channel_id` is in the process of closure.
2859     */
2860    LDKEvent_ChannelClosed,
2861    /**
2862     * Used to indicate to the user that they can abandon the funding transaction and recycle the
2863     * inputs for another purpose.
2864     */
2865    LDKEvent_DiscardFunding,
2866    /**
2867     * Indicates that a path for an outbound payment was successful.
2868     *
2869     * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
2870     * [`Event::PaymentSent`] for obtaining the payment preimage.
2871     */
2872    LDKEvent_PaymentPathSuccessful,
2873    /**
2874     * Indicates a request to open a new channel by a peer.
2875     *
2876     * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the
2877     * request, call [`ChannelManager::force_close_channel`].
2878     *
2879     * The event is only triggered when a new open channel request is received and the
2880     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
2881     *
2882     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
2883     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel
2884     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
2885     */
2886    LDKEvent_OpenChannelRequest,
2887    /**
2888     * Must be last for serialization purposes
2889     */
2890    LDKEvent_Sentinel,
2891 } LDKEvent_Tag;
2892
2893 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
2894    /**
2895     * The random channel_id we picked which you'll need to pass into
2896     * ChannelManager::funding_transaction_generated.
2897     */
2898    struct LDKThirtyTwoBytes temporary_channel_id;
2899    /**
2900     * The value, in satoshis, that the output should have.
2901     */
2902    uint64_t channel_value_satoshis;
2903    /**
2904     * The script which should be used in the transaction output.
2905     */
2906    struct LDKCVec_u8Z output_script;
2907    /**
2908     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
2909     * an inbound channel.
2910     *
2911     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
2912     */
2913    uint64_t user_channel_id;
2914 } LDKEvent_LDKFundingGenerationReady_Body;
2915
2916 typedef struct LDKEvent_LDKPaymentReceived_Body {
2917    /**
2918     * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
2919     * not stop you from registering duplicate payment hashes for inbound payments.
2920     */
2921    struct LDKThirtyTwoBytes payment_hash;
2922    /**
2923     * The value, in thousandths of a satoshi, that this payment is for.
2924     */
2925    uint64_t amt;
2926    /**
2927     * Information for claiming this received payment, based on whether the purpose of the
2928     * payment is to pay an invoice or to send a spontaneous payment.
2929     */
2930    struct LDKPaymentPurpose purpose;
2931 } LDKEvent_LDKPaymentReceived_Body;
2932
2933 typedef struct LDKEvent_LDKPaymentSent_Body {
2934    /**
2935     * The id returned by [`ChannelManager::send_payment`] and used with
2936     * [`ChannelManager::retry_payment`].
2937     *
2938     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2939     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
2940     *
2941     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2942     */
2943    struct LDKThirtyTwoBytes payment_id;
2944    /**
2945     * The preimage to the hash given to ChannelManager::send_payment.
2946     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
2947     * store it somehow!
2948     */
2949    struct LDKThirtyTwoBytes payment_preimage;
2950    /**
2951     * The hash that was given to [`ChannelManager::send_payment`].
2952     *
2953     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2954     */
2955    struct LDKThirtyTwoBytes payment_hash;
2956    /**
2957     * The total fee which was spent at intermediate hops in this payment, across all paths.
2958     *
2959     * Note that, like [`Route::get_total_fees`] this does *not* include any potential
2960     * overpayment to the recipient node.
2961     *
2962     * If the recipient or an intermediate node misbehaves and gives us free money, this may
2963     * overstate the amount paid, though this is unlikely.
2964     *
2965     * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
2966     */
2967    struct LDKCOption_u64Z fee_paid_msat;
2968 } LDKEvent_LDKPaymentSent_Body;
2969
2970 typedef struct LDKEvent_LDKPaymentPathFailed_Body {
2971    /**
2972     * The id returned by [`ChannelManager::send_payment`] and used with
2973     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
2974     *
2975     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2976     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
2977     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
2978     *
2979     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2980     */
2981    struct LDKThirtyTwoBytes payment_id;
2982    /**
2983     * The hash that was given to [`ChannelManager::send_payment`].
2984     *
2985     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2986     */
2987    struct LDKThirtyTwoBytes payment_hash;
2988    /**
2989     * Indicates the payment was rejected for some reason by the recipient. This implies that
2990     * the payment has failed, not just the route in question. If this is not set, you may
2991     * retry the payment via a different route.
2992     */
2993    bool rejected_by_dest;
2994    /**
2995     * Any failure information conveyed via the Onion return packet by a node along the failed
2996     * payment route.
2997     *
2998     * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
2999     * account the update. [`NetGraphMsgHandler`] is capable of doing this.
3000     *
3001     * [`NetworkGraph`]: crate::routing::network_graph::NetworkGraph
3002     * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
3003     */
3004    struct LDKCOption_NetworkUpdateZ network_update;
3005    /**
3006     * For both single-path and multi-path payments, this is set if all paths of the payment have
3007     * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
3008     * larger MPP payment were still in flight when this event was generated.
3009     *
3010     * Note that if you are retrying individual MPP parts, using this value to determine if a
3011     * payment has fully failed is race-y. Because multiple failures can happen prior to events
3012     * being processed, you may retry in response to a first failure, with a second failure
3013     * (with `all_paths_failed` set) still pending. Then, when the second failure is processed
3014     * you will see `all_paths_failed` set even though the retry of the first failure still
3015     * has an associated in-flight HTLC. See (1) for an example of such a failure.
3016     *
3017     * If you wish to retry individual MPP parts and learn when a payment has failed, you must
3018     * call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event.
3019     *
3020     * (1) <https://github.com/lightningdevkit/rust-lightning/issues/1164>
3021     *
3022     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3023     */
3024    bool all_paths_failed;
3025    /**
3026     * The payment path that failed.
3027     */
3028    struct LDKCVec_RouteHopZ path;
3029    /**
3030     * The channel responsible for the failed payment path.
3031     *
3032     * If this is `Some`, then the corresponding channel should be avoided when the payment is
3033     * retried. May be `None` for older [`Event`] serializations.
3034     */
3035    struct LDKCOption_u64Z short_channel_id;
3036    /**
3037     * Parameters needed to compute a new [`Route`] when retrying the failed payment path.
3038     *
3039     * See [`find_route`] for details.
3040     *
3041     * [`Route`]: crate::routing::router::Route
3042     * [`find_route`]: crate::routing::router::find_route
3043     *
3044     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3045     */
3046    struct LDKRouteParameters retry;
3047 } LDKEvent_LDKPaymentPathFailed_Body;
3048
3049 typedef struct LDKEvent_LDKPaymentFailed_Body {
3050    /**
3051     * The id returned by [`ChannelManager::send_payment`] and used with
3052     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
3053     *
3054     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3055     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3056     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3057     */
3058    struct LDKThirtyTwoBytes payment_id;
3059    /**
3060     * The hash that was given to [`ChannelManager::send_payment`].
3061     *
3062     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3063     */
3064    struct LDKThirtyTwoBytes payment_hash;
3065 } LDKEvent_LDKPaymentFailed_Body;
3066
3067 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
3068    /**
3069     * The minimum amount of time that should be waited prior to calling
3070     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
3071     * you should wait a random amount of time in roughly the range (now + time_forwardable,
3072     * now + 5*time_forwardable).
3073     */
3074    uint64_t time_forwardable;
3075 } LDKEvent_LDKPendingHTLCsForwardable_Body;
3076
3077 typedef struct LDKEvent_LDKSpendableOutputs_Body {
3078    /**
3079     * The outputs which you should store as spendable by you.
3080     */
3081    struct LDKCVec_SpendableOutputDescriptorZ outputs;
3082 } LDKEvent_LDKSpendableOutputs_Body;
3083
3084 typedef struct LDKEvent_LDKPaymentForwarded_Body {
3085    /**
3086     * The fee, in milli-satoshis, which was earned as a result of the payment.
3087     *
3088     * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
3089     * was pending, the amount the next hop claimed will have been rounded down to the nearest
3090     * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
3091     * claimed the full value in millisatoshis from the source. In this case,
3092     * `claim_from_onchain_tx` will be set.
3093     *
3094     * If the channel which sent us the payment has been force-closed, we will claim the funds
3095     * via an on-chain transaction. In that case we do not yet know the on-chain transaction
3096     * fees which we will spend and will instead set this to `None`. It is possible duplicate
3097     * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
3098     * `None`.
3099     */
3100    struct LDKCOption_u64Z fee_earned_msat;
3101    /**
3102     * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
3103     * transaction.
3104     */
3105    bool claim_from_onchain_tx;
3106 } LDKEvent_LDKPaymentForwarded_Body;
3107
3108 typedef struct LDKEvent_LDKChannelClosed_Body {
3109    /**
3110     * The channel_id of the channel which has been closed. Note that on-chain transactions
3111     * resolving the channel are likely still awaiting confirmation.
3112     */
3113    struct LDKThirtyTwoBytes channel_id;
3114    /**
3115     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
3116     * an inbound channel. This will always be zero for objects serialized with LDK versions
3117     * prior to 0.0.102.
3118     *
3119     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
3120     */
3121    uint64_t user_channel_id;
3122    /**
3123     * The reason the channel was closed.
3124     */
3125    struct LDKClosureReason reason;
3126 } LDKEvent_LDKChannelClosed_Body;
3127
3128 typedef struct LDKEvent_LDKDiscardFunding_Body {
3129    /**
3130     * The channel_id of the channel which has been closed.
3131     */
3132    struct LDKThirtyTwoBytes channel_id;
3133    /**
3134     * The full transaction received from the user
3135     */
3136    struct LDKTransaction transaction;
3137 } LDKEvent_LDKDiscardFunding_Body;
3138
3139 typedef struct LDKEvent_LDKPaymentPathSuccessful_Body {
3140    /**
3141     * The id returned by [`ChannelManager::send_payment`] and used with
3142     * [`ChannelManager::retry_payment`].
3143     *
3144     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3145     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3146     */
3147    struct LDKThirtyTwoBytes payment_id;
3148    /**
3149     * The hash that was given to [`ChannelManager::send_payment`].
3150     *
3151     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3152     *
3153     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3154     */
3155    struct LDKThirtyTwoBytes payment_hash;
3156    /**
3157     * The payment path that was successful.
3158     *
3159     * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
3160     */
3161    struct LDKCVec_RouteHopZ path;
3162 } LDKEvent_LDKPaymentPathSuccessful_Body;
3163
3164 typedef struct LDKEvent_LDKOpenChannelRequest_Body {
3165    /**
3166     * The temporary channel ID of the channel requested to be opened.
3167     *
3168     * When responding to the request, the `temporary_channel_id` should be passed
3169     * back to the ChannelManager with [`ChannelManager::accept_inbound_channel`] to accept,
3170     * or to [`ChannelManager::force_close_channel`] to reject.
3171     *
3172     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3173     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel
3174     */
3175    struct LDKThirtyTwoBytes temporary_channel_id;
3176    /**
3177     * The node_id of the counterparty requesting to open the channel.
3178     */
3179    struct LDKPublicKey counterparty_node_id;
3180    /**
3181     * The channel value of the requested channel.
3182     */
3183    uint64_t funding_satoshis;
3184    /**
3185     * Our starting balance in the channel if the request is accepted, in milli-satoshi.
3186     */
3187    uint64_t push_msat;
3188 } LDKEvent_LDKOpenChannelRequest_Body;
3189
3190 typedef struct MUST_USE_STRUCT LDKEvent {
3191    LDKEvent_Tag tag;
3192    union {
3193       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
3194       LDKEvent_LDKPaymentReceived_Body payment_received;
3195       LDKEvent_LDKPaymentSent_Body payment_sent;
3196       LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
3197       LDKEvent_LDKPaymentFailed_Body payment_failed;
3198       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
3199       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
3200       LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
3201       LDKEvent_LDKChannelClosed_Body channel_closed;
3202       LDKEvent_LDKDiscardFunding_Body discard_funding;
3203       LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful;
3204       LDKEvent_LDKOpenChannelRequest_Body open_channel_request;
3205    };
3206 } LDKEvent;
3207
3208 /**
3209  * An enum which can either contain a crate::lightning::util::events::Event or not
3210  */
3211 typedef enum LDKCOption_EventZ_Tag {
3212    /**
3213     * When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3214     */
3215    LDKCOption_EventZ_Some,
3216    /**
3217     * When we're in this state, this COption_EventZ contains nothing
3218     */
3219    LDKCOption_EventZ_None,
3220    /**
3221     * Must be last for serialization purposes
3222     */
3223    LDKCOption_EventZ_Sentinel,
3224 } LDKCOption_EventZ_Tag;
3225
3226 typedef struct LDKCOption_EventZ {
3227    LDKCOption_EventZ_Tag tag;
3228    union {
3229       struct {
3230          struct LDKEvent some;
3231       };
3232    };
3233 } LDKCOption_EventZ;
3234
3235 /**
3236  * The contents of CResult_COption_EventZDecodeErrorZ
3237  */
3238 typedef union LDKCResult_COption_EventZDecodeErrorZPtr {
3239    /**
3240     * A pointer to the contents in the success state.
3241     * Reading from this pointer when `result_ok` is not set is undefined.
3242     */
3243    struct LDKCOption_EventZ *result;
3244    /**
3245     * A pointer to the contents in the error state.
3246     * Reading from this pointer when `result_ok` is set is undefined.
3247     */
3248    struct LDKDecodeError *err;
3249 } LDKCResult_COption_EventZDecodeErrorZPtr;
3250
3251 /**
3252  * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3253  * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3254  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3255  */
3256 typedef struct LDKCResult_COption_EventZDecodeErrorZ {
3257    /**
3258     * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3259     * `err` or `result` depending on the state of `result_ok`.
3260     */
3261    union LDKCResult_COption_EventZDecodeErrorZPtr contents;
3262    /**
3263     * Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3264     */
3265    bool result_ok;
3266 } LDKCResult_COption_EventZDecodeErrorZ;
3267
3268
3269
3270 /**
3271  * An accept_channel message to be sent or received from a peer
3272  */
3273 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
3274    /**
3275     * A pointer to the opaque Rust object.
3276     * Nearly everywhere, inner must be non-null, however in places where
3277     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3278     */
3279    LDKnativeAcceptChannel *inner;
3280    /**
3281     * Indicates that this is the only struct which contains the same pointer.
3282     * Rust functions which take ownership of an object provided via an argument require
3283     * this to be true and invalidate the object pointed to by inner.
3284     */
3285    bool is_owned;
3286 } LDKAcceptChannel;
3287
3288
3289
3290 /**
3291  * An open_channel message to be sent or received from a peer
3292  */
3293 typedef struct MUST_USE_STRUCT LDKOpenChannel {
3294    /**
3295     * A pointer to the opaque Rust object.
3296     * Nearly everywhere, inner must be non-null, however in places where
3297     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3298     */
3299    LDKnativeOpenChannel *inner;
3300    /**
3301     * Indicates that this is the only struct which contains the same pointer.
3302     * Rust functions which take ownership of an object provided via an argument require
3303     * this to be true and invalidate the object pointed to by inner.
3304     */
3305    bool is_owned;
3306 } LDKOpenChannel;
3307
3308
3309
3310 /**
3311  * A funding_created message to be sent or received from a peer
3312  */
3313 typedef struct MUST_USE_STRUCT LDKFundingCreated {
3314    /**
3315     * A pointer to the opaque Rust object.
3316     * Nearly everywhere, inner must be non-null, however in places where
3317     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3318     */
3319    LDKnativeFundingCreated *inner;
3320    /**
3321     * Indicates that this is the only struct which contains the same pointer.
3322     * Rust functions which take ownership of an object provided via an argument require
3323     * this to be true and invalidate the object pointed to by inner.
3324     */
3325    bool is_owned;
3326 } LDKFundingCreated;
3327
3328
3329
3330 /**
3331  * A funding_signed message to be sent or received from a peer
3332  */
3333 typedef struct MUST_USE_STRUCT LDKFundingSigned {
3334    /**
3335     * A pointer to the opaque Rust object.
3336     * Nearly everywhere, inner must be non-null, however in places where
3337     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3338     */
3339    LDKnativeFundingSigned *inner;
3340    /**
3341     * Indicates that this is the only struct which contains the same pointer.
3342     * Rust functions which take ownership of an object provided via an argument require
3343     * this to be true and invalidate the object pointed to by inner.
3344     */
3345    bool is_owned;
3346 } LDKFundingSigned;
3347
3348
3349
3350 /**
3351  * A funding_locked message to be sent or received from a peer
3352  */
3353 typedef struct MUST_USE_STRUCT LDKFundingLocked {
3354    /**
3355     * A pointer to the opaque Rust object.
3356     * Nearly everywhere, inner must be non-null, however in places where
3357     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3358     */
3359    LDKnativeFundingLocked *inner;
3360    /**
3361     * Indicates that this is the only struct which contains the same pointer.
3362     * Rust functions which take ownership of an object provided via an argument require
3363     * this to be true and invalidate the object pointed to by inner.
3364     */
3365    bool is_owned;
3366 } LDKFundingLocked;
3367
3368
3369
3370 /**
3371  * An announcement_signatures message to be sent or received from a peer
3372  */
3373 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
3374    /**
3375     * A pointer to the opaque Rust object.
3376     * Nearly everywhere, inner must be non-null, however in places where
3377     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3378     */
3379    LDKnativeAnnouncementSignatures *inner;
3380    /**
3381     * Indicates that this is the only struct which contains the same pointer.
3382     * Rust functions which take ownership of an object provided via an argument require
3383     * this to be true and invalidate the object pointed to by inner.
3384     */
3385    bool is_owned;
3386 } LDKAnnouncementSignatures;
3387
3388
3389
3390 /**
3391  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
3392  * transaction updates if they were pending.
3393  */
3394 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
3395    /**
3396     * A pointer to the opaque Rust object.
3397     * Nearly everywhere, inner must be non-null, however in places where
3398     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3399     */
3400    LDKnativeCommitmentUpdate *inner;
3401    /**
3402     * Indicates that this is the only struct which contains the same pointer.
3403     * Rust functions which take ownership of an object provided via an argument require
3404     * this to be true and invalidate the object pointed to by inner.
3405     */
3406    bool is_owned;
3407 } LDKCommitmentUpdate;
3408
3409
3410
3411 /**
3412  * A revoke_and_ack message to be sent or received from a peer
3413  */
3414 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
3415    /**
3416     * A pointer to the opaque Rust object.
3417     * Nearly everywhere, inner must be non-null, however in places where
3418     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3419     */
3420    LDKnativeRevokeAndACK *inner;
3421    /**
3422     * Indicates that this is the only struct which contains the same pointer.
3423     * Rust functions which take ownership of an object provided via an argument require
3424     * this to be true and invalidate the object pointed to by inner.
3425     */
3426    bool is_owned;
3427 } LDKRevokeAndACK;
3428
3429
3430
3431 /**
3432  * A closing_signed message to be sent or received from a peer
3433  */
3434 typedef struct MUST_USE_STRUCT LDKClosingSigned {
3435    /**
3436     * A pointer to the opaque Rust object.
3437     * Nearly everywhere, inner must be non-null, however in places where
3438     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3439     */
3440    LDKnativeClosingSigned *inner;
3441    /**
3442     * Indicates that this is the only struct which contains the same pointer.
3443     * Rust functions which take ownership of an object provided via an argument require
3444     * this to be true and invalidate the object pointed to by inner.
3445     */
3446    bool is_owned;
3447 } LDKClosingSigned;
3448
3449
3450
3451 /**
3452  * A shutdown message to be sent or received from a peer
3453  */
3454 typedef struct MUST_USE_STRUCT LDKShutdown {
3455    /**
3456     * A pointer to the opaque Rust object.
3457     * Nearly everywhere, inner must be non-null, however in places where
3458     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3459     */
3460    LDKnativeShutdown *inner;
3461    /**
3462     * Indicates that this is the only struct which contains the same pointer.
3463     * Rust functions which take ownership of an object provided via an argument require
3464     * this to be true and invalidate the object pointed to by inner.
3465     */
3466    bool is_owned;
3467 } LDKShutdown;
3468
3469
3470
3471 /**
3472  * A channel_reestablish message to be sent or received from a peer
3473  */
3474 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
3475    /**
3476     * A pointer to the opaque Rust object.
3477     * Nearly everywhere, inner must be non-null, however in places where
3478     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3479     */
3480    LDKnativeChannelReestablish *inner;
3481    /**
3482     * Indicates that this is the only struct which contains the same pointer.
3483     * Rust functions which take ownership of an object provided via an argument require
3484     * this to be true and invalidate the object pointed to by inner.
3485     */
3486    bool is_owned;
3487 } LDKChannelReestablish;
3488
3489
3490
3491 /**
3492  * A channel_announcement message to be sent or received from a peer
3493  */
3494 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
3495    /**
3496     * A pointer to the opaque Rust object.
3497     * Nearly everywhere, inner must be non-null, however in places where
3498     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3499     */
3500    LDKnativeChannelAnnouncement *inner;
3501    /**
3502     * Indicates that this is the only struct which contains the same pointer.
3503     * Rust functions which take ownership of an object provided via an argument require
3504     * this to be true and invalidate the object pointed to by inner.
3505     */
3506    bool is_owned;
3507 } LDKChannelAnnouncement;
3508
3509
3510
3511 /**
3512  * A node_announcement message to be sent or received from a peer
3513  */
3514 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
3515    /**
3516     * A pointer to the opaque Rust object.
3517     * Nearly everywhere, inner must be non-null, however in places where
3518     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3519     */
3520    LDKnativeNodeAnnouncement *inner;
3521    /**
3522     * Indicates that this is the only struct which contains the same pointer.
3523     * Rust functions which take ownership of an object provided via an argument require
3524     * this to be true and invalidate the object pointed to by inner.
3525     */
3526    bool is_owned;
3527 } LDKNodeAnnouncement;
3528
3529
3530
3531 /**
3532  * An error message to be sent or received from a peer
3533  */
3534 typedef struct MUST_USE_STRUCT LDKErrorMessage {
3535    /**
3536     * A pointer to the opaque Rust object.
3537     * Nearly everywhere, inner must be non-null, however in places where
3538     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3539     */
3540    LDKnativeErrorMessage *inner;
3541    /**
3542     * Indicates that this is the only struct which contains the same pointer.
3543     * Rust functions which take ownership of an object provided via an argument require
3544     * this to be true and invalidate the object pointed to by inner.
3545     */
3546    bool is_owned;
3547 } LDKErrorMessage;
3548
3549
3550
3551 /**
3552  * A warning message to be sent or received from a peer
3553  */
3554 typedef struct MUST_USE_STRUCT LDKWarningMessage {
3555    /**
3556     * A pointer to the opaque Rust object.
3557     * Nearly everywhere, inner must be non-null, however in places where
3558     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3559     */
3560    LDKnativeWarningMessage *inner;
3561    /**
3562     * Indicates that this is the only struct which contains the same pointer.
3563     * Rust functions which take ownership of an object provided via an argument require
3564     * this to be true and invalidate the object pointed to by inner.
3565     */
3566    bool is_owned;
3567 } LDKWarningMessage;
3568
3569 /**
3570  * Used to put an error message in a LightningError
3571  */
3572 typedef enum LDKErrorAction_Tag {
3573    /**
3574     * The peer took some action which made us think they were useless. Disconnect them.
3575     */
3576    LDKErrorAction_DisconnectPeer,
3577    /**
3578     * The peer did something harmless that we weren't able to process, just log and ignore
3579     */
3580    LDKErrorAction_IgnoreError,
3581    /**
3582     * The peer did something harmless that we weren't able to meaningfully process.
3583     * If the error is logged, log it at the given level.
3584     */
3585    LDKErrorAction_IgnoreAndLog,
3586    /**
3587     * The peer provided us with a gossip message which we'd already seen. In most cases this
3588     * should be ignored, but it may result in the message being forwarded if it is a duplicate of
3589     * our own channel announcements.
3590     */
3591    LDKErrorAction_IgnoreDuplicateGossip,
3592    /**
3593     * The peer did something incorrect. Tell them.
3594     */
3595    LDKErrorAction_SendErrorMessage,
3596    /**
3597     * The peer did something incorrect. Tell them without closing any channels.
3598     */
3599    LDKErrorAction_SendWarningMessage,
3600    /**
3601     * Must be last for serialization purposes
3602     */
3603    LDKErrorAction_Sentinel,
3604 } LDKErrorAction_Tag;
3605
3606 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
3607    /**
3608     * An error message which we should make an effort to send before we disconnect.
3609     *
3610     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3611     */
3612    struct LDKErrorMessage msg;
3613 } LDKErrorAction_LDKDisconnectPeer_Body;
3614
3615 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
3616    /**
3617     * The message to send.
3618     */
3619    struct LDKErrorMessage msg;
3620 } LDKErrorAction_LDKSendErrorMessage_Body;
3621
3622 typedef struct LDKErrorAction_LDKSendWarningMessage_Body {
3623    /**
3624     * The message to send.
3625     */
3626    struct LDKWarningMessage msg;
3627    /**
3628     * The peer may have done something harmless that we weren't able to meaningfully process,
3629     * though we should still tell them about it.
3630     * If this event is logged, log it at the given level.
3631     */
3632    enum LDKLevel log_level;
3633 } LDKErrorAction_LDKSendWarningMessage_Body;
3634
3635 typedef struct MUST_USE_STRUCT LDKErrorAction {
3636    LDKErrorAction_Tag tag;
3637    union {
3638       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
3639       struct {
3640          enum LDKLevel ignore_and_log;
3641       };
3642       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
3643       LDKErrorAction_LDKSendWarningMessage_Body send_warning_message;
3644    };
3645 } LDKErrorAction;
3646
3647
3648
3649 /**
3650  * A query_channel_range message is used to query a peer for channel
3651  * UTXOs in a range of blocks. The recipient of a query makes a best
3652  * effort to reply to the query using one or more reply_channel_range
3653  * messages.
3654  */
3655 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
3656    /**
3657     * A pointer to the opaque Rust object.
3658     * Nearly everywhere, inner must be non-null, however in places where
3659     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3660     */
3661    LDKnativeQueryChannelRange *inner;
3662    /**
3663     * Indicates that this is the only struct which contains the same pointer.
3664     * Rust functions which take ownership of an object provided via an argument require
3665     * this to be true and invalidate the object pointed to by inner.
3666     */
3667    bool is_owned;
3668 } LDKQueryChannelRange;
3669
3670
3671
3672 /**
3673  * A query_short_channel_ids message is used to query a peer for
3674  * routing gossip messages related to one or more short_channel_ids.
3675  * The query recipient will reply with the latest, if available,
3676  * channel_announcement, channel_update and node_announcement messages
3677  * it maintains for the requested short_channel_ids followed by a
3678  * reply_short_channel_ids_end message. The short_channel_ids sent in
3679  * this query are encoded. We only support encoding_type=0 uncompressed
3680  * serialization and do not support encoding_type=1 zlib serialization.
3681  */
3682 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
3683    /**
3684     * A pointer to the opaque Rust object.
3685     * Nearly everywhere, inner must be non-null, however in places where
3686     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3687     */
3688    LDKnativeQueryShortChannelIds *inner;
3689    /**
3690     * Indicates that this is the only struct which contains the same pointer.
3691     * Rust functions which take ownership of an object provided via an argument require
3692     * this to be true and invalidate the object pointed to by inner.
3693     */
3694    bool is_owned;
3695 } LDKQueryShortChannelIds;
3696
3697
3698
3699 /**
3700  * A reply_channel_range message is a reply to a query_channel_range
3701  * message. Multiple reply_channel_range messages can be sent in reply
3702  * to a single query_channel_range message. The query recipient makes a
3703  * best effort to respond based on their local network view which may
3704  * not be a perfect view of the network. The short_channel_ids in the
3705  * reply are encoded. We only support encoding_type=0 uncompressed
3706  * serialization and do not support encoding_type=1 zlib serialization.
3707  */
3708 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
3709    /**
3710     * A pointer to the opaque Rust object.
3711     * Nearly everywhere, inner must be non-null, however in places where
3712     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3713     */
3714    LDKnativeReplyChannelRange *inner;
3715    /**
3716     * Indicates that this is the only struct which contains the same pointer.
3717     * Rust functions which take ownership of an object provided via an argument require
3718     * this to be true and invalidate the object pointed to by inner.
3719     */
3720    bool is_owned;
3721 } LDKReplyChannelRange;
3722
3723 /**
3724  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
3725  * broadcast to most peers).
3726  * These events are handled by PeerManager::process_events if you are using a PeerManager.
3727  */
3728 typedef enum LDKMessageSendEvent_Tag {
3729    /**
3730     * Used to indicate that we've accepted a channel open and should send the accept_channel
3731     * message provided to the given peer.
3732     */
3733    LDKMessageSendEvent_SendAcceptChannel,
3734    /**
3735     * Used to indicate that we've initiated a channel open and should send the open_channel
3736     * message provided to the given peer.
3737     */
3738    LDKMessageSendEvent_SendOpenChannel,
3739    /**
3740     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
3741     */
3742    LDKMessageSendEvent_SendFundingCreated,
3743    /**
3744     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
3745     */
3746    LDKMessageSendEvent_SendFundingSigned,
3747    /**
3748     * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
3749     */
3750    LDKMessageSendEvent_SendFundingLocked,
3751    /**
3752     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
3753     */
3754    LDKMessageSendEvent_SendAnnouncementSignatures,
3755    /**
3756     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
3757     * message should be sent to the peer with the given node_id.
3758     */
3759    LDKMessageSendEvent_UpdateHTLCs,
3760    /**
3761     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
3762     */
3763    LDKMessageSendEvent_SendRevokeAndACK,
3764    /**
3765     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
3766     */
3767    LDKMessageSendEvent_SendClosingSigned,
3768    /**
3769     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
3770     */
3771    LDKMessageSendEvent_SendShutdown,
3772    /**
3773     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
3774     */
3775    LDKMessageSendEvent_SendChannelReestablish,
3776    /**
3777     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
3778     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
3779     *
3780     * Note that after doing so, you very likely (unless you did so very recently) want to call
3781     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
3782     * This ensures that any nodes which see our channel_announcement also have a relevant
3783     * node_announcement, including relevant feature flags which may be important for routing
3784     * through or to us.
3785     */
3786    LDKMessageSendEvent_BroadcastChannelAnnouncement,
3787    /**
3788     * Used to indicate that a node_announcement should be broadcast to all peers.
3789     */
3790    LDKMessageSendEvent_BroadcastNodeAnnouncement,
3791    /**
3792     * Used to indicate that a channel_update should be broadcast to all peers.
3793     */
3794    LDKMessageSendEvent_BroadcastChannelUpdate,
3795    /**
3796     * Used to indicate that a channel_update should be sent to a single peer.
3797     * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
3798     * private channel and we shouldn't be informing all of our peers of channel parameters.
3799     */
3800    LDKMessageSendEvent_SendChannelUpdate,
3801    /**
3802     * Broadcast an error downstream to be handled
3803     */
3804    LDKMessageSendEvent_HandleError,
3805    /**
3806     * Query a peer for channels with funding transaction UTXOs in a block range.
3807     */
3808    LDKMessageSendEvent_SendChannelRangeQuery,
3809    /**
3810     * Request routing gossip messages from a peer for a list of channels identified by
3811     * their short_channel_ids.
3812     */
3813    LDKMessageSendEvent_SendShortIdsQuery,
3814    /**
3815     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
3816     * emitted during processing of the query.
3817     */
3818    LDKMessageSendEvent_SendReplyChannelRange,
3819    /**
3820     * Must be last for serialization purposes
3821     */
3822    LDKMessageSendEvent_Sentinel,
3823 } LDKMessageSendEvent_Tag;
3824
3825 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
3826    /**
3827     * The node_id of the node which should receive this message
3828     */
3829    struct LDKPublicKey node_id;
3830    /**
3831     * The message which should be sent.
3832     */
3833    struct LDKAcceptChannel msg;
3834 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
3835
3836 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
3837    /**
3838     * The node_id of the node which should receive this message
3839     */
3840    struct LDKPublicKey node_id;
3841    /**
3842     * The message which should be sent.
3843     */
3844    struct LDKOpenChannel msg;
3845 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
3846
3847 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
3848    /**
3849     * The node_id of the node which should receive this message
3850     */
3851    struct LDKPublicKey node_id;
3852    /**
3853     * The message which should be sent.
3854     */
3855    struct LDKFundingCreated msg;
3856 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
3857
3858 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
3859    /**
3860     * The node_id of the node which should receive this message
3861     */
3862    struct LDKPublicKey node_id;
3863    /**
3864     * The message which should be sent.
3865     */
3866    struct LDKFundingSigned msg;
3867 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
3868
3869 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
3870    /**
3871     * The node_id of the node which should receive these message(s)
3872     */
3873    struct LDKPublicKey node_id;
3874    /**
3875     * The funding_locked message which should be sent.
3876     */
3877    struct LDKFundingLocked msg;
3878 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
3879
3880 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
3881    /**
3882     * The node_id of the node which should receive these message(s)
3883     */
3884    struct LDKPublicKey node_id;
3885    /**
3886     * The announcement_signatures message which should be sent.
3887     */
3888    struct LDKAnnouncementSignatures msg;
3889 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
3890
3891 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
3892    /**
3893     * The node_id of the node which should receive these message(s)
3894     */
3895    struct LDKPublicKey node_id;
3896    /**
3897     * The update messages which should be sent. ALL messages in the struct should be sent!
3898     */
3899    struct LDKCommitmentUpdate updates;
3900 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
3901
3902 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
3903    /**
3904     * The node_id of the node which should receive this message
3905     */
3906    struct LDKPublicKey node_id;
3907    /**
3908     * The message which should be sent.
3909     */
3910    struct LDKRevokeAndACK msg;
3911 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
3912
3913 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
3914    /**
3915     * The node_id of the node which should receive this message
3916     */
3917    struct LDKPublicKey node_id;
3918    /**
3919     * The message which should be sent.
3920     */
3921    struct LDKClosingSigned msg;
3922 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
3923
3924 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
3925    /**
3926     * The node_id of the node which should receive this message
3927     */
3928    struct LDKPublicKey node_id;
3929    /**
3930     * The message which should be sent.
3931     */
3932    struct LDKShutdown msg;
3933 } LDKMessageSendEvent_LDKSendShutdown_Body;
3934
3935 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
3936    /**
3937     * The node_id of the node which should receive this message
3938     */
3939    struct LDKPublicKey node_id;
3940    /**
3941     * The message which should be sent.
3942     */
3943    struct LDKChannelReestablish msg;
3944 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
3945
3946 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
3947    /**
3948     * The channel_announcement which should be sent.
3949     */
3950    struct LDKChannelAnnouncement msg;
3951    /**
3952     * The followup channel_update which should be sent.
3953     */
3954    struct LDKChannelUpdate update_msg;
3955 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
3956
3957 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
3958    /**
3959     * The node_announcement which should be sent.
3960     */
3961    struct LDKNodeAnnouncement msg;
3962 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
3963
3964 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
3965    /**
3966     * The channel_update which should be sent.
3967     */
3968    struct LDKChannelUpdate msg;
3969 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
3970
3971 typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
3972    /**
3973     * The node_id of the node which should receive this message
3974     */
3975    struct LDKPublicKey node_id;
3976    /**
3977     * The channel_update which should be sent.
3978     */
3979    struct LDKChannelUpdate msg;
3980 } LDKMessageSendEvent_LDKSendChannelUpdate_Body;
3981
3982 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
3983    /**
3984     * The node_id of the node which should receive this message
3985     */
3986    struct LDKPublicKey node_id;
3987    /**
3988     * The action which should be taken.
3989     */
3990    struct LDKErrorAction action;
3991 } LDKMessageSendEvent_LDKHandleError_Body;
3992
3993 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
3994    /**
3995     * The node_id of this message recipient
3996     */
3997    struct LDKPublicKey node_id;
3998    /**
3999     * The query_channel_range which should be sent.
4000     */
4001    struct LDKQueryChannelRange msg;
4002 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
4003
4004 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
4005    /**
4006     * The node_id of this message recipient
4007     */
4008    struct LDKPublicKey node_id;
4009    /**
4010     * The query_short_channel_ids which should be sent.
4011     */
4012    struct LDKQueryShortChannelIds msg;
4013 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
4014
4015 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
4016    /**
4017     * The node_id of this message recipient
4018     */
4019    struct LDKPublicKey node_id;
4020    /**
4021     * The reply_channel_range which should be sent.
4022     */
4023    struct LDKReplyChannelRange msg;
4024 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
4025
4026 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
4027    LDKMessageSendEvent_Tag tag;
4028    union {
4029       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
4030       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
4031       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
4032       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
4033       LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
4034       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
4035       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
4036       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
4037       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
4038       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
4039       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
4040       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
4041       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
4042       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
4043       LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
4044       LDKMessageSendEvent_LDKHandleError_Body handle_error;
4045       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
4046       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
4047       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
4048    };
4049 } LDKMessageSendEvent;
4050
4051 /**
4052  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
4053  * This corresponds to std::vector in C++
4054  */
4055 typedef struct LDKCVec_MessageSendEventZ {
4056    /**
4057     * The elements in the array.
4058     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4059     */
4060    struct LDKMessageSendEvent *data;
4061    /**
4062     * The number of elements pointed to by `data`.
4063     */
4064    uintptr_t datalen;
4065 } LDKCVec_MessageSendEventZ;
4066
4067
4068
4069 /**
4070  * [`Score`] implementation that uses a fixed penalty.
4071  */
4072 typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer {
4073    /**
4074     * A pointer to the opaque Rust object.
4075     * Nearly everywhere, inner must be non-null, however in places where
4076     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4077     */
4078    LDKnativeFixedPenaltyScorer *inner;
4079    /**
4080     * Indicates that this is the only struct which contains the same pointer.
4081     * Rust functions which take ownership of an object provided via an argument require
4082     * this to be true and invalidate the object pointed to by inner.
4083     */
4084    bool is_owned;
4085 } LDKFixedPenaltyScorer;
4086
4087 /**
4088  * The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4089  */
4090 typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr {
4091    /**
4092     * A pointer to the contents in the success state.
4093     * Reading from this pointer when `result_ok` is not set is undefined.
4094     */
4095    struct LDKFixedPenaltyScorer *result;
4096    /**
4097     * A pointer to the contents in the error state.
4098     * Reading from this pointer when `result_ok` is set is undefined.
4099     */
4100    struct LDKDecodeError *err;
4101 } LDKCResult_FixedPenaltyScorerDecodeErrorZPtr;
4102
4103 /**
4104  * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4105  * containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4106  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4107  */
4108 typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ {
4109    /**
4110     * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4111     * `err` or `result` depending on the state of `result_ok`.
4112     */
4113    union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents;
4114    /**
4115     * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4116     */
4117    bool result_ok;
4118 } LDKCResult_FixedPenaltyScorerDecodeErrorZ;
4119
4120
4121
4122 /**
4123  * Parameters for configuring [`Scorer`].
4124  */
4125 typedef struct MUST_USE_STRUCT LDKScoringParameters {
4126    /**
4127     * A pointer to the opaque Rust object.
4128     * Nearly everywhere, inner must be non-null, however in places where
4129     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4130     */
4131    LDKnativeScoringParameters *inner;
4132    /**
4133     * Indicates that this is the only struct which contains the same pointer.
4134     * Rust functions which take ownership of an object provided via an argument require
4135     * this to be true and invalidate the object pointed to by inner.
4136     */
4137    bool is_owned;
4138 } LDKScoringParameters;
4139
4140 /**
4141  * The contents of CResult_ScoringParametersDecodeErrorZ
4142  */
4143 typedef union LDKCResult_ScoringParametersDecodeErrorZPtr {
4144    /**
4145     * A pointer to the contents in the success state.
4146     * Reading from this pointer when `result_ok` is not set is undefined.
4147     */
4148    struct LDKScoringParameters *result;
4149    /**
4150     * A pointer to the contents in the error state.
4151     * Reading from this pointer when `result_ok` is set is undefined.
4152     */
4153    struct LDKDecodeError *err;
4154 } LDKCResult_ScoringParametersDecodeErrorZPtr;
4155
4156 /**
4157  * A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
4158  * containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4159  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4160  */
4161 typedef struct LDKCResult_ScoringParametersDecodeErrorZ {
4162    /**
4163     * The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
4164     * `err` or `result` depending on the state of `result_ok`.
4165     */
4166    union LDKCResult_ScoringParametersDecodeErrorZPtr contents;
4167    /**
4168     * Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
4169     */
4170    bool result_ok;
4171 } LDKCResult_ScoringParametersDecodeErrorZ;
4172
4173
4174
4175 /**
4176  * [`Score`] implementation that provides reasonable default behavior.
4177  *
4178  * Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with
4179  * slightly higher fees are available. Will further penalize channels that fail to relay payments.
4180  *
4181  * See [module-level documentation] for usage and [`ScoringParameters`] for customization.
4182  *
4183  * # Note
4184  *
4185  * Mixing the `no-std` feature between serialization and deserialization results in undefined
4186  * behavior.
4187  *
4188  * [module-level documentation]: crate::routing::scoring
4189  */
4190 typedef struct MUST_USE_STRUCT LDKScorer {
4191    /**
4192     * A pointer to the opaque Rust object.
4193     * Nearly everywhere, inner must be non-null, however in places where
4194     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4195     */
4196    LDKnativeScorer *inner;
4197    /**
4198     * Indicates that this is the only struct which contains the same pointer.
4199     * Rust functions which take ownership of an object provided via an argument require
4200     * this to be true and invalidate the object pointed to by inner.
4201     */
4202    bool is_owned;
4203 } LDKScorer;
4204
4205 /**
4206  * The contents of CResult_ScorerDecodeErrorZ
4207  */
4208 typedef union LDKCResult_ScorerDecodeErrorZPtr {
4209    /**
4210     * A pointer to the contents in the success state.
4211     * Reading from this pointer when `result_ok` is not set is undefined.
4212     */
4213    struct LDKScorer *result;
4214    /**
4215     * A pointer to the contents in the error state.
4216     * Reading from this pointer when `result_ok` is set is undefined.
4217     */
4218    struct LDKDecodeError *err;
4219 } LDKCResult_ScorerDecodeErrorZPtr;
4220
4221 /**
4222  * A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
4223  * containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4224  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4225  */
4226 typedef struct LDKCResult_ScorerDecodeErrorZ {
4227    /**
4228     * The contents of this CResult_ScorerDecodeErrorZ, accessible via either
4229     * `err` or `result` depending on the state of `result_ok`.
4230     */
4231    union LDKCResult_ScorerDecodeErrorZPtr contents;
4232    /**
4233     * Whether this CResult_ScorerDecodeErrorZ represents a success state.
4234     */
4235    bool result_ok;
4236 } LDKCResult_ScorerDecodeErrorZ;
4237
4238
4239
4240 /**
4241  * Parameters for configuring [`ProbabilisticScorer`].
4242  */
4243 typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters {
4244    /**
4245     * A pointer to the opaque Rust object.
4246     * Nearly everywhere, inner must be non-null, however in places where
4247     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4248     */
4249    LDKnativeProbabilisticScoringParameters *inner;
4250    /**
4251     * Indicates that this is the only struct which contains the same pointer.
4252     * Rust functions which take ownership of an object provided via an argument require
4253     * this to be true and invalidate the object pointed to by inner.
4254     */
4255    bool is_owned;
4256 } LDKProbabilisticScoringParameters;
4257
4258 /**
4259  * The contents of CResult_ProbabilisticScoringParametersDecodeErrorZ
4260  */
4261 typedef union LDKCResult_ProbabilisticScoringParametersDecodeErrorZPtr {
4262    /**
4263     * A pointer to the contents in the success state.
4264     * Reading from this pointer when `result_ok` is not set is undefined.
4265     */
4266    struct LDKProbabilisticScoringParameters *result;
4267    /**
4268     * A pointer to the contents in the error state.
4269     * Reading from this pointer when `result_ok` is set is undefined.
4270     */
4271    struct LDKDecodeError *err;
4272 } LDKCResult_ProbabilisticScoringParametersDecodeErrorZPtr;
4273
4274 /**
4275  * A CResult_ProbabilisticScoringParametersDecodeErrorZ represents the result of a fallible operation,
4276  * containing a crate::lightning::routing::scoring::ProbabilisticScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4277  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4278  */
4279 typedef struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ {
4280    /**
4281     * The contents of this CResult_ProbabilisticScoringParametersDecodeErrorZ, accessible via either
4282     * `err` or `result` depending on the state of `result_ok`.
4283     */
4284    union LDKCResult_ProbabilisticScoringParametersDecodeErrorZPtr contents;
4285    /**
4286     * Whether this CResult_ProbabilisticScoringParametersDecodeErrorZ represents a success state.
4287     */
4288    bool result_ok;
4289 } LDKCResult_ProbabilisticScoringParametersDecodeErrorZ;
4290
4291
4292
4293 /**
4294  * Represents the network as nodes and channels between them
4295  */
4296 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
4297    /**
4298     * A pointer to the opaque Rust object.
4299     * Nearly everywhere, inner must be non-null, however in places where
4300     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4301     */
4302    LDKnativeNetworkGraph *inner;
4303    /**
4304     * Indicates that this is the only struct which contains the same pointer.
4305     * Rust functions which take ownership of an object provided via an argument require
4306     * this to be true and invalidate the object pointed to by inner.
4307     */
4308    bool is_owned;
4309 } LDKNetworkGraph;
4310
4311
4312
4313 /**
4314  * [`Score`] implementation using channel success probability distributions.
4315  *
4316  * Based on *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
4317  * and Stefan Richter [[1]]. Given the uncertainty of channel liquidity balances, probability
4318  * distributions are defined based on knowledge learned from successful and unsuccessful attempts.
4319  * Then the negative `log10` of the success probability is used to determine the cost of routing a
4320  * specific HTLC amount through a channel.
4321  *
4322  * Knowledge about channel liquidity balances takes the form of upper and lower bounds on the
4323  * possible liquidity. Certainty of the bounds is decreased over time using a decay function. See
4324  * [`ProbabilisticScoringParameters`] for details.
4325  *
4326  * Since the scorer aims to learn the current channel liquidity balances, it works best for nodes
4327  * with high payment volume or that actively probe the [`NetworkGraph`]. Nodes with low payment
4328  * volume are more likely to experience failed payment paths, which would need to be retried.
4329  *
4330  * # Note
4331  *
4332  * Mixing the `no-std` feature between serialization and deserialization results in undefined
4333  * behavior.
4334  *
4335  * [1]: https://arxiv.org/abs/2107.05322
4336  */
4337 typedef struct MUST_USE_STRUCT LDKProbabilisticScorer {
4338    /**
4339     * A pointer to the opaque Rust object.
4340     * Nearly everywhere, inner must be non-null, however in places where
4341     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4342     */
4343    LDKnativeProbabilisticScorer *inner;
4344    /**
4345     * Indicates that this is the only struct which contains the same pointer.
4346     * Rust functions which take ownership of an object provided via an argument require
4347     * this to be true and invalidate the object pointed to by inner.
4348     */
4349    bool is_owned;
4350 } LDKProbabilisticScorer;
4351
4352 /**
4353  * The contents of CResult_ProbabilisticScorerDecodeErrorZ
4354  */
4355 typedef union LDKCResult_ProbabilisticScorerDecodeErrorZPtr {
4356    /**
4357     * A pointer to the contents in the success state.
4358     * Reading from this pointer when `result_ok` is not set is undefined.
4359     */
4360    struct LDKProbabilisticScorer *result;
4361    /**
4362     * A pointer to the contents in the error state.
4363     * Reading from this pointer when `result_ok` is set is undefined.
4364     */
4365    struct LDKDecodeError *err;
4366 } LDKCResult_ProbabilisticScorerDecodeErrorZPtr;
4367
4368 /**
4369  * A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4370  * containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4371  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4372  */
4373 typedef struct LDKCResult_ProbabilisticScorerDecodeErrorZ {
4374    /**
4375     * The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4376     * `err` or `result` depending on the state of `result_ok`.
4377     */
4378    union LDKCResult_ProbabilisticScorerDecodeErrorZPtr contents;
4379    /**
4380     * Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4381     */
4382    bool result_ok;
4383 } LDKCResult_ProbabilisticScorerDecodeErrorZ;
4384
4385
4386
4387 /**
4388  * Features used within an `init` message.
4389  */
4390 typedef struct MUST_USE_STRUCT LDKInitFeatures {
4391    /**
4392     * A pointer to the opaque Rust object.
4393     * Nearly everywhere, inner must be non-null, however in places where
4394     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4395     */
4396    LDKnativeInitFeatures *inner;
4397    /**
4398     * Indicates that this is the only struct which contains the same pointer.
4399     * Rust functions which take ownership of an object provided via an argument require
4400     * this to be true and invalidate the object pointed to by inner.
4401     */
4402    bool is_owned;
4403 } LDKInitFeatures;
4404
4405 /**
4406  * The contents of CResult_InitFeaturesDecodeErrorZ
4407  */
4408 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
4409    /**
4410     * A pointer to the contents in the success state.
4411     * Reading from this pointer when `result_ok` is not set is undefined.
4412     */
4413    struct LDKInitFeatures *result;
4414    /**
4415     * A pointer to the contents in the error state.
4416     * Reading from this pointer when `result_ok` is set is undefined.
4417     */
4418    struct LDKDecodeError *err;
4419 } LDKCResult_InitFeaturesDecodeErrorZPtr;
4420
4421 /**
4422  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4423  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4424  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4425  */
4426 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
4427    /**
4428     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4429     * `err` or `result` depending on the state of `result_ok`.
4430     */
4431    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
4432    /**
4433     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4434     */
4435    bool result_ok;
4436 } LDKCResult_InitFeaturesDecodeErrorZ;
4437
4438
4439
4440 /**
4441  * Features used within a `channel_announcement` message.
4442  */
4443 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
4444    /**
4445     * A pointer to the opaque Rust object.
4446     * Nearly everywhere, inner must be non-null, however in places where
4447     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4448     */
4449    LDKnativeChannelFeatures *inner;
4450    /**
4451     * Indicates that this is the only struct which contains the same pointer.
4452     * Rust functions which take ownership of an object provided via an argument require
4453     * this to be true and invalidate the object pointed to by inner.
4454     */
4455    bool is_owned;
4456 } LDKChannelFeatures;
4457
4458 /**
4459  * The contents of CResult_ChannelFeaturesDecodeErrorZ
4460  */
4461 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
4462    /**
4463     * A pointer to the contents in the success state.
4464     * Reading from this pointer when `result_ok` is not set is undefined.
4465     */
4466    struct LDKChannelFeatures *result;
4467    /**
4468     * A pointer to the contents in the error state.
4469     * Reading from this pointer when `result_ok` is set is undefined.
4470     */
4471    struct LDKDecodeError *err;
4472 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
4473
4474 /**
4475  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4476  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4477  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4478  */
4479 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
4480    /**
4481     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4482     * `err` or `result` depending on the state of `result_ok`.
4483     */
4484    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
4485    /**
4486     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4487     */
4488    bool result_ok;
4489 } LDKCResult_ChannelFeaturesDecodeErrorZ;
4490
4491
4492
4493 /**
4494  * Features used within a `node_announcement` message.
4495  */
4496 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
4497    /**
4498     * A pointer to the opaque Rust object.
4499     * Nearly everywhere, inner must be non-null, however in places where
4500     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4501     */
4502    LDKnativeNodeFeatures *inner;
4503    /**
4504     * Indicates that this is the only struct which contains the same pointer.
4505     * Rust functions which take ownership of an object provided via an argument require
4506     * this to be true and invalidate the object pointed to by inner.
4507     */
4508    bool is_owned;
4509 } LDKNodeFeatures;
4510
4511 /**
4512  * The contents of CResult_NodeFeaturesDecodeErrorZ
4513  */
4514 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
4515    /**
4516     * A pointer to the contents in the success state.
4517     * Reading from this pointer when `result_ok` is not set is undefined.
4518     */
4519    struct LDKNodeFeatures *result;
4520    /**
4521     * A pointer to the contents in the error state.
4522     * Reading from this pointer when `result_ok` is set is undefined.
4523     */
4524    struct LDKDecodeError *err;
4525 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
4526
4527 /**
4528  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4529  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4530  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4531  */
4532 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
4533    /**
4534     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4535     * `err` or `result` depending on the state of `result_ok`.
4536     */
4537    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
4538    /**
4539     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4540     */
4541    bool result_ok;
4542 } LDKCResult_NodeFeaturesDecodeErrorZ;
4543
4544
4545
4546 /**
4547  * Features used within an invoice.
4548  */
4549 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
4550    /**
4551     * A pointer to the opaque Rust object.
4552     * Nearly everywhere, inner must be non-null, however in places where
4553     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4554     */
4555    LDKnativeInvoiceFeatures *inner;
4556    /**
4557     * Indicates that this is the only struct which contains the same pointer.
4558     * Rust functions which take ownership of an object provided via an argument require
4559     * this to be true and invalidate the object pointed to by inner.
4560     */
4561    bool is_owned;
4562 } LDKInvoiceFeatures;
4563
4564 /**
4565  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
4566  */
4567 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
4568    /**
4569     * A pointer to the contents in the success state.
4570     * Reading from this pointer when `result_ok` is not set is undefined.
4571     */
4572    struct LDKInvoiceFeatures *result;
4573    /**
4574     * A pointer to the contents in the error state.
4575     * Reading from this pointer when `result_ok` is set is undefined.
4576     */
4577    struct LDKDecodeError *err;
4578 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
4579
4580 /**
4581  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4582  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4583  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4584  */
4585 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
4586    /**
4587     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4588     * `err` or `result` depending on the state of `result_ok`.
4589     */
4590    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
4591    /**
4592     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4593     */
4594    bool result_ok;
4595 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
4596
4597
4598
4599 /**
4600  * Features used within the channel_type field in an OpenChannel message.
4601  *
4602  * A channel is always of some known \"type\", describing the transaction formats used and the exact
4603  * semantics of our interaction with our peer.
4604  *
4605  * Note that because a channel is a specific type which is proposed by the opener and accepted by
4606  * the counterparty, only required features are allowed here.
4607  *
4608  * This is serialized differently from other feature types - it is not prefixed by a length, and
4609  * thus must only appear inside a TLV where its length is known in advance.
4610  */
4611 typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures {
4612    /**
4613     * A pointer to the opaque Rust object.
4614     * Nearly everywhere, inner must be non-null, however in places where
4615     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4616     */
4617    LDKnativeChannelTypeFeatures *inner;
4618    /**
4619     * Indicates that this is the only struct which contains the same pointer.
4620     * Rust functions which take ownership of an object provided via an argument require
4621     * this to be true and invalidate the object pointed to by inner.
4622     */
4623    bool is_owned;
4624 } LDKChannelTypeFeatures;
4625
4626 /**
4627  * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4628  */
4629 typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr {
4630    /**
4631     * A pointer to the contents in the success state.
4632     * Reading from this pointer when `result_ok` is not set is undefined.
4633     */
4634    struct LDKChannelTypeFeatures *result;
4635    /**
4636     * A pointer to the contents in the error state.
4637     * Reading from this pointer when `result_ok` is set is undefined.
4638     */
4639    struct LDKDecodeError *err;
4640 } LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr;
4641
4642 /**
4643  * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4644  * containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4645  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4646  */
4647 typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ {
4648    /**
4649     * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4650     * `err` or `result` depending on the state of `result_ok`.
4651     */
4652    union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents;
4653    /**
4654     * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4655     */
4656    bool result_ok;
4657 } LDKCResult_ChannelTypeFeaturesDecodeErrorZ;
4658
4659 /**
4660  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
4661  */
4662 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4663    /**
4664     * A pointer to the contents in the success state.
4665     * Reading from this pointer when `result_ok` is not set is undefined.
4666     */
4667    struct LDKDelayedPaymentOutputDescriptor *result;
4668    /**
4669     * A pointer to the contents in the error state.
4670     * Reading from this pointer when `result_ok` is set is undefined.
4671     */
4672    struct LDKDecodeError *err;
4673 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
4674
4675 /**
4676  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4677  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4678  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4679  */
4680 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4681    /**
4682     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
4683     * `err` or `result` depending on the state of `result_ok`.
4684     */
4685    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
4686    /**
4687     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
4688     */
4689    bool result_ok;
4690 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
4691
4692 /**
4693  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
4694  */
4695 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4696    /**
4697     * A pointer to the contents in the success state.
4698     * Reading from this pointer when `result_ok` is not set is undefined.
4699     */
4700    struct LDKStaticPaymentOutputDescriptor *result;
4701    /**
4702     * A pointer to the contents in the error state.
4703     * Reading from this pointer when `result_ok` is set is undefined.
4704     */
4705    struct LDKDecodeError *err;
4706 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
4707
4708 /**
4709  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4710  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4711  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4712  */
4713 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4714    /**
4715     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
4716     * `err` or `result` depending on the state of `result_ok`.
4717     */
4718    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
4719    /**
4720     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
4721     */
4722    bool result_ok;
4723 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
4724
4725 /**
4726  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4727  */
4728 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
4729    /**
4730     * A pointer to the contents in the success state.
4731     * Reading from this pointer when `result_ok` is not set is undefined.
4732     */
4733    struct LDKSpendableOutputDescriptor *result;
4734    /**
4735     * A pointer to the contents in the error state.
4736     * Reading from this pointer when `result_ok` is set is undefined.
4737     */
4738    struct LDKDecodeError *err;
4739 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
4740
4741 /**
4742  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4743  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4744  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4745  */
4746 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
4747    /**
4748     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4749     * `err` or `result` depending on the state of `result_ok`.
4750     */
4751    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
4752    /**
4753     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4754     */
4755    bool result_ok;
4756 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
4757
4758 /**
4759  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4760  * This corresponds to std::vector in C++
4761  */
4762 typedef struct LDKCVec_PaymentPreimageZ {
4763    /**
4764     * The elements in the array.
4765     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4766     */
4767    struct LDKThirtyTwoBytes *data;
4768    /**
4769     * The number of elements pointed to by `data`.
4770     */
4771    uintptr_t datalen;
4772 } LDKCVec_PaymentPreimageZ;
4773
4774 /**
4775  * A tuple of 2 elements. See the individual fields for the types contained.
4776  */
4777 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
4778    /**
4779     * The element at position 0
4780     */
4781    struct LDKSignature a;
4782    /**
4783     * The element at position 1
4784     */
4785    struct LDKCVec_SignatureZ b;
4786 } LDKC2Tuple_SignatureCVec_SignatureZZ;
4787
4788 /**
4789  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4790  */
4791 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4792    /**
4793     * A pointer to the contents in the success state.
4794     * Reading from this pointer when `result_ok` is not set is undefined.
4795     */
4796    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
4797    /**
4798     * Note that this value is always NULL, as there are no contents in the Err variant
4799     */
4800    void *err;
4801 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
4802
4803 /**
4804  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4805  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4806  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4807  */
4808 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4809    /**
4810     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4811     * `err` or `result` depending on the state of `result_ok`.
4812     */
4813    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
4814    /**
4815     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4816     */
4817    bool result_ok;
4818 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
4819
4820 /**
4821  * The contents of CResult_SignatureNoneZ
4822  */
4823 typedef union LDKCResult_SignatureNoneZPtr {
4824    /**
4825     * A pointer to the contents in the success state.
4826     * Reading from this pointer when `result_ok` is not set is undefined.
4827     */
4828    struct LDKSignature *result;
4829    /**
4830     * Note that this value is always NULL, as there are no contents in the Err variant
4831     */
4832    void *err;
4833 } LDKCResult_SignatureNoneZPtr;
4834
4835 /**
4836  * A CResult_SignatureNoneZ represents the result of a fallible operation,
4837  * containing a crate::c_types::Signature on success and a () on failure.
4838  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4839  */
4840 typedef struct LDKCResult_SignatureNoneZ {
4841    /**
4842     * The contents of this CResult_SignatureNoneZ, accessible via either
4843     * `err` or `result` depending on the state of `result_ok`.
4844     */
4845    union LDKCResult_SignatureNoneZPtr contents;
4846    /**
4847     * Whether this CResult_SignatureNoneZ represents a success state.
4848     */
4849    bool result_ok;
4850 } LDKCResult_SignatureNoneZ;
4851
4852 /**
4853  * A tuple of 2 elements. See the individual fields for the types contained.
4854  */
4855 typedef struct LDKC2Tuple_SignatureSignatureZ {
4856    /**
4857     * The element at position 0
4858     */
4859    struct LDKSignature a;
4860    /**
4861     * The element at position 1
4862     */
4863    struct LDKSignature b;
4864 } LDKC2Tuple_SignatureSignatureZ;
4865
4866 /**
4867  * The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
4868  */
4869 typedef union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr {
4870    /**
4871     * A pointer to the contents in the success state.
4872     * Reading from this pointer when `result_ok` is not set is undefined.
4873     */
4874    struct LDKC2Tuple_SignatureSignatureZ *result;
4875    /**
4876     * Note that this value is always NULL, as there are no contents in the Err variant
4877     */
4878    void *err;
4879 } LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr;
4880
4881 /**
4882  * A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
4883  * containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
4884  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4885  */
4886 typedef struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ {
4887    /**
4888     * The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
4889     * `err` or `result` depending on the state of `result_ok`.
4890     */
4891    union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr contents;
4892    /**
4893     * Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
4894     */
4895    bool result_ok;
4896 } LDKCResult_C2Tuple_SignatureSignatureZNoneZ;
4897
4898 /**
4899  * The contents of CResult_SecretKeyNoneZ
4900  */
4901 typedef union LDKCResult_SecretKeyNoneZPtr {
4902    /**
4903     * A pointer to the contents in the success state.
4904     * Reading from this pointer when `result_ok` is not set is undefined.
4905     */
4906    struct LDKSecretKey *result;
4907    /**
4908     * Note that this value is always NULL, as there are no contents in the Err variant
4909     */
4910    void *err;
4911 } LDKCResult_SecretKeyNoneZPtr;
4912
4913 /**
4914  * A CResult_SecretKeyNoneZ represents the result of a fallible operation,
4915  * containing a crate::c_types::SecretKey on success and a () on failure.
4916  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4917  */
4918 typedef struct LDKCResult_SecretKeyNoneZ {
4919    /**
4920     * The contents of this CResult_SecretKeyNoneZ, accessible via either
4921     * `err` or `result` depending on the state of `result_ok`.
4922     */
4923    union LDKCResult_SecretKeyNoneZPtr contents;
4924    /**
4925     * Whether this CResult_SecretKeyNoneZ represents a success state.
4926     */
4927    bool result_ok;
4928 } LDKCResult_SecretKeyNoneZ;
4929
4930
4931
4932 /**
4933  * This class tracks the per-transaction information needed to build a closing transaction and will
4934  * actually build it and sign.
4935  *
4936  * This class can be used inside a signer implementation to generate a signature given the relevant
4937  * secret key.
4938  */
4939 typedef struct MUST_USE_STRUCT LDKClosingTransaction {
4940    /**
4941     * A pointer to the opaque Rust object.
4942     * Nearly everywhere, inner must be non-null, however in places where
4943     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4944     */
4945    LDKnativeClosingTransaction *inner;
4946    /**
4947     * Indicates that this is the only struct which contains the same pointer.
4948     * Rust functions which take ownership of an object provided via an argument require
4949     * this to be true and invalidate the object pointed to by inner.
4950     */
4951    bool is_owned;
4952 } LDKClosingTransaction;
4953
4954
4955
4956 /**
4957  * The unsigned part of a channel_announcement
4958  */
4959 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
4960    /**
4961     * A pointer to the opaque Rust object.
4962     * Nearly everywhere, inner must be non-null, however in places where
4963     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4964     */
4965    LDKnativeUnsignedChannelAnnouncement *inner;
4966    /**
4967     * Indicates that this is the only struct which contains the same pointer.
4968     * Rust functions which take ownership of an object provided via an argument require
4969     * this to be true and invalidate the object pointed to by inner.
4970     */
4971    bool is_owned;
4972 } LDKUnsignedChannelAnnouncement;
4973
4974 /**
4975  * A trait to sign lightning channel transactions as described in BOLT 3.
4976  *
4977  * Signing services could be implemented on a hardware wallet. In this case,
4978  * the current Sign would be a front-end on top of a communication
4979  * channel connected to your secure device and lightning key material wouldn't
4980  * reside on a hot server. Nevertheless, a this deployment would still need
4981  * to trust the ChannelManager to avoid loss of funds as this latest component
4982  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
4983  *
4984  * A more secure iteration would be to use hashlock (or payment points) to pair
4985  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
4986  * at the price of more state and computation on the hardware wallet side. In the future,
4987  * we are looking forward to design such interface.
4988  *
4989  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
4990  * to act, as liveness and breach reply correctness are always going to be hard requirements
4991  * of LN security model, orthogonal of key management issues.
4992  */
4993 typedef struct LDKBaseSign {
4994    /**
4995     * An opaque pointer which is passed to your function implementations as an argument.
4996     * This has no meaning in the LDK, and can be NULL or any other value.
4997     */
4998    void *this_arg;
4999    /**
5000     * Gets the per-commitment point for a specific commitment number
5001     *
5002     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
5003     */
5004    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
5005    /**
5006     * Gets the commitment secret for a specific commitment number as part of the revocation process
5007     *
5008     * An external signer implementation should error here if the commitment was already signed
5009     * and should refuse to sign it in the future.
5010     *
5011     * May be called more than once for the same index.
5012     *
5013     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
5014     */
5015    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
5016    /**
5017     * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
5018     *
5019     * This is required in order for the signer to make sure that releasing a commitment
5020     * secret won't leave us without a broadcastable holder transaction.
5021     * Policy checks should be implemented in this function, including checking the amount
5022     * sent to us and checking the HTLCs.
5023     *
5024     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
5025     * A validating signer should ensure that an HTLC output is removed only when the matching
5026     * preimage is provided, or when the value to holder is restored.
5027     *
5028     * NOTE: all the relevant preimages will be provided, but there may also be additional
5029     * irrelevant or duplicate preimages.
5030     */
5031    struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages);
5032    /**
5033     * Gets the holder's channel public keys and basepoints
5034     */
5035    struct LDKChannelPublicKeys pubkeys;
5036    /**
5037     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
5038     * Note that this takes a pointer to this object, not the this_ptr like other methods do
5039     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
5040     */
5041    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
5042    /**
5043     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
5044     * some SpendableOutputDescriptor types. This should be sufficient to identify this
5045     * Sign object uniquely and lookup or re-derive its keys.
5046     */
5047    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
5048    /**
5049     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
5050     *
5051     * Note that if signing fails or is rejected, the channel will be force-closed.
5052     *
5053     * Policy checks should be implemented in this function, including checking the amount
5054     * sent to us and checking the HTLCs.
5055     *
5056     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
5057     * A validating signer should ensure that an HTLC output is removed only when the matching
5058     * preimage is provided, or when the value to holder is restored.
5059     *
5060     * NOTE: all the relevant preimages will be provided, but there may also be additional
5061     * irrelevant or duplicate preimages.
5062     */
5063    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages);
5064    /**
5065     * Validate the counterparty's revocation.
5066     *
5067     * This is required in order for the signer to make sure that the state has moved
5068     * forward and it is safe to sign the next counterparty commitment.
5069     */
5070    struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
5071    /**
5072     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
5073     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
5074     * latest commitment_tx when we initiate a force-close.
5075     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
5076     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
5077     * the latest.
5078     * This may be called multiple times for the same transaction.
5079     *
5080     * An external signer implementation should check that the commitment has not been revoked.
5081     *
5082     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
5083     */
5084    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
5085    /**
5086     * Create a signature for the given input in a transaction spending an HTLC transaction output
5087     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
5088     *
5089     * A justice transaction may claim multiple outputs at the same time if timelocks are
5090     * similar, but only a signature for the input at index `input` should be signed for here.
5091     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
5092     * to an upcoming timelock expiration.
5093     *
5094     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
5095     *
5096     * per_commitment_key is revocation secret which was provided by our counterparty when they
5097     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
5098     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
5099     * so).
5100     */
5101    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]);
5102    /**
5103     * Create a signature for the given input in a transaction spending a commitment transaction
5104     * HTLC output when our counterparty broadcasts an old state.
5105     *
5106     * A justice transaction may claim multiple outputs at the same time if timelocks are
5107     * similar, but only a signature for the input at index `input` should be signed for here.
5108     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
5109     * to an upcoming timelock expiration.
5110     *
5111     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
5112     *
5113     * per_commitment_key is revocation secret which was provided by our counterparty when they
5114     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
5115     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
5116     * so).
5117     *
5118     * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
5119     * (which is committed to in the BIP 143 signatures).
5120     */
5121    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);
5122    /**
5123     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
5124     * transaction, either offered or received.
5125     *
5126     * Such a transaction may claim multiples offered outputs at same time if we know the
5127     * preimage for each when we create it, but only the input at index `input` should be
5128     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
5129     * needed with regards to an upcoming timelock expiration.
5130     *
5131     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
5132     * outputs.
5133     *
5134     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
5135     *
5136     * Per_commitment_point is the dynamic point corresponding to the channel state
5137     * detected onchain. It has been generated by our counterparty and is used to derive
5138     * channel state keys, which are then included in the witness script and committed to in the
5139     * BIP 143 signature.
5140     */
5141    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);
5142    /**
5143     * Create a signature for a (proposed) closing transaction.
5144     *
5145     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
5146     * chosen to forgo their output as dust.
5147     */
5148    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
5149    /**
5150     * Signs a channel announcement message with our funding key and our node secret key (aka
5151     * node_id or network_key), proving it comes from one of the channel participants.
5152     *
5153     * The first returned signature should be from our node secret key, the second from our
5154     * funding key.
5155     *
5156     * Note that if this fails or is rejected, the channel will not be publicly announced and
5157     * our counterparty may (though likely will not) close the channel on us for violating the
5158     * protocol.
5159     */
5160    struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
5161    /**
5162     * Set the counterparty static channel data, including basepoints,
5163     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
5164     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
5165     * they MUST NOT be allowed to change to different values once set.
5166     *
5167     * channel_parameters.is_populated() MUST be true.
5168     *
5169     * We bind holder_selected_contest_delay late here for API convenience.
5170     *
5171     * Will be called before any signatures are applied.
5172     */
5173    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
5174    /**
5175     * Frees any resources associated with this object given its this_arg pointer.
5176     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5177     */
5178    void (*free)(void *this_arg);
5179 } LDKBaseSign;
5180
5181 /**
5182  * A cloneable signer.
5183  *
5184  * Although we require signers to be cloneable, it may be useful for developers to be able to use
5185  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
5186  * which implies Sized, into this derived trait.
5187  */
5188 typedef struct LDKSign {
5189    /**
5190     * An opaque pointer which is passed to your function implementations as an argument.
5191     * This has no meaning in the LDK, and can be NULL or any other value.
5192     */
5193    void *this_arg;
5194    /**
5195     * Implementation of BaseSign for this object.
5196     */
5197    struct LDKBaseSign BaseSign;
5198    /**
5199     * Serialize the object into a byte array
5200     */
5201    struct LDKCVec_u8Z (*write)(const void *this_arg);
5202    /**
5203     * Called, if set, after this Sign has been cloned into a duplicate object.
5204     * The new Sign is provided, and should be mutated as needed to perform a
5205     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
5206     */
5207    void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign);
5208    /**
5209     * Frees any resources associated with this object given its this_arg pointer.
5210     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5211     */
5212    void (*free)(void *this_arg);
5213 } LDKSign;
5214
5215 /**
5216  * The contents of CResult_SignDecodeErrorZ
5217  */
5218 typedef union LDKCResult_SignDecodeErrorZPtr {
5219    /**
5220     * A pointer to the contents in the success state.
5221     * Reading from this pointer when `result_ok` is not set is undefined.
5222     */
5223    struct LDKSign *result;
5224    /**
5225     * A pointer to the contents in the error state.
5226     * Reading from this pointer when `result_ok` is set is undefined.
5227     */
5228    struct LDKDecodeError *err;
5229 } LDKCResult_SignDecodeErrorZPtr;
5230
5231 /**
5232  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
5233  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
5234  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5235  */
5236 typedef struct LDKCResult_SignDecodeErrorZ {
5237    /**
5238     * The contents of this CResult_SignDecodeErrorZ, accessible via either
5239     * `err` or `result` depending on the state of `result_ok`.
5240     */
5241    union LDKCResult_SignDecodeErrorZPtr contents;
5242    /**
5243     * Whether this CResult_SignDecodeErrorZ represents a success state.
5244     */
5245    bool result_ok;
5246 } LDKCResult_SignDecodeErrorZ;
5247
5248 /**
5249  * Integer in the range `0..32`
5250  */
5251 typedef struct LDKu5 {
5252    uint8_t _0;
5253 } LDKu5;
5254
5255 /**
5256  * A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
5257  * This corresponds to std::vector in C++
5258  */
5259 typedef struct LDKCVec_u5Z {
5260    /**
5261     * The elements in the array.
5262     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5263     */
5264    struct LDKu5 *data;
5265    /**
5266     * The number of elements pointed to by `data`.
5267     */
5268    uintptr_t datalen;
5269 } LDKCVec_u5Z;
5270
5271 /**
5272  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
5273  * allows recovering the exact public key which created the signature given the message.
5274  */
5275 typedef struct LDKRecoverableSignature {
5276    /**
5277     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
5278     * recovery.
5279     */
5280    uint8_t serialized_form[68];
5281 } LDKRecoverableSignature;
5282
5283 /**
5284  * The contents of CResult_RecoverableSignatureNoneZ
5285  */
5286 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
5287    /**
5288     * A pointer to the contents in the success state.
5289     * Reading from this pointer when `result_ok` is not set is undefined.
5290     */
5291    struct LDKRecoverableSignature *result;
5292    /**
5293     * Note that this value is always NULL, as there are no contents in the Err variant
5294     */
5295    void *err;
5296 } LDKCResult_RecoverableSignatureNoneZPtr;
5297
5298 /**
5299  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
5300  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
5301  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5302  */
5303 typedef struct LDKCResult_RecoverableSignatureNoneZ {
5304    /**
5305     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
5306     * `err` or `result` depending on the state of `result_ok`.
5307     */
5308    union LDKCResult_RecoverableSignatureNoneZPtr contents;
5309    /**
5310     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
5311     */
5312    bool result_ok;
5313 } LDKCResult_RecoverableSignatureNoneZ;
5314
5315 /**
5316  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
5317  * This corresponds to std::vector in C++
5318  */
5319 typedef struct LDKCVec_CVec_u8ZZ {
5320    /**
5321     * The elements in the array.
5322     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5323     */
5324    struct LDKCVec_u8Z *data;
5325    /**
5326     * The number of elements pointed to by `data`.
5327     */
5328    uintptr_t datalen;
5329 } LDKCVec_CVec_u8ZZ;
5330
5331 /**
5332  * The contents of CResult_CVec_CVec_u8ZZNoneZ
5333  */
5334 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
5335    /**
5336     * A pointer to the contents in the success state.
5337     * Reading from this pointer when `result_ok` is not set is undefined.
5338     */
5339    struct LDKCVec_CVec_u8ZZ *result;
5340    /**
5341     * Note that this value is always NULL, as there are no contents in the Err variant
5342     */
5343    void *err;
5344 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
5345
5346 /**
5347  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
5348  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
5349  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5350  */
5351 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
5352    /**
5353     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
5354     * `err` or `result` depending on the state of `result_ok`.
5355     */
5356    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
5357    /**
5358     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
5359     */
5360    bool result_ok;
5361 } LDKCResult_CVec_CVec_u8ZZNoneZ;
5362
5363
5364
5365 /**
5366  * A simple implementation of Sign that just keeps the private keys in memory.
5367  *
5368  * This implementation performs no policy checks and is insufficient by itself as
5369  * a secure external signer.
5370  */
5371 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
5372    /**
5373     * A pointer to the opaque Rust object.
5374     * Nearly everywhere, inner must be non-null, however in places where
5375     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5376     */
5377    LDKnativeInMemorySigner *inner;
5378    /**
5379     * Indicates that this is the only struct which contains the same pointer.
5380     * Rust functions which take ownership of an object provided via an argument require
5381     * this to be true and invalidate the object pointed to by inner.
5382     */
5383    bool is_owned;
5384 } LDKInMemorySigner;
5385
5386 /**
5387  * The contents of CResult_InMemorySignerDecodeErrorZ
5388  */
5389 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
5390    /**
5391     * A pointer to the contents in the success state.
5392     * Reading from this pointer when `result_ok` is not set is undefined.
5393     */
5394    struct LDKInMemorySigner *result;
5395    /**
5396     * A pointer to the contents in the error state.
5397     * Reading from this pointer when `result_ok` is set is undefined.
5398     */
5399    struct LDKDecodeError *err;
5400 } LDKCResult_InMemorySignerDecodeErrorZPtr;
5401
5402 /**
5403  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
5404  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
5405  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5406  */
5407 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
5408    /**
5409     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
5410     * `err` or `result` depending on the state of `result_ok`.
5411     */
5412    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
5413    /**
5414     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
5415     */
5416    bool result_ok;
5417 } LDKCResult_InMemorySignerDecodeErrorZ;
5418
5419 /**
5420  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5421  * This corresponds to std::vector in C++
5422  */
5423 typedef struct LDKCVec_TxOutZ {
5424    /**
5425     * The elements in the array.
5426     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5427     */
5428    struct LDKTxOut *data;
5429    /**
5430     * The number of elements pointed to by `data`.
5431     */
5432    uintptr_t datalen;
5433 } LDKCVec_TxOutZ;
5434
5435 /**
5436  * The contents of CResult_TransactionNoneZ
5437  */
5438 typedef union LDKCResult_TransactionNoneZPtr {
5439    /**
5440     * A pointer to the contents in the success state.
5441     * Reading from this pointer when `result_ok` is not set is undefined.
5442     */
5443    struct LDKTransaction *result;
5444    /**
5445     * Note that this value is always NULL, as there are no contents in the Err variant
5446     */
5447    void *err;
5448 } LDKCResult_TransactionNoneZPtr;
5449
5450 /**
5451  * A CResult_TransactionNoneZ represents the result of a fallible operation,
5452  * containing a crate::c_types::Transaction on success and a () on failure.
5453  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5454  */
5455 typedef struct LDKCResult_TransactionNoneZ {
5456    /**
5457     * The contents of this CResult_TransactionNoneZ, accessible via either
5458     * `err` or `result` depending on the state of `result_ok`.
5459     */
5460    union LDKCResult_TransactionNoneZPtr contents;
5461    /**
5462     * Whether this CResult_TransactionNoneZ represents a success state.
5463     */
5464    bool result_ok;
5465 } LDKCResult_TransactionNoneZ;
5466
5467
5468
5469 /**
5470  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
5471  * on-chain transactions to ensure no loss of funds occurs.
5472  *
5473  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
5474  * information and are actively monitoring the chain.
5475  *
5476  * Pending Events or updated HTLCs which have not yet been read out by
5477  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
5478  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
5479  * gotten are fully handled before re-serializing the new state.
5480  *
5481  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
5482  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
5483  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
5484  * returned block hash and the the current chain and then reconnecting blocks to get to the
5485  * best chain) upon deserializing the object!
5486  */
5487 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
5488    /**
5489     * A pointer to the opaque Rust object.
5490     * Nearly everywhere, inner must be non-null, however in places where
5491     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5492     */
5493    LDKnativeChannelMonitor *inner;
5494    /**
5495     * Indicates that this is the only struct which contains the same pointer.
5496     * Rust functions which take ownership of an object provided via an argument require
5497     * this to be true and invalidate the object pointed to by inner.
5498     */
5499    bool is_owned;
5500 } LDKChannelMonitor;
5501
5502 /**
5503  * A tuple of 2 elements. See the individual fields for the types contained.
5504  */
5505 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
5506    /**
5507     * The element at position 0
5508     */
5509    struct LDKThirtyTwoBytes a;
5510    /**
5511     * The element at position 1
5512     */
5513    struct LDKChannelMonitor b;
5514 } LDKC2Tuple_BlockHashChannelMonitorZ;
5515
5516 /**
5517  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5518  * This corresponds to std::vector in C++
5519  */
5520 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
5521    /**
5522     * The elements in the array.
5523     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5524     */
5525    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
5526    /**
5527     * The number of elements pointed to by `data`.
5528     */
5529    uintptr_t datalen;
5530 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
5531
5532 /**
5533  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5534  */
5535 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5536    /**
5537     * A pointer to the contents in the success state.
5538     * Reading from this pointer when `result_ok` is not set is undefined.
5539     */
5540    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
5541    /**
5542     * A pointer to the contents in the error state.
5543     * Reading from this pointer when `result_ok` is set is undefined.
5544     */
5545    enum LDKIOError *err;
5546 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
5547
5548 /**
5549  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5550  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5551  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5552  */
5553 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5554    /**
5555     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5556     * `err` or `result` depending on the state of `result_ok`.
5557     */
5558    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
5559    /**
5560     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
5561     */
5562    bool result_ok;
5563 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
5564
5565 /**
5566  * An enum which can either contain a u16 or not
5567  */
5568 typedef enum LDKCOption_u16Z_Tag {
5569    /**
5570     * When we're in this state, this COption_u16Z contains a u16
5571     */
5572    LDKCOption_u16Z_Some,
5573    /**
5574     * When we're in this state, this COption_u16Z contains nothing
5575     */
5576    LDKCOption_u16Z_None,
5577    /**
5578     * Must be last for serialization purposes
5579     */
5580    LDKCOption_u16Z_Sentinel,
5581 } LDKCOption_u16Z_Tag;
5582
5583 typedef struct LDKCOption_u16Z {
5584    LDKCOption_u16Z_Tag tag;
5585    union {
5586       struct {
5587          uint16_t some;
5588       };
5589    };
5590 } LDKCOption_u16Z;
5591
5592 /**
5593  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
5594  * too-high values)
5595  */
5596 typedef enum LDKAPIError_Tag {
5597    /**
5598     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
5599     * are documented, but generally indicates some precondition of a function was violated.
5600     */
5601    LDKAPIError_APIMisuseError,
5602    /**
5603     * Due to a high feerate, we were unable to complete the request.
5604     * For example, this may be returned if the feerate implies we cannot open a channel at the
5605     * requested value, but opening a larger channel would succeed.
5606     */
5607    LDKAPIError_FeeRateTooHigh,
5608    /**
5609     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
5610     * too-many-hops, etc).
5611     */
5612    LDKAPIError_RouteError,
5613    /**
5614     * We were unable to complete the request as the Channel required to do so is unable to
5615     * complete the request (or was not found). This can take many forms, including disconnected
5616     * peer, channel at capacity, channel shutting down, etc.
5617     */
5618    LDKAPIError_ChannelUnavailable,
5619    /**
5620     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
5621     * attempted action to fail.
5622     */
5623    LDKAPIError_MonitorUpdateFailed,
5624    /**
5625     * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
5626     * with the channel counterparty as negotiated in [`InitFeatures`].
5627     *
5628     * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
5629     * a channel or cooperatively close one with this peer (and will have to force-close instead).
5630     *
5631     * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
5632     * [`InitFeatures`]: crate::ln::features::InitFeatures
5633     */
5634    LDKAPIError_IncompatibleShutdownScript,
5635    /**
5636     * Must be last for serialization purposes
5637     */
5638    LDKAPIError_Sentinel,
5639 } LDKAPIError_Tag;
5640
5641 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
5642    /**
5643     * A human-readable error message
5644     */
5645    struct LDKStr err;
5646 } LDKAPIError_LDKAPIMisuseError_Body;
5647
5648 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
5649    /**
5650     * A human-readable error message
5651     */
5652    struct LDKStr err;
5653    /**
5654     * The feerate which was too high.
5655     */
5656    uint32_t feerate;
5657 } LDKAPIError_LDKFeeRateTooHigh_Body;
5658
5659 typedef struct LDKAPIError_LDKRouteError_Body {
5660    /**
5661     * A human-readable error message
5662     */
5663    struct LDKStr err;
5664 } LDKAPIError_LDKRouteError_Body;
5665
5666 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
5667    /**
5668     * A human-readable error message
5669     */
5670    struct LDKStr err;
5671 } LDKAPIError_LDKChannelUnavailable_Body;
5672
5673 typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
5674    /**
5675     * The incompatible shutdown script.
5676     */
5677    struct LDKShutdownScript script;
5678 } LDKAPIError_LDKIncompatibleShutdownScript_Body;
5679
5680 typedef struct MUST_USE_STRUCT LDKAPIError {
5681    LDKAPIError_Tag tag;
5682    union {
5683       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
5684       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
5685       LDKAPIError_LDKRouteError_Body route_error;
5686       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
5687       LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
5688    };
5689 } LDKAPIError;
5690
5691 /**
5692  * The contents of CResult_NoneAPIErrorZ
5693  */
5694 typedef union LDKCResult_NoneAPIErrorZPtr {
5695    /**
5696     * Note that this value is always NULL, as there are no contents in the OK variant
5697     */
5698    void *result;
5699    /**
5700     * A pointer to the contents in the error state.
5701     * Reading from this pointer when `result_ok` is set is undefined.
5702     */
5703    struct LDKAPIError *err;
5704 } LDKCResult_NoneAPIErrorZPtr;
5705
5706 /**
5707  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
5708  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
5709  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5710  */
5711 typedef struct LDKCResult_NoneAPIErrorZ {
5712    /**
5713     * The contents of this CResult_NoneAPIErrorZ, accessible via either
5714     * `err` or `result` depending on the state of `result_ok`.
5715     */
5716    union LDKCResult_NoneAPIErrorZPtr contents;
5717    /**
5718     * Whether this CResult_NoneAPIErrorZ represents a success state.
5719     */
5720    bool result_ok;
5721 } LDKCResult_NoneAPIErrorZ;
5722
5723 /**
5724  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
5725  * This corresponds to std::vector in C++
5726  */
5727 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
5728    /**
5729     * The elements in the array.
5730     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5731     */
5732    struct LDKCResult_NoneAPIErrorZ *data;
5733    /**
5734     * The number of elements pointed to by `data`.
5735     */
5736    uintptr_t datalen;
5737 } LDKCVec_CResult_NoneAPIErrorZZ;
5738
5739 /**
5740  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
5741  * This corresponds to std::vector in C++
5742  */
5743 typedef struct LDKCVec_APIErrorZ {
5744    /**
5745     * The elements in the array.
5746     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5747     */
5748    struct LDKAPIError *data;
5749    /**
5750     * The number of elements pointed to by `data`.
5751     */
5752    uintptr_t datalen;
5753 } LDKCVec_APIErrorZ;
5754
5755 /**
5756  * The contents of CResult__u832APIErrorZ
5757  */
5758 typedef union LDKCResult__u832APIErrorZPtr {
5759    /**
5760     * A pointer to the contents in the success state.
5761     * Reading from this pointer when `result_ok` is not set is undefined.
5762     */
5763    struct LDKThirtyTwoBytes *result;
5764    /**
5765     * A pointer to the contents in the error state.
5766     * Reading from this pointer when `result_ok` is set is undefined.
5767     */
5768    struct LDKAPIError *err;
5769 } LDKCResult__u832APIErrorZPtr;
5770
5771 /**
5772  * A CResult__u832APIErrorZ represents the result of a fallible operation,
5773  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
5774  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5775  */
5776 typedef struct LDKCResult__u832APIErrorZ {
5777    /**
5778     * The contents of this CResult__u832APIErrorZ, accessible via either
5779     * `err` or `result` depending on the state of `result_ok`.
5780     */
5781    union LDKCResult__u832APIErrorZPtr contents;
5782    /**
5783     * Whether this CResult__u832APIErrorZ represents a success state.
5784     */
5785    bool result_ok;
5786 } LDKCResult__u832APIErrorZ;
5787
5788 /**
5789  * If a payment fails to send, it can be in one of several states. This enum is returned as the
5790  * Err() type describing which state the payment is in, see the description of individual enum
5791  * states for more.
5792  */
5793 typedef enum LDKPaymentSendFailure_Tag {
5794    /**
5795     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
5796     * send the payment at all. No channel state has been changed or messages sent to peers, and
5797     * once you've changed the parameter at error, you can freely retry the payment in full.
5798     */
5799    LDKPaymentSendFailure_ParameterError,
5800    /**
5801     * A parameter in a single path which was passed to send_payment was invalid, preventing us
5802     * from attempting to send the payment at all. No channel state has been changed or messages
5803     * sent to peers, and once you've changed the parameter at error, you can freely retry the
5804     * payment in full.
5805     *
5806     * The results here are ordered the same as the paths in the route object which was passed to
5807     * send_payment.
5808     */
5809    LDKPaymentSendFailure_PathParameterError,
5810    /**
5811     * All paths which were attempted failed to send, with no channel state change taking place.
5812     * You can freely retry the payment in full (though you probably want to do so over different
5813     * paths than the ones selected).
5814     */
5815    LDKPaymentSendFailure_AllFailedRetrySafe,
5816    /**
5817     * Some paths which were attempted failed to send, though possibly not all. At least some
5818     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
5819     * in over-/re-payment.
5820     *
5821     * The results here are ordered the same as the paths in the route object which was passed to
5822     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
5823     * retried (though there is currently no API with which to do so).
5824     *
5825     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
5826     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
5827     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
5828     * with the latest update_id.
5829     */
5830    LDKPaymentSendFailure_PartialFailure,
5831    /**
5832     * Must be last for serialization purposes
5833     */
5834    LDKPaymentSendFailure_Sentinel,
5835 } LDKPaymentSendFailure_Tag;
5836
5837 typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
5838    /**
5839     * The errors themselves, in the same order as the route hops.
5840     */
5841    struct LDKCVec_CResult_NoneAPIErrorZZ results;
5842    /**
5843     * If some paths failed without irrevocably committing to the new HTLC(s), this will
5844     * contain a [`RouteParameters`] object which can be used to calculate a new route that
5845     * will pay all remaining unpaid balance.
5846     *
5847     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
5848     */
5849    struct LDKRouteParameters failed_paths_retry;
5850    /**
5851     * The payment id for the payment, which is now at least partially pending.
5852     */
5853    struct LDKThirtyTwoBytes payment_id;
5854 } LDKPaymentSendFailure_LDKPartialFailure_Body;
5855
5856 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
5857    LDKPaymentSendFailure_Tag tag;
5858    union {
5859       struct {
5860          struct LDKAPIError parameter_error;
5861       };
5862       struct {
5863          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
5864       };
5865       struct {
5866          struct LDKCVec_APIErrorZ all_failed_retry_safe;
5867       };
5868       LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
5869    };
5870 } LDKPaymentSendFailure;
5871
5872 /**
5873  * The contents of CResult_PaymentIdPaymentSendFailureZ
5874  */
5875 typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr {
5876    /**
5877     * A pointer to the contents in the success state.
5878     * Reading from this pointer when `result_ok` is not set is undefined.
5879     */
5880    struct LDKThirtyTwoBytes *result;
5881    /**
5882     * A pointer to the contents in the error state.
5883     * Reading from this pointer when `result_ok` is set is undefined.
5884     */
5885    struct LDKPaymentSendFailure *err;
5886 } LDKCResult_PaymentIdPaymentSendFailureZPtr;
5887
5888 /**
5889  * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
5890  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5891  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5892  */
5893 typedef struct LDKCResult_PaymentIdPaymentSendFailureZ {
5894    /**
5895     * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
5896     * `err` or `result` depending on the state of `result_ok`.
5897     */
5898    union LDKCResult_PaymentIdPaymentSendFailureZPtr contents;
5899    /**
5900     * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
5901     */
5902    bool result_ok;
5903 } LDKCResult_PaymentIdPaymentSendFailureZ;
5904
5905 /**
5906  * The contents of CResult_NonePaymentSendFailureZ
5907  */
5908 typedef union LDKCResult_NonePaymentSendFailureZPtr {
5909    /**
5910     * Note that this value is always NULL, as there are no contents in the OK variant
5911     */
5912    void *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 LDKPaymentSendFailure *err;
5918 } LDKCResult_NonePaymentSendFailureZPtr;
5919
5920 /**
5921  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
5922  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5923  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5924  */
5925 typedef struct LDKCResult_NonePaymentSendFailureZ {
5926    /**
5927     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
5928     * `err` or `result` depending on the state of `result_ok`.
5929     */
5930    union LDKCResult_NonePaymentSendFailureZPtr contents;
5931    /**
5932     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
5933     */
5934    bool result_ok;
5935 } LDKCResult_NonePaymentSendFailureZ;
5936
5937 /**
5938  * A tuple of 2 elements. See the individual fields for the types contained.
5939  */
5940 typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
5941    /**
5942     * The element at position 0
5943     */
5944    struct LDKThirtyTwoBytes a;
5945    /**
5946     * The element at position 1
5947     */
5948    struct LDKThirtyTwoBytes b;
5949 } LDKC2Tuple_PaymentHashPaymentIdZ;
5950
5951 /**
5952  * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
5953  */
5954 typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5955    /**
5956     * A pointer to the contents in the success state.
5957     * Reading from this pointer when `result_ok` is not set is undefined.
5958     */
5959    struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
5960    /**
5961     * A pointer to the contents in the error state.
5962     * Reading from this pointer when `result_ok` is set is undefined.
5963     */
5964    struct LDKPaymentSendFailure *err;
5965 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
5966
5967 /**
5968  * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
5969  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5970  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5971  */
5972 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5973    /**
5974     * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
5975     * `err` or `result` depending on the state of `result_ok`.
5976     */
5977    union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
5978    /**
5979     * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
5980     */
5981    bool result_ok;
5982 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
5983
5984 /**
5985  * A 4-byte byte array.
5986  */
5987 typedef struct LDKFourBytes {
5988    /**
5989     * The four bytes
5990     */
5991    uint8_t data[4];
5992 } LDKFourBytes;
5993
5994 /**
5995  * A 16-byte byte array.
5996  */
5997 typedef struct LDKSixteenBytes {
5998    /**
5999     * The sixteen bytes
6000     */
6001    uint8_t data[16];
6002 } LDKSixteenBytes;
6003
6004 /**
6005  * A 12-byte byte array.
6006  */
6007 typedef struct LDKTwelveBytes {
6008    /**
6009     * The twelve bytes
6010     */
6011    uint8_t data[12];
6012 } LDKTwelveBytes;
6013
6014 /**
6015  * An address which can be used to connect to a remote peer
6016  */
6017 typedef enum LDKNetAddress_Tag {
6018    /**
6019     * An IPv4 address/port on which the peer is listening.
6020     */
6021    LDKNetAddress_IPv4,
6022    /**
6023     * An IPv6 address/port on which the peer is listening.
6024     */
6025    LDKNetAddress_IPv6,
6026    /**
6027     * An old-style Tor onion address/port on which the peer is listening.
6028     *
6029     * This field is deprecated and the Tor network generally no longer supports V2 Onion
6030     * addresses. Thus, the details are not parsed here.
6031     */
6032    LDKNetAddress_OnionV2,
6033    /**
6034     * A new-style Tor onion address/port on which the peer is listening.
6035     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
6036     * wrap as base32 and append \".onion\".
6037     */
6038    LDKNetAddress_OnionV3,
6039    /**
6040     * Must be last for serialization purposes
6041     */
6042    LDKNetAddress_Sentinel,
6043 } LDKNetAddress_Tag;
6044
6045 typedef struct LDKNetAddress_LDKIPv4_Body {
6046    /**
6047     * The 4-byte IPv4 address
6048     */
6049    struct LDKFourBytes addr;
6050    /**
6051     * The port on which the node is listening
6052     */
6053    uint16_t port;
6054 } LDKNetAddress_LDKIPv4_Body;
6055
6056 typedef struct LDKNetAddress_LDKIPv6_Body {
6057    /**
6058     * The 16-byte IPv6 address
6059     */
6060    struct LDKSixteenBytes addr;
6061    /**
6062     * The port on which the node is listening
6063     */
6064    uint16_t port;
6065 } LDKNetAddress_LDKIPv6_Body;
6066
6067 typedef struct LDKNetAddress_LDKOnionV3_Body {
6068    /**
6069     * The ed25519 long-term public key of the peer
6070     */
6071    struct LDKThirtyTwoBytes ed25519_pubkey;
6072    /**
6073     * The checksum of the pubkey and version, as included in the onion address
6074     */
6075    uint16_t checksum;
6076    /**
6077     * The version byte, as defined by the Tor Onion v3 spec.
6078     */
6079    uint8_t version;
6080    /**
6081     * The port on which the node is listening
6082     */
6083    uint16_t port;
6084 } LDKNetAddress_LDKOnionV3_Body;
6085
6086 typedef struct MUST_USE_STRUCT LDKNetAddress {
6087    LDKNetAddress_Tag tag;
6088    union {
6089       LDKNetAddress_LDKIPv4_Body i_pv4;
6090       LDKNetAddress_LDKIPv6_Body i_pv6;
6091       struct {
6092          struct LDKTwelveBytes onion_v2;
6093       };
6094       LDKNetAddress_LDKOnionV3_Body onion_v3;
6095    };
6096 } LDKNetAddress;
6097
6098 /**
6099  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6100  * This corresponds to std::vector in C++
6101  */
6102 typedef struct LDKCVec_NetAddressZ {
6103    /**
6104     * The elements in the array.
6105     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6106     */
6107    struct LDKNetAddress *data;
6108    /**
6109     * The number of elements pointed to by `data`.
6110     */
6111    uintptr_t datalen;
6112 } LDKCVec_NetAddressZ;
6113
6114 /**
6115  * A tuple of 2 elements. See the individual fields for the types contained.
6116  */
6117 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
6118    /**
6119     * The element at position 0
6120     */
6121    struct LDKThirtyTwoBytes a;
6122    /**
6123     * The element at position 1
6124     */
6125    struct LDKThirtyTwoBytes b;
6126 } LDKC2Tuple_PaymentHashPaymentSecretZ;
6127
6128 /**
6129  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
6130  */
6131 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6132    /**
6133     * A pointer to the contents in the success state.
6134     * Reading from this pointer when `result_ok` is not set is undefined.
6135     */
6136    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
6137    /**
6138     * Note that this value is always NULL, as there are no contents in the Err variant
6139     */
6140    void *err;
6141 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr;
6142
6143 /**
6144  * A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
6145  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
6146  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6147  */
6148 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6149    /**
6150     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
6151     * `err` or `result` depending on the state of `result_ok`.
6152     */
6153    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents;
6154    /**
6155     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
6156     */
6157    bool result_ok;
6158 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ;
6159
6160 /**
6161  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
6162  */
6163 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6164    /**
6165     * A pointer to the contents in the success state.
6166     * Reading from this pointer when `result_ok` is not set is undefined.
6167     */
6168    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
6169    /**
6170     * A pointer to the contents in the error state.
6171     * Reading from this pointer when `result_ok` is set is undefined.
6172     */
6173    struct LDKAPIError *err;
6174 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr;
6175
6176 /**
6177  * A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
6178  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
6179  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6180  */
6181 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6182    /**
6183     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
6184     * `err` or `result` depending on the state of `result_ok`.
6185     */
6186    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr contents;
6187    /**
6188     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
6189     */
6190    bool result_ok;
6191 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ;
6192
6193 /**
6194  * The contents of CResult_PaymentSecretNoneZ
6195  */
6196 typedef union LDKCResult_PaymentSecretNoneZPtr {
6197    /**
6198     * A pointer to the contents in the success state.
6199     * Reading from this pointer when `result_ok` is not set is undefined.
6200     */
6201    struct LDKThirtyTwoBytes *result;
6202    /**
6203     * Note that this value is always NULL, as there are no contents in the Err variant
6204     */
6205    void *err;
6206 } LDKCResult_PaymentSecretNoneZPtr;
6207
6208 /**
6209  * A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
6210  * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6211  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6212  */
6213 typedef struct LDKCResult_PaymentSecretNoneZ {
6214    /**
6215     * The contents of this CResult_PaymentSecretNoneZ, accessible via either
6216     * `err` or `result` depending on the state of `result_ok`.
6217     */
6218    union LDKCResult_PaymentSecretNoneZPtr contents;
6219    /**
6220     * Whether this CResult_PaymentSecretNoneZ represents a success state.
6221     */
6222    bool result_ok;
6223 } LDKCResult_PaymentSecretNoneZ;
6224
6225 /**
6226  * The contents of CResult_PaymentSecretAPIErrorZ
6227  */
6228 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
6229    /**
6230     * A pointer to the contents in the success state.
6231     * Reading from this pointer when `result_ok` is not set is undefined.
6232     */
6233    struct LDKThirtyTwoBytes *result;
6234    /**
6235     * A pointer to the contents in the error state.
6236     * Reading from this pointer when `result_ok` is set is undefined.
6237     */
6238    struct LDKAPIError *err;
6239 } LDKCResult_PaymentSecretAPIErrorZPtr;
6240
6241 /**
6242  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
6243  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6244  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6245  */
6246 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
6247    /**
6248     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
6249     * `err` or `result` depending on the state of `result_ok`.
6250     */
6251    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
6252    /**
6253     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
6254     */
6255    bool result_ok;
6256 } LDKCResult_PaymentSecretAPIErrorZ;
6257
6258 /**
6259  * The contents of CResult_PaymentPreimageAPIErrorZ
6260  */
6261 typedef union LDKCResult_PaymentPreimageAPIErrorZPtr {
6262    /**
6263     * A pointer to the contents in the success state.
6264     * Reading from this pointer when `result_ok` is not set is undefined.
6265     */
6266    struct LDKThirtyTwoBytes *result;
6267    /**
6268     * A pointer to the contents in the error state.
6269     * Reading from this pointer when `result_ok` is set is undefined.
6270     */
6271    struct LDKAPIError *err;
6272 } LDKCResult_PaymentPreimageAPIErrorZPtr;
6273
6274 /**
6275  * A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
6276  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6277  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6278  */
6279 typedef struct LDKCResult_PaymentPreimageAPIErrorZ {
6280    /**
6281     * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
6282     * `err` or `result` depending on the state of `result_ok`.
6283     */
6284    union LDKCResult_PaymentPreimageAPIErrorZPtr contents;
6285    /**
6286     * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
6287     */
6288    bool result_ok;
6289 } LDKCResult_PaymentPreimageAPIErrorZ;
6290
6291
6292
6293 /**
6294  * Information needed for constructing an invoice route hint for this channel.
6295  */
6296 typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
6297    /**
6298     * A pointer to the opaque Rust object.
6299     * Nearly everywhere, inner must be non-null, however in places where
6300     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6301     */
6302    LDKnativeCounterpartyForwardingInfo *inner;
6303    /**
6304     * Indicates that this is the only struct which contains the same pointer.
6305     * Rust functions which take ownership of an object provided via an argument require
6306     * this to be true and invalidate the object pointed to by inner.
6307     */
6308    bool is_owned;
6309 } LDKCounterpartyForwardingInfo;
6310
6311 /**
6312  * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
6313  */
6314 typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr {
6315    /**
6316     * A pointer to the contents in the success state.
6317     * Reading from this pointer when `result_ok` is not set is undefined.
6318     */
6319    struct LDKCounterpartyForwardingInfo *result;
6320    /**
6321     * A pointer to the contents in the error state.
6322     * Reading from this pointer when `result_ok` is set is undefined.
6323     */
6324    struct LDKDecodeError *err;
6325 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr;
6326
6327 /**
6328  * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
6329  * containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6330  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6331  */
6332 typedef struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ {
6333    /**
6334     * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
6335     * `err` or `result` depending on the state of `result_ok`.
6336     */
6337    union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents;
6338    /**
6339     * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
6340     */
6341    bool result_ok;
6342 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZ;
6343
6344
6345
6346 /**
6347  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
6348  * to better separate parameters.
6349  */
6350 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
6351    /**
6352     * A pointer to the opaque Rust object.
6353     * Nearly everywhere, inner must be non-null, however in places where
6354     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6355     */
6356    LDKnativeChannelCounterparty *inner;
6357    /**
6358     * Indicates that this is the only struct which contains the same pointer.
6359     * Rust functions which take ownership of an object provided via an argument require
6360     * this to be true and invalidate the object pointed to by inner.
6361     */
6362    bool is_owned;
6363 } LDKChannelCounterparty;
6364
6365 /**
6366  * The contents of CResult_ChannelCounterpartyDecodeErrorZ
6367  */
6368 typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr {
6369    /**
6370     * A pointer to the contents in the success state.
6371     * Reading from this pointer when `result_ok` is not set is undefined.
6372     */
6373    struct LDKChannelCounterparty *result;
6374    /**
6375     * A pointer to the contents in the error state.
6376     * Reading from this pointer when `result_ok` is set is undefined.
6377     */
6378    struct LDKDecodeError *err;
6379 } LDKCResult_ChannelCounterpartyDecodeErrorZPtr;
6380
6381 /**
6382  * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
6383  * containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
6384  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6385  */
6386 typedef struct LDKCResult_ChannelCounterpartyDecodeErrorZ {
6387    /**
6388     * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
6389     * `err` or `result` depending on the state of `result_ok`.
6390     */
6391    union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents;
6392    /**
6393     * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
6394     */
6395    bool result_ok;
6396 } LDKCResult_ChannelCounterpartyDecodeErrorZ;
6397
6398 /**
6399  * The contents of CResult_ChannelDetailsDecodeErrorZ
6400  */
6401 typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr {
6402    /**
6403     * A pointer to the contents in the success state.
6404     * Reading from this pointer when `result_ok` is not set is undefined.
6405     */
6406    struct LDKChannelDetails *result;
6407    /**
6408     * A pointer to the contents in the error state.
6409     * Reading from this pointer when `result_ok` is set is undefined.
6410     */
6411    struct LDKDecodeError *err;
6412 } LDKCResult_ChannelDetailsDecodeErrorZPtr;
6413
6414 /**
6415  * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
6416  * containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
6417  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6418  */
6419 typedef struct LDKCResult_ChannelDetailsDecodeErrorZ {
6420    /**
6421     * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
6422     * `err` or `result` depending on the state of `result_ok`.
6423     */
6424    union LDKCResult_ChannelDetailsDecodeErrorZPtr contents;
6425    /**
6426     * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
6427     */
6428    bool result_ok;
6429 } LDKCResult_ChannelDetailsDecodeErrorZ;
6430
6431
6432
6433 /**
6434  * Route hints used in constructing invoices for [phantom node payents].
6435  *
6436  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
6437  */
6438 typedef struct MUST_USE_STRUCT LDKPhantomRouteHints {
6439    /**
6440     * A pointer to the opaque Rust object.
6441     * Nearly everywhere, inner must be non-null, however in places where
6442     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6443     */
6444    LDKnativePhantomRouteHints *inner;
6445    /**
6446     * Indicates that this is the only struct which contains the same pointer.
6447     * Rust functions which take ownership of an object provided via an argument require
6448     * this to be true and invalidate the object pointed to by inner.
6449     */
6450    bool is_owned;
6451 } LDKPhantomRouteHints;
6452
6453 /**
6454  * The contents of CResult_PhantomRouteHintsDecodeErrorZ
6455  */
6456 typedef union LDKCResult_PhantomRouteHintsDecodeErrorZPtr {
6457    /**
6458     * A pointer to the contents in the success state.
6459     * Reading from this pointer when `result_ok` is not set is undefined.
6460     */
6461    struct LDKPhantomRouteHints *result;
6462    /**
6463     * A pointer to the contents in the error state.
6464     * Reading from this pointer when `result_ok` is set is undefined.
6465     */
6466    struct LDKDecodeError *err;
6467 } LDKCResult_PhantomRouteHintsDecodeErrorZPtr;
6468
6469 /**
6470  * A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
6471  * containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
6472  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6473  */
6474 typedef struct LDKCResult_PhantomRouteHintsDecodeErrorZ {
6475    /**
6476     * The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
6477     * `err` or `result` depending on the state of `result_ok`.
6478     */
6479    union LDKCResult_PhantomRouteHintsDecodeErrorZPtr contents;
6480    /**
6481     * Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
6482     */
6483    bool result_ok;
6484 } LDKCResult_PhantomRouteHintsDecodeErrorZ;
6485
6486 /**
6487  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
6488  * This corresponds to std::vector in C++
6489  */
6490 typedef struct LDKCVec_ChannelMonitorZ {
6491    /**
6492     * The elements in the array.
6493     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6494     */
6495    struct LDKChannelMonitor *data;
6496    /**
6497     * The number of elements pointed to by `data`.
6498     */
6499    uintptr_t datalen;
6500 } LDKCVec_ChannelMonitorZ;
6501
6502
6503
6504 /**
6505  * An update generated by the underlying Channel itself which contains some new information the
6506  * ChannelMonitor should be made aware of.
6507  */
6508 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
6509    /**
6510     * A pointer to the opaque Rust object.
6511     * Nearly everywhere, inner must be non-null, however in places where
6512     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6513     */
6514    LDKnativeChannelMonitorUpdate *inner;
6515    /**
6516     * Indicates that this is the only struct which contains the same pointer.
6517     * Rust functions which take ownership of an object provided via an argument require
6518     * this to be true and invalidate the object pointed to by inner.
6519     */
6520    bool is_owned;
6521 } LDKChannelMonitorUpdate;
6522
6523 /**
6524  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
6525  * blocks are connected and disconnected.
6526  *
6527  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
6528  * responsible for maintaining a set of monitors such that they can be updated accordingly as
6529  * channel state changes and HTLCs are resolved. See method documentation for specific
6530  * requirements.
6531  *
6532  * Implementations **must** ensure that updates are successfully applied and persisted upon method
6533  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
6534  * without taking any further action such as persisting the current state.
6535  *
6536  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
6537  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
6538  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
6539  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
6540  * multiple instances.
6541  *
6542  * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure
6543  */
6544 typedef struct LDKWatch {
6545    /**
6546     * An opaque pointer which is passed to your function implementations as an argument.
6547     * This has no meaning in the LDK, and can be NULL or any other value.
6548     */
6549    void *this_arg;
6550    /**
6551     * Watches a channel identified by `funding_txo` using `monitor`.
6552     *
6553     * Implementations are responsible for watching the chain for the funding transaction along
6554     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
6555     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
6556     *
6557     * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if
6558     * the given `funding_txo` has previously been registered via `watch_channel`.
6559     *
6560     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
6561     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
6562     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
6563     */
6564    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
6565    /**
6566     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
6567     *
6568     * Implementations must call [`update_monitor`] with the given update. See
6569     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
6570     *
6571     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
6572     */
6573    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
6574    /**
6575     * Returns any monitor events since the last call. Subsequent calls must only return new
6576     * events.
6577     *
6578     * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
6579     * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
6580     * to disk.
6581     *
6582     * For details on asynchronous [`ChannelMonitor`] updating and returning
6583     * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
6584     */
6585    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
6586    /**
6587     * Frees any resources associated with this object given its this_arg pointer.
6588     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6589     */
6590    void (*free)(void *this_arg);
6591 } LDKWatch;
6592
6593 /**
6594  * An interface to send a transaction to the Bitcoin network.
6595  */
6596 typedef struct LDKBroadcasterInterface {
6597    /**
6598     * An opaque pointer which is passed to your function implementations as an argument.
6599     * This has no meaning in the LDK, and can be NULL or any other value.
6600     */
6601    void *this_arg;
6602    /**
6603     * Sends a transaction out to (hopefully) be mined.
6604     */
6605    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
6606    /**
6607     * Frees any resources associated with this object given its this_arg pointer.
6608     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6609     */
6610    void (*free)(void *this_arg);
6611 } LDKBroadcasterInterface;
6612
6613 /**
6614  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
6615  * own the memory pointed to by data.
6616  */
6617 typedef struct LDKu8slice {
6618    /**
6619     * A pointer to the byte buffer
6620     */
6621    const uint8_t *data;
6622    /**
6623     * The number of bytes pointed to by `data`.
6624     */
6625    uintptr_t datalen;
6626 } LDKu8slice;
6627
6628 /**
6629  * A trait to describe an object which can get user secrets and key material.
6630  */
6631 typedef struct LDKKeysInterface {
6632    /**
6633     * An opaque pointer which is passed to your function implementations as an argument.
6634     * This has no meaning in the LDK, and can be NULL or any other value.
6635     */
6636    void *this_arg;
6637    /**
6638     * Get node secret key (aka node_id or network_key) based on the provided [`Recipient`].
6639     *
6640     * This method must return the same value each time it is called with a given `Recipient`
6641     * parameter.
6642     */
6643    struct LDKCResult_SecretKeyNoneZ (*get_node_secret)(const void *this_arg, enum LDKRecipient recipient);
6644    /**
6645     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
6646     *
6647     * This method should return a different value each time it is called, to avoid linking
6648     * on-chain funds across channels as controlled to the same user.
6649     */
6650    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
6651    /**
6652     * Get a script pubkey which we will send funds to when closing a channel.
6653     *
6654     * This method should return a different value each time it is called, to avoid linking
6655     * on-chain funds across channels as controlled to the same user.
6656     */
6657    struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
6658    /**
6659     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
6660     * restarted with some stale data!
6661     *
6662     * This method must return a different value each time it is called.
6663     */
6664    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
6665    /**
6666     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
6667     * onion packets and for temporary channel IDs. There is no requirement that these be
6668     * persisted anywhere, though they must be unique across restarts.
6669     *
6670     * This method must return a different value each time it is called.
6671     */
6672    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
6673    /**
6674     * Reads a `Signer` for this `KeysInterface` from the given input stream.
6675     * This is only called during deserialization of other objects which contain
6676     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
6677     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
6678     * contain no versioning scheme. You may wish to include your own version prefix and ensure
6679     * you've read all of the provided bytes to ensure no corruption occurred.
6680     */
6681    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
6682    /**
6683     * Sign an invoice.
6684     * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of
6685     * this trait to parse the invoice and make sure they're signing what they expect, rather than
6686     * blindly signing the hash.
6687     * The hrp is ascii bytes, while the invoice data is base32.
6688     *
6689     * The secret key used to sign the invoice is dependent on the [`Recipient`].
6690     */
6691    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z invoice_data, enum LDKRecipient receipient);
6692    /**
6693     * Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
6694     *
6695     * If the implementor of this trait supports [phantom node payments], then every node that is
6696     * intended to be included in the phantom invoice route hints must return the same value from
6697     * this method.
6698     *
6699     * This method must return the same value each time it is called.
6700     *
6701     * [phantom node payments]: PhantomKeysManager
6702     */
6703    struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg);
6704    /**
6705     * Frees any resources associated with this object given its this_arg pointer.
6706     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6707     */
6708    void (*free)(void *this_arg);
6709 } LDKKeysInterface;
6710
6711 /**
6712  * A trait which should be implemented to provide feerate information on a number of time
6713  * horizons.
6714  *
6715  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
6716  * called from inside the library in response to chain events, P2P events, or timer events).
6717  */
6718 typedef struct LDKFeeEstimator {
6719    /**
6720     * An opaque pointer which is passed to your function implementations as an argument.
6721     * This has no meaning in the LDK, and can be NULL or any other value.
6722     */
6723    void *this_arg;
6724    /**
6725     * Gets estimated satoshis of fee required per 1000 Weight-Units.
6726     *
6727     * Must return a value no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later
6728     * round-downs don't put us below 1 satoshi-per-byte).
6729     *
6730     * This method can be implemented with the following unit conversions:
6731     *  * max(satoshis-per-byte * 250, 253)
6732     *  * max(satoshis-per-kbyte / 4, 253)
6733     */
6734    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
6735    /**
6736     * Frees any resources associated with this object given its this_arg pointer.
6737     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6738     */
6739    void (*free)(void *this_arg);
6740 } LDKFeeEstimator;
6741
6742
6743
6744 /**
6745  * A Record, unit of logging output with Metadata to enable filtering
6746  * Module_path, file, line to inform on log's source
6747  */
6748 typedef struct MUST_USE_STRUCT LDKRecord {
6749    /**
6750     * A pointer to the opaque Rust object.
6751     * Nearly everywhere, inner must be non-null, however in places where
6752     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6753     */
6754    LDKnativeRecord *inner;
6755    /**
6756     * Indicates that this is the only struct which contains the same pointer.
6757     * Rust functions which take ownership of an object provided via an argument require
6758     * this to be true and invalidate the object pointed to by inner.
6759     */
6760    bool is_owned;
6761 } LDKRecord;
6762
6763 /**
6764  * A trait encapsulating the operations required of a logger
6765  */
6766 typedef struct LDKLogger {
6767    /**
6768     * An opaque pointer which is passed to your function implementations as an argument.
6769     * This has no meaning in the LDK, and can be NULL or any other value.
6770     */
6771    void *this_arg;
6772    /**
6773     * Logs the `Record`
6774     */
6775    void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record);
6776    /**
6777     * Frees any resources associated with this object given its this_arg pointer.
6778     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6779     */
6780    void (*free)(void *this_arg);
6781 } LDKLogger;
6782
6783
6784
6785 /**
6786  * Manager which keeps track of a number of channels and sends messages to the appropriate
6787  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
6788  *
6789  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
6790  * to individual Channels.
6791  *
6792  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
6793  * all peers during write/read (though does not modify this instance, only the instance being
6794  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
6795  * called funding_transaction_generated for outbound channels).
6796  *
6797  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
6798  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
6799  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
6800  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
6801  * the serialization process). If the deserialized version is out-of-date compared to the
6802  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
6803  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
6804  *
6805  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
6806  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
6807  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
6808  * block_connected() to step towards your best block) upon deserialization before using the
6809  * object!
6810  *
6811  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
6812  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
6813  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
6814  * offline for a full minute. In order to track this, you must call
6815  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
6816  *
6817  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
6818  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
6819  * essentially you should default to using a SimpleRefChannelManager, and use a
6820  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
6821  * you're using lightning-net-tokio.
6822  */
6823 typedef struct MUST_USE_STRUCT LDKChannelManager {
6824    /**
6825     * A pointer to the opaque Rust object.
6826     * Nearly everywhere, inner must be non-null, however in places where
6827     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6828     */
6829    LDKnativeChannelManager *inner;
6830    /**
6831     * Indicates that this is the only struct which contains the same pointer.
6832     * Rust functions which take ownership of an object provided via an argument require
6833     * this to be true and invalidate the object pointed to by inner.
6834     */
6835    bool is_owned;
6836 } LDKChannelManager;
6837
6838 /**
6839  * A tuple of 2 elements. See the individual fields for the types contained.
6840  */
6841 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
6842    /**
6843     * The element at position 0
6844     */
6845    struct LDKThirtyTwoBytes a;
6846    /**
6847     * The element at position 1
6848     */
6849    struct LDKChannelManager b;
6850 } LDKC2Tuple_BlockHashChannelManagerZ;
6851
6852 /**
6853  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
6854  */
6855 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6856    /**
6857     * A pointer to the contents in the success state.
6858     * Reading from this pointer when `result_ok` is not set is undefined.
6859     */
6860    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
6861    /**
6862     * A pointer to the contents in the error state.
6863     * Reading from this pointer when `result_ok` is set is undefined.
6864     */
6865    struct LDKDecodeError *err;
6866 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
6867
6868 /**
6869  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
6870  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6871  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6872  */
6873 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6874    /**
6875     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
6876     * `err` or `result` depending on the state of `result_ok`.
6877     */
6878    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
6879    /**
6880     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
6881     */
6882    bool result_ok;
6883 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
6884
6885
6886
6887 /**
6888  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
6889  * with our counterparty.
6890  */
6891 typedef struct MUST_USE_STRUCT LDKChannelConfig {
6892    /**
6893     * A pointer to the opaque Rust object.
6894     * Nearly everywhere, inner must be non-null, however in places where
6895     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6896     */
6897    LDKnativeChannelConfig *inner;
6898    /**
6899     * Indicates that this is the only struct which contains the same pointer.
6900     * Rust functions which take ownership of an object provided via an argument require
6901     * this to be true and invalidate the object pointed to by inner.
6902     */
6903    bool is_owned;
6904 } LDKChannelConfig;
6905
6906 /**
6907  * The contents of CResult_ChannelConfigDecodeErrorZ
6908  */
6909 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
6910    /**
6911     * A pointer to the contents in the success state.
6912     * Reading from this pointer when `result_ok` is not set is undefined.
6913     */
6914    struct LDKChannelConfig *result;
6915    /**
6916     * A pointer to the contents in the error state.
6917     * Reading from this pointer when `result_ok` is set is undefined.
6918     */
6919    struct LDKDecodeError *err;
6920 } LDKCResult_ChannelConfigDecodeErrorZPtr;
6921
6922 /**
6923  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
6924  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
6925  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6926  */
6927 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
6928    /**
6929     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
6930     * `err` or `result` depending on the state of `result_ok`.
6931     */
6932    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
6933    /**
6934     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
6935     */
6936    bool result_ok;
6937 } LDKCResult_ChannelConfigDecodeErrorZ;
6938
6939 /**
6940  * The contents of CResult_OutPointDecodeErrorZ
6941  */
6942 typedef union LDKCResult_OutPointDecodeErrorZPtr {
6943    /**
6944     * A pointer to the contents in the success state.
6945     * Reading from this pointer when `result_ok` is not set is undefined.
6946     */
6947    struct LDKOutPoint *result;
6948    /**
6949     * A pointer to the contents in the error state.
6950     * Reading from this pointer when `result_ok` is set is undefined.
6951     */
6952    struct LDKDecodeError *err;
6953 } LDKCResult_OutPointDecodeErrorZPtr;
6954
6955 /**
6956  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
6957  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
6958  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6959  */
6960 typedef struct LDKCResult_OutPointDecodeErrorZ {
6961    /**
6962     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
6963     * `err` or `result` depending on the state of `result_ok`.
6964     */
6965    union LDKCResult_OutPointDecodeErrorZPtr contents;
6966    /**
6967     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
6968     */
6969    bool result_ok;
6970 } LDKCResult_OutPointDecodeErrorZ;
6971
6972 /**
6973  * Defines a type identifier for sending messages over the wire.
6974  *
6975  * Messages implementing this trait specify a type and must be [`Writeable`].
6976  */
6977 typedef struct LDKType {
6978    /**
6979     * An opaque pointer which is passed to your function implementations as an argument.
6980     * This has no meaning in the LDK, and can be NULL or any other value.
6981     */
6982    void *this_arg;
6983    /**
6984     * Returns the type identifying the message payload.
6985     */
6986    uint16_t (*type_id)(const void *this_arg);
6987    /**
6988     * Return a human-readable "debug" string describing this object
6989     */
6990    struct LDKStr (*debug_str)(const void *this_arg);
6991    /**
6992     * Serialize the object into a byte array
6993     */
6994    struct LDKCVec_u8Z (*write)(const void *this_arg);
6995    /**
6996     * Frees any resources associated with this object given its this_arg pointer.
6997     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6998     */
6999    void (*free)(void *this_arg);
7000 } LDKType;
7001
7002 /**
7003  * An enum which can either contain a crate::lightning::ln::wire::Type or not
7004  */
7005 typedef enum LDKCOption_TypeZ_Tag {
7006    /**
7007     * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
7008     */
7009    LDKCOption_TypeZ_Some,
7010    /**
7011     * When we're in this state, this COption_TypeZ contains nothing
7012     */
7013    LDKCOption_TypeZ_None,
7014    /**
7015     * Must be last for serialization purposes
7016     */
7017    LDKCOption_TypeZ_Sentinel,
7018 } LDKCOption_TypeZ_Tag;
7019
7020 typedef struct LDKCOption_TypeZ {
7021    LDKCOption_TypeZ_Tag tag;
7022    union {
7023       struct {
7024          struct LDKType some;
7025       };
7026    };
7027 } LDKCOption_TypeZ;
7028
7029 /**
7030  * The contents of CResult_COption_TypeZDecodeErrorZ
7031  */
7032 typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
7033    /**
7034     * A pointer to the contents in the success state.
7035     * Reading from this pointer when `result_ok` is not set is undefined.
7036     */
7037    struct LDKCOption_TypeZ *result;
7038    /**
7039     * A pointer to the contents in the error state.
7040     * Reading from this pointer when `result_ok` is set is undefined.
7041     */
7042    struct LDKDecodeError *err;
7043 } LDKCResult_COption_TypeZDecodeErrorZPtr;
7044
7045 /**
7046  * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
7047  * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7048  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7049  */
7050 typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
7051    /**
7052     * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
7053     * `err` or `result` depending on the state of `result_ok`.
7054     */
7055    union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
7056    /**
7057     * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
7058     */
7059    bool result_ok;
7060 } LDKCResult_COption_TypeZDecodeErrorZ;
7061
7062 /**
7063  * An error that may occur when making a payment.
7064  */
7065 typedef enum LDKPaymentError_Tag {
7066    /**
7067     * An error resulting from the provided [`Invoice`] or payment hash.
7068     */
7069    LDKPaymentError_Invoice,
7070    /**
7071     * An error occurring when finding a route.
7072     */
7073    LDKPaymentError_Routing,
7074    /**
7075     * An error occurring when sending a payment.
7076     */
7077    LDKPaymentError_Sending,
7078    /**
7079     * Must be last for serialization purposes
7080     */
7081    LDKPaymentError_Sentinel,
7082 } LDKPaymentError_Tag;
7083
7084 typedef struct MUST_USE_STRUCT LDKPaymentError {
7085    LDKPaymentError_Tag tag;
7086    union {
7087       struct {
7088          struct LDKStr invoice;
7089       };
7090       struct {
7091          struct LDKLightningError routing;
7092       };
7093       struct {
7094          struct LDKPaymentSendFailure sending;
7095       };
7096    };
7097 } LDKPaymentError;
7098
7099 /**
7100  * The contents of CResult_PaymentIdPaymentErrorZ
7101  */
7102 typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
7103    /**
7104     * A pointer to the contents in the success state.
7105     * Reading from this pointer when `result_ok` is not set is undefined.
7106     */
7107    struct LDKThirtyTwoBytes *result;
7108    /**
7109     * A pointer to the contents in the error state.
7110     * Reading from this pointer when `result_ok` is set is undefined.
7111     */
7112    struct LDKPaymentError *err;
7113 } LDKCResult_PaymentIdPaymentErrorZPtr;
7114
7115 /**
7116  * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
7117  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
7118  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7119  */
7120 typedef struct LDKCResult_PaymentIdPaymentErrorZ {
7121    /**
7122     * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
7123     * `err` or `result` depending on the state of `result_ok`.
7124     */
7125    union LDKCResult_PaymentIdPaymentErrorZPtr contents;
7126    /**
7127     * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
7128     */
7129    bool result_ok;
7130 } LDKCResult_PaymentIdPaymentErrorZ;
7131
7132 /**
7133  * The contents of CResult_SiPrefixNoneZ
7134  */
7135 typedef union LDKCResult_SiPrefixNoneZPtr {
7136    /**
7137     * A pointer to the contents in the success state.
7138     * Reading from this pointer when `result_ok` is not set is undefined.
7139     */
7140    enum LDKSiPrefix *result;
7141    /**
7142     * Note that this value is always NULL, as there are no contents in the Err variant
7143     */
7144    void *err;
7145 } LDKCResult_SiPrefixNoneZPtr;
7146
7147 /**
7148  * A CResult_SiPrefixNoneZ represents the result of a fallible operation,
7149  * containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
7150  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7151  */
7152 typedef struct LDKCResult_SiPrefixNoneZ {
7153    /**
7154     * The contents of this CResult_SiPrefixNoneZ, accessible via either
7155     * `err` or `result` depending on the state of `result_ok`.
7156     */
7157    union LDKCResult_SiPrefixNoneZPtr contents;
7158    /**
7159     * Whether this CResult_SiPrefixNoneZ represents a success state.
7160     */
7161    bool result_ok;
7162 } LDKCResult_SiPrefixNoneZ;
7163
7164
7165
7166 /**
7167  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
7168  *
7169  * There are three ways to construct an `Invoice`:
7170  *  1. using `InvoiceBuilder`
7171  *  2. using `Invoice::from_signed(SignedRawInvoice)`
7172  *  3. using `str::parse::<Invoice>(&str)`
7173  */
7174 typedef struct MUST_USE_STRUCT LDKInvoice {
7175    /**
7176     * A pointer to the opaque Rust object.
7177     * Nearly everywhere, inner must be non-null, however in places where
7178     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7179     */
7180    LDKnativeInvoice *inner;
7181    /**
7182     * Indicates that this is the only struct which contains the same pointer.
7183     * Rust functions which take ownership of an object provided via an argument require
7184     * this to be true and invalidate the object pointed to by inner.
7185     */
7186    bool is_owned;
7187 } LDKInvoice;
7188
7189 /**
7190  * The contents of CResult_InvoiceNoneZ
7191  */
7192 typedef union LDKCResult_InvoiceNoneZPtr {
7193    /**
7194     * A pointer to the contents in the success state.
7195     * Reading from this pointer when `result_ok` is not set is undefined.
7196     */
7197    struct LDKInvoice *result;
7198    /**
7199     * Note that this value is always NULL, as there are no contents in the Err variant
7200     */
7201    void *err;
7202 } LDKCResult_InvoiceNoneZPtr;
7203
7204 /**
7205  * A CResult_InvoiceNoneZ represents the result of a fallible operation,
7206  * containing a crate::lightning_invoice::Invoice on success and a () on failure.
7207  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7208  */
7209 typedef struct LDKCResult_InvoiceNoneZ {
7210    /**
7211     * The contents of this CResult_InvoiceNoneZ, accessible via either
7212     * `err` or `result` depending on the state of `result_ok`.
7213     */
7214    union LDKCResult_InvoiceNoneZPtr contents;
7215    /**
7216     * Whether this CResult_InvoiceNoneZ represents a success state.
7217     */
7218    bool result_ok;
7219 } LDKCResult_InvoiceNoneZ;
7220
7221
7222
7223 /**
7224  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
7225  * invalid.
7226  *
7227  * # Invariants
7228  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
7229  */
7230 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
7231    /**
7232     * A pointer to the opaque Rust object.
7233     * Nearly everywhere, inner must be non-null, however in places where
7234     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7235     */
7236    LDKnativeSignedRawInvoice *inner;
7237    /**
7238     * Indicates that this is the only struct which contains the same pointer.
7239     * Rust functions which take ownership of an object provided via an argument require
7240     * this to be true and invalidate the object pointed to by inner.
7241     */
7242    bool is_owned;
7243 } LDKSignedRawInvoice;
7244
7245 /**
7246  * The contents of CResult_SignedRawInvoiceNoneZ
7247  */
7248 typedef union LDKCResult_SignedRawInvoiceNoneZPtr {
7249    /**
7250     * A pointer to the contents in the success state.
7251     * Reading from this pointer when `result_ok` is not set is undefined.
7252     */
7253    struct LDKSignedRawInvoice *result;
7254    /**
7255     * Note that this value is always NULL, as there are no contents in the Err variant
7256     */
7257    void *err;
7258 } LDKCResult_SignedRawInvoiceNoneZPtr;
7259
7260 /**
7261  * A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
7262  * containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
7263  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7264  */
7265 typedef struct LDKCResult_SignedRawInvoiceNoneZ {
7266    /**
7267     * The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
7268     * `err` or `result` depending on the state of `result_ok`.
7269     */
7270    union LDKCResult_SignedRawInvoiceNoneZPtr contents;
7271    /**
7272     * Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
7273     */
7274    bool result_ok;
7275 } LDKCResult_SignedRawInvoiceNoneZ;
7276
7277
7278
7279 /**
7280  * Represents an syntactically correct Invoice for a payment on the lightning network,
7281  * but without the signature information.
7282  * De- and encoding should not lead to information loss but may lead to different hashes.
7283  *
7284  * For methods without docs see the corresponding methods in `Invoice`.
7285  */
7286 typedef struct MUST_USE_STRUCT LDKRawInvoice {
7287    /**
7288     * A pointer to the opaque Rust object.
7289     * Nearly everywhere, inner must be non-null, however in places where
7290     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7291     */
7292    LDKnativeRawInvoice *inner;
7293    /**
7294     * Indicates that this is the only struct which contains the same pointer.
7295     * Rust functions which take ownership of an object provided via an argument require
7296     * this to be true and invalidate the object pointed to by inner.
7297     */
7298    bool is_owned;
7299 } LDKRawInvoice;
7300
7301
7302
7303 /**
7304  * Recoverable signature
7305  */
7306 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
7307    /**
7308     * A pointer to the opaque Rust object.
7309     * Nearly everywhere, inner must be non-null, however in places where
7310     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7311     */
7312    LDKnativeInvoiceSignature *inner;
7313    /**
7314     * Indicates that this is the only struct which contains the same pointer.
7315     * Rust functions which take ownership of an object provided via an argument require
7316     * this to be true and invalidate the object pointed to by inner.
7317     */
7318    bool is_owned;
7319 } LDKInvoiceSignature;
7320
7321 /**
7322  * A tuple of 3 elements. See the individual fields for the types contained.
7323  */
7324 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
7325    /**
7326     * The element at position 0
7327     */
7328    struct LDKRawInvoice a;
7329    /**
7330     * The element at position 1
7331     */
7332    struct LDKThirtyTwoBytes b;
7333    /**
7334     * The element at position 2
7335     */
7336    struct LDKInvoiceSignature c;
7337 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
7338
7339
7340
7341 /**
7342  * Payee public key
7343  */
7344 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
7345    /**
7346     * A pointer to the opaque Rust object.
7347     * Nearly everywhere, inner must be non-null, however in places where
7348     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7349     */
7350    LDKnativePayeePubKey *inner;
7351    /**
7352     * Indicates that this is the only struct which contains the same pointer.
7353     * Rust functions which take ownership of an object provided via an argument require
7354     * this to be true and invalidate the object pointed to by inner.
7355     */
7356    bool is_owned;
7357 } LDKPayeePubKey;
7358
7359 /**
7360  * The contents of CResult_PayeePubKeyErrorZ
7361  */
7362 typedef union LDKCResult_PayeePubKeyErrorZPtr {
7363    /**
7364     * A pointer to the contents in the success state.
7365     * Reading from this pointer when `result_ok` is not set is undefined.
7366     */
7367    struct LDKPayeePubKey *result;
7368    /**
7369     * A pointer to the contents in the error state.
7370     * Reading from this pointer when `result_ok` is set is undefined.
7371     */
7372    enum LDKSecp256k1Error *err;
7373 } LDKCResult_PayeePubKeyErrorZPtr;
7374
7375 /**
7376  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
7377  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
7378  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7379  */
7380 typedef struct LDKCResult_PayeePubKeyErrorZ {
7381    /**
7382     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
7383     * `err` or `result` depending on the state of `result_ok`.
7384     */
7385    union LDKCResult_PayeePubKeyErrorZPtr contents;
7386    /**
7387     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
7388     */
7389    bool result_ok;
7390 } LDKCResult_PayeePubKeyErrorZ;
7391
7392
7393
7394 /**
7395  * Private routing information
7396  *
7397  * # Invariants
7398  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
7399  *
7400  */
7401 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
7402    /**
7403     * A pointer to the opaque Rust object.
7404     * Nearly everywhere, inner must be non-null, however in places where
7405     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7406     */
7407    LDKnativePrivateRoute *inner;
7408    /**
7409     * Indicates that this is the only struct which contains the same pointer.
7410     * Rust functions which take ownership of an object provided via an argument require
7411     * this to be true and invalidate the object pointed to by inner.
7412     */
7413    bool is_owned;
7414 } LDKPrivateRoute;
7415
7416 /**
7417  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
7418  * This corresponds to std::vector in C++
7419  */
7420 typedef struct LDKCVec_PrivateRouteZ {
7421    /**
7422     * The elements in the array.
7423     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7424     */
7425    struct LDKPrivateRoute *data;
7426    /**
7427     * The number of elements pointed to by `data`.
7428     */
7429    uintptr_t datalen;
7430 } LDKCVec_PrivateRouteZ;
7431
7432
7433
7434 /**
7435  * A timestamp that refers to a date after 1 January 1970.
7436  *
7437  * # Invariants
7438  *
7439  * The Unix timestamp representing the stored time has to be positive and no greater than
7440  * [`MAX_TIMESTAMP`].
7441  */
7442 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
7443    /**
7444     * A pointer to the opaque Rust object.
7445     * Nearly everywhere, inner must be non-null, however in places where
7446     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7447     */
7448    LDKnativePositiveTimestamp *inner;
7449    /**
7450     * Indicates that this is the only struct which contains the same pointer.
7451     * Rust functions which take ownership of an object provided via an argument require
7452     * this to be true and invalidate the object pointed to by inner.
7453     */
7454    bool is_owned;
7455 } LDKPositiveTimestamp;
7456
7457 /**
7458  * The contents of CResult_PositiveTimestampCreationErrorZ
7459  */
7460 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
7461    /**
7462     * A pointer to the contents in the success state.
7463     * Reading from this pointer when `result_ok` is not set is undefined.
7464     */
7465    struct LDKPositiveTimestamp *result;
7466    /**
7467     * A pointer to the contents in the error state.
7468     * Reading from this pointer when `result_ok` is set is undefined.
7469     */
7470    enum LDKCreationError *err;
7471 } LDKCResult_PositiveTimestampCreationErrorZPtr;
7472
7473 /**
7474  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
7475  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
7476  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7477  */
7478 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
7479    /**
7480     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
7481     * `err` or `result` depending on the state of `result_ok`.
7482     */
7483    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
7484    /**
7485     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
7486     */
7487    bool result_ok;
7488 } LDKCResult_PositiveTimestampCreationErrorZ;
7489
7490 /**
7491  * The contents of CResult_NoneSemanticErrorZ
7492  */
7493 typedef union LDKCResult_NoneSemanticErrorZPtr {
7494    /**
7495     * Note that this value is always NULL, as there are no contents in the OK variant
7496     */
7497    void *result;
7498    /**
7499     * A pointer to the contents in the error state.
7500     * Reading from this pointer when `result_ok` is set is undefined.
7501     */
7502    enum LDKSemanticError *err;
7503 } LDKCResult_NoneSemanticErrorZPtr;
7504
7505 /**
7506  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
7507  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
7508  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7509  */
7510 typedef struct LDKCResult_NoneSemanticErrorZ {
7511    /**
7512     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
7513     * `err` or `result` depending on the state of `result_ok`.
7514     */
7515    union LDKCResult_NoneSemanticErrorZPtr contents;
7516    /**
7517     * Whether this CResult_NoneSemanticErrorZ represents a success state.
7518     */
7519    bool result_ok;
7520 } LDKCResult_NoneSemanticErrorZ;
7521
7522 /**
7523  * The contents of CResult_InvoiceSemanticErrorZ
7524  */
7525 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
7526    /**
7527     * A pointer to the contents in the success state.
7528     * Reading from this pointer when `result_ok` is not set is undefined.
7529     */
7530    struct LDKInvoice *result;
7531    /**
7532     * A pointer to the contents in the error state.
7533     * Reading from this pointer when `result_ok` is set is undefined.
7534     */
7535    enum LDKSemanticError *err;
7536 } LDKCResult_InvoiceSemanticErrorZPtr;
7537
7538 /**
7539  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
7540  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
7541  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7542  */
7543 typedef struct LDKCResult_InvoiceSemanticErrorZ {
7544    /**
7545     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
7546     * `err` or `result` depending on the state of `result_ok`.
7547     */
7548    union LDKCResult_InvoiceSemanticErrorZPtr contents;
7549    /**
7550     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
7551     */
7552    bool result_ok;
7553 } LDKCResult_InvoiceSemanticErrorZ;
7554
7555
7556
7557 /**
7558  * Description string
7559  *
7560  * # Invariants
7561  * The description can be at most 639 __bytes__ long
7562  */
7563 typedef struct MUST_USE_STRUCT LDKDescription {
7564    /**
7565     * A pointer to the opaque Rust object.
7566     * Nearly everywhere, inner must be non-null, however in places where
7567     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7568     */
7569    LDKnativeDescription *inner;
7570    /**
7571     * Indicates that this is the only struct which contains the same pointer.
7572     * Rust functions which take ownership of an object provided via an argument require
7573     * this to be true and invalidate the object pointed to by inner.
7574     */
7575    bool is_owned;
7576 } LDKDescription;
7577
7578 /**
7579  * The contents of CResult_DescriptionCreationErrorZ
7580  */
7581 typedef union LDKCResult_DescriptionCreationErrorZPtr {
7582    /**
7583     * A pointer to the contents in the success state.
7584     * Reading from this pointer when `result_ok` is not set is undefined.
7585     */
7586    struct LDKDescription *result;
7587    /**
7588     * A pointer to the contents in the error state.
7589     * Reading from this pointer when `result_ok` is set is undefined.
7590     */
7591    enum LDKCreationError *err;
7592 } LDKCResult_DescriptionCreationErrorZPtr;
7593
7594 /**
7595  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
7596  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
7597  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7598  */
7599 typedef struct LDKCResult_DescriptionCreationErrorZ {
7600    /**
7601     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
7602     * `err` or `result` depending on the state of `result_ok`.
7603     */
7604    union LDKCResult_DescriptionCreationErrorZPtr contents;
7605    /**
7606     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
7607     */
7608    bool result_ok;
7609 } LDKCResult_DescriptionCreationErrorZ;
7610
7611 /**
7612  * The contents of CResult_PrivateRouteCreationErrorZ
7613  */
7614 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
7615    /**
7616     * A pointer to the contents in the success state.
7617     * Reading from this pointer when `result_ok` is not set is undefined.
7618     */
7619    struct LDKPrivateRoute *result;
7620    /**
7621     * A pointer to the contents in the error state.
7622     * Reading from this pointer when `result_ok` is set is undefined.
7623     */
7624    enum LDKCreationError *err;
7625 } LDKCResult_PrivateRouteCreationErrorZPtr;
7626
7627 /**
7628  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
7629  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
7630  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7631  */
7632 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
7633    /**
7634     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
7635     * `err` or `result` depending on the state of `result_ok`.
7636     */
7637    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
7638    /**
7639     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
7640     */
7641    bool result_ok;
7642 } LDKCResult_PrivateRouteCreationErrorZ;
7643
7644 /**
7645  * The contents of CResult_StringErrorZ
7646  */
7647 typedef union LDKCResult_StringErrorZPtr {
7648    /**
7649     * A pointer to the contents in the success state.
7650     * Reading from this pointer when `result_ok` is not set is undefined.
7651     */
7652    struct LDKStr *result;
7653    /**
7654     * A pointer to the contents in the error state.
7655     * Reading from this pointer when `result_ok` is set is undefined.
7656     */
7657    enum LDKSecp256k1Error *err;
7658 } LDKCResult_StringErrorZPtr;
7659
7660 /**
7661  * A CResult_StringErrorZ represents the result of a fallible operation,
7662  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
7663  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7664  */
7665 typedef struct LDKCResult_StringErrorZ {
7666    /**
7667     * The contents of this CResult_StringErrorZ, accessible via either
7668     * `err` or `result` depending on the state of `result_ok`.
7669     */
7670    union LDKCResult_StringErrorZPtr contents;
7671    /**
7672     * Whether this CResult_StringErrorZ represents a success state.
7673     */
7674    bool result_ok;
7675 } LDKCResult_StringErrorZ;
7676
7677 /**
7678  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
7679  */
7680 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
7681    /**
7682     * A pointer to the contents in the success state.
7683     * Reading from this pointer when `result_ok` is not set is undefined.
7684     */
7685    struct LDKChannelMonitorUpdate *result;
7686    /**
7687     * A pointer to the contents in the error state.
7688     * Reading from this pointer when `result_ok` is set is undefined.
7689     */
7690    struct LDKDecodeError *err;
7691 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
7692
7693 /**
7694  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
7695  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7696  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7697  */
7698 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
7699    /**
7700     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
7701     * `err` or `result` depending on the state of `result_ok`.
7702     */
7703    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
7704    /**
7705     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
7706     */
7707    bool result_ok;
7708 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
7709
7710 /**
7711  * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
7712  */
7713 typedef enum LDKCOption_MonitorEventZ_Tag {
7714    /**
7715     * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
7716     */
7717    LDKCOption_MonitorEventZ_Some,
7718    /**
7719     * When we're in this state, this COption_MonitorEventZ contains nothing
7720     */
7721    LDKCOption_MonitorEventZ_None,
7722    /**
7723     * Must be last for serialization purposes
7724     */
7725    LDKCOption_MonitorEventZ_Sentinel,
7726 } LDKCOption_MonitorEventZ_Tag;
7727
7728 typedef struct LDKCOption_MonitorEventZ {
7729    LDKCOption_MonitorEventZ_Tag tag;
7730    union {
7731       struct {
7732          struct LDKMonitorEvent some;
7733       };
7734    };
7735 } LDKCOption_MonitorEventZ;
7736
7737 /**
7738  * The contents of CResult_COption_MonitorEventZDecodeErrorZ
7739  */
7740 typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr {
7741    /**
7742     * A pointer to the contents in the success state.
7743     * Reading from this pointer when `result_ok` is not set is undefined.
7744     */
7745    struct LDKCOption_MonitorEventZ *result;
7746    /**
7747     * A pointer to the contents in the error state.
7748     * Reading from this pointer when `result_ok` is set is undefined.
7749     */
7750    struct LDKDecodeError *err;
7751 } LDKCResult_COption_MonitorEventZDecodeErrorZPtr;
7752
7753 /**
7754  * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
7755  * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7756  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7757  */
7758 typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ {
7759    /**
7760     * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
7761     * `err` or `result` depending on the state of `result_ok`.
7762     */
7763    union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents;
7764    /**
7765     * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
7766     */
7767    bool result_ok;
7768 } LDKCResult_COption_MonitorEventZDecodeErrorZ;
7769
7770 /**
7771  * The contents of CResult_HTLCUpdateDecodeErrorZ
7772  */
7773 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
7774    /**
7775     * A pointer to the contents in the success state.
7776     * Reading from this pointer when `result_ok` is not set is undefined.
7777     */
7778    struct LDKHTLCUpdate *result;
7779    /**
7780     * A pointer to the contents in the error state.
7781     * Reading from this pointer when `result_ok` is set is undefined.
7782     */
7783    struct LDKDecodeError *err;
7784 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
7785
7786 /**
7787  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
7788  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7789  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7790  */
7791 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
7792    /**
7793     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
7794     * `err` or `result` depending on the state of `result_ok`.
7795     */
7796    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
7797    /**
7798     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
7799     */
7800    bool result_ok;
7801 } LDKCResult_HTLCUpdateDecodeErrorZ;
7802
7803 /**
7804  * A tuple of 2 elements. See the individual fields for the types contained.
7805  */
7806 typedef struct LDKC2Tuple_OutPointScriptZ {
7807    /**
7808     * The element at position 0
7809     */
7810    struct LDKOutPoint a;
7811    /**
7812     * The element at position 1
7813     */
7814    struct LDKCVec_u8Z b;
7815 } LDKC2Tuple_OutPointScriptZ;
7816
7817 /**
7818  * A tuple of 2 elements. See the individual fields for the types contained.
7819  */
7820 typedef struct LDKC2Tuple_u32ScriptZ {
7821    /**
7822     * The element at position 0
7823     */
7824    uint32_t a;
7825    /**
7826     * The element at position 1
7827     */
7828    struct LDKCVec_u8Z b;
7829 } LDKC2Tuple_u32ScriptZ;
7830
7831 /**
7832  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
7833  * This corresponds to std::vector in C++
7834  */
7835 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
7836    /**
7837     * The elements in the array.
7838     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7839     */
7840    struct LDKC2Tuple_u32ScriptZ *data;
7841    /**
7842     * The number of elements pointed to by `data`.
7843     */
7844    uintptr_t datalen;
7845 } LDKCVec_C2Tuple_u32ScriptZZ;
7846
7847 /**
7848  * A tuple of 2 elements. See the individual fields for the types contained.
7849  */
7850 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
7851    /**
7852     * The element at position 0
7853     */
7854    struct LDKThirtyTwoBytes a;
7855    /**
7856     * The element at position 1
7857     */
7858    struct LDKCVec_C2Tuple_u32ScriptZZ b;
7859 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
7860
7861 /**
7862  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
7863  * This corresponds to std::vector in C++
7864  */
7865 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7866    /**
7867     * The elements in the array.
7868     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7869     */
7870    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
7871    /**
7872     * The number of elements pointed to by `data`.
7873     */
7874    uintptr_t datalen;
7875 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
7876
7877 /**
7878  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
7879  * This corresponds to std::vector in C++
7880  */
7881 typedef struct LDKCVec_EventZ {
7882    /**
7883     * The elements in the array.
7884     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7885     */
7886    struct LDKEvent *data;
7887    /**
7888     * The number of elements pointed to by `data`.
7889     */
7890    uintptr_t datalen;
7891 } LDKCVec_EventZ;
7892
7893 /**
7894  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
7895  * This corresponds to std::vector in C++
7896  */
7897 typedef struct LDKCVec_TransactionZ {
7898    /**
7899     * The elements in the array.
7900     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7901     */
7902    struct LDKTransaction *data;
7903    /**
7904     * The number of elements pointed to by `data`.
7905     */
7906    uintptr_t datalen;
7907 } LDKCVec_TransactionZ;
7908
7909 /**
7910  * A tuple of 2 elements. See the individual fields for the types contained.
7911  */
7912 typedef struct LDKC2Tuple_u32TxOutZ {
7913    /**
7914     * The element at position 0
7915     */
7916    uint32_t a;
7917    /**
7918     * The element at position 1
7919     */
7920    struct LDKTxOut b;
7921 } LDKC2Tuple_u32TxOutZ;
7922
7923 /**
7924  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
7925  * This corresponds to std::vector in C++
7926  */
7927 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
7928    /**
7929     * The elements in the array.
7930     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7931     */
7932    struct LDKC2Tuple_u32TxOutZ *data;
7933    /**
7934     * The number of elements pointed to by `data`.
7935     */
7936    uintptr_t datalen;
7937 } LDKCVec_C2Tuple_u32TxOutZZ;
7938
7939 /**
7940  * A tuple of 2 elements. See the individual fields for the types contained.
7941  */
7942 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7943    /**
7944     * The element at position 0
7945     */
7946    struct LDKThirtyTwoBytes a;
7947    /**
7948     * The element at position 1
7949     */
7950    struct LDKCVec_C2Tuple_u32TxOutZZ b;
7951 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
7952
7953 /**
7954  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
7955  * This corresponds to std::vector in C++
7956  */
7957 typedef struct LDKCVec_TransactionOutputsZ {
7958    /**
7959     * The elements in the array.
7960     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7961     */
7962    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
7963    /**
7964     * The number of elements pointed to by `data`.
7965     */
7966    uintptr_t datalen;
7967 } LDKCVec_TransactionOutputsZ;
7968
7969 /**
7970  * Details about the balance(s) available for spending once the channel appears on chain.
7971  *
7972  * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
7973  * be provided.
7974  */
7975 typedef enum LDKBalance_Tag {
7976    /**
7977     * The channel is not yet closed (or the commitment or closing transaction has not yet
7978     * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
7979     * force-closed now.
7980     */
7981    LDKBalance_ClaimableOnChannelClose,
7982    /**
7983     * The channel has been closed, and the given balance is ours but awaiting confirmations until
7984     * we consider it spendable.
7985     */
7986    LDKBalance_ClaimableAwaitingConfirmations,
7987    /**
7988     * The channel has been closed, and the given balance should be ours but awaiting spending
7989     * transaction confirmation. If the spending transaction does not confirm in time, it is
7990     * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
7991     *
7992     * Once the spending transaction confirms, before it has reached enough confirmations to be
7993     * considered safe from chain reorganizations, the balance will instead be provided via
7994     * [`Balance::ClaimableAwaitingConfirmations`].
7995     */
7996    LDKBalance_ContentiousClaimable,
7997    /**
7998     * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
7999     * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
8000     * likely to be claimed by our counterparty before we do.
8001     */
8002    LDKBalance_MaybeClaimableHTLCAwaitingTimeout,
8003    /**
8004     * Must be last for serialization purposes
8005     */
8006    LDKBalance_Sentinel,
8007 } LDKBalance_Tag;
8008
8009 typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
8010    /**
8011     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
8012     * required to do so.
8013     */
8014    uint64_t claimable_amount_satoshis;
8015 } LDKBalance_LDKClaimableOnChannelClose_Body;
8016
8017 typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
8018    /**
8019     * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
8020     * were spent in broadcasting the transaction.
8021     */
8022    uint64_t claimable_amount_satoshis;
8023    /**
8024     * The height at which an [`Event::SpendableOutputs`] event will be generated for this
8025     * amount.
8026     */
8027    uint32_t confirmation_height;
8028 } LDKBalance_LDKClaimableAwaitingConfirmations_Body;
8029
8030 typedef struct LDKBalance_LDKContentiousClaimable_Body {
8031    /**
8032     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
8033     * required to do so.
8034     */
8035    uint64_t claimable_amount_satoshis;
8036    /**
8037     * The height at which the counterparty may be able to claim the balance if we have not
8038     * done so.
8039     */
8040    uint32_t timeout_height;
8041 } LDKBalance_LDKContentiousClaimable_Body;
8042
8043 typedef struct LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body {
8044    /**
8045     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
8046     * required to do so.
8047     */
8048    uint64_t claimable_amount_satoshis;
8049    /**
8050     * The height at which we will be able to claim the balance if our counterparty has not
8051     * done so.
8052     */
8053    uint32_t claimable_height;
8054 } LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body;
8055
8056 typedef struct MUST_USE_STRUCT LDKBalance {
8057    LDKBalance_Tag tag;
8058    union {
8059       LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
8060       LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
8061       LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
8062       LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body maybe_claimable_htlc_awaiting_timeout;
8063    };
8064 } LDKBalance;
8065
8066 /**
8067  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
8068  * This corresponds to std::vector in C++
8069  */
8070 typedef struct LDKCVec_BalanceZ {
8071    /**
8072     * The elements in the array.
8073     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8074     */
8075    struct LDKBalance *data;
8076    /**
8077     * The number of elements pointed to by `data`.
8078     */
8079    uintptr_t datalen;
8080 } LDKCVec_BalanceZ;
8081
8082 /**
8083  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
8084  */
8085 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
8086    /**
8087     * A pointer to the contents in the success state.
8088     * Reading from this pointer when `result_ok` is not set is undefined.
8089     */
8090    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
8091    /**
8092     * A pointer to the contents in the error state.
8093     * Reading from this pointer when `result_ok` is set is undefined.
8094     */
8095    struct LDKDecodeError *err;
8096 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
8097
8098 /**
8099  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
8100  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8101  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8102  */
8103 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
8104    /**
8105     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
8106     * `err` or `result` depending on the state of `result_ok`.
8107     */
8108    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
8109    /**
8110     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
8111     */
8112    bool result_ok;
8113 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
8114
8115 /**
8116  * The contents of CResult_NoneLightningErrorZ
8117  */
8118 typedef union LDKCResult_NoneLightningErrorZPtr {
8119    /**
8120     * Note that this value is always NULL, as there are no contents in the OK variant
8121     */
8122    void *result;
8123    /**
8124     * A pointer to the contents in the error state.
8125     * Reading from this pointer when `result_ok` is set is undefined.
8126     */
8127    struct LDKLightningError *err;
8128 } LDKCResult_NoneLightningErrorZPtr;
8129
8130 /**
8131  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
8132  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
8133  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8134  */
8135 typedef struct LDKCResult_NoneLightningErrorZ {
8136    /**
8137     * The contents of this CResult_NoneLightningErrorZ, accessible via either
8138     * `err` or `result` depending on the state of `result_ok`.
8139     */
8140    union LDKCResult_NoneLightningErrorZPtr contents;
8141    /**
8142     * Whether this CResult_NoneLightningErrorZ represents a success state.
8143     */
8144    bool result_ok;
8145 } LDKCResult_NoneLightningErrorZ;
8146
8147 /**
8148  * A tuple of 2 elements. See the individual fields for the types contained.
8149  */
8150 typedef struct LDKC2Tuple_PublicKeyTypeZ {
8151    /**
8152     * The element at position 0
8153     */
8154    struct LDKPublicKey a;
8155    /**
8156     * The element at position 1
8157     */
8158    struct LDKType b;
8159 } LDKC2Tuple_PublicKeyTypeZ;
8160
8161 /**
8162  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
8163  * This corresponds to std::vector in C++
8164  */
8165 typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
8166    /**
8167     * The elements in the array.
8168     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8169     */
8170    struct LDKC2Tuple_PublicKeyTypeZ *data;
8171    /**
8172     * The number of elements pointed to by `data`.
8173     */
8174    uintptr_t datalen;
8175 } LDKCVec_C2Tuple_PublicKeyTypeZZ;
8176
8177 /**
8178  * The contents of CResult_boolLightningErrorZ
8179  */
8180 typedef union LDKCResult_boolLightningErrorZPtr {
8181    /**
8182     * A pointer to the contents in the success state.
8183     * Reading from this pointer when `result_ok` is not set is undefined.
8184     */
8185    bool *result;
8186    /**
8187     * A pointer to the contents in the error state.
8188     * Reading from this pointer when `result_ok` is set is undefined.
8189     */
8190    struct LDKLightningError *err;
8191 } LDKCResult_boolLightningErrorZPtr;
8192
8193 /**
8194  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
8195  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
8196  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8197  */
8198 typedef struct LDKCResult_boolLightningErrorZ {
8199    /**
8200     * The contents of this CResult_boolLightningErrorZ, accessible via either
8201     * `err` or `result` depending on the state of `result_ok`.
8202     */
8203    union LDKCResult_boolLightningErrorZPtr contents;
8204    /**
8205     * Whether this CResult_boolLightningErrorZ represents a success state.
8206     */
8207    bool result_ok;
8208 } LDKCResult_boolLightningErrorZ;
8209
8210 /**
8211  * A tuple of 3 elements. See the individual fields for the types contained.
8212  */
8213 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8214    /**
8215     * The element at position 0
8216     */
8217    struct LDKChannelAnnouncement a;
8218    /**
8219     * The element at position 1
8220     */
8221    struct LDKChannelUpdate b;
8222    /**
8223     * The element at position 2
8224     */
8225    struct LDKChannelUpdate c;
8226 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
8227
8228 /**
8229  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
8230  * This corresponds to std::vector in C++
8231  */
8232 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8233    /**
8234     * The elements in the array.
8235     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8236     */
8237    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
8238    /**
8239     * The number of elements pointed to by `data`.
8240     */
8241    uintptr_t datalen;
8242 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
8243
8244 /**
8245  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
8246  * This corresponds to std::vector in C++
8247  */
8248 typedef struct LDKCVec_NodeAnnouncementZ {
8249    /**
8250     * The elements in the array.
8251     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8252     */
8253    struct LDKNodeAnnouncement *data;
8254    /**
8255     * The number of elements pointed to by `data`.
8256     */
8257    uintptr_t datalen;
8258 } LDKCVec_NodeAnnouncementZ;
8259
8260 /**
8261  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
8262  * This corresponds to std::vector in C++
8263  */
8264 typedef struct LDKCVec_PublicKeyZ {
8265    /**
8266     * The elements in the array.
8267     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8268     */
8269    struct LDKPublicKey *data;
8270    /**
8271     * The number of elements pointed to by `data`.
8272     */
8273    uintptr_t datalen;
8274 } LDKCVec_PublicKeyZ;
8275
8276
8277
8278 /**
8279  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
8280  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
8281  * descriptor.
8282  */
8283 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
8284    /**
8285     * A pointer to the opaque Rust object.
8286     * Nearly everywhere, inner must be non-null, however in places where
8287     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8288     */
8289    LDKnativePeerHandleError *inner;
8290    /**
8291     * Indicates that this is the only struct which contains the same pointer.
8292     * Rust functions which take ownership of an object provided via an argument require
8293     * this to be true and invalidate the object pointed to by inner.
8294     */
8295    bool is_owned;
8296 } LDKPeerHandleError;
8297
8298 /**
8299  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
8300  */
8301 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
8302    /**
8303     * A pointer to the contents in the success state.
8304     * Reading from this pointer when `result_ok` is not set is undefined.
8305     */
8306    struct LDKCVec_u8Z *result;
8307    /**
8308     * A pointer to the contents in the error state.
8309     * Reading from this pointer when `result_ok` is set is undefined.
8310     */
8311    struct LDKPeerHandleError *err;
8312 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
8313
8314 /**
8315  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
8316  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8317  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8318  */
8319 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
8320    /**
8321     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
8322     * `err` or `result` depending on the state of `result_ok`.
8323     */
8324    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
8325    /**
8326     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
8327     */
8328    bool result_ok;
8329 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
8330
8331 /**
8332  * The contents of CResult_NonePeerHandleErrorZ
8333  */
8334 typedef union LDKCResult_NonePeerHandleErrorZPtr {
8335    /**
8336     * Note that this value is always NULL, as there are no contents in the OK variant
8337     */
8338    void *result;
8339    /**
8340     * A pointer to the contents in the error state.
8341     * Reading from this pointer when `result_ok` is set is undefined.
8342     */
8343    struct LDKPeerHandleError *err;
8344 } LDKCResult_NonePeerHandleErrorZPtr;
8345
8346 /**
8347  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
8348  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8349  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8350  */
8351 typedef struct LDKCResult_NonePeerHandleErrorZ {
8352    /**
8353     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
8354     * `err` or `result` depending on the state of `result_ok`.
8355     */
8356    union LDKCResult_NonePeerHandleErrorZPtr contents;
8357    /**
8358     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
8359     */
8360    bool result_ok;
8361 } LDKCResult_NonePeerHandleErrorZ;
8362
8363 /**
8364  * The contents of CResult_boolPeerHandleErrorZ
8365  */
8366 typedef union LDKCResult_boolPeerHandleErrorZPtr {
8367    /**
8368     * A pointer to the contents in the success state.
8369     * Reading from this pointer when `result_ok` is not set is undefined.
8370     */
8371    bool *result;
8372    /**
8373     * A pointer to the contents in the error state.
8374     * Reading from this pointer when `result_ok` is set is undefined.
8375     */
8376    struct LDKPeerHandleError *err;
8377 } LDKCResult_boolPeerHandleErrorZPtr;
8378
8379 /**
8380  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
8381  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8382  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8383  */
8384 typedef struct LDKCResult_boolPeerHandleErrorZ {
8385    /**
8386     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
8387     * `err` or `result` depending on the state of `result_ok`.
8388     */
8389    union LDKCResult_boolPeerHandleErrorZPtr contents;
8390    /**
8391     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
8392     */
8393    bool result_ok;
8394 } LDKCResult_boolPeerHandleErrorZ;
8395
8396
8397
8398 /**
8399  * Represents the compressed public key of a node
8400  */
8401 typedef struct MUST_USE_STRUCT LDKNodeId {
8402    /**
8403     * A pointer to the opaque Rust object.
8404     * Nearly everywhere, inner must be non-null, however in places where
8405     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8406     */
8407    LDKnativeNodeId *inner;
8408    /**
8409     * Indicates that this is the only struct which contains the same pointer.
8410     * Rust functions which take ownership of an object provided via an argument require
8411     * this to be true and invalidate the object pointed to by inner.
8412     */
8413    bool is_owned;
8414 } LDKNodeId;
8415
8416 /**
8417  * The contents of CResult_NodeIdDecodeErrorZ
8418  */
8419 typedef union LDKCResult_NodeIdDecodeErrorZPtr {
8420    /**
8421     * A pointer to the contents in the success state.
8422     * Reading from this pointer when `result_ok` is not set is undefined.
8423     */
8424    struct LDKNodeId *result;
8425    /**
8426     * A pointer to the contents in the error state.
8427     * Reading from this pointer when `result_ok` is set is undefined.
8428     */
8429    struct LDKDecodeError *err;
8430 } LDKCResult_NodeIdDecodeErrorZPtr;
8431
8432 /**
8433  * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
8434  * containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
8435  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8436  */
8437 typedef struct LDKCResult_NodeIdDecodeErrorZ {
8438    /**
8439     * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
8440     * `err` or `result` depending on the state of `result_ok`.
8441     */
8442    union LDKCResult_NodeIdDecodeErrorZPtr contents;
8443    /**
8444     * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
8445     */
8446    bool result_ok;
8447 } LDKCResult_NodeIdDecodeErrorZ;
8448
8449 /**
8450  * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
8451  */
8452 typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr {
8453    /**
8454     * A pointer to the contents in the success state.
8455     * Reading from this pointer when `result_ok` is not set is undefined.
8456     */
8457    struct LDKCOption_NetworkUpdateZ *result;
8458    /**
8459     * A pointer to the contents in the error state.
8460     * Reading from this pointer when `result_ok` is set is undefined.
8461     */
8462    struct LDKDecodeError *err;
8463 } LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr;
8464
8465 /**
8466  * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
8467  * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8468  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8469  */
8470 typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ {
8471    /**
8472     * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
8473     * `err` or `result` depending on the state of `result_ok`.
8474     */
8475    union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents;
8476    /**
8477     * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
8478     */
8479    bool result_ok;
8480 } LDKCResult_COption_NetworkUpdateZDecodeErrorZ;
8481
8482 /**
8483  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
8484  * UTXOs.
8485  */
8486 typedef struct LDKAccess {
8487    /**
8488     * An opaque pointer which is passed to your function implementations as an argument.
8489     * This has no meaning in the LDK, and can be NULL or any other value.
8490     */
8491    void *this_arg;
8492    /**
8493     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
8494     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
8495     * is unknown.
8496     *
8497     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
8498     */
8499    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
8500    /**
8501     * Frees any resources associated with this object given its this_arg pointer.
8502     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8503     */
8504    void (*free)(void *this_arg);
8505 } LDKAccess;
8506
8507 /**
8508  * An enum which can either contain a crate::lightning::chain::Access or not
8509  */
8510 typedef enum LDKCOption_AccessZ_Tag {
8511    /**
8512     * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
8513     */
8514    LDKCOption_AccessZ_Some,
8515    /**
8516     * When we're in this state, this COption_AccessZ contains nothing
8517     */
8518    LDKCOption_AccessZ_None,
8519    /**
8520     * Must be last for serialization purposes
8521     */
8522    LDKCOption_AccessZ_Sentinel,
8523 } LDKCOption_AccessZ_Tag;
8524
8525 typedef struct LDKCOption_AccessZ {
8526    LDKCOption_AccessZ_Tag tag;
8527    union {
8528       struct {
8529          struct LDKAccess some;
8530       };
8531    };
8532 } LDKCOption_AccessZ;
8533
8534
8535
8536 /**
8537  * Details about one direction of a channel as received within a [`ChannelUpdate`].
8538  */
8539 typedef struct MUST_USE_STRUCT LDKChannelUpdateInfo {
8540    /**
8541     * A pointer to the opaque Rust object.
8542     * Nearly everywhere, inner must be non-null, however in places where
8543     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8544     */
8545    LDKnativeChannelUpdateInfo *inner;
8546    /**
8547     * Indicates that this is the only struct which contains the same pointer.
8548     * Rust functions which take ownership of an object provided via an argument require
8549     * this to be true and invalidate the object pointed to by inner.
8550     */
8551    bool is_owned;
8552 } LDKChannelUpdateInfo;
8553
8554 /**
8555  * The contents of CResult_ChannelUpdateInfoDecodeErrorZ
8556  */
8557 typedef union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr {
8558    /**
8559     * A pointer to the contents in the success state.
8560     * Reading from this pointer when `result_ok` is not set is undefined.
8561     */
8562    struct LDKChannelUpdateInfo *result;
8563    /**
8564     * A pointer to the contents in the error state.
8565     * Reading from this pointer when `result_ok` is set is undefined.
8566     */
8567    struct LDKDecodeError *err;
8568 } LDKCResult_ChannelUpdateInfoDecodeErrorZPtr;
8569
8570 /**
8571  * A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
8572  * containing a crate::lightning::routing::network_graph::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8573  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8574  */
8575 typedef struct LDKCResult_ChannelUpdateInfoDecodeErrorZ {
8576    /**
8577     * The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
8578     * `err` or `result` depending on the state of `result_ok`.
8579     */
8580    union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr contents;
8581    /**
8582     * Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
8583     */
8584    bool result_ok;
8585 } LDKCResult_ChannelUpdateInfoDecodeErrorZ;
8586
8587
8588
8589 /**
8590  * Details about a channel (both directions).
8591  * Received within a channel announcement.
8592  */
8593 typedef struct MUST_USE_STRUCT LDKChannelInfo {
8594    /**
8595     * A pointer to the opaque Rust object.
8596     * Nearly everywhere, inner must be non-null, however in places where
8597     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8598     */
8599    LDKnativeChannelInfo *inner;
8600    /**
8601     * Indicates that this is the only struct which contains the same pointer.
8602     * Rust functions which take ownership of an object provided via an argument require
8603     * this to be true and invalidate the object pointed to by inner.
8604     */
8605    bool is_owned;
8606 } LDKChannelInfo;
8607
8608 /**
8609  * The contents of CResult_ChannelInfoDecodeErrorZ
8610  */
8611 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
8612    /**
8613     * A pointer to the contents in the success state.
8614     * Reading from this pointer when `result_ok` is not set is undefined.
8615     */
8616    struct LDKChannelInfo *result;
8617    /**
8618     * A pointer to the contents in the error state.
8619     * Reading from this pointer when `result_ok` is set is undefined.
8620     */
8621    struct LDKDecodeError *err;
8622 } LDKCResult_ChannelInfoDecodeErrorZPtr;
8623
8624 /**
8625  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
8626  * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8627  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8628  */
8629 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
8630    /**
8631     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
8632     * `err` or `result` depending on the state of `result_ok`.
8633     */
8634    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
8635    /**
8636     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
8637     */
8638    bool result_ok;
8639 } LDKCResult_ChannelInfoDecodeErrorZ;
8640
8641
8642
8643 /**
8644  * Fees for routing via a given channel or a node
8645  */
8646 typedef struct MUST_USE_STRUCT LDKRoutingFees {
8647    /**
8648     * A pointer to the opaque Rust object.
8649     * Nearly everywhere, inner must be non-null, however in places where
8650     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8651     */
8652    LDKnativeRoutingFees *inner;
8653    /**
8654     * Indicates that this is the only struct which contains the same pointer.
8655     * Rust functions which take ownership of an object provided via an argument require
8656     * this to be true and invalidate the object pointed to by inner.
8657     */
8658    bool is_owned;
8659 } LDKRoutingFees;
8660
8661 /**
8662  * The contents of CResult_RoutingFeesDecodeErrorZ
8663  */
8664 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
8665    /**
8666     * A pointer to the contents in the success state.
8667     * Reading from this pointer when `result_ok` is not set is undefined.
8668     */
8669    struct LDKRoutingFees *result;
8670    /**
8671     * A pointer to the contents in the error state.
8672     * Reading from this pointer when `result_ok` is set is undefined.
8673     */
8674    struct LDKDecodeError *err;
8675 } LDKCResult_RoutingFeesDecodeErrorZPtr;
8676
8677 /**
8678  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
8679  * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
8680  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8681  */
8682 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
8683    /**
8684     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
8685     * `err` or `result` depending on the state of `result_ok`.
8686     */
8687    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
8688    /**
8689     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
8690     */
8691    bool result_ok;
8692 } LDKCResult_RoutingFeesDecodeErrorZ;
8693
8694
8695
8696 /**
8697  * Information received in the latest node_announcement from this node.
8698  */
8699 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
8700    /**
8701     * A pointer to the opaque Rust object.
8702     * Nearly everywhere, inner must be non-null, however in places where
8703     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8704     */
8705    LDKnativeNodeAnnouncementInfo *inner;
8706    /**
8707     * Indicates that this is the only struct which contains the same pointer.
8708     * Rust functions which take ownership of an object provided via an argument require
8709     * this to be true and invalidate the object pointed to by inner.
8710     */
8711    bool is_owned;
8712 } LDKNodeAnnouncementInfo;
8713
8714 /**
8715  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
8716  */
8717 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
8718    /**
8719     * A pointer to the contents in the success state.
8720     * Reading from this pointer when `result_ok` is not set is undefined.
8721     */
8722    struct LDKNodeAnnouncementInfo *result;
8723    /**
8724     * A pointer to the contents in the error state.
8725     * Reading from this pointer when `result_ok` is set is undefined.
8726     */
8727    struct LDKDecodeError *err;
8728 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
8729
8730 /**
8731  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
8732  * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8733  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8734  */
8735 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
8736    /**
8737     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
8738     * `err` or `result` depending on the state of `result_ok`.
8739     */
8740    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
8741    /**
8742     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
8743     */
8744    bool result_ok;
8745 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
8746
8747 /**
8748  * A dynamically-allocated array of u64s of arbitrary size.
8749  * This corresponds to std::vector in C++
8750  */
8751 typedef struct LDKCVec_u64Z {
8752    /**
8753     * The elements in the array.
8754     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8755     */
8756    uint64_t *data;
8757    /**
8758     * The number of elements pointed to by `data`.
8759     */
8760    uintptr_t datalen;
8761 } LDKCVec_u64Z;
8762
8763
8764
8765 /**
8766  * Details about a node in the network, known from the network announcement.
8767  */
8768 typedef struct MUST_USE_STRUCT LDKNodeInfo {
8769    /**
8770     * A pointer to the opaque Rust object.
8771     * Nearly everywhere, inner must be non-null, however in places where
8772     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8773     */
8774    LDKnativeNodeInfo *inner;
8775    /**
8776     * Indicates that this is the only struct which contains the same pointer.
8777     * Rust functions which take ownership of an object provided via an argument require
8778     * this to be true and invalidate the object pointed to by inner.
8779     */
8780    bool is_owned;
8781 } LDKNodeInfo;
8782
8783 /**
8784  * The contents of CResult_NodeInfoDecodeErrorZ
8785  */
8786 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
8787    /**
8788     * A pointer to the contents in the success state.
8789     * Reading from this pointer when `result_ok` is not set is undefined.
8790     */
8791    struct LDKNodeInfo *result;
8792    /**
8793     * A pointer to the contents in the error state.
8794     * Reading from this pointer when `result_ok` is set is undefined.
8795     */
8796    struct LDKDecodeError *err;
8797 } LDKCResult_NodeInfoDecodeErrorZPtr;
8798
8799 /**
8800  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
8801  * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8802  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8803  */
8804 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
8805    /**
8806     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
8807     * `err` or `result` depending on the state of `result_ok`.
8808     */
8809    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
8810    /**
8811     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
8812     */
8813    bool result_ok;
8814 } LDKCResult_NodeInfoDecodeErrorZ;
8815
8816 /**
8817  * The contents of CResult_NetworkGraphDecodeErrorZ
8818  */
8819 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
8820    /**
8821     * A pointer to the contents in the success state.
8822     * Reading from this pointer when `result_ok` is not set is undefined.
8823     */
8824    struct LDKNetworkGraph *result;
8825    /**
8826     * A pointer to the contents in the error state.
8827     * Reading from this pointer when `result_ok` is set is undefined.
8828     */
8829    struct LDKDecodeError *err;
8830 } LDKCResult_NetworkGraphDecodeErrorZPtr;
8831
8832 /**
8833  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
8834  * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
8835  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8836  */
8837 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
8838    /**
8839     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
8840     * `err` or `result` depending on the state of `result_ok`.
8841     */
8842    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
8843    /**
8844     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
8845     */
8846    bool result_ok;
8847 } LDKCResult_NetworkGraphDecodeErrorZ;
8848
8849 /**
8850  * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
8851  */
8852 typedef enum LDKCOption_CVec_NetAddressZZ_Tag {
8853    /**
8854     * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
8855     */
8856    LDKCOption_CVec_NetAddressZZ_Some,
8857    /**
8858     * When we're in this state, this COption_CVec_NetAddressZZ contains nothing
8859     */
8860    LDKCOption_CVec_NetAddressZZ_None,
8861    /**
8862     * Must be last for serialization purposes
8863     */
8864    LDKCOption_CVec_NetAddressZZ_Sentinel,
8865 } LDKCOption_CVec_NetAddressZZ_Tag;
8866
8867 typedef struct LDKCOption_CVec_NetAddressZZ {
8868    LDKCOption_CVec_NetAddressZZ_Tag tag;
8869    union {
8870       struct {
8871          struct LDKCVec_NetAddressZ some;
8872       };
8873    };
8874 } LDKCOption_CVec_NetAddressZZ;
8875
8876 /**
8877  * The contents of CResult_NetAddressDecodeErrorZ
8878  */
8879 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
8880    /**
8881     * A pointer to the contents in the success state.
8882     * Reading from this pointer when `result_ok` is not set is undefined.
8883     */
8884    struct LDKNetAddress *result;
8885    /**
8886     * A pointer to the contents in the error state.
8887     * Reading from this pointer when `result_ok` is set is undefined.
8888     */
8889    struct LDKDecodeError *err;
8890 } LDKCResult_NetAddressDecodeErrorZPtr;
8891
8892 /**
8893  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
8894  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
8895  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8896  */
8897 typedef struct LDKCResult_NetAddressDecodeErrorZ {
8898    /**
8899     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
8900     * `err` or `result` depending on the state of `result_ok`.
8901     */
8902    union LDKCResult_NetAddressDecodeErrorZPtr contents;
8903    /**
8904     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
8905     */
8906    bool result_ok;
8907 } LDKCResult_NetAddressDecodeErrorZ;
8908
8909
8910
8911 /**
8912  * An update_add_htlc message to be sent or received from a peer
8913  */
8914 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
8915    /**
8916     * A pointer to the opaque Rust object.
8917     * Nearly everywhere, inner must be non-null, however in places where
8918     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8919     */
8920    LDKnativeUpdateAddHTLC *inner;
8921    /**
8922     * Indicates that this is the only struct which contains the same pointer.
8923     * Rust functions which take ownership of an object provided via an argument require
8924     * this to be true and invalidate the object pointed to by inner.
8925     */
8926    bool is_owned;
8927 } LDKUpdateAddHTLC;
8928
8929 /**
8930  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
8931  * This corresponds to std::vector in C++
8932  */
8933 typedef struct LDKCVec_UpdateAddHTLCZ {
8934    /**
8935     * The elements in the array.
8936     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8937     */
8938    struct LDKUpdateAddHTLC *data;
8939    /**
8940     * The number of elements pointed to by `data`.
8941     */
8942    uintptr_t datalen;
8943 } LDKCVec_UpdateAddHTLCZ;
8944
8945
8946
8947 /**
8948  * An update_fulfill_htlc message to be sent or received from a peer
8949  */
8950 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
8951    /**
8952     * A pointer to the opaque Rust object.
8953     * Nearly everywhere, inner must be non-null, however in places where
8954     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8955     */
8956    LDKnativeUpdateFulfillHTLC *inner;
8957    /**
8958     * Indicates that this is the only struct which contains the same pointer.
8959     * Rust functions which take ownership of an object provided via an argument require
8960     * this to be true and invalidate the object pointed to by inner.
8961     */
8962    bool is_owned;
8963 } LDKUpdateFulfillHTLC;
8964
8965 /**
8966  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
8967  * This corresponds to std::vector in C++
8968  */
8969 typedef struct LDKCVec_UpdateFulfillHTLCZ {
8970    /**
8971     * The elements in the array.
8972     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8973     */
8974    struct LDKUpdateFulfillHTLC *data;
8975    /**
8976     * The number of elements pointed to by `data`.
8977     */
8978    uintptr_t datalen;
8979 } LDKCVec_UpdateFulfillHTLCZ;
8980
8981
8982
8983 /**
8984  * An update_fail_htlc message to be sent or received from a peer
8985  */
8986 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
8987    /**
8988     * A pointer to the opaque Rust object.
8989     * Nearly everywhere, inner must be non-null, however in places where
8990     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8991     */
8992    LDKnativeUpdateFailHTLC *inner;
8993    /**
8994     * Indicates that this is the only struct which contains the same pointer.
8995     * Rust functions which take ownership of an object provided via an argument require
8996     * this to be true and invalidate the object pointed to by inner.
8997     */
8998    bool is_owned;
8999 } LDKUpdateFailHTLC;
9000
9001 /**
9002  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
9003  * This corresponds to std::vector in C++
9004  */
9005 typedef struct LDKCVec_UpdateFailHTLCZ {
9006    /**
9007     * The elements in the array.
9008     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9009     */
9010    struct LDKUpdateFailHTLC *data;
9011    /**
9012     * The number of elements pointed to by `data`.
9013     */
9014    uintptr_t datalen;
9015 } LDKCVec_UpdateFailHTLCZ;
9016
9017
9018
9019 /**
9020  * An update_fail_malformed_htlc message to be sent or received from a peer
9021  */
9022 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
9023    /**
9024     * A pointer to the opaque Rust object.
9025     * Nearly everywhere, inner must be non-null, however in places where
9026     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9027     */
9028    LDKnativeUpdateFailMalformedHTLC *inner;
9029    /**
9030     * Indicates that this is the only struct which contains the same pointer.
9031     * Rust functions which take ownership of an object provided via an argument require
9032     * this to be true and invalidate the object pointed to by inner.
9033     */
9034    bool is_owned;
9035 } LDKUpdateFailMalformedHTLC;
9036
9037 /**
9038  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
9039  * This corresponds to std::vector in C++
9040  */
9041 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
9042    /**
9043     * The elements in the array.
9044     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9045     */
9046    struct LDKUpdateFailMalformedHTLC *data;
9047    /**
9048     * The number of elements pointed to by `data`.
9049     */
9050    uintptr_t datalen;
9051 } LDKCVec_UpdateFailMalformedHTLCZ;
9052
9053 /**
9054  * The contents of CResult_AcceptChannelDecodeErrorZ
9055  */
9056 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
9057    /**
9058     * A pointer to the contents in the success state.
9059     * Reading from this pointer when `result_ok` is not set is undefined.
9060     */
9061    struct LDKAcceptChannel *result;
9062    /**
9063     * A pointer to the contents in the error state.
9064     * Reading from this pointer when `result_ok` is set is undefined.
9065     */
9066    struct LDKDecodeError *err;
9067 } LDKCResult_AcceptChannelDecodeErrorZPtr;
9068
9069 /**
9070  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
9071  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9072  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9073  */
9074 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
9075    /**
9076     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
9077     * `err` or `result` depending on the state of `result_ok`.
9078     */
9079    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
9080    /**
9081     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
9082     */
9083    bool result_ok;
9084 } LDKCResult_AcceptChannelDecodeErrorZ;
9085
9086 /**
9087  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
9088  */
9089 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
9090    /**
9091     * A pointer to the contents in the success state.
9092     * Reading from this pointer when `result_ok` is not set is undefined.
9093     */
9094    struct LDKAnnouncementSignatures *result;
9095    /**
9096     * A pointer to the contents in the error state.
9097     * Reading from this pointer when `result_ok` is set is undefined.
9098     */
9099    struct LDKDecodeError *err;
9100 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
9101
9102 /**
9103  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
9104  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
9105  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9106  */
9107 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
9108    /**
9109     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
9110     * `err` or `result` depending on the state of `result_ok`.
9111     */
9112    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
9113    /**
9114     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
9115     */
9116    bool result_ok;
9117 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
9118
9119 /**
9120  * The contents of CResult_ChannelReestablishDecodeErrorZ
9121  */
9122 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
9123    /**
9124     * A pointer to the contents in the success state.
9125     * Reading from this pointer when `result_ok` is not set is undefined.
9126     */
9127    struct LDKChannelReestablish *result;
9128    /**
9129     * A pointer to the contents in the error state.
9130     * Reading from this pointer when `result_ok` is set is undefined.
9131     */
9132    struct LDKDecodeError *err;
9133 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
9134
9135 /**
9136  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
9137  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
9138  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9139  */
9140 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
9141    /**
9142     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
9143     * `err` or `result` depending on the state of `result_ok`.
9144     */
9145    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
9146    /**
9147     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
9148     */
9149    bool result_ok;
9150 } LDKCResult_ChannelReestablishDecodeErrorZ;
9151
9152 /**
9153  * The contents of CResult_ClosingSignedDecodeErrorZ
9154  */
9155 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
9156    /**
9157     * A pointer to the contents in the success state.
9158     * Reading from this pointer when `result_ok` is not set is undefined.
9159     */
9160    struct LDKClosingSigned *result;
9161    /**
9162     * A pointer to the contents in the error state.
9163     * Reading from this pointer when `result_ok` is set is undefined.
9164     */
9165    struct LDKDecodeError *err;
9166 } LDKCResult_ClosingSignedDecodeErrorZPtr;
9167
9168 /**
9169  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
9170  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9171  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9172  */
9173 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
9174    /**
9175     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
9176     * `err` or `result` depending on the state of `result_ok`.
9177     */
9178    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
9179    /**
9180     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
9181     */
9182    bool result_ok;
9183 } LDKCResult_ClosingSignedDecodeErrorZ;
9184
9185
9186
9187 /**
9188  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
9189  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
9190  * to use.
9191  */
9192 typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
9193    /**
9194     * A pointer to the opaque Rust object.
9195     * Nearly everywhere, inner must be non-null, however in places where
9196     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9197     */
9198    LDKnativeClosingSignedFeeRange *inner;
9199    /**
9200     * Indicates that this is the only struct which contains the same pointer.
9201     * Rust functions which take ownership of an object provided via an argument require
9202     * this to be true and invalidate the object pointed to by inner.
9203     */
9204    bool is_owned;
9205 } LDKClosingSignedFeeRange;
9206
9207 /**
9208  * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
9209  */
9210 typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9211    /**
9212     * A pointer to the contents in the success state.
9213     * Reading from this pointer when `result_ok` is not set is undefined.
9214     */
9215    struct LDKClosingSignedFeeRange *result;
9216    /**
9217     * A pointer to the contents in the error state.
9218     * Reading from this pointer when `result_ok` is set is undefined.
9219     */
9220    struct LDKDecodeError *err;
9221 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr;
9222
9223 /**
9224  * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
9225  * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
9226  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9227  */
9228 typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ {
9229    /**
9230     * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
9231     * `err` or `result` depending on the state of `result_ok`.
9232     */
9233    union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
9234    /**
9235     * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
9236     */
9237    bool result_ok;
9238 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
9239
9240
9241
9242 /**
9243  * A commitment_signed message to be sent or received from a peer
9244  */
9245 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
9246    /**
9247     * A pointer to the opaque Rust object.
9248     * Nearly everywhere, inner must be non-null, however in places where
9249     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9250     */
9251    LDKnativeCommitmentSigned *inner;
9252    /**
9253     * Indicates that this is the only struct which contains the same pointer.
9254     * Rust functions which take ownership of an object provided via an argument require
9255     * this to be true and invalidate the object pointed to by inner.
9256     */
9257    bool is_owned;
9258 } LDKCommitmentSigned;
9259
9260 /**
9261  * The contents of CResult_CommitmentSignedDecodeErrorZ
9262  */
9263 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
9264    /**
9265     * A pointer to the contents in the success state.
9266     * Reading from this pointer when `result_ok` is not set is undefined.
9267     */
9268    struct LDKCommitmentSigned *result;
9269    /**
9270     * A pointer to the contents in the error state.
9271     * Reading from this pointer when `result_ok` is set is undefined.
9272     */
9273    struct LDKDecodeError *err;
9274 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
9275
9276 /**
9277  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
9278  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9279  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9280  */
9281 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
9282    /**
9283     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
9284     * `err` or `result` depending on the state of `result_ok`.
9285     */
9286    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
9287    /**
9288     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
9289     */
9290    bool result_ok;
9291 } LDKCResult_CommitmentSignedDecodeErrorZ;
9292
9293 /**
9294  * The contents of CResult_FundingCreatedDecodeErrorZ
9295  */
9296 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
9297    /**
9298     * A pointer to the contents in the success state.
9299     * Reading from this pointer when `result_ok` is not set is undefined.
9300     */
9301    struct LDKFundingCreated *result;
9302    /**
9303     * A pointer to the contents in the error state.
9304     * Reading from this pointer when `result_ok` is set is undefined.
9305     */
9306    struct LDKDecodeError *err;
9307 } LDKCResult_FundingCreatedDecodeErrorZPtr;
9308
9309 /**
9310  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
9311  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
9312  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9313  */
9314 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
9315    /**
9316     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
9317     * `err` or `result` depending on the state of `result_ok`.
9318     */
9319    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
9320    /**
9321     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
9322     */
9323    bool result_ok;
9324 } LDKCResult_FundingCreatedDecodeErrorZ;
9325
9326 /**
9327  * The contents of CResult_FundingSignedDecodeErrorZ
9328  */
9329 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
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 LDKFundingSigned *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_FundingSignedDecodeErrorZPtr;
9341
9342 /**
9343  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
9344  * containing a crate::lightning::ln::msgs::FundingSigned 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_FundingSignedDecodeErrorZ {
9348    /**
9349     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
9350     * `err` or `result` depending on the state of `result_ok`.
9351     */
9352    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
9353    /**
9354     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
9355     */
9356    bool result_ok;
9357 } LDKCResult_FundingSignedDecodeErrorZ;
9358
9359 /**
9360  * The contents of CResult_FundingLockedDecodeErrorZ
9361  */
9362 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
9363    /**
9364     * A pointer to the contents in the success state.
9365     * Reading from this pointer when `result_ok` is not set is undefined.
9366     */
9367    struct LDKFundingLocked *result;
9368    /**
9369     * A pointer to the contents in the error state.
9370     * Reading from this pointer when `result_ok` is set is undefined.
9371     */
9372    struct LDKDecodeError *err;
9373 } LDKCResult_FundingLockedDecodeErrorZPtr;
9374
9375 /**
9376  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
9377  * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
9378  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9379  */
9380 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
9381    /**
9382     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
9383     * `err` or `result` depending on the state of `result_ok`.
9384     */
9385    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
9386    /**
9387     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
9388     */
9389    bool result_ok;
9390 } LDKCResult_FundingLockedDecodeErrorZ;
9391
9392
9393
9394 /**
9395  * An init message to be sent or received from a peer
9396  */
9397 typedef struct MUST_USE_STRUCT LDKInit {
9398    /**
9399     * A pointer to the opaque Rust object.
9400     * Nearly everywhere, inner must be non-null, however in places where
9401     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9402     */
9403    LDKnativeInit *inner;
9404    /**
9405     * Indicates that this is the only struct which contains the same pointer.
9406     * Rust functions which take ownership of an object provided via an argument require
9407     * this to be true and invalidate the object pointed to by inner.
9408     */
9409    bool is_owned;
9410 } LDKInit;
9411
9412 /**
9413  * The contents of CResult_InitDecodeErrorZ
9414  */
9415 typedef union LDKCResult_InitDecodeErrorZPtr {
9416    /**
9417     * A pointer to the contents in the success state.
9418     * Reading from this pointer when `result_ok` is not set is undefined.
9419     */
9420    struct LDKInit *result;
9421    /**
9422     * A pointer to the contents in the error state.
9423     * Reading from this pointer when `result_ok` is set is undefined.
9424     */
9425    struct LDKDecodeError *err;
9426 } LDKCResult_InitDecodeErrorZPtr;
9427
9428 /**
9429  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
9430  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
9431  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9432  */
9433 typedef struct LDKCResult_InitDecodeErrorZ {
9434    /**
9435     * The contents of this CResult_InitDecodeErrorZ, accessible via either
9436     * `err` or `result` depending on the state of `result_ok`.
9437     */
9438    union LDKCResult_InitDecodeErrorZPtr contents;
9439    /**
9440     * Whether this CResult_InitDecodeErrorZ represents a success state.
9441     */
9442    bool result_ok;
9443 } LDKCResult_InitDecodeErrorZ;
9444
9445 /**
9446  * The contents of CResult_OpenChannelDecodeErrorZ
9447  */
9448 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
9449    /**
9450     * A pointer to the contents in the success state.
9451     * Reading from this pointer when `result_ok` is not set is undefined.
9452     */
9453    struct LDKOpenChannel *result;
9454    /**
9455     * A pointer to the contents in the error state.
9456     * Reading from this pointer when `result_ok` is set is undefined.
9457     */
9458    struct LDKDecodeError *err;
9459 } LDKCResult_OpenChannelDecodeErrorZPtr;
9460
9461 /**
9462  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
9463  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9464  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9465  */
9466 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
9467    /**
9468     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
9469     * `err` or `result` depending on the state of `result_ok`.
9470     */
9471    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
9472    /**
9473     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
9474     */
9475    bool result_ok;
9476 } LDKCResult_OpenChannelDecodeErrorZ;
9477
9478 /**
9479  * The contents of CResult_RevokeAndACKDecodeErrorZ
9480  */
9481 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
9482    /**
9483     * A pointer to the contents in the success state.
9484     * Reading from this pointer when `result_ok` is not set is undefined.
9485     */
9486    struct LDKRevokeAndACK *result;
9487    /**
9488     * A pointer to the contents in the error state.
9489     * Reading from this pointer when `result_ok` is set is undefined.
9490     */
9491    struct LDKDecodeError *err;
9492 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
9493
9494 /**
9495  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
9496  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
9497  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9498  */
9499 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
9500    /**
9501     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
9502     * `err` or `result` depending on the state of `result_ok`.
9503     */
9504    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
9505    /**
9506     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
9507     */
9508    bool result_ok;
9509 } LDKCResult_RevokeAndACKDecodeErrorZ;
9510
9511 /**
9512  * The contents of CResult_ShutdownDecodeErrorZ
9513  */
9514 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
9515    /**
9516     * A pointer to the contents in the success state.
9517     * Reading from this pointer when `result_ok` is not set is undefined.
9518     */
9519    struct LDKShutdown *result;
9520    /**
9521     * A pointer to the contents in the error state.
9522     * Reading from this pointer when `result_ok` is set is undefined.
9523     */
9524    struct LDKDecodeError *err;
9525 } LDKCResult_ShutdownDecodeErrorZPtr;
9526
9527 /**
9528  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
9529  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
9530  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9531  */
9532 typedef struct LDKCResult_ShutdownDecodeErrorZ {
9533    /**
9534     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
9535     * `err` or `result` depending on the state of `result_ok`.
9536     */
9537    union LDKCResult_ShutdownDecodeErrorZPtr contents;
9538    /**
9539     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
9540     */
9541    bool result_ok;
9542 } LDKCResult_ShutdownDecodeErrorZ;
9543
9544 /**
9545  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
9546  */
9547 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
9548    /**
9549     * A pointer to the contents in the success state.
9550     * Reading from this pointer when `result_ok` is not set is undefined.
9551     */
9552    struct LDKUpdateFailHTLC *result;
9553    /**
9554     * A pointer to the contents in the error state.
9555     * Reading from this pointer when `result_ok` is set is undefined.
9556     */
9557    struct LDKDecodeError *err;
9558 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
9559
9560 /**
9561  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
9562  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9563  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9564  */
9565 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
9566    /**
9567     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
9568     * `err` or `result` depending on the state of `result_ok`.
9569     */
9570    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
9571    /**
9572     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
9573     */
9574    bool result_ok;
9575 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
9576
9577 /**
9578  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
9579  */
9580 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9581    /**
9582     * A pointer to the contents in the success state.
9583     * Reading from this pointer when `result_ok` is not set is undefined.
9584     */
9585    struct LDKUpdateFailMalformedHTLC *result;
9586    /**
9587     * A pointer to the contents in the error state.
9588     * Reading from this pointer when `result_ok` is set is undefined.
9589     */
9590    struct LDKDecodeError *err;
9591 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
9592
9593 /**
9594  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
9595  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9596  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9597  */
9598 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
9599    /**
9600     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
9601     * `err` or `result` depending on the state of `result_ok`.
9602     */
9603    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
9604    /**
9605     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
9606     */
9607    bool result_ok;
9608 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
9609
9610
9611
9612 /**
9613  * An update_fee message to be sent or received from a peer
9614  */
9615 typedef struct MUST_USE_STRUCT LDKUpdateFee {
9616    /**
9617     * A pointer to the opaque Rust object.
9618     * Nearly everywhere, inner must be non-null, however in places where
9619     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9620     */
9621    LDKnativeUpdateFee *inner;
9622    /**
9623     * Indicates that this is the only struct which contains the same pointer.
9624     * Rust functions which take ownership of an object provided via an argument require
9625     * this to be true and invalidate the object pointed to by inner.
9626     */
9627    bool is_owned;
9628 } LDKUpdateFee;
9629
9630 /**
9631  * The contents of CResult_UpdateFeeDecodeErrorZ
9632  */
9633 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
9634    /**
9635     * A pointer to the contents in the success state.
9636     * Reading from this pointer when `result_ok` is not set is undefined.
9637     */
9638    struct LDKUpdateFee *result;
9639    /**
9640     * A pointer to the contents in the error state.
9641     * Reading from this pointer when `result_ok` is set is undefined.
9642     */
9643    struct LDKDecodeError *err;
9644 } LDKCResult_UpdateFeeDecodeErrorZPtr;
9645
9646 /**
9647  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
9648  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
9649  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9650  */
9651 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
9652    /**
9653     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
9654     * `err` or `result` depending on the state of `result_ok`.
9655     */
9656    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
9657    /**
9658     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
9659     */
9660    bool result_ok;
9661 } LDKCResult_UpdateFeeDecodeErrorZ;
9662
9663 /**
9664  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
9665  */
9666 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
9667    /**
9668     * A pointer to the contents in the success state.
9669     * Reading from this pointer when `result_ok` is not set is undefined.
9670     */
9671    struct LDKUpdateFulfillHTLC *result;
9672    /**
9673     * A pointer to the contents in the error state.
9674     * Reading from this pointer when `result_ok` is set is undefined.
9675     */
9676    struct LDKDecodeError *err;
9677 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
9678
9679 /**
9680  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
9681  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9682  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9683  */
9684 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
9685    /**
9686     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
9687     * `err` or `result` depending on the state of `result_ok`.
9688     */
9689    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
9690    /**
9691     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
9692     */
9693    bool result_ok;
9694 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
9695
9696 /**
9697  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
9698  */
9699 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
9700    /**
9701     * A pointer to the contents in the success state.
9702     * Reading from this pointer when `result_ok` is not set is undefined.
9703     */
9704    struct LDKUpdateAddHTLC *result;
9705    /**
9706     * A pointer to the contents in the error state.
9707     * Reading from this pointer when `result_ok` is set is undefined.
9708     */
9709    struct LDKDecodeError *err;
9710 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
9711
9712 /**
9713  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
9714  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9715  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9716  */
9717 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
9718    /**
9719     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
9720     * `err` or `result` depending on the state of `result_ok`.
9721     */
9722    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
9723    /**
9724     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
9725     */
9726    bool result_ok;
9727 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
9728
9729
9730
9731 /**
9732  * A ping message to be sent or received from a peer
9733  */
9734 typedef struct MUST_USE_STRUCT LDKPing {
9735    /**
9736     * A pointer to the opaque Rust object.
9737     * Nearly everywhere, inner must be non-null, however in places where
9738     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9739     */
9740    LDKnativePing *inner;
9741    /**
9742     * Indicates that this is the only struct which contains the same pointer.
9743     * Rust functions which take ownership of an object provided via an argument require
9744     * this to be true and invalidate the object pointed to by inner.
9745     */
9746    bool is_owned;
9747 } LDKPing;
9748
9749 /**
9750  * The contents of CResult_PingDecodeErrorZ
9751  */
9752 typedef union LDKCResult_PingDecodeErrorZPtr {
9753    /**
9754     * A pointer to the contents in the success state.
9755     * Reading from this pointer when `result_ok` is not set is undefined.
9756     */
9757    struct LDKPing *result;
9758    /**
9759     * A pointer to the contents in the error state.
9760     * Reading from this pointer when `result_ok` is set is undefined.
9761     */
9762    struct LDKDecodeError *err;
9763 } LDKCResult_PingDecodeErrorZPtr;
9764
9765 /**
9766  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
9767  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
9768  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9769  */
9770 typedef struct LDKCResult_PingDecodeErrorZ {
9771    /**
9772     * The contents of this CResult_PingDecodeErrorZ, accessible via either
9773     * `err` or `result` depending on the state of `result_ok`.
9774     */
9775    union LDKCResult_PingDecodeErrorZPtr contents;
9776    /**
9777     * Whether this CResult_PingDecodeErrorZ represents a success state.
9778     */
9779    bool result_ok;
9780 } LDKCResult_PingDecodeErrorZ;
9781
9782
9783
9784 /**
9785  * A pong message to be sent or received from a peer
9786  */
9787 typedef struct MUST_USE_STRUCT LDKPong {
9788    /**
9789     * A pointer to the opaque Rust object.
9790     * Nearly everywhere, inner must be non-null, however in places where
9791     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9792     */
9793    LDKnativePong *inner;
9794    /**
9795     * Indicates that this is the only struct which contains the same pointer.
9796     * Rust functions which take ownership of an object provided via an argument require
9797     * this to be true and invalidate the object pointed to by inner.
9798     */
9799    bool is_owned;
9800 } LDKPong;
9801
9802 /**
9803  * The contents of CResult_PongDecodeErrorZ
9804  */
9805 typedef union LDKCResult_PongDecodeErrorZPtr {
9806    /**
9807     * A pointer to the contents in the success state.
9808     * Reading from this pointer when `result_ok` is not set is undefined.
9809     */
9810    struct LDKPong *result;
9811    /**
9812     * A pointer to the contents in the error state.
9813     * Reading from this pointer when `result_ok` is set is undefined.
9814     */
9815    struct LDKDecodeError *err;
9816 } LDKCResult_PongDecodeErrorZPtr;
9817
9818 /**
9819  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
9820  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
9821  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9822  */
9823 typedef struct LDKCResult_PongDecodeErrorZ {
9824    /**
9825     * The contents of this CResult_PongDecodeErrorZ, accessible via either
9826     * `err` or `result` depending on the state of `result_ok`.
9827     */
9828    union LDKCResult_PongDecodeErrorZPtr contents;
9829    /**
9830     * Whether this CResult_PongDecodeErrorZ represents a success state.
9831     */
9832    bool result_ok;
9833 } LDKCResult_PongDecodeErrorZ;
9834
9835 /**
9836  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
9837  */
9838 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
9839    /**
9840     * A pointer to the contents in the success state.
9841     * Reading from this pointer when `result_ok` is not set is undefined.
9842     */
9843    struct LDKUnsignedChannelAnnouncement *result;
9844    /**
9845     * A pointer to the contents in the error state.
9846     * Reading from this pointer when `result_ok` is set is undefined.
9847     */
9848    struct LDKDecodeError *err;
9849 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
9850
9851 /**
9852  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
9853  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
9854  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9855  */
9856 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
9857    /**
9858     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
9859     * `err` or `result` depending on the state of `result_ok`.
9860     */
9861    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
9862    /**
9863     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
9864     */
9865    bool result_ok;
9866 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
9867
9868 /**
9869  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
9870  */
9871 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
9872    /**
9873     * A pointer to the contents in the success state.
9874     * Reading from this pointer when `result_ok` is not set is undefined.
9875     */
9876    struct LDKChannelAnnouncement *result;
9877    /**
9878     * A pointer to the contents in the error state.
9879     * Reading from this pointer when `result_ok` is set is undefined.
9880     */
9881    struct LDKDecodeError *err;
9882 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
9883
9884 /**
9885  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
9886  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
9887  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9888  */
9889 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
9890    /**
9891     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
9892     * `err` or `result` depending on the state of `result_ok`.
9893     */
9894    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
9895    /**
9896     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
9897     */
9898    bool result_ok;
9899 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
9900
9901
9902
9903 /**
9904  * The unsigned part of a channel_update
9905  */
9906 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
9907    /**
9908     * A pointer to the opaque Rust object.
9909     * Nearly everywhere, inner must be non-null, however in places where
9910     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9911     */
9912    LDKnativeUnsignedChannelUpdate *inner;
9913    /**
9914     * Indicates that this is the only struct which contains the same pointer.
9915     * Rust functions which take ownership of an object provided via an argument require
9916     * this to be true and invalidate the object pointed to by inner.
9917     */
9918    bool is_owned;
9919 } LDKUnsignedChannelUpdate;
9920
9921 /**
9922  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
9923  */
9924 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
9925    /**
9926     * A pointer to the contents in the success state.
9927     * Reading from this pointer when `result_ok` is not set is undefined.
9928     */
9929    struct LDKUnsignedChannelUpdate *result;
9930    /**
9931     * A pointer to the contents in the error state.
9932     * Reading from this pointer when `result_ok` is set is undefined.
9933     */
9934    struct LDKDecodeError *err;
9935 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
9936
9937 /**
9938  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
9939  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9940  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9941  */
9942 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
9943    /**
9944     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
9945     * `err` or `result` depending on the state of `result_ok`.
9946     */
9947    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
9948    /**
9949     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
9950     */
9951    bool result_ok;
9952 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
9953
9954 /**
9955  * The contents of CResult_ChannelUpdateDecodeErrorZ
9956  */
9957 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
9958    /**
9959     * A pointer to the contents in the success state.
9960     * Reading from this pointer when `result_ok` is not set is undefined.
9961     */
9962    struct LDKChannelUpdate *result;
9963    /**
9964     * A pointer to the contents in the error state.
9965     * Reading from this pointer when `result_ok` is set is undefined.
9966     */
9967    struct LDKDecodeError *err;
9968 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
9969
9970 /**
9971  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
9972  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9973  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9974  */
9975 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
9976    /**
9977     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
9978     * `err` or `result` depending on the state of `result_ok`.
9979     */
9980    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
9981    /**
9982     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
9983     */
9984    bool result_ok;
9985 } LDKCResult_ChannelUpdateDecodeErrorZ;
9986
9987 /**
9988  * The contents of CResult_ErrorMessageDecodeErrorZ
9989  */
9990 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
9991    /**
9992     * A pointer to the contents in the success state.
9993     * Reading from this pointer when `result_ok` is not set is undefined.
9994     */
9995    struct LDKErrorMessage *result;
9996    /**
9997     * A pointer to the contents in the error state.
9998     * Reading from this pointer when `result_ok` is set is undefined.
9999     */
10000    struct LDKDecodeError *err;
10001 } LDKCResult_ErrorMessageDecodeErrorZPtr;
10002
10003 /**
10004  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
10005  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
10006  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10007  */
10008 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
10009    /**
10010     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
10011     * `err` or `result` depending on the state of `result_ok`.
10012     */
10013    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
10014    /**
10015     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
10016     */
10017    bool result_ok;
10018 } LDKCResult_ErrorMessageDecodeErrorZ;
10019
10020 /**
10021  * The contents of CResult_WarningMessageDecodeErrorZ
10022  */
10023 typedef union LDKCResult_WarningMessageDecodeErrorZPtr {
10024    /**
10025     * A pointer to the contents in the success state.
10026     * Reading from this pointer when `result_ok` is not set is undefined.
10027     */
10028    struct LDKWarningMessage *result;
10029    /**
10030     * A pointer to the contents in the error state.
10031     * Reading from this pointer when `result_ok` is set is undefined.
10032     */
10033    struct LDKDecodeError *err;
10034 } LDKCResult_WarningMessageDecodeErrorZPtr;
10035
10036 /**
10037  * A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
10038  * containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
10039  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10040  */
10041 typedef struct LDKCResult_WarningMessageDecodeErrorZ {
10042    /**
10043     * The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
10044     * `err` or `result` depending on the state of `result_ok`.
10045     */
10046    union LDKCResult_WarningMessageDecodeErrorZPtr contents;
10047    /**
10048     * Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
10049     */
10050    bool result_ok;
10051 } LDKCResult_WarningMessageDecodeErrorZ;
10052
10053
10054
10055 /**
10056  * The unsigned part of a node_announcement
10057  */
10058 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
10059    /**
10060     * A pointer to the opaque Rust object.
10061     * Nearly everywhere, inner must be non-null, however in places where
10062     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10063     */
10064    LDKnativeUnsignedNodeAnnouncement *inner;
10065    /**
10066     * Indicates that this is the only struct which contains the same pointer.
10067     * Rust functions which take ownership of an object provided via an argument require
10068     * this to be true and invalidate the object pointed to by inner.
10069     */
10070    bool is_owned;
10071 } LDKUnsignedNodeAnnouncement;
10072
10073 /**
10074  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
10075  */
10076 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10077    /**
10078     * A pointer to the contents in the success state.
10079     * Reading from this pointer when `result_ok` is not set is undefined.
10080     */
10081    struct LDKUnsignedNodeAnnouncement *result;
10082    /**
10083     * A pointer to the contents in the error state.
10084     * Reading from this pointer when `result_ok` is set is undefined.
10085     */
10086    struct LDKDecodeError *err;
10087 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
10088
10089 /**
10090  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10091  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10092  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10093  */
10094 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
10095    /**
10096     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
10097     * `err` or `result` depending on the state of `result_ok`.
10098     */
10099    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
10100    /**
10101     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
10102     */
10103    bool result_ok;
10104 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
10105
10106 /**
10107  * The contents of CResult_NodeAnnouncementDecodeErrorZ
10108  */
10109 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
10110    /**
10111     * A pointer to the contents in the success state.
10112     * Reading from this pointer when `result_ok` is not set is undefined.
10113     */
10114    struct LDKNodeAnnouncement *result;
10115    /**
10116     * A pointer to the contents in the error state.
10117     * Reading from this pointer when `result_ok` is set is undefined.
10118     */
10119    struct LDKDecodeError *err;
10120 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
10121
10122 /**
10123  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10124  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10125  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10126  */
10127 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
10128    /**
10129     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
10130     * `err` or `result` depending on the state of `result_ok`.
10131     */
10132    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
10133    /**
10134     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
10135     */
10136    bool result_ok;
10137 } LDKCResult_NodeAnnouncementDecodeErrorZ;
10138
10139 /**
10140  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
10141  */
10142 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
10143    /**
10144     * A pointer to the contents in the success state.
10145     * Reading from this pointer when `result_ok` is not set is undefined.
10146     */
10147    struct LDKQueryShortChannelIds *result;
10148    /**
10149     * A pointer to the contents in the error state.
10150     * Reading from this pointer when `result_ok` is set is undefined.
10151     */
10152    struct LDKDecodeError *err;
10153 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
10154
10155 /**
10156  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
10157  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
10158  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10159  */
10160 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
10161    /**
10162     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
10163     * `err` or `result` depending on the state of `result_ok`.
10164     */
10165    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
10166    /**
10167     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
10168     */
10169    bool result_ok;
10170 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
10171
10172
10173
10174 /**
10175  * A reply_short_channel_ids_end message is sent as a reply to a
10176  * query_short_channel_ids message. The query recipient makes a best
10177  * effort to respond based on their local network view which may not be
10178  * a perfect view of the network.
10179  */
10180 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
10181    /**
10182     * A pointer to the opaque Rust object.
10183     * Nearly everywhere, inner must be non-null, however in places where
10184     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10185     */
10186    LDKnativeReplyShortChannelIdsEnd *inner;
10187    /**
10188     * Indicates that this is the only struct which contains the same pointer.
10189     * Rust functions which take ownership of an object provided via an argument require
10190     * this to be true and invalidate the object pointed to by inner.
10191     */
10192    bool is_owned;
10193 } LDKReplyShortChannelIdsEnd;
10194
10195 /**
10196  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
10197  */
10198 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10199    /**
10200     * A pointer to the contents in the success state.
10201     * Reading from this pointer when `result_ok` is not set is undefined.
10202     */
10203    struct LDKReplyShortChannelIdsEnd *result;
10204    /**
10205     * A pointer to the contents in the error state.
10206     * Reading from this pointer when `result_ok` is set is undefined.
10207     */
10208    struct LDKDecodeError *err;
10209 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
10210
10211 /**
10212  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
10213  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
10214  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10215  */
10216 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
10217    /**
10218     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
10219     * `err` or `result` depending on the state of `result_ok`.
10220     */
10221    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
10222    /**
10223     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
10224     */
10225    bool result_ok;
10226 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
10227
10228 /**
10229  * The contents of CResult_QueryChannelRangeDecodeErrorZ
10230  */
10231 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
10232    /**
10233     * A pointer to the contents in the success state.
10234     * Reading from this pointer when `result_ok` is not set is undefined.
10235     */
10236    struct LDKQueryChannelRange *result;
10237    /**
10238     * A pointer to the contents in the error state.
10239     * Reading from this pointer when `result_ok` is set is undefined.
10240     */
10241    struct LDKDecodeError *err;
10242 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
10243
10244 /**
10245  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
10246  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10247  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10248  */
10249 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
10250    /**
10251     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
10252     * `err` or `result` depending on the state of `result_ok`.
10253     */
10254    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
10255    /**
10256     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
10257     */
10258    bool result_ok;
10259 } LDKCResult_QueryChannelRangeDecodeErrorZ;
10260
10261 /**
10262  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
10263  */
10264 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
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 LDKReplyChannelRange *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_ReplyChannelRangeDecodeErrorZPtr;
10276
10277 /**
10278  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
10279  * containing a crate::lightning::ln::msgs::ReplyChannelRange 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_ReplyChannelRangeDecodeErrorZ {
10283    /**
10284     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
10285     * `err` or `result` depending on the state of `result_ok`.
10286     */
10287    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
10288    /**
10289     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
10290     */
10291    bool result_ok;
10292 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
10293
10294
10295
10296 /**
10297  * A gossip_timestamp_filter message is used by a node to request
10298  * gossip relay for messages in the requested time range when the
10299  * gossip_queries feature has been negotiated.
10300  */
10301 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
10302    /**
10303     * A pointer to the opaque Rust object.
10304     * Nearly everywhere, inner must be non-null, however in places where
10305     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10306     */
10307    LDKnativeGossipTimestampFilter *inner;
10308    /**
10309     * Indicates that this is the only struct which contains the same pointer.
10310     * Rust functions which take ownership of an object provided via an argument require
10311     * this to be true and invalidate the object pointed to by inner.
10312     */
10313    bool is_owned;
10314 } LDKGossipTimestampFilter;
10315
10316 /**
10317  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
10318  */
10319 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
10320    /**
10321     * A pointer to the contents in the success state.
10322     * Reading from this pointer when `result_ok` is not set is undefined.
10323     */
10324    struct LDKGossipTimestampFilter *result;
10325    /**
10326     * A pointer to the contents in the error state.
10327     * Reading from this pointer when `result_ok` is set is undefined.
10328     */
10329    struct LDKDecodeError *err;
10330 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
10331
10332 /**
10333  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
10334  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
10335  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10336  */
10337 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
10338    /**
10339     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
10340     * `err` or `result` depending on the state of `result_ok`.
10341     */
10342    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
10343    /**
10344     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
10345     */
10346    bool result_ok;
10347 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
10348
10349 /**
10350  * A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
10351  * This corresponds to std::vector in C++
10352  */
10353 typedef struct LDKCVec_PhantomRouteHintsZ {
10354    /**
10355     * The elements in the array.
10356     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10357     */
10358    struct LDKPhantomRouteHints *data;
10359    /**
10360     * The number of elements pointed to by `data`.
10361     */
10362    uintptr_t datalen;
10363 } LDKCVec_PhantomRouteHintsZ;
10364
10365 /**
10366  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
10367  * may occur.
10368  */
10369 typedef enum LDKSignOrCreationError_Tag {
10370    /**
10371     * An error occurred during signing
10372     */
10373    LDKSignOrCreationError_SignError,
10374    /**
10375     * An error occurred while building the transaction
10376     */
10377    LDKSignOrCreationError_CreationError,
10378    /**
10379     * Must be last for serialization purposes
10380     */
10381    LDKSignOrCreationError_Sentinel,
10382 } LDKSignOrCreationError_Tag;
10383
10384 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
10385    LDKSignOrCreationError_Tag tag;
10386    union {
10387       struct {
10388          enum LDKCreationError creation_error;
10389       };
10390    };
10391 } LDKSignOrCreationError;
10392
10393 /**
10394  * The contents of CResult_InvoiceSignOrCreationErrorZ
10395  */
10396 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
10397    /**
10398     * A pointer to the contents in the success state.
10399     * Reading from this pointer when `result_ok` is not set is undefined.
10400     */
10401    struct LDKInvoice *result;
10402    /**
10403     * A pointer to the contents in the error state.
10404     * Reading from this pointer when `result_ok` is set is undefined.
10405     */
10406    struct LDKSignOrCreationError *err;
10407 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
10408
10409 /**
10410  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
10411  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
10412  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10413  */
10414 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
10415    /**
10416     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
10417     * `err` or `result` depending on the state of `result_ok`.
10418     */
10419    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
10420    /**
10421     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
10422     */
10423    bool result_ok;
10424 } LDKCResult_InvoiceSignOrCreationErrorZ;
10425
10426
10427
10428 /**
10429  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
10430  *
10431  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
10432  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
10433  * the return value of [`Filter::register_output`].
10434  *
10435  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
10436  * may have been spent there. See [`Filter::register_output`] for details.
10437  *
10438  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
10439  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
10440  */
10441 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
10442    /**
10443     * A pointer to the opaque Rust object.
10444     * Nearly everywhere, inner must be non-null, however in places where
10445     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10446     */
10447    LDKnativeWatchedOutput *inner;
10448    /**
10449     * Indicates that this is the only struct which contains the same pointer.
10450     * Rust functions which take ownership of an object provided via an argument require
10451     * this to be true and invalidate the object pointed to by inner.
10452     */
10453    bool is_owned;
10454 } LDKWatchedOutput;
10455
10456 /**
10457  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
10458  * channels.
10459  *
10460  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
10461  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
10462  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
10463  * receiving full blocks from a chain source, any further filtering is unnecessary.
10464  *
10465  * After an output has been registered, subsequent block retrievals from the chain source must not
10466  * exclude any transactions matching the new criteria nor any in-block descendants of such
10467  * transactions.
10468  *
10469  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
10470  * should not block on I/O. Implementations should instead queue the newly monitored data to be
10471  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
10472  * invocation that has called the `Filter` must return [`TemporaryFailure`].
10473  *
10474  * [`TemporaryFailure`]: ChannelMonitorUpdateErr::TemporaryFailure
10475  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
10476  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
10477  */
10478 typedef struct LDKFilter {
10479    /**
10480     * An opaque pointer which is passed to your function implementations as an argument.
10481     * This has no meaning in the LDK, and can be NULL or any other value.
10482     */
10483    void *this_arg;
10484    /**
10485     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
10486     * a spending condition.
10487     */
10488    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
10489    /**
10490     * Registers interest in spends of a transaction output.
10491     *
10492     * Optionally, when `output.block_hash` is set, should return any transaction spending the
10493     * output that is found in the corresponding block along with its index.
10494     *
10495     * This return value is useful for Electrum clients in order to supply in-block descendant
10496     * transactions which otherwise were not included. This is not necessary for other clients if
10497     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
10498     * full block).
10499     */
10500    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
10501    /**
10502     * Frees any resources associated with this object given its this_arg pointer.
10503     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10504     */
10505    void (*free)(void *this_arg);
10506 } LDKFilter;
10507
10508 /**
10509  * An enum which can either contain a crate::lightning::chain::Filter or not
10510  */
10511 typedef enum LDKCOption_FilterZ_Tag {
10512    /**
10513     * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
10514     */
10515    LDKCOption_FilterZ_Some,
10516    /**
10517     * When we're in this state, this COption_FilterZ contains nothing
10518     */
10519    LDKCOption_FilterZ_None,
10520    /**
10521     * Must be last for serialization purposes
10522     */
10523    LDKCOption_FilterZ_Sentinel,
10524 } LDKCOption_FilterZ_Tag;
10525
10526 typedef struct LDKCOption_FilterZ {
10527    LDKCOption_FilterZ_Tag tag;
10528    union {
10529       struct {
10530          struct LDKFilter some;
10531       };
10532    };
10533 } LDKCOption_FilterZ;
10534
10535
10536
10537 /**
10538  * A read-only reference to a current ChannelMonitor.
10539  *
10540  * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is
10541  * released.
10542  */
10543 typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor {
10544    /**
10545     * A pointer to the opaque Rust object.
10546     * Nearly everywhere, inner must be non-null, however in places where
10547     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10548     */
10549    LDKnativeLockedChannelMonitor *inner;
10550    /**
10551     * Indicates that this is the only struct which contains the same pointer.
10552     * Rust functions which take ownership of an object provided via an argument require
10553     * this to be true and invalidate the object pointed to by inner.
10554     */
10555    bool is_owned;
10556 } LDKLockedChannelMonitor;
10557
10558 /**
10559  * The contents of CResult_LockedChannelMonitorNoneZ
10560  */
10561 typedef union LDKCResult_LockedChannelMonitorNoneZPtr {
10562    /**
10563     * A pointer to the contents in the success state.
10564     * Reading from this pointer when `result_ok` is not set is undefined.
10565     */
10566    struct LDKLockedChannelMonitor *result;
10567    /**
10568     * Note that this value is always NULL, as there are no contents in the Err variant
10569     */
10570    void *err;
10571 } LDKCResult_LockedChannelMonitorNoneZPtr;
10572
10573 /**
10574  * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
10575  * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
10576  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10577  */
10578 typedef struct LDKCResult_LockedChannelMonitorNoneZ {
10579    /**
10580     * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
10581     * `err` or `result` depending on the state of `result_ok`.
10582     */
10583    union LDKCResult_LockedChannelMonitorNoneZPtr contents;
10584    /**
10585     * Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
10586     */
10587    bool result_ok;
10588 } LDKCResult_LockedChannelMonitorNoneZ;
10589
10590 /**
10591  * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
10592  * This corresponds to std::vector in C++
10593  */
10594 typedef struct LDKCVec_OutPointZ {
10595    /**
10596     * The elements in the array.
10597     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10598     */
10599    struct LDKOutPoint *data;
10600    /**
10601     * The number of elements pointed to by `data`.
10602     */
10603    uintptr_t datalen;
10604 } LDKCVec_OutPointZ;
10605
10606 /**
10607  * A trait indicating an object may generate message send events
10608  */
10609 typedef struct LDKMessageSendEventsProvider {
10610    /**
10611     * An opaque pointer which is passed to your function implementations as an argument.
10612     * This has no meaning in the LDK, and can be NULL or any other value.
10613     */
10614    void *this_arg;
10615    /**
10616     * Gets the list of pending events which were generated by previous actions, clearing the list
10617     * in the process.
10618     */
10619    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
10620    /**
10621     * Frees any resources associated with this object given its this_arg pointer.
10622     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10623     */
10624    void (*free)(void *this_arg);
10625 } LDKMessageSendEventsProvider;
10626
10627 /**
10628  * A trait implemented for objects handling events from [`EventsProvider`].
10629  */
10630 typedef struct LDKEventHandler {
10631    /**
10632     * An opaque pointer which is passed to your function implementations as an argument.
10633     * This has no meaning in the LDK, and can be NULL or any other value.
10634     */
10635    void *this_arg;
10636    /**
10637     * Handles the given [`Event`].
10638     *
10639     * See [`EventsProvider`] for details that must be considered when implementing this method.
10640     */
10641    void (*handle_event)(const void *this_arg, const struct LDKEvent *NONNULL_PTR event);
10642    /**
10643     * Frees any resources associated with this object given its this_arg pointer.
10644     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10645     */
10646    void (*free)(void *this_arg);
10647 } LDKEventHandler;
10648
10649 /**
10650  * A trait indicating an object may generate events.
10651  *
10652  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
10653  *
10654  * # Requirements
10655  *
10656  * See [`process_pending_events`] for requirements around event processing.
10657  *
10658  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
10659  * event since the last invocation. The handler must either act upon the event immediately
10660  * or preserve it for later handling.
10661  *
10662  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
10663  * consult the provider's documentation on the implication of processing events and how a handler
10664  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
10665  * [`ChainMonitor::process_pending_events`]).
10666  *
10667  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
10668  * own type(s).
10669  *
10670  * [`process_pending_events`]: Self::process_pending_events
10671  * [`handle_event`]: EventHandler::handle_event
10672  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
10673  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
10674  */
10675 typedef struct LDKEventsProvider {
10676    /**
10677     * An opaque pointer which is passed to your function implementations as an argument.
10678     * This has no meaning in the LDK, and can be NULL or any other value.
10679     */
10680    void *this_arg;
10681    /**
10682     * Processes any events generated since the last call using the given event handler.
10683     *
10684     * Subsequent calls must only process new events. However, handlers must be capable of handling
10685     * duplicate events across process restarts. This may occur if the provider was recovered from
10686     * an old state (i.e., it hadn't been successfully persisted after processing pending events).
10687     */
10688    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
10689    /**
10690     * Frees any resources associated with this object given its this_arg pointer.
10691     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10692     */
10693    void (*free)(void *this_arg);
10694 } LDKEventsProvider;
10695
10696
10697
10698 /**
10699  * Configuration we set when applicable.
10700  *
10701  * Default::default() provides sane defaults.
10702  */
10703 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
10704    /**
10705     * A pointer to the opaque Rust object.
10706     * Nearly everywhere, inner must be non-null, however in places where
10707     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10708     */
10709    LDKnativeChannelHandshakeConfig *inner;
10710    /**
10711     * Indicates that this is the only struct which contains the same pointer.
10712     * Rust functions which take ownership of an object provided via an argument require
10713     * this to be true and invalidate the object pointed to by inner.
10714     */
10715    bool is_owned;
10716 } LDKChannelHandshakeConfig;
10717
10718
10719
10720 /**
10721  * Optional channel limits which are applied during channel creation.
10722  *
10723  * These limits are only applied to our counterparty's limits, not our own.
10724  *
10725  * Use 0/<type>::max_value() as appropriate to skip checking.
10726  *
10727  * Provides sane defaults for most configurations.
10728  *
10729  * Most additional limits are disabled except those with which specify a default in individual
10730  * field documentation. Note that this may result in barely-usable channels, but since they
10731  * are applied mostly only to incoming channels that's not much of a problem.
10732  */
10733 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
10734    /**
10735     * A pointer to the opaque Rust object.
10736     * Nearly everywhere, inner must be non-null, however in places where
10737     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10738     */
10739    LDKnativeChannelHandshakeLimits *inner;
10740    /**
10741     * Indicates that this is the only struct which contains the same pointer.
10742     * Rust functions which take ownership of an object provided via an argument require
10743     * this to be true and invalidate the object pointed to by inner.
10744     */
10745    bool is_owned;
10746 } LDKChannelHandshakeLimits;
10747
10748
10749
10750 /**
10751  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
10752  *
10753  * Default::default() provides sane defaults for most configurations
10754  * (but currently with 0 relay fees!)
10755  */
10756 typedef struct MUST_USE_STRUCT LDKUserConfig {
10757    /**
10758     * A pointer to the opaque Rust object.
10759     * Nearly everywhere, inner must be non-null, however in places where
10760     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10761     */
10762    LDKnativeUserConfig *inner;
10763    /**
10764     * Indicates that this is the only struct which contains the same pointer.
10765     * Rust functions which take ownership of an object provided via an argument require
10766     * this to be true and invalidate the object pointed to by inner.
10767     */
10768    bool is_owned;
10769 } LDKUserConfig;
10770
10771
10772
10773 /**
10774  * The best known block as identified by its hash and height.
10775  */
10776 typedef struct MUST_USE_STRUCT LDKBestBlock {
10777    /**
10778     * A pointer to the opaque Rust object.
10779     * Nearly everywhere, inner must be non-null, however in places where
10780     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10781     */
10782    LDKnativeBestBlock *inner;
10783    /**
10784     * Indicates that this is the only struct which contains the same pointer.
10785     * Rust functions which take ownership of an object provided via an argument require
10786     * this to be true and invalidate the object pointed to by inner.
10787     */
10788    bool is_owned;
10789 } LDKBestBlock;
10790
10791 /**
10792  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
10793  * chain.
10794  *
10795  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
10796  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
10797  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
10798  * when needed.
10799  */
10800 typedef struct LDKListen {
10801    /**
10802     * An opaque pointer which is passed to your function implementations as an argument.
10803     * This has no meaning in the LDK, and can be NULL or any other value.
10804     */
10805    void *this_arg;
10806    /**
10807     * Notifies the listener that a block was added at the given height.
10808     */
10809    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
10810    /**
10811     * Notifies the listener that a block was removed at the given height.
10812     */
10813    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
10814    /**
10815     * Frees any resources associated with this object given its this_arg pointer.
10816     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10817     */
10818    void (*free)(void *this_arg);
10819 } LDKListen;
10820
10821 /**
10822  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
10823  * unconfirmed during a chain reorganization.
10824  *
10825  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
10826  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
10827  * related to registered transactions and outputs. Upon notification, it would pass along the
10828  * matching transactions using this interface.
10829  *
10830  * # Use
10831  *
10832  * The intended use is as follows:
10833  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
10834  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
10835  *   that has been reorganized out of the chain.
10836  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
10837  *
10838  * # Order
10839  *
10840  * Clients must call these methods in chain order. Specifically:
10841  * - Transactions confirmed in a block must be given before transactions confirmed in a later
10842  *   block.
10843  * - Dependent transactions within the same block must be given in topological order, possibly in
10844  *   separate calls.
10845  * - Unconfirmed transactions must be given after the original confirmations and before any
10846  *   reconfirmation.
10847  *
10848  * See individual method documentation for further details.
10849  *
10850  * [`transactions_confirmed`]: Self::transactions_confirmed
10851  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
10852  * [`best_block_updated`]: Self::best_block_updated
10853  * [`get_relevant_txids`]: Self::get_relevant_txids
10854  */
10855 typedef struct LDKConfirm {
10856    /**
10857     * An opaque pointer which is passed to your function implementations as an argument.
10858     * This has no meaning in the LDK, and can be NULL or any other value.
10859     */
10860    void *this_arg;
10861    /**
10862     * Processes transactions confirmed in a block with a given header and height.
10863     *
10864     * Should be called for any transactions registered by [`Filter::register_tx`] or any
10865     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
10866     * appearing in the same block do not need to be included in the same call; instead, multiple
10867     * calls with additional transactions may be made so long as they are made in [chain order].
10868     *
10869     * May be called before or after [`best_block_updated`] for the corresponding block. However,
10870     * in the event of a chain reorganization, it must not be called with a `header` that is no
10871     * longer in the chain as of the last call to [`best_block_updated`].
10872     *
10873     * [chain order]: Confirm#Order
10874     * [`best_block_updated`]: Self::best_block_updated
10875     */
10876    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
10877    /**
10878     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
10879     *
10880     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
10881     * reorganized out of the best chain. Once called, the given transaction should not be returned
10882     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
10883     *
10884     * [`get_relevant_txids`]: Self::get_relevant_txids
10885     * [`transactions_confirmed`]: Self::transactions_confirmed
10886     */
10887    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
10888    /**
10889     * Processes an update to the best header connected at the given height.
10890     *
10891     * Should be called when a new header is available but may be skipped for intermediary blocks
10892     * if they become available at the same time.
10893     */
10894    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
10895    /**
10896     * Returns transactions that should be monitored for reorganization out of the chain.
10897     *
10898     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
10899     * confirmations to be safe from a chain reorganization. Should not include any transactions
10900     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
10901     *
10902     * May be called to determine the subset of transactions that must still be monitored for
10903     * reorganization. Will be idempotent between calls but may change as a result of calls to the
10904     * other interface methods. Thus, this is useful to determine which transactions may need to be
10905     * given to [`transaction_unconfirmed`].
10906     *
10907     * [`transactions_confirmed`]: Self::transactions_confirmed
10908     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
10909     */
10910    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
10911    /**
10912     * Frees any resources associated with this object given its this_arg pointer.
10913     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10914     */
10915    void (*free)(void *this_arg);
10916 } LDKConfirm;
10917
10918
10919
10920 /**
10921  * An opaque identifier describing a specific [`Persist`] method call.
10922  */
10923 typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
10924    /**
10925     * A pointer to the opaque Rust object.
10926     * Nearly everywhere, inner must be non-null, however in places where
10927     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10928     */
10929    LDKnativeMonitorUpdateId *inner;
10930    /**
10931     * Indicates that this is the only struct which contains the same pointer.
10932     * Rust functions which take ownership of an object provided via an argument require
10933     * this to be true and invalidate the object pointed to by inner.
10934     */
10935    bool is_owned;
10936 } LDKMonitorUpdateId;
10937
10938 /**
10939  * `Persist` defines behavior for persisting channel monitors: this could mean
10940  * writing once to disk, and/or uploading to one or more backup services.
10941  *
10942  * Each method can return three possible values:
10943  *  * If persistence (including any relevant `fsync()` calls) happens immediately, the
10944  *    implementation should return `Ok(())`, indicating normal channel operation should continue.
10945  *  * If persistence happens asynchronously, implementations should first ensure the
10946  *    [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return
10947  *    `Err(ChannelMonitorUpdateErr::TemporaryFailure)` while the update continues in the
10948  *    background. Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be
10949  *    called with the corresponding [`MonitorUpdateId`].
10950  *
10951  *    Note that unlike the direct [`chain::Watch`] interface,
10952  *    [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
10953  *
10954  *  * If persistence fails for some reason, implementations should return
10955  *    `Err(ChannelMonitorUpdateErr::PermanentFailure)`, in which case the channel will likely be
10956  *    closed without broadcasting the latest state. See
10957  *    [`ChannelMonitorUpdateErr::PermanentFailure`] for more details.
10958  */
10959 typedef struct LDKPersist {
10960    /**
10961     * An opaque pointer which is passed to your function implementations as an argument.
10962     * This has no meaning in the LDK, and can be NULL or any other value.
10963     */
10964    void *this_arg;
10965    /**
10966     * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
10967     * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
10968     *
10969     * The data can be stored any way you want, but the identifier provided by LDK is the
10970     * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
10971     * and the stored channel data). Note that you **must** persist every new monitor to disk.
10972     *
10973     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
10974     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
10975     *
10976     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
10977     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
10978     *
10979     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
10980     * [`Writeable::write`]: crate::util::ser::Writeable::write
10981     */
10982    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
10983    /**
10984     * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
10985     * update.
10986     *
10987     * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
10988     * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
10989     * details.
10990     *
10991     * During blockchain synchronization operations, this may be called with no
10992     * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
10993     * Note that after the full [`ChannelMonitor`] is persisted any previous
10994     * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
10995     * applied to the persisted [`ChannelMonitor`] as they were already applied.
10996     *
10997     * If an implementer chooses to persist the updates only, they need to make
10998     * sure that all the updates are applied to the `ChannelMonitors` *before*
10999     * the set of channel monitors is given to the `ChannelManager`
11000     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
11001     * applying a monitor update to a monitor. If full `ChannelMonitors` are
11002     * persisted, then there is no need to persist individual updates.
11003     *
11004     * Note that there could be a performance tradeoff between persisting complete
11005     * channel monitors on every update vs. persisting only updates and applying
11006     * them in batches. The size of each monitor grows `O(number of state updates)`
11007     * whereas updates are small and `O(1)`.
11008     *
11009     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
11010     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
11011     *
11012     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
11013     * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
11014     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
11015     *
11016     * [`Writeable::write`]: crate::util::ser::Writeable::write
11017     *
11018     * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
11019     */
11020    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
11021    /**
11022     * Frees any resources associated with this object given its this_arg pointer.
11023     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11024     */
11025    void (*free)(void *this_arg);
11026 } LDKPersist;
11027
11028
11029
11030 /**
11031  * An implementation of [`chain::Watch`] for monitoring channels.
11032  *
11033  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
11034  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
11035  * or used independently to monitor channels remotely. See the [module-level documentation] for
11036  * details.
11037  *
11038  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
11039  * [module-level documentation]: crate::chain::chainmonitor
11040  */
11041 typedef struct MUST_USE_STRUCT LDKChainMonitor {
11042    /**
11043     * A pointer to the opaque Rust object.
11044     * Nearly everywhere, inner must be non-null, however in places where
11045     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11046     */
11047    LDKnativeChainMonitor *inner;
11048    /**
11049     * Indicates that this is the only struct which contains the same pointer.
11050     * Rust functions which take ownership of an object provided via an argument require
11051     * this to be true and invalidate the object pointed to by inner.
11052     */
11053    bool is_owned;
11054 } LDKChainMonitor;
11055
11056
11057
11058 /**
11059  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
11060  * and derives keys from that.
11061  *
11062  * Your node_id is seed/0'
11063  * ChannelMonitor closes may use seed/1'
11064  * Cooperative closes may use seed/2'
11065  * The two close keys may be needed to claim on-chain funds!
11066  *
11067  * This struct cannot be used for nodes that wish to support receiving phantom payments;
11068  * [`PhantomKeysManager`] must be used instead.
11069  *
11070  * Note that switching between this struct and [`PhantomKeysManager`] will invalidate any
11071  * previously issued invoices and attempts to pay previous invoices will fail.
11072  */
11073 typedef struct MUST_USE_STRUCT LDKKeysManager {
11074    /**
11075     * A pointer to the opaque Rust object.
11076     * Nearly everywhere, inner must be non-null, however in places where
11077     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11078     */
11079    LDKnativeKeysManager *inner;
11080    /**
11081     * Indicates that this is the only struct which contains the same pointer.
11082     * Rust functions which take ownership of an object provided via an argument require
11083     * this to be true and invalidate the object pointed to by inner.
11084     */
11085    bool is_owned;
11086 } LDKKeysManager;
11087
11088
11089
11090 /**
11091  * Similar to [`KeysManager`], but allows the node using this struct to receive phantom node
11092  * payments.
11093  *
11094  * A phantom node payment is a payment made to a phantom invoice, which is an invoice that can be
11095  * paid to one of multiple nodes. This works because we encode the invoice route hints such that
11096  * LDK will recognize an incoming payment as destined for a phantom node, and collect the payment
11097  * itself without ever needing to forward to this fake node.
11098  *
11099  * Phantom node payments are useful for load balancing between multiple LDK nodes. They also
11100  * provide some fault tolerance, because payers will automatically retry paying other provided
11101  * nodes in the case that one node goes down.
11102  *
11103  * Note that multi-path payments are not supported in phantom invoices for security reasons.
11104  * Switching between this struct and [`KeysManager`] will invalidate any previously issued
11105  * invoices and attempts to pay previous invoices will fail.
11106  */
11107 typedef struct MUST_USE_STRUCT LDKPhantomKeysManager {
11108    /**
11109     * A pointer to the opaque Rust object.
11110     * Nearly everywhere, inner must be non-null, however in places where
11111     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11112     */
11113    LDKnativePhantomKeysManager *inner;
11114    /**
11115     * Indicates that this is the only struct which contains the same pointer.
11116     * Rust functions which take ownership of an object provided via an argument require
11117     * this to be true and invalidate the object pointed to by inner.
11118     */
11119    bool is_owned;
11120 } LDKPhantomKeysManager;
11121
11122
11123
11124 /**
11125  * Chain-related parameters used to construct a new `ChannelManager`.
11126  *
11127  * Typically, the block-specific parameters are derived from the best block hash for the network,
11128  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
11129  * are not needed when deserializing a previously constructed `ChannelManager`.
11130  */
11131 typedef struct MUST_USE_STRUCT LDKChainParameters {
11132    /**
11133     * A pointer to the opaque Rust object.
11134     * Nearly everywhere, inner must be non-null, however in places where
11135     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11136     */
11137    LDKnativeChainParameters *inner;
11138    /**
11139     * Indicates that this is the only struct which contains the same pointer.
11140     * Rust functions which take ownership of an object provided via an argument require
11141     * this to be true and invalidate the object pointed to by inner.
11142     */
11143    bool is_owned;
11144 } LDKChainParameters;
11145
11146 /**
11147  * A 3-byte byte array.
11148  */
11149 typedef struct LDKThreeBytes {
11150    /**
11151     * The three bytes
11152     */
11153    uint8_t data[3];
11154 } LDKThreeBytes;
11155
11156 /**
11157  * A trait to describe an object which can receive channel messages.
11158  *
11159  * Messages MAY be called in parallel when they originate from different their_node_ids, however
11160  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
11161  */
11162 typedef struct LDKChannelMessageHandler {
11163    /**
11164     * An opaque pointer which is passed to your function implementations as an argument.
11165     * This has no meaning in the LDK, and can be NULL or any other value.
11166     */
11167    void *this_arg;
11168    /**
11169     * Handle an incoming open_channel message from the given peer.
11170     */
11171    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
11172    /**
11173     * Handle an incoming accept_channel message from the given peer.
11174     */
11175    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
11176    /**
11177     * Handle an incoming funding_created message from the given peer.
11178     */
11179    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
11180    /**
11181     * Handle an incoming funding_signed message from the given peer.
11182     */
11183    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
11184    /**
11185     * Handle an incoming funding_locked message from the given peer.
11186     */
11187    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
11188    /**
11189     * Handle an incoming shutdown message from the given peer.
11190     */
11191    void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInitFeatures *NONNULL_PTR their_features, const struct LDKShutdown *NONNULL_PTR msg);
11192    /**
11193     * Handle an incoming closing_signed message from the given peer.
11194     */
11195    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
11196    /**
11197     * Handle an incoming update_add_htlc message from the given peer.
11198     */
11199    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
11200    /**
11201     * Handle an incoming update_fulfill_htlc message from the given peer.
11202     */
11203    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
11204    /**
11205     * Handle an incoming update_fail_htlc message from the given peer.
11206     */
11207    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
11208    /**
11209     * Handle an incoming update_fail_malformed_htlc message from the given peer.
11210     */
11211    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
11212    /**
11213     * Handle an incoming commitment_signed message from the given peer.
11214     */
11215    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
11216    /**
11217     * Handle an incoming revoke_and_ack message from the given peer.
11218     */
11219    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
11220    /**
11221     * Handle an incoming update_fee message from the given peer.
11222     */
11223    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
11224    /**
11225     * Handle an incoming announcement_signatures message from the given peer.
11226     */
11227    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
11228    /**
11229     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
11230     * is believed to be possible in the future (eg they're sending us messages we don't
11231     * understand or indicate they require unknown feature bits), no_connection_possible is set
11232     * and any outstanding channels should be failed.
11233     */
11234    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
11235    /**
11236     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
11237     */
11238    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
11239    /**
11240     * Handle an incoming channel_reestablish message from the given peer.
11241     */
11242    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
11243    /**
11244     * Handle an incoming channel update from the given peer.
11245     */
11246    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
11247    /**
11248     * Handle an incoming error message from the given peer.
11249     */
11250    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
11251    /**
11252     * Implementation of MessageSendEventsProvider for this object.
11253     */
11254    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
11255    /**
11256     * Frees any resources associated with this object given its this_arg pointer.
11257     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11258     */
11259    void (*free)(void *this_arg);
11260 } LDKChannelMessageHandler;
11261
11262
11263
11264 /**
11265  * Arguments for the creation of a ChannelManager that are not deserialized.
11266  *
11267  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
11268  * is:
11269  * 1) Deserialize all stored [`ChannelMonitor`]s.
11270  * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
11271  *    `<(BlockHash, ChannelManager)>::read(reader, args)`
11272  *    This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
11273  *    [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
11274  * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
11275  *    same way you would handle a [`chain::Filter`] call using
11276  *    [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
11277  * 4) Reconnect blocks on your [`ChannelMonitor`]s.
11278  * 5) Disconnect/connect blocks on the [`ChannelManager`].
11279  * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
11280  *    Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
11281  *    will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
11282  *    the next step.
11283  * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
11284  *    [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
11285  *
11286  * Note that the ordering of #4-7 is not of importance, however all four must occur before you
11287  * call any other methods on the newly-deserialized [`ChannelManager`].
11288  *
11289  * Note that because some channels may be closed during deserialization, it is critical that you
11290  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
11291  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
11292  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
11293  * not force-close the same channels but consider them live), you may end up revoking a state for
11294  * which you've already broadcasted the transaction.
11295  *
11296  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
11297  */
11298 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
11299    /**
11300     * A pointer to the opaque Rust object.
11301     * Nearly everywhere, inner must be non-null, however in places where
11302     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11303     */
11304    LDKnativeChannelManagerReadArgs *inner;
11305    /**
11306     * Indicates that this is the only struct which contains the same pointer.
11307     * Rust functions which take ownership of an object provided via an argument require
11308     * this to be true and invalidate the object pointed to by inner.
11309     */
11310    bool is_owned;
11311 } LDKChannelManagerReadArgs;
11312
11313
11314
11315 /**
11316  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
11317  * This is used to convince the recipient that the channel is at a certain commitment
11318  * number even if they lost that data due to a local failure.  Of course, the peer may lie
11319  * and even later commitments may have been revoked.
11320  */
11321 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
11322    /**
11323     * A pointer to the opaque Rust object.
11324     * Nearly everywhere, inner must be non-null, however in places where
11325     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11326     */
11327    LDKnativeDataLossProtect *inner;
11328    /**
11329     * Indicates that this is the only struct which contains the same pointer.
11330     * Rust functions which take ownership of an object provided via an argument require
11331     * this to be true and invalidate the object pointed to by inner.
11332     */
11333    bool is_owned;
11334 } LDKDataLossProtect;
11335
11336 /**
11337  * A trait to describe an object which can receive routing messages.
11338  *
11339  * # Implementor DoS Warnings
11340  *
11341  * For `gossip_queries` messages there are potential DoS vectors when handling
11342  * inbound queries. Implementors using an on-disk network graph should be aware of
11343  * repeated disk I/O for queries accessing different parts of the network graph.
11344  */
11345 typedef struct LDKRoutingMessageHandler {
11346    /**
11347     * An opaque pointer which is passed to your function implementations as an argument.
11348     * This has no meaning in the LDK, and can be NULL or any other value.
11349     */
11350    void *this_arg;
11351    /**
11352     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
11353     * false or returning an Err otherwise.
11354     */
11355    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
11356    /**
11357     * Handle a channel_announcement message, returning true if it should be forwarded on, false
11358     * or returning an Err otherwise.
11359     */
11360    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
11361    /**
11362     * Handle an incoming channel_update message, returning true if it should be forwarded on,
11363     * false or returning an Err otherwise.
11364     */
11365    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
11366    /**
11367     * Gets a subset of the channel announcements and updates required to dump our routing table
11368     * to a remote node, starting at the short_channel_id indicated by starting_point and
11369     * including the batch_amount entries immediately higher in numerical value than starting_point.
11370     */
11371    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
11372    /**
11373     * Gets a subset of the node announcements required to dump our routing table to a remote node,
11374     * starting at the node *after* the provided publickey and including batch_amount entries
11375     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
11376     * If None is provided for starting_point, we start at the first node.
11377     *
11378     * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
11379     */
11380    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
11381    /**
11382     * Called when a connection is established with a peer. This can be used to
11383     * perform routing table synchronization using a strategy defined by the
11384     * implementor.
11385     */
11386    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
11387    /**
11388     * Handles the reply of a query we initiated to learn about channels
11389     * for a given range of blocks. We can expect to receive one or more
11390     * replies to a single query.
11391     */
11392    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
11393    /**
11394     * Handles the reply of a query we initiated asking for routing gossip
11395     * messages for a list of channels. We should receive this message when
11396     * a node has completed its best effort to send us the pertaining routing
11397     * gossip messages.
11398     */
11399    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
11400    /**
11401     * Handles when a peer asks us to send a list of short_channel_ids
11402     * for the requested range of blocks.
11403     */
11404    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
11405    /**
11406     * Handles when a peer asks us to send routing gossip messages for a
11407     * list of short_channel_ids.
11408     */
11409    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
11410    /**
11411     * Implementation of MessageSendEventsProvider for this object.
11412     */
11413    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
11414    /**
11415     * Frees any resources associated with this object given its this_arg pointer.
11416     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11417     */
11418    void (*free)(void *this_arg);
11419 } LDKRoutingMessageHandler;
11420
11421 /**
11422  * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
11423  * decoders.
11424  */
11425 typedef struct LDKCustomMessageReader {
11426    /**
11427     * An opaque pointer which is passed to your function implementations as an argument.
11428     * This has no meaning in the LDK, and can be NULL or any other value.
11429     */
11430    void *this_arg;
11431    /**
11432     * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
11433     * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
11434     * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
11435     * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
11436     */
11437    struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer);
11438    /**
11439     * Frees any resources associated with this object given its this_arg pointer.
11440     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11441     */
11442    void (*free)(void *this_arg);
11443 } LDKCustomMessageReader;
11444
11445 /**
11446  * Handler for BOLT1-compliant messages.
11447  */
11448 typedef struct LDKCustomMessageHandler {
11449    /**
11450     * An opaque pointer which is passed to your function implementations as an argument.
11451     * This has no meaning in the LDK, and can be NULL or any other value.
11452     */
11453    void *this_arg;
11454    /**
11455     * Called with the message type that was received and the buffer to be read.
11456     * Can return a `MessageHandlingError` if the message could not be handled.
11457     */
11458    struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id);
11459    /**
11460     * Gets the list of pending messages which were generated by the custom message
11461     * handler, clearing the list in the process. The first tuple element must
11462     * correspond to the intended recipients node ids. If no connection to one of the
11463     * specified node does not exist, the message is simply not sent to it.
11464     */
11465    struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg);
11466    /**
11467     * Implementation of CustomMessageReader for this object.
11468     */
11469    struct LDKCustomMessageReader CustomMessageReader;
11470    /**
11471     * Frees any resources associated with this object given its this_arg pointer.
11472     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11473     */
11474    void (*free)(void *this_arg);
11475 } LDKCustomMessageHandler;
11476
11477
11478
11479 /**
11480  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
11481  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
11482  */
11483 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
11484    /**
11485     * A pointer to the opaque Rust object.
11486     * Nearly everywhere, inner must be non-null, however in places where
11487     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11488     */
11489    LDKnativeIgnoringMessageHandler *inner;
11490    /**
11491     * Indicates that this is the only struct which contains the same pointer.
11492     * Rust functions which take ownership of an object provided via an argument require
11493     * this to be true and invalidate the object pointed to by inner.
11494     */
11495    bool is_owned;
11496 } LDKIgnoringMessageHandler;
11497
11498
11499
11500 /**
11501  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
11502  * You can provide one of these as the route_handler in a MessageHandler.
11503  */
11504 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
11505    /**
11506     * A pointer to the opaque Rust object.
11507     * Nearly everywhere, inner must be non-null, however in places where
11508     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11509     */
11510    LDKnativeErroringMessageHandler *inner;
11511    /**
11512     * Indicates that this is the only struct which contains the same pointer.
11513     * Rust functions which take ownership of an object provided via an argument require
11514     * this to be true and invalidate the object pointed to by inner.
11515     */
11516    bool is_owned;
11517 } LDKErroringMessageHandler;
11518
11519
11520
11521 /**
11522  * Provides references to trait impls which handle different types of messages.
11523  */
11524 typedef struct MUST_USE_STRUCT LDKMessageHandler {
11525    /**
11526     * A pointer to the opaque Rust object.
11527     * Nearly everywhere, inner must be non-null, however in places where
11528     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11529     */
11530    LDKnativeMessageHandler *inner;
11531    /**
11532     * Indicates that this is the only struct which contains the same pointer.
11533     * Rust functions which take ownership of an object provided via an argument require
11534     * this to be true and invalidate the object pointed to by inner.
11535     */
11536    bool is_owned;
11537 } LDKMessageHandler;
11538
11539 /**
11540  * Provides an object which can be used to send data to and which uniquely identifies a connection
11541  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
11542  * implement Hash to meet the PeerManager API.
11543  *
11544  * For efficiency, Clone should be relatively cheap for this type.
11545  *
11546  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
11547  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
11548  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
11549  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
11550  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
11551  * to simply use another value which is guaranteed to be globally unique instead.
11552  */
11553 typedef struct LDKSocketDescriptor {
11554    /**
11555     * An opaque pointer which is passed to your function implementations as an argument.
11556     * This has no meaning in the LDK, and can be NULL or any other value.
11557     */
11558    void *this_arg;
11559    /**
11560     * Attempts to send some data from the given slice to the peer.
11561     *
11562     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
11563     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
11564     * called and further write attempts may occur until that time.
11565     *
11566     * If the returned size is smaller than `data.len()`, a
11567     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
11568     * written. Additionally, until a `send_data` event completes fully, no further
11569     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
11570     * prevent denial-of-service issues, you should not read or buffer any data from the socket
11571     * until then.
11572     *
11573     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
11574     * (indicating that read events should be paused to prevent DoS in the send buffer),
11575     * `resume_read` may be set indicating that read events on this descriptor should resume. A
11576     * `resume_read` of false carries no meaning, and should not cause any action.
11577     */
11578    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
11579    /**
11580     * Disconnect the socket pointed to by this SocketDescriptor.
11581     *
11582     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
11583     * call (doing so is a noop).
11584     */
11585    void (*disconnect_socket)(void *this_arg);
11586    /**
11587     * Checks if two objects are equal given this object's this_arg pointer and another object.
11588     */
11589    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
11590    /**
11591     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
11592     * This is used, for example, for inclusion of this object in a hash map.
11593     */
11594    uint64_t (*hash)(const void *this_arg);
11595    /**
11596     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
11597     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
11598     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
11599     */
11600    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
11601    /**
11602     * Frees any resources associated with this object given its this_arg pointer.
11603     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11604     */
11605    void (*free)(void *this_arg);
11606 } LDKSocketDescriptor;
11607
11608
11609
11610 /**
11611  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
11612  * socket events into messages which it passes on to its [`MessageHandler`].
11613  *
11614  * Locks are taken internally, so you must never assume that reentrancy from a
11615  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
11616  *
11617  * Calls to [`read_event`] will decode relevant messages and pass them to the
11618  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
11619  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
11620  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
11621  * calls only after previous ones have returned.
11622  *
11623  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
11624  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
11625  * essentially you should default to using a SimpleRefPeerManager, and use a
11626  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
11627  * you're using lightning-net-tokio.
11628  *
11629  * [`read_event`]: PeerManager::read_event
11630  */
11631 typedef struct MUST_USE_STRUCT LDKPeerManager {
11632    /**
11633     * A pointer to the opaque Rust object.
11634     * Nearly everywhere, inner must be non-null, however in places where
11635     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11636     */
11637    LDKnativePeerManager *inner;
11638    /**
11639     * Indicates that this is the only struct which contains the same pointer.
11640     * Rust functions which take ownership of an object provided via an argument require
11641     * this to be true and invalidate the object pointed to by inner.
11642     */
11643    bool is_owned;
11644 } LDKPeerManager;
11645
11646
11647
11648 /**
11649  * Static channel fields used to build transactions given per-commitment fields, organized by
11650  * broadcaster/countersignatory.
11651  *
11652  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
11653  * as_holder_broadcastable and as_counterparty_broadcastable functions.
11654  */
11655 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
11656    /**
11657     * A pointer to the opaque Rust object.
11658     * Nearly everywhere, inner must be non-null, however in places where
11659     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11660     */
11661    LDKnativeDirectedChannelTransactionParameters *inner;
11662    /**
11663     * Indicates that this is the only struct which contains the same pointer.
11664     * Rust functions which take ownership of an object provided via an argument require
11665     * this to be true and invalidate the object pointed to by inner.
11666     */
11667    bool is_owned;
11668 } LDKDirectedChannelTransactionParameters;
11669
11670
11671
11672 /**
11673  * A read-only view of [`NetworkGraph`].
11674  */
11675 typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
11676    /**
11677     * A pointer to the opaque Rust object.
11678     * Nearly everywhere, inner must be non-null, however in places where
11679     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11680     */
11681    LDKnativeReadOnlyNetworkGraph *inner;
11682    /**
11683     * Indicates that this is the only struct which contains the same pointer.
11684     * Rust functions which take ownership of an object provided via an argument require
11685     * this to be true and invalidate the object pointed to by inner.
11686     */
11687    bool is_owned;
11688 } LDKReadOnlyNetworkGraph;
11689
11690
11691
11692 /**
11693  * Receives and validates network updates from peers,
11694  * stores authentic and relevant data as a network graph.
11695  * This network graph is then used for routing payments.
11696  * Provides interface to help with initial routing sync by
11697  * serving historical announcements.
11698  *
11699  * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
11700  * [`NetworkGraph`].
11701  */
11702 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
11703    /**
11704     * A pointer to the opaque Rust object.
11705     * Nearly everywhere, inner must be non-null, however in places where
11706     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11707     */
11708    LDKnativeNetGraphMsgHandler *inner;
11709    /**
11710     * Indicates that this is the only struct which contains the same pointer.
11711     * Rust functions which take ownership of an object provided via an argument require
11712     * this to be true and invalidate the object pointed to by inner.
11713     */
11714    bool is_owned;
11715 } LDKNetGraphMsgHandler;
11716
11717
11718
11719 /**
11720  * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a
11721  * source node to a target node.
11722  */
11723 typedef struct MUST_USE_STRUCT LDKDirectedChannelInfo {
11724    /**
11725     * A pointer to the opaque Rust object.
11726     * Nearly everywhere, inner must be non-null, however in places where
11727     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11728     */
11729    LDKnativeDirectedChannelInfo *inner;
11730    /**
11731     * Indicates that this is the only struct which contains the same pointer.
11732     * Rust functions which take ownership of an object provided via an argument require
11733     * this to be true and invalidate the object pointed to by inner.
11734     */
11735    bool is_owned;
11736 } LDKDirectedChannelInfo;
11737
11738 /**
11739  * The effective capacity of a channel for routing purposes.
11740  *
11741  * While this may be smaller than the actual channel capacity, amounts greater than
11742  * [`Self::as_msat`] should not be routed through the channel.
11743  */
11744 typedef enum LDKEffectiveCapacity_Tag {
11745    /**
11746     * The available liquidity in the channel known from being a channel counterparty, and thus a
11747     * direct hop.
11748     */
11749    LDKEffectiveCapacity_ExactLiquidity,
11750    /**
11751     * The maximum HTLC amount in one direction as advertised on the gossip network.
11752     */
11753    LDKEffectiveCapacity_MaximumHTLC,
11754    /**
11755     * The total capacity of the channel as determined by the funding transaction.
11756     */
11757    LDKEffectiveCapacity_Total,
11758    /**
11759     * A capacity sufficient to route any payment, typically used for private channels provided by
11760     * an invoice.
11761     */
11762    LDKEffectiveCapacity_Infinite,
11763    /**
11764     * A capacity that is unknown possibly because either the chain state is unavailable to know
11765     * the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network.
11766     */
11767    LDKEffectiveCapacity_Unknown,
11768    /**
11769     * Must be last for serialization purposes
11770     */
11771    LDKEffectiveCapacity_Sentinel,
11772 } LDKEffectiveCapacity_Tag;
11773
11774 typedef struct LDKEffectiveCapacity_LDKExactLiquidity_Body {
11775    /**
11776     * Either the inbound or outbound liquidity depending on the direction, denominated in
11777     * millisatoshi.
11778     */
11779    uint64_t liquidity_msat;
11780 } LDKEffectiveCapacity_LDKExactLiquidity_Body;
11781
11782 typedef struct LDKEffectiveCapacity_LDKMaximumHTLC_Body {
11783    /**
11784     * The maximum HTLC amount denominated in millisatoshi.
11785     */
11786    uint64_t amount_msat;
11787 } LDKEffectiveCapacity_LDKMaximumHTLC_Body;
11788
11789 typedef struct LDKEffectiveCapacity_LDKTotal_Body {
11790    /**
11791     * The funding amount denominated in millisatoshi.
11792     */
11793    uint64_t capacity_msat;
11794 } LDKEffectiveCapacity_LDKTotal_Body;
11795
11796 typedef struct MUST_USE_STRUCT LDKEffectiveCapacity {
11797    LDKEffectiveCapacity_Tag tag;
11798    union {
11799       LDKEffectiveCapacity_LDKExactLiquidity_Body exact_liquidity;
11800       LDKEffectiveCapacity_LDKMaximumHTLC_Body maximum_htlc;
11801       LDKEffectiveCapacity_LDKTotal_Body total;
11802    };
11803 } LDKEffectiveCapacity;
11804
11805 /**
11806  * An interface used to score payment channels for path finding.
11807  *
11808  *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
11809  */
11810 typedef struct LDKScore {
11811    /**
11812     * An opaque pointer which is passed to your function implementations as an argument.
11813     * This has no meaning in the LDK, and can be NULL or any other value.
11814     */
11815    void *this_arg;
11816    /**
11817     * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
11818     * given channel in the direction from `source` to `target`.
11819     *
11820     * The channel's capacity (less any other MPP parts that are also being considered for use in
11821     * the same payment) is given by `capacity_msat`. It may be determined from various sources
11822     * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near
11823     * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount.
11824     * Thus, implementations should be overflow-safe.
11825     */
11826    uint64_t (*channel_penalty_msat)(const void *this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, uint64_t capacity_msat, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target);
11827    /**
11828     * Handles updating channel penalties after failing to route through a channel.
11829     */
11830    void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
11831    /**
11832     * Handles updating channel penalties after successfully routing along a path.
11833     */
11834    void (*payment_path_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
11835    /**
11836     * Serialize the object into a byte array
11837     */
11838    struct LDKCVec_u8Z (*write)(const void *this_arg);
11839    /**
11840     * Frees any resources associated with this object given its this_arg pointer.
11841     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11842     */
11843    void (*free)(void *this_arg);
11844 } LDKScore;
11845
11846 /**
11847  * A scorer that is accessed under a lock.
11848  *
11849  * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while
11850  * having shared ownership of a scorer but without requiring internal locking in [`Score`]
11851  * implementations. Internal locking would be detrimental to route finding performance and could
11852  * result in [`Score::channel_penalty_msat`] returning a different value for the same channel.
11853  *
11854  * [`find_route`]: crate::routing::router::find_route
11855  */
11856 typedef struct LDKLockableScore {
11857    /**
11858     * An opaque pointer which is passed to your function implementations as an argument.
11859     * This has no meaning in the LDK, and can be NULL or any other value.
11860     */
11861    void *this_arg;
11862    /**
11863     * Returns the locked scorer.
11864     */
11865    struct LDKScore (*lock)(const void *this_arg);
11866    /**
11867     * Frees any resources associated with this object given its this_arg pointer.
11868     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11869     */
11870    void (*free)(void *this_arg);
11871 } LDKLockableScore;
11872
11873
11874
11875 /**
11876  * A concrete implementation of [`LockableScore`] which supports multi-threading.
11877  */
11878 typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore {
11879    /**
11880     * A pointer to the opaque Rust object.
11881     * Nearly everywhere, inner must be non-null, however in places where
11882     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11883     */
11884    LDKnativeMultiThreadedLockableScore *inner;
11885    /**
11886     * Indicates that this is the only struct which contains the same pointer.
11887     * Rust functions which take ownership of an object provided via an argument require
11888     * this to be true and invalidate the object pointed to by inner.
11889     */
11890    bool is_owned;
11891 } LDKMultiThreadedLockableScore;
11892
11893
11894
11895 /**
11896  * FilesystemPersister persists channel data on disk, where each channel's
11897  * data is stored in a file named after its funding outpoint.
11898  *
11899  * Warning: this module does the best it can with calls to persist data, but it
11900  * can only guarantee that the data is passed to the drive. It is up to the
11901  * drive manufacturers to do the actual persistence properly, which they often
11902  * don't (especially on consumer-grade hardware). Therefore, it is up to the
11903  * user to validate their entire storage stack, to ensure the writes are
11904  * persistent.
11905  * Corollary: especially when dealing with larger amounts of money, it is best
11906  * practice to have multiple channel data backups and not rely only on one
11907  * FilesystemPersister.
11908  */
11909 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
11910    /**
11911     * A pointer to the opaque Rust object.
11912     * Nearly everywhere, inner must be non-null, however in places where
11913     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11914     */
11915    LDKnativeFilesystemPersister *inner;
11916    /**
11917     * Indicates that this is the only struct which contains the same pointer.
11918     * Rust functions which take ownership of an object provided via an argument require
11919     * this to be true and invalidate the object pointed to by inner.
11920     */
11921    bool is_owned;
11922 } LDKFilesystemPersister;
11923
11924
11925
11926 /**
11927  * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
11928  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
11929  * responsibilities are:
11930  * * Processing [`Event`]s with a user-provided [`EventHandler`].
11931  * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
11932  *   writing it to disk/backups by invoking the callback given to it at startup.
11933  *   [`ChannelManager`] persistence should be done in the background.
11934  * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
11935  *   at the appropriate intervals.
11936  * * Calling [`NetworkGraph::remove_stale_channels`] (if a [`NetGraphMsgHandler`] is provided to
11937  *   [`BackgroundProcessor::start`]).
11938  *
11939  * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
11940  * upon as doing so may result in high latency.
11941  *
11942  * # Note
11943  *
11944  * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
11945  * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
11946  * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
11947  * unilateral chain closure fees are at risk.
11948  *
11949  * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
11950  * [`Event`]: lightning::util::events::Event
11951  *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
11952  */
11953 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
11954    /**
11955     * A pointer to the opaque Rust object.
11956     * Nearly everywhere, inner must be non-null, however in places where
11957     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11958     */
11959    LDKnativeBackgroundProcessor *inner;
11960    /**
11961     * Indicates that this is the only struct which contains the same pointer.
11962     * Rust functions which take ownership of an object provided via an argument require
11963     * this to be true and invalidate the object pointed to by inner.
11964     */
11965    bool is_owned;
11966 } LDKBackgroundProcessor;
11967
11968 /**
11969  * Trait which handles persisting a [`ChannelManager`] to disk.
11970  *
11971  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
11972  */
11973 typedef struct LDKChannelManagerPersister {
11974    /**
11975     * An opaque pointer which is passed to your function implementations as an argument.
11976     * This has no meaning in the LDK, and can be NULL or any other value.
11977     */
11978    void *this_arg;
11979    /**
11980     * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed
11981     * (which will cause the [`BackgroundProcessor`] which called this method to exit.
11982     *
11983     * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
11984     */
11985    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
11986    /**
11987     * Frees any resources associated with this object given its this_arg pointer.
11988     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11989     */
11990    void (*free)(void *this_arg);
11991 } LDKChannelManagerPersister;
11992
11993
11994
11995 /**
11996  * Data of the `RawInvoice` that is encoded in the data part
11997  */
11998 typedef struct MUST_USE_STRUCT LDKRawDataPart {
11999    /**
12000     * A pointer to the opaque Rust object.
12001     * Nearly everywhere, inner must be non-null, however in places where
12002     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12003     */
12004    LDKnativeRawDataPart *inner;
12005    /**
12006     * Indicates that this is the only struct which contains the same pointer.
12007     * Rust functions which take ownership of an object provided via an argument require
12008     * this to be true and invalidate the object pointed to by inner.
12009     */
12010    bool is_owned;
12011 } LDKRawDataPart;
12012
12013
12014
12015 /**
12016  * SHA-256 hash
12017  */
12018 typedef struct MUST_USE_STRUCT LDKSha256 {
12019    /**
12020     * A pointer to the opaque Rust object.
12021     * Nearly everywhere, inner must be non-null, however in places where
12022     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12023     */
12024    LDKnativeSha256 *inner;
12025    /**
12026     * Indicates that this is the only struct which contains the same pointer.
12027     * Rust functions which take ownership of an object provided via an argument require
12028     * this to be true and invalidate the object pointed to by inner.
12029     */
12030    bool is_owned;
12031 } LDKSha256;
12032
12033
12034
12035 /**
12036  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
12037  * expires
12038  */
12039 typedef struct MUST_USE_STRUCT LDKExpiryTime {
12040    /**
12041     * A pointer to the opaque Rust object.
12042     * Nearly everywhere, inner must be non-null, however in places where
12043     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12044     */
12045    LDKnativeExpiryTime *inner;
12046    /**
12047     * Indicates that this is the only struct which contains the same pointer.
12048     * Rust functions which take ownership of an object provided via an argument require
12049     * this to be true and invalidate the object pointed to by inner.
12050     */
12051    bool is_owned;
12052 } LDKExpiryTime;
12053
12054
12055
12056 /**
12057  * `min_final_cltv_expiry` to use for the last HTLC in the route
12058  */
12059 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
12060    /**
12061     * A pointer to the opaque Rust object.
12062     * Nearly everywhere, inner must be non-null, however in places where
12063     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12064     */
12065    LDKnativeMinFinalCltvExpiry *inner;
12066    /**
12067     * Indicates that this is the only struct which contains the same pointer.
12068     * Rust functions which take ownership of an object provided via an argument require
12069     * this to be true and invalidate the object pointed to by inner.
12070     */
12071    bool is_owned;
12072 } LDKMinFinalCltvExpiry;
12073
12074 /**
12075  * A 20-byte byte array.
12076  */
12077 typedef struct LDKTwentyBytes {
12078    /**
12079     * The twenty bytes
12080     */
12081    uint8_t data[20];
12082 } LDKTwentyBytes;
12083
12084 /**
12085  * Fallback address in case no LN payment is possible
12086  */
12087 typedef enum LDKFallback_Tag {
12088    LDKFallback_SegWitProgram,
12089    LDKFallback_PubKeyHash,
12090    LDKFallback_ScriptHash,
12091    /**
12092     * Must be last for serialization purposes
12093     */
12094    LDKFallback_Sentinel,
12095 } LDKFallback_Tag;
12096
12097 typedef struct LDKFallback_LDKSegWitProgram_Body {
12098    struct LDKu5 version;
12099    struct LDKCVec_u8Z program;
12100 } LDKFallback_LDKSegWitProgram_Body;
12101
12102 typedef struct MUST_USE_STRUCT LDKFallback {
12103    LDKFallback_Tag tag;
12104    union {
12105       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
12106       struct {
12107          struct LDKTwentyBytes pub_key_hash;
12108       };
12109       struct {
12110          struct LDKTwentyBytes script_hash;
12111       };
12112    };
12113 } LDKFallback;
12114
12115 /**
12116  * A trait defining behavior of an [`Invoice`] payer.
12117  */
12118 typedef struct LDKPayer {
12119    /**
12120     * An opaque pointer which is passed to your function implementations as an argument.
12121     * This has no meaning in the LDK, and can be NULL or any other value.
12122     */
12123    void *this_arg;
12124    /**
12125     * Returns the payer's node id.
12126     */
12127    struct LDKPublicKey (*node_id)(const void *this_arg);
12128    /**
12129     * Returns the payer's channels.
12130     */
12131    struct LDKCVec_ChannelDetailsZ (*first_hops)(const void *this_arg);
12132    /**
12133     * Sends a payment over the Lightning Network using the given [`Route`].
12134     *
12135     * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
12136     */
12137    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
12138    /**
12139     * Sends a spontaneous payment over the Lightning Network using the given [`Route`].
12140     */
12141    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_spontaneous_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage);
12142    /**
12143     * Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
12144     */
12145    struct LDKCResult_NonePaymentSendFailureZ (*retry_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
12146    /**
12147     * Signals that no further retries for the given payment will occur.
12148     */
12149    void (*abandon_payment)(const void *this_arg, struct LDKThirtyTwoBytes payment_id);
12150    /**
12151     * Frees any resources associated with this object given its this_arg pointer.
12152     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12153     */
12154    void (*free)(void *this_arg);
12155 } LDKPayer;
12156
12157 /**
12158  * A trait defining behavior for routing an [`Invoice`] payment.
12159  */
12160 typedef struct LDKRouter {
12161    /**
12162     * An opaque pointer which is passed to your function implementations as an argument.
12163     * This has no meaning in the LDK, and can be NULL or any other value.
12164     */
12165    void *this_arg;
12166    /**
12167     * Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
12168     *
12169     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
12170     */
12171    struct LDKCResult_RouteLightningErrorZ (*find_route)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, const uint8_t (*payment_hash)[32], struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKScore *NONNULL_PTR scorer);
12172    /**
12173     * Frees any resources associated with this object given its this_arg pointer.
12174     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12175     */
12176    void (*free)(void *this_arg);
12177 } LDKRouter;
12178
12179
12180
12181 /**
12182  * A utility for paying [`Invoice`]s and sending spontaneous payments.
12183  *
12184  * See [module-level documentation] for details.
12185  *
12186  * [module-level documentation]: crate::payment
12187  */
12188 typedef struct MUST_USE_STRUCT LDKInvoicePayer {
12189    /**
12190     * A pointer to the opaque Rust object.
12191     * Nearly everywhere, inner must be non-null, however in places where
12192     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12193     */
12194    LDKnativeInvoicePayer *inner;
12195    /**
12196     * Indicates that this is the only struct which contains the same pointer.
12197     * Rust functions which take ownership of an object provided via an argument require
12198     * this to be true and invalidate the object pointed to by inner.
12199     */
12200    bool is_owned;
12201 } LDKInvoicePayer;
12202
12203
12204
12205 /**
12206  * Number of attempts to retry payment path failures for an [`Invoice`].
12207  *
12208  * Note that this is the number of *path* failures, not full payment retries. For multi-path
12209  * payments, if this is less than the total number of paths, we will never even retry all of the
12210  * payment's paths.
12211  */
12212 typedef struct MUST_USE_STRUCT LDKRetryAttempts {
12213    /**
12214     * A pointer to the opaque Rust object.
12215     * Nearly everywhere, inner must be non-null, however in places where
12216     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12217     */
12218    LDKnativeRetryAttempts *inner;
12219    /**
12220     * Indicates that this is the only struct which contains the same pointer.
12221     * Rust functions which take ownership of an object provided via an argument require
12222     * this to be true and invalidate the object pointed to by inner.
12223     */
12224    bool is_owned;
12225 } LDKRetryAttempts;
12226
12227
12228
12229 /**
12230  * A [`Router`] implemented using [`find_route`].
12231  */
12232 typedef struct MUST_USE_STRUCT LDKDefaultRouter {
12233    /**
12234     * A pointer to the opaque Rust object.
12235     * Nearly everywhere, inner must be non-null, however in places where
12236     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12237     */
12238    LDKnativeDefaultRouter *inner;
12239    /**
12240     * Indicates that this is the only struct which contains the same pointer.
12241     * Rust functions which take ownership of an object provided via an argument require
12242     * this to be true and invalidate the object pointed to by inner.
12243     */
12244    bool is_owned;
12245 } LDKDefaultRouter;
12246
12247 extern const uintptr_t MAX_BUF_SIZE;
12248
12249 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
12250
12251 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
12252
12253 extern const uint32_t ANTI_REORG_DELAY;
12254
12255 extern const uint16_t BREAKDOWN_TIMEOUT;
12256
12257 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
12258
12259 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
12260
12261 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
12262
12263 extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT;
12264
12265 extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA;
12266
12267 extern const uint64_t MAX_TIMESTAMP;
12268
12269 extern const uint64_t DEFAULT_EXPIRY_TIME;
12270
12271 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY;
12272
12273 extern const uint8_t TAG_PAYMENT_HASH;
12274
12275 extern const uint8_t TAG_DESCRIPTION;
12276
12277 extern const uint8_t TAG_PAYEE_PUB_KEY;
12278
12279 extern const uint8_t TAG_DESCRIPTION_HASH;
12280
12281 extern const uint8_t TAG_EXPIRY_TIME;
12282
12283 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
12284
12285 extern const uint8_t TAG_FALLBACK;
12286
12287 extern const uint8_t TAG_PRIVATE_ROUTE;
12288
12289 extern const uint8_t TAG_PAYMENT_SECRET;
12290
12291 extern const uint8_t TAG_FEATURES;
12292
12293 struct LDKStr _ldk_get_compiled_version(void);
12294
12295 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
12296
12297 /**
12298  * Frees the data buffer, if data_is_owned is set and datalen > 0.
12299  */
12300 void Transaction_free(struct LDKTransaction _res);
12301
12302 /**
12303  * Convenience function for constructing a new TxOut
12304  */
12305 struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
12306
12307 /**
12308  * Frees the data pointed to by script_pubkey.
12309  */
12310 void TxOut_free(struct LDKTxOut _res);
12311
12312 /**
12313  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
12314  */
12315 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
12316
12317 /**
12318  * Frees the data buffer, if chars_is_owned is set and len > 0.
12319  */
12320 void Str_free(struct LDKStr _res);
12321
12322 #if defined(LDK_DEBUG_BUILD)
12323 /**
12324  * This function exists for memory safety testing purposes. It should never be used in production
12325  * code
12326  */
12327 const void *__unmangle_inner_ptr(const void *ptr);
12328 #endif
12329
12330 /**
12331  * Creates a new CResult_NoneNoneZ in the success state.
12332  */
12333 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
12334
12335 /**
12336  * Creates a new CResult_NoneNoneZ in the error state.
12337  */
12338 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
12339
12340 /**
12341  * Checks if the given object is currently in the success state
12342  */
12343 bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o);
12344
12345 /**
12346  * Frees any resources used by the CResult_NoneNoneZ.
12347  */
12348 void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
12349
12350 /**
12351  * Creates a new CResult_NoneNoneZ which has the same data as `orig`
12352  * but with all dynamically-allocated buffers duplicated in new buffers.
12353  */
12354 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
12355
12356 /**
12357  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
12358  */
12359 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o);
12360
12361 /**
12362  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
12363  */
12364 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e);
12365
12366 /**
12367  * Checks if the given object is currently in the success state
12368  */
12369 bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o);
12370
12371 /**
12372  * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
12373  */
12374 void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res);
12375
12376 /**
12377  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
12378  * but with all dynamically-allocated buffers duplicated in new buffers.
12379  */
12380 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig);
12381
12382 /**
12383  * Creates a new CResult_SecretKeyErrorZ in the success state.
12384  */
12385 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
12386
12387 /**
12388  * Creates a new CResult_SecretKeyErrorZ in the error state.
12389  */
12390 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
12391
12392 /**
12393  * Checks if the given object is currently in the success state
12394  */
12395 bool CResult_SecretKeyErrorZ_is_ok(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR o);
12396
12397 /**
12398  * Frees any resources used by the CResult_SecretKeyErrorZ.
12399  */
12400 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
12401
12402 /**
12403  * Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
12404  * but with all dynamically-allocated buffers duplicated in new buffers.
12405  */
12406 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_clone(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR orig);
12407
12408 /**
12409  * Creates a new CResult_PublicKeyErrorZ in the success state.
12410  */
12411 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
12412
12413 /**
12414  * Creates a new CResult_PublicKeyErrorZ in the error state.
12415  */
12416 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
12417
12418 /**
12419  * Checks if the given object is currently in the success state
12420  */
12421 bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o);
12422
12423 /**
12424  * Frees any resources used by the CResult_PublicKeyErrorZ.
12425  */
12426 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
12427
12428 /**
12429  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
12430  * but with all dynamically-allocated buffers duplicated in new buffers.
12431  */
12432 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
12433
12434 /**
12435  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
12436  */
12437 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
12438
12439 /**
12440  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
12441  */
12442 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
12443
12444 /**
12445  * Checks if the given object is currently in the success state
12446  */
12447 bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o);
12448
12449 /**
12450  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
12451  */
12452 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
12453
12454 /**
12455  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
12456  * but with all dynamically-allocated buffers duplicated in new buffers.
12457  */
12458 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
12459
12460 /**
12461  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
12462  */
12463 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
12464
12465 /**
12466  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
12467  */
12468 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
12469
12470 /**
12471  * Checks if the given object is currently in the success state
12472  */
12473 bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o);
12474
12475 /**
12476  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
12477  */
12478 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
12479
12480 /**
12481  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
12482  * but with all dynamically-allocated buffers duplicated in new buffers.
12483  */
12484 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
12485
12486 /**
12487  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
12488  */
12489 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
12490
12491 /**
12492  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
12493  */
12494 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
12495
12496 /**
12497  * Checks if the given object is currently in the success state
12498  */
12499 bool CResult_TxCreationKeysErrorZ_is_ok(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR o);
12500
12501 /**
12502  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
12503  */
12504 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
12505
12506 /**
12507  * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
12508  * but with all dynamically-allocated buffers duplicated in new buffers.
12509  */
12510 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig);
12511
12512 /**
12513  * Constructs a new COption_u32Z containing a u32
12514  */
12515 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
12516
12517 /**
12518  * Constructs a new COption_u32Z containing nothing
12519  */
12520 struct LDKCOption_u32Z COption_u32Z_none(void);
12521
12522 /**
12523  * Frees any resources associated with the u32, if we are in the Some state
12524  */
12525 void COption_u32Z_free(struct LDKCOption_u32Z _res);
12526
12527 /**
12528  * Creates a new COption_u32Z which has the same data as `orig`
12529  * but with all dynamically-allocated buffers duplicated in new buffers.
12530  */
12531 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
12532
12533 /**
12534  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
12535  */
12536 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
12537
12538 /**
12539  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
12540  */
12541 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
12542
12543 /**
12544  * Checks if the given object is currently in the success state
12545  */
12546 bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o);
12547
12548 /**
12549  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
12550  */
12551 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
12552
12553 /**
12554  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
12555  * but with all dynamically-allocated buffers duplicated in new buffers.
12556  */
12557 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
12558
12559 /**
12560  * Constructs a new COption_NoneZ containing a
12561  */
12562 enum LDKCOption_NoneZ COption_NoneZ_some(void);
12563
12564 /**
12565  * Constructs a new COption_NoneZ containing nothing
12566  */
12567 enum LDKCOption_NoneZ COption_NoneZ_none(void);
12568
12569 /**
12570  * Frees any resources associated with the , if we are in the Some state
12571  */
12572 void COption_NoneZ_free(enum LDKCOption_NoneZ _res);
12573
12574 /**
12575  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
12576  */
12577 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
12578
12579 /**
12580  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
12581  */
12582 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
12583
12584 /**
12585  * Checks if the given object is currently in the success state
12586  */
12587 bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
12588
12589 /**
12590  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
12591  */
12592 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
12593
12594 /**
12595  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
12596  * but with all dynamically-allocated buffers duplicated in new buffers.
12597  */
12598 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
12599
12600 /**
12601  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
12602  */
12603 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
12604
12605 /**
12606  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
12607  */
12608 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
12609
12610 /**
12611  * Checks if the given object is currently in the success state
12612  */
12613 bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
12614
12615 /**
12616  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
12617  */
12618 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
12619
12620 /**
12621  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
12622  * but with all dynamically-allocated buffers duplicated in new buffers.
12623  */
12624 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
12625
12626 /**
12627  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12628  */
12629 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
12630
12631 /**
12632  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
12633  */
12634 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
12635
12636 /**
12637  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
12638  */
12639 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
12640
12641 /**
12642  * Checks if the given object is currently in the success state
12643  */
12644 bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
12645
12646 /**
12647  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
12648  */
12649 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
12650
12651 /**
12652  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
12653  * but with all dynamically-allocated buffers duplicated in new buffers.
12654  */
12655 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
12656
12657 /**
12658  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
12659  */
12660 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
12661
12662 /**
12663  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
12664  */
12665 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
12666
12667 /**
12668  * Checks if the given object is currently in the success state
12669  */
12670 bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
12671
12672 /**
12673  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
12674  */
12675 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
12676
12677 /**
12678  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
12679  * but with all dynamically-allocated buffers duplicated in new buffers.
12680  */
12681 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
12682
12683 /**
12684  * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
12685  */
12686 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
12687
12688 /**
12689  * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
12690  */
12691 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
12692
12693 /**
12694  * Checks if the given object is currently in the success state
12695  */
12696 bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o);
12697
12698 /**
12699  * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
12700  */
12701 void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
12702
12703 /**
12704  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
12705  */
12706 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
12707
12708 /**
12709  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
12710  */
12711 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
12712
12713 /**
12714  * Checks if the given object is currently in the success state
12715  */
12716 bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
12717
12718 /**
12719  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
12720  */
12721 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
12722
12723 /**
12724  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
12725  * but with all dynamically-allocated buffers duplicated in new buffers.
12726  */
12727 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
12728
12729 /**
12730  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
12731  */
12732 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
12733
12734 /**
12735  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
12736  */
12737 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
12738
12739 /**
12740  * Checks if the given object is currently in the success state
12741  */
12742 bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o);
12743
12744 /**
12745  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
12746  */
12747 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
12748
12749 /**
12750  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
12751  */
12752 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
12753
12754 /**
12755  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
12756  */
12757 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
12758
12759 /**
12760  * Checks if the given object is currently in the success state
12761  */
12762 bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o);
12763
12764 /**
12765  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
12766  */
12767 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
12768
12769 /**
12770  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
12771  * but with all dynamically-allocated buffers duplicated in new buffers.
12772  */
12773 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
12774
12775 /**
12776  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
12777  */
12778 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
12779
12780 /**
12781  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
12782  */
12783 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
12784
12785 /**
12786  * Checks if the given object is currently in the success state
12787  */
12788 bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o);
12789
12790 /**
12791  * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
12792  */
12793 void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
12794
12795 /**
12796  * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
12797  * but with all dynamically-allocated buffers duplicated in new buffers.
12798  */
12799 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
12800
12801 /**
12802  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
12803  */
12804 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
12805
12806 /**
12807  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
12808  */
12809 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
12810
12811 /**
12812  * Checks if the given object is currently in the success state
12813  */
12814 bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o);
12815
12816 /**
12817  * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
12818  */
12819 void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
12820
12821 /**
12822  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
12823  * but with all dynamically-allocated buffers duplicated in new buffers.
12824  */
12825 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig);
12826
12827 /**
12828  * Creates a new CResult_NoneErrorZ in the success state.
12829  */
12830 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
12831
12832 /**
12833  * Creates a new CResult_NoneErrorZ in the error state.
12834  */
12835 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
12836
12837 /**
12838  * Checks if the given object is currently in the success state
12839  */
12840 bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o);
12841
12842 /**
12843  * Frees any resources used by the CResult_NoneErrorZ.
12844  */
12845 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
12846
12847 /**
12848  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
12849  * but with all dynamically-allocated buffers duplicated in new buffers.
12850  */
12851 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
12852
12853 /**
12854  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
12855  */
12856 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
12857
12858 /**
12859  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
12860  */
12861 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
12862
12863 /**
12864  * Checks if the given object is currently in the success state
12865  */
12866 bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o);
12867
12868 /**
12869  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
12870  */
12871 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
12872
12873 /**
12874  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
12875  * but with all dynamically-allocated buffers duplicated in new buffers.
12876  */
12877 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
12878
12879 /**
12880  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12881  */
12882 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
12883
12884 /**
12885  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12886  */
12887 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
12888
12889 /**
12890  * Creates a new CResult_RouteDecodeErrorZ in the success state.
12891  */
12892 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
12893
12894 /**
12895  * Creates a new CResult_RouteDecodeErrorZ in the error state.
12896  */
12897 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
12898
12899 /**
12900  * Checks if the given object is currently in the success state
12901  */
12902 bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o);
12903
12904 /**
12905  * Frees any resources used by the CResult_RouteDecodeErrorZ.
12906  */
12907 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
12908
12909 /**
12910  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
12911  * but with all dynamically-allocated buffers duplicated in new buffers.
12912  */
12913 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
12914
12915 /**
12916  * Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
12917  */
12918 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o);
12919
12920 /**
12921  * Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
12922  */
12923 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e);
12924
12925 /**
12926  * Checks if the given object is currently in the success state
12927  */
12928 bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o);
12929
12930 /**
12931  * Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
12932  */
12933 void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res);
12934
12935 /**
12936  * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
12937  * but with all dynamically-allocated buffers duplicated in new buffers.
12938  */
12939 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig);
12940
12941 /**
12942  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12943  */
12944 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
12945
12946 /**
12947  * Constructs a new COption_u64Z containing a u64
12948  */
12949 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
12950
12951 /**
12952  * Constructs a new COption_u64Z containing nothing
12953  */
12954 struct LDKCOption_u64Z COption_u64Z_none(void);
12955
12956 /**
12957  * Frees any resources associated with the u64, if we are in the Some state
12958  */
12959 void COption_u64Z_free(struct LDKCOption_u64Z _res);
12960
12961 /**
12962  * Creates a new COption_u64Z which has the same data as `orig`
12963  * but with all dynamically-allocated buffers duplicated in new buffers.
12964  */
12965 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
12966
12967 /**
12968  * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
12969  */
12970 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o);
12971
12972 /**
12973  * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
12974  */
12975 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e);
12976
12977 /**
12978  * Checks if the given object is currently in the success state
12979  */
12980 bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o);
12981
12982 /**
12983  * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
12984  */
12985 void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res);
12986
12987 /**
12988  * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
12989  * but with all dynamically-allocated buffers duplicated in new buffers.
12990  */
12991 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig);
12992
12993 /**
12994  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12995  */
12996 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
12997
12998 /**
12999  * Creates a new CResult_RouteHintDecodeErrorZ in the success state.
13000  */
13001 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o);
13002
13003 /**
13004  * Creates a new CResult_RouteHintDecodeErrorZ in the error state.
13005  */
13006 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e);
13007
13008 /**
13009  * Checks if the given object is currently in the success state
13010  */
13011 bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o);
13012
13013 /**
13014  * Frees any resources used by the CResult_RouteHintDecodeErrorZ.
13015  */
13016 void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res);
13017
13018 /**
13019  * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
13020  * but with all dynamically-allocated buffers duplicated in new buffers.
13021  */
13022 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig);
13023
13024 /**
13025  * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
13026  */
13027 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o);
13028
13029 /**
13030  * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
13031  */
13032 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e);
13033
13034 /**
13035  * Checks if the given object is currently in the success state
13036  */
13037 bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o);
13038
13039 /**
13040  * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
13041  */
13042 void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res);
13043
13044 /**
13045  * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
13046  * but with all dynamically-allocated buffers duplicated in new buffers.
13047  */
13048 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
13049
13050 /**
13051  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13052  */
13053 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
13054
13055 /**
13056  * Creates a new CResult_RouteLightningErrorZ in the success state.
13057  */
13058 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
13059
13060 /**
13061  * Creates a new CResult_RouteLightningErrorZ in the error state.
13062  */
13063 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
13064
13065 /**
13066  * Checks if the given object is currently in the success state
13067  */
13068 bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o);
13069
13070 /**
13071  * Frees any resources used by the CResult_RouteLightningErrorZ.
13072  */
13073 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
13074
13075 /**
13076  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
13077  * but with all dynamically-allocated buffers duplicated in new buffers.
13078  */
13079 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
13080
13081 /**
13082  * Creates a new CResult_TxOutAccessErrorZ in the success state.
13083  */
13084 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
13085
13086 /**
13087  * Creates a new CResult_TxOutAccessErrorZ in the error state.
13088  */
13089 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
13090
13091 /**
13092  * Checks if the given object is currently in the success state
13093  */
13094 bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o);
13095
13096 /**
13097  * Frees any resources used by the CResult_TxOutAccessErrorZ.
13098  */
13099 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
13100
13101 /**
13102  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
13103  * but with all dynamically-allocated buffers duplicated in new buffers.
13104  */
13105 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
13106
13107 /**
13108  * Creates a new tuple which has the same data as `orig`
13109  * but with all dynamically-allocated buffers duplicated in new buffers.
13110  */
13111 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
13112
13113 /**
13114  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
13115  */
13116 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
13117
13118 /**
13119  * Frees any resources used by the C2Tuple_usizeTransactionZ.
13120  */
13121 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
13122
13123 /**
13124  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13125  */
13126 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
13127
13128 /**
13129  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13130  */
13131 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
13132
13133 /**
13134  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
13135  */
13136 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
13137
13138 /**
13139  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
13140  */
13141 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
13142
13143 /**
13144  * Checks if the given object is currently in the success state
13145  */
13146 bool CResult_NoneChannelMonitorUpdateErrZ_is_ok(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR o);
13147
13148 /**
13149  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
13150  */
13151 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
13152
13153 /**
13154  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
13155  * but with all dynamically-allocated buffers duplicated in new buffers.
13156  */
13157 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
13158
13159 /**
13160  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13161  */
13162 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
13163
13164 /**
13165  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
13166  */
13167 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
13168
13169 /**
13170  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
13171  */
13172 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
13173
13174 /**
13175  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
13176  */
13177 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
13178
13179 /**
13180  * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
13181  * but with all dynamically-allocated buffers duplicated in new buffers.
13182  */
13183 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
13184
13185 /**
13186  * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
13187  */
13188 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o);
13189
13190 /**
13191  * Constructs a new COption_ClosureReasonZ containing nothing
13192  */
13193 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void);
13194
13195 /**
13196  * Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
13197  */
13198 void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res);
13199
13200 /**
13201  * Creates a new COption_ClosureReasonZ which has the same data as `orig`
13202  * but with all dynamically-allocated buffers duplicated in new buffers.
13203  */
13204 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig);
13205
13206 /**
13207  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
13208  */
13209 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o);
13210
13211 /**
13212  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
13213  */
13214 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e);
13215
13216 /**
13217  * Checks if the given object is currently in the success state
13218  */
13219 bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o);
13220
13221 /**
13222  * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
13223  */
13224 void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res);
13225
13226 /**
13227  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
13228  * but with all dynamically-allocated buffers duplicated in new buffers.
13229  */
13230 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig);
13231
13232 /**
13233  * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
13234  */
13235 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
13236
13237 /**
13238  * Constructs a new COption_NetworkUpdateZ containing nothing
13239  */
13240 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
13241
13242 /**
13243  * Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
13244  */
13245 void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
13246
13247 /**
13248  * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
13249  * but with all dynamically-allocated buffers duplicated in new buffers.
13250  */
13251 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
13252
13253 /**
13254  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13255  */
13256 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
13257
13258 /**
13259  * Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
13260  */
13261 struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o);
13262
13263 /**
13264  * Constructs a new COption_EventZ containing nothing
13265  */
13266 struct LDKCOption_EventZ COption_EventZ_none(void);
13267
13268 /**
13269  * Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
13270  */
13271 void COption_EventZ_free(struct LDKCOption_EventZ _res);
13272
13273 /**
13274  * Creates a new COption_EventZ which has the same data as `orig`
13275  * but with all dynamically-allocated buffers duplicated in new buffers.
13276  */
13277 struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig);
13278
13279 /**
13280  * Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
13281  */
13282 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o);
13283
13284 /**
13285  * Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
13286  */
13287 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e);
13288
13289 /**
13290  * Checks if the given object is currently in the success state
13291  */
13292 bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o);
13293
13294 /**
13295  * Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
13296  */
13297 void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res);
13298
13299 /**
13300  * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
13301  * but with all dynamically-allocated buffers duplicated in new buffers.
13302  */
13303 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig);
13304
13305 /**
13306  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13307  */
13308 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
13309
13310 /**
13311  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
13312  */
13313 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o);
13314
13315 /**
13316  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
13317  */
13318 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e);
13319
13320 /**
13321  * Checks if the given object is currently in the success state
13322  */
13323 bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o);
13324
13325 /**
13326  * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
13327  */
13328 void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res);
13329
13330 /**
13331  * Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
13332  */
13333 struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_ok(struct LDKScoringParameters o);
13334
13335 /**
13336  * Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
13337  */
13338 struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_err(struct LDKDecodeError e);
13339
13340 /**
13341  * Checks if the given object is currently in the success state
13342  */
13343 bool CResult_ScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR o);
13344
13345 /**
13346  * Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
13347  */
13348 void CResult_ScoringParametersDecodeErrorZ_free(struct LDKCResult_ScoringParametersDecodeErrorZ _res);
13349
13350 /**
13351  * Creates a new CResult_ScorerDecodeErrorZ in the success state.
13352  */
13353 struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_ok(struct LDKScorer o);
13354
13355 /**
13356  * Creates a new CResult_ScorerDecodeErrorZ in the error state.
13357  */
13358 struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_err(struct LDKDecodeError e);
13359
13360 /**
13361  * Checks if the given object is currently in the success state
13362  */
13363 bool CResult_ScorerDecodeErrorZ_is_ok(const struct LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR o);
13364
13365 /**
13366  * Frees any resources used by the CResult_ScorerDecodeErrorZ.
13367  */
13368 void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res);
13369
13370 /**
13371  * Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the success state.
13372  */
13373 struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(struct LDKProbabilisticScoringParameters o);
13374
13375 /**
13376  * Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the error state.
13377  */
13378 struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ CResult_ProbabilisticScoringParametersDecodeErrorZ_err(struct LDKDecodeError e);
13379
13380 /**
13381  * Checks if the given object is currently in the success state
13382  */
13383 bool CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR o);
13384
13385 /**
13386  * Frees any resources used by the CResult_ProbabilisticScoringParametersDecodeErrorZ.
13387  */
13388 void CResult_ProbabilisticScoringParametersDecodeErrorZ_free(struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ _res);
13389
13390 /**
13391  * Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ which has the same data as `orig`
13392  * but with all dynamically-allocated buffers duplicated in new buffers.
13393  */
13394 struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(const struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR orig);
13395
13396 /**
13397  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
13398  */
13399 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o);
13400
13401 /**
13402  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
13403  */
13404 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e);
13405
13406 /**
13407  * Checks if the given object is currently in the success state
13408  */
13409 bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o);
13410
13411 /**
13412  * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
13413  */
13414 void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res);
13415
13416 /**
13417  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
13418  */
13419 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
13420
13421 /**
13422  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
13423  */
13424 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13425
13426 /**
13427  * Checks if the given object is currently in the success state
13428  */
13429 bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o);
13430
13431 /**
13432  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
13433  */
13434 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
13435
13436 /**
13437  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
13438  */
13439 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
13440
13441 /**
13442  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
13443  */
13444 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13445
13446 /**
13447  * Checks if the given object is currently in the success state
13448  */
13449 bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o);
13450
13451 /**
13452  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
13453  */
13454 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
13455
13456 /**
13457  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
13458  */
13459 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
13460
13461 /**
13462  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
13463  */
13464 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13465
13466 /**
13467  * Checks if the given object is currently in the success state
13468  */
13469 bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o);
13470
13471 /**
13472  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
13473  */
13474 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
13475
13476 /**
13477  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
13478  */
13479 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
13480
13481 /**
13482  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
13483  */
13484 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13485
13486 /**
13487  * Checks if the given object is currently in the success state
13488  */
13489 bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o);
13490
13491 /**
13492  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
13493  */
13494 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
13495
13496 /**
13497  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
13498  */
13499 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o);
13500
13501 /**
13502  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
13503  */
13504 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13505
13506 /**
13507  * Checks if the given object is currently in the success state
13508  */
13509 bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o);
13510
13511 /**
13512  * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
13513  */
13514 void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res);
13515
13516 /**
13517  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
13518  */
13519 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
13520
13521 /**
13522  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
13523  */
13524 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
13525
13526 /**
13527  * Checks if the given object is currently in the success state
13528  */
13529 bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
13530
13531 /**
13532  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
13533  */
13534 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
13535
13536 /**
13537  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
13538  * but with all dynamically-allocated buffers duplicated in new buffers.
13539  */
13540 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
13541
13542 /**
13543  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
13544  */
13545 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
13546
13547 /**
13548  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
13549  */
13550 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
13551
13552 /**
13553  * Checks if the given object is currently in the success state
13554  */
13555 bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
13556
13557 /**
13558  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
13559  */
13560 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
13561
13562 /**
13563  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
13564  * but with all dynamically-allocated buffers duplicated in new buffers.
13565  */
13566 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
13567
13568 /**
13569  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
13570  */
13571 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
13572
13573 /**
13574  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
13575  */
13576 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
13577
13578 /**
13579  * Checks if the given object is currently in the success state
13580  */
13581 bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
13582
13583 /**
13584  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
13585  */
13586 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
13587
13588 /**
13589  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
13590  * but with all dynamically-allocated buffers duplicated in new buffers.
13591  */
13592 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
13593
13594 /**
13595  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13596  */
13597 void CVec_PaymentPreimageZ_free(struct LDKCVec_PaymentPreimageZ _res);
13598
13599 /**
13600  * Creates a new tuple which has the same data as `orig`
13601  * but with all dynamically-allocated buffers duplicated in new buffers.
13602  */
13603 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
13604
13605 /**
13606  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
13607  */
13608 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
13609
13610 /**
13611  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
13612  */
13613 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
13614
13615 /**
13616  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
13617  */
13618 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
13619
13620 /**
13621  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
13622  */
13623 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
13624
13625 /**
13626  * Checks if the given object is currently in the success state
13627  */
13628 bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o);
13629
13630 /**
13631  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
13632  */
13633 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
13634
13635 /**
13636  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
13637  * but with all dynamically-allocated buffers duplicated in new buffers.
13638  */
13639 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
13640
13641 /**
13642  * Creates a new CResult_SignatureNoneZ in the success state.
13643  */
13644 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
13645
13646 /**
13647  * Creates a new CResult_SignatureNoneZ in the error state.
13648  */
13649 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
13650
13651 /**
13652  * Checks if the given object is currently in the success state
13653  */
13654 bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o);
13655
13656 /**
13657  * Frees any resources used by the CResult_SignatureNoneZ.
13658  */
13659 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
13660
13661 /**
13662  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
13663  * but with all dynamically-allocated buffers duplicated in new buffers.
13664  */
13665 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
13666
13667 /**
13668  * Creates a new tuple which has the same data as `orig`
13669  * but with all dynamically-allocated buffers duplicated in new buffers.
13670  */
13671 struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_clone(const struct LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR orig);
13672
13673 /**
13674  * Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
13675  */
13676 struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_new(struct LDKSignature a, struct LDKSignature b);
13677
13678 /**
13679  * Frees any resources used by the C2Tuple_SignatureSignatureZ.
13680  */
13681 void C2Tuple_SignatureSignatureZ_free(struct LDKC2Tuple_SignatureSignatureZ _res);
13682
13683 /**
13684  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
13685  */
13686 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_ok(struct LDKC2Tuple_SignatureSignatureZ o);
13687
13688 /**
13689  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
13690  */
13691 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_err(void);
13692
13693 /**
13694  * Checks if the given object is currently in the success state
13695  */
13696 bool CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR o);
13697
13698 /**
13699  * Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
13700  */
13701 void CResult_C2Tuple_SignatureSignatureZNoneZ_free(struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res);
13702
13703 /**
13704  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
13705  * but with all dynamically-allocated buffers duplicated in new buffers.
13706  */
13707 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR orig);
13708
13709 /**
13710  * Creates a new CResult_SecretKeyNoneZ in the success state.
13711  */
13712 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_ok(struct LDKSecretKey o);
13713
13714 /**
13715  * Creates a new CResult_SecretKeyNoneZ in the error state.
13716  */
13717 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_err(void);
13718
13719 /**
13720  * Checks if the given object is currently in the success state
13721  */
13722 bool CResult_SecretKeyNoneZ_is_ok(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR o);
13723
13724 /**
13725  * Frees any resources used by the CResult_SecretKeyNoneZ.
13726  */
13727 void CResult_SecretKeyNoneZ_free(struct LDKCResult_SecretKeyNoneZ _res);
13728
13729 /**
13730  * Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
13731  * but with all dynamically-allocated buffers duplicated in new buffers.
13732  */
13733 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_clone(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR orig);
13734
13735 /**
13736  * Creates a new CResult_SignDecodeErrorZ in the success state.
13737  */
13738 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
13739
13740 /**
13741  * Creates a new CResult_SignDecodeErrorZ in the error state.
13742  */
13743 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
13744
13745 /**
13746  * Checks if the given object is currently in the success state
13747  */
13748 bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o);
13749
13750 /**
13751  * Frees any resources used by the CResult_SignDecodeErrorZ.
13752  */
13753 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
13754
13755 /**
13756  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
13757  * but with all dynamically-allocated buffers duplicated in new buffers.
13758  */
13759 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
13760
13761 /**
13762  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13763  */
13764 void CVec_u5Z_free(struct LDKCVec_u5Z _res);
13765
13766 /**
13767  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
13768  */
13769 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
13770
13771 /**
13772  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
13773  */
13774 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
13775
13776 /**
13777  * Checks if the given object is currently in the success state
13778  */
13779 bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o);
13780
13781 /**
13782  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
13783  */
13784 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
13785
13786 /**
13787  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
13788  * but with all dynamically-allocated buffers duplicated in new buffers.
13789  */
13790 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
13791
13792 /**
13793  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13794  */
13795 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
13796
13797 /**
13798  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13799  */
13800 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
13801
13802 /**
13803  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
13804  */
13805 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
13806
13807 /**
13808  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
13809  */
13810 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
13811
13812 /**
13813  * Checks if the given object is currently in the success state
13814  */
13815 bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o);
13816
13817 /**
13818  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
13819  */
13820 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
13821
13822 /**
13823  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
13824  * but with all dynamically-allocated buffers duplicated in new buffers.
13825  */
13826 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
13827
13828 /**
13829  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
13830  */
13831 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
13832
13833 /**
13834  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
13835  */
13836 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
13837
13838 /**
13839  * Checks if the given object is currently in the success state
13840  */
13841 bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o);
13842
13843 /**
13844  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
13845  */
13846 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
13847
13848 /**
13849  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
13850  * but with all dynamically-allocated buffers duplicated in new buffers.
13851  */
13852 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
13853
13854 /**
13855  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13856  */
13857 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
13858
13859 /**
13860  * Creates a new CResult_TransactionNoneZ in the success state.
13861  */
13862 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
13863
13864 /**
13865  * Creates a new CResult_TransactionNoneZ in the error state.
13866  */
13867 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
13868
13869 /**
13870  * Checks if the given object is currently in the success state
13871  */
13872 bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o);
13873
13874 /**
13875  * Frees any resources used by the CResult_TransactionNoneZ.
13876  */
13877 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
13878
13879 /**
13880  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
13881  * but with all dynamically-allocated buffers duplicated in new buffers.
13882  */
13883 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
13884
13885 /**
13886  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
13887  */
13888 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
13889
13890 /**
13891  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
13892  */
13893 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
13894
13895 /**
13896  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13897  */
13898 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
13899
13900 /**
13901  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
13902  */
13903 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
13904
13905 /**
13906  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
13907  */
13908 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
13909
13910 /**
13911  * Checks if the given object is currently in the success state
13912  */
13913 bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o);
13914
13915 /**
13916  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
13917  */
13918 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
13919
13920 /**
13921  * Constructs a new COption_u16Z containing a u16
13922  */
13923 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
13924
13925 /**
13926  * Constructs a new COption_u16Z containing nothing
13927  */
13928 struct LDKCOption_u16Z COption_u16Z_none(void);
13929
13930 /**
13931  * Frees any resources associated with the u16, if we are in the Some state
13932  */
13933 void COption_u16Z_free(struct LDKCOption_u16Z _res);
13934
13935 /**
13936  * Creates a new COption_u16Z which has the same data as `orig`
13937  * but with all dynamically-allocated buffers duplicated in new buffers.
13938  */
13939 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
13940
13941 /**
13942  * Creates a new CResult_NoneAPIErrorZ in the success state.
13943  */
13944 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
13945
13946 /**
13947  * Creates a new CResult_NoneAPIErrorZ in the error state.
13948  */
13949 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
13950
13951 /**
13952  * Checks if the given object is currently in the success state
13953  */
13954 bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o);
13955
13956 /**
13957  * Frees any resources used by the CResult_NoneAPIErrorZ.
13958  */
13959 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
13960
13961 /**
13962  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
13963  * but with all dynamically-allocated buffers duplicated in new buffers.
13964  */
13965 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
13966
13967 /**
13968  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13969  */
13970 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
13971
13972 /**
13973  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13974  */
13975 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
13976
13977 /**
13978  * Creates a new CResult__u832APIErrorZ in the success state.
13979  */
13980 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o);
13981
13982 /**
13983  * Creates a new CResult__u832APIErrorZ in the error state.
13984  */
13985 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
13986
13987 /**
13988  * Checks if the given object is currently in the success state
13989  */
13990 bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o);
13991
13992 /**
13993  * Frees any resources used by the CResult__u832APIErrorZ.
13994  */
13995 void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res);
13996
13997 /**
13998  * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
13999  * but with all dynamically-allocated buffers duplicated in new buffers.
14000  */
14001 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig);
14002
14003 /**
14004  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
14005  */
14006 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
14007
14008 /**
14009  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
14010  */
14011 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
14012
14013 /**
14014  * Checks if the given object is currently in the success state
14015  */
14016 bool CResult_PaymentIdPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR o);
14017
14018 /**
14019  * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
14020  */
14021 void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res);
14022
14023 /**
14024  * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
14025  * but with all dynamically-allocated buffers duplicated in new buffers.
14026  */
14027 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig);
14028
14029 /**
14030  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
14031  */
14032 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
14033
14034 /**
14035  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
14036  */
14037 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
14038
14039 /**
14040  * Checks if the given object is currently in the success state
14041  */
14042 bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o);
14043
14044 /**
14045  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
14046  */
14047 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
14048
14049 /**
14050  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
14051  * but with all dynamically-allocated buffers duplicated in new buffers.
14052  */
14053 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
14054
14055 /**
14056  * Creates a new tuple which has the same data as `orig`
14057  * but with all dynamically-allocated buffers duplicated in new buffers.
14058  */
14059 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig);
14060
14061 /**
14062  * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
14063  */
14064 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
14065
14066 /**
14067  * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
14068  */
14069 void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res);
14070
14071 /**
14072  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
14073  */
14074 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o);
14075
14076 /**
14077  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
14078  */
14079 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
14080
14081 /**
14082  * Checks if the given object is currently in the success state
14083  */
14084 bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o);
14085
14086 /**
14087  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
14088  */
14089 void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res);
14090
14091 /**
14092  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
14093  * but with all dynamically-allocated buffers duplicated in new buffers.
14094  */
14095 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig);
14096
14097 /**
14098  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14099  */
14100 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
14101
14102 /**
14103  * Creates a new tuple which has the same data as `orig`
14104  * but with all dynamically-allocated buffers duplicated in new buffers.
14105  */
14106 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
14107
14108 /**
14109  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
14110  */
14111 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
14112
14113 /**
14114  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
14115  */
14116 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
14117
14118 /**
14119  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
14120  */
14121 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
14122
14123 /**
14124  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
14125  */
14126 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void);
14127
14128 /**
14129  * Checks if the given object is currently in the success state
14130  */
14131 bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o);
14132
14133 /**
14134  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
14135  */
14136 void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res);
14137
14138 /**
14139  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
14140  * but with all dynamically-allocated buffers duplicated in new buffers.
14141  */
14142 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig);
14143
14144 /**
14145  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
14146  */
14147 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
14148
14149 /**
14150  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
14151  */
14152 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e);
14153
14154 /**
14155  * Checks if the given object is currently in the success state
14156  */
14157 bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o);
14158
14159 /**
14160  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
14161  */
14162 void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res);
14163
14164 /**
14165  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
14166  * but with all dynamically-allocated buffers duplicated in new buffers.
14167  */
14168 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig);
14169
14170 /**
14171  * Creates a new CResult_PaymentSecretNoneZ in the success state.
14172  */
14173 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
14174
14175 /**
14176  * Creates a new CResult_PaymentSecretNoneZ in the error state.
14177  */
14178 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void);
14179
14180 /**
14181  * Checks if the given object is currently in the success state
14182  */
14183 bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o);
14184
14185 /**
14186  * Frees any resources used by the CResult_PaymentSecretNoneZ.
14187  */
14188 void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res);
14189
14190 /**
14191  * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
14192  * but with all dynamically-allocated buffers duplicated in new buffers.
14193  */
14194 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig);
14195
14196 /**
14197  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
14198  */
14199 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
14200
14201 /**
14202  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
14203  */
14204 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
14205
14206 /**
14207  * Checks if the given object is currently in the success state
14208  */
14209 bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o);
14210
14211 /**
14212  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
14213  */
14214 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
14215
14216 /**
14217  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
14218  * but with all dynamically-allocated buffers duplicated in new buffers.
14219  */
14220 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
14221
14222 /**
14223  * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
14224  */
14225 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
14226
14227 /**
14228  * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
14229  */
14230 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e);
14231
14232 /**
14233  * Checks if the given object is currently in the success state
14234  */
14235 bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o);
14236
14237 /**
14238  * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
14239  */
14240 void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res);
14241
14242 /**
14243  * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
14244  * but with all dynamically-allocated buffers duplicated in new buffers.
14245  */
14246 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig);
14247
14248 /**
14249  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
14250  */
14251 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o);
14252
14253 /**
14254  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
14255  */
14256 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e);
14257
14258 /**
14259  * Checks if the given object is currently in the success state
14260  */
14261 bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o);
14262
14263 /**
14264  * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
14265  */
14266 void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res);
14267
14268 /**
14269  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
14270  * but with all dynamically-allocated buffers duplicated in new buffers.
14271  */
14272 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig);
14273
14274 /**
14275  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
14276  */
14277 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o);
14278
14279 /**
14280  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
14281  */
14282 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e);
14283
14284 /**
14285  * Checks if the given object is currently in the success state
14286  */
14287 bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o);
14288
14289 /**
14290  * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
14291  */
14292 void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res);
14293
14294 /**
14295  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
14296  * but with all dynamically-allocated buffers duplicated in new buffers.
14297  */
14298 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig);
14299
14300 /**
14301  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
14302  */
14303 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o);
14304
14305 /**
14306  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
14307  */
14308 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e);
14309
14310 /**
14311  * Checks if the given object is currently in the success state
14312  */
14313 bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o);
14314
14315 /**
14316  * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
14317  */
14318 void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res);
14319
14320 /**
14321  * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
14322  * but with all dynamically-allocated buffers duplicated in new buffers.
14323  */
14324 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig);
14325
14326 /**
14327  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
14328  */
14329 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o);
14330
14331 /**
14332  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
14333  */
14334 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e);
14335
14336 /**
14337  * Checks if the given object is currently in the success state
14338  */
14339 bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o);
14340
14341 /**
14342  * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
14343  */
14344 void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res);
14345
14346 /**
14347  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14348  */
14349 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
14350
14351 /**
14352  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
14353  */
14354 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
14355
14356 /**
14357  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
14358  */
14359 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
14360
14361 /**
14362  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
14363  */
14364 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
14365
14366 /**
14367  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
14368  */
14369 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
14370
14371 /**
14372  * Checks if the given object is currently in the success state
14373  */
14374 bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o);
14375
14376 /**
14377  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
14378  */
14379 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
14380
14381 /**
14382  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
14383  */
14384 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
14385
14386 /**
14387  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
14388  */
14389 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
14390
14391 /**
14392  * Checks if the given object is currently in the success state
14393  */
14394 bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o);
14395
14396 /**
14397  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
14398  */
14399 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
14400
14401 /**
14402  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
14403  * but with all dynamically-allocated buffers duplicated in new buffers.
14404  */
14405 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
14406
14407 /**
14408  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
14409  */
14410 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
14411
14412 /**
14413  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
14414  */
14415 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
14416
14417 /**
14418  * Checks if the given object is currently in the success state
14419  */
14420 bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o);
14421
14422 /**
14423  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
14424  */
14425 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
14426
14427 /**
14428  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
14429  * but with all dynamically-allocated buffers duplicated in new buffers.
14430  */
14431 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
14432
14433 /**
14434  * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
14435  */
14436 struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
14437
14438 /**
14439  * Constructs a new COption_TypeZ containing nothing
14440  */
14441 struct LDKCOption_TypeZ COption_TypeZ_none(void);
14442
14443 /**
14444  * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
14445  */
14446 void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
14447
14448 /**
14449  * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
14450  */
14451 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
14452
14453 /**
14454  * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
14455  */
14456 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
14457
14458 /**
14459  * Checks if the given object is currently in the success state
14460  */
14461 bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o);
14462
14463 /**
14464  * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
14465  */
14466 void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
14467
14468 /**
14469  * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
14470  */
14471 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
14472
14473 /**
14474  * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
14475  */
14476 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
14477
14478 /**
14479  * Checks if the given object is currently in the success state
14480  */
14481 bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o);
14482
14483 /**
14484  * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
14485  */
14486 void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
14487
14488 /**
14489  * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
14490  * but with all dynamically-allocated buffers duplicated in new buffers.
14491  */
14492 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
14493
14494 /**
14495  * Creates a new CResult_SiPrefixNoneZ in the success state.
14496  */
14497 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o);
14498
14499 /**
14500  * Creates a new CResult_SiPrefixNoneZ in the error state.
14501  */
14502 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void);
14503
14504 /**
14505  * Checks if the given object is currently in the success state
14506  */
14507 bool CResult_SiPrefixNoneZ_is_ok(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR o);
14508
14509 /**
14510  * Frees any resources used by the CResult_SiPrefixNoneZ.
14511  */
14512 void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res);
14513
14514 /**
14515  * Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
14516  * but with all dynamically-allocated buffers duplicated in new buffers.
14517  */
14518 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig);
14519
14520 /**
14521  * Creates a new CResult_InvoiceNoneZ in the success state.
14522  */
14523 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o);
14524
14525 /**
14526  * Creates a new CResult_InvoiceNoneZ in the error state.
14527  */
14528 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void);
14529
14530 /**
14531  * Checks if the given object is currently in the success state
14532  */
14533 bool CResult_InvoiceNoneZ_is_ok(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR o);
14534
14535 /**
14536  * Frees any resources used by the CResult_InvoiceNoneZ.
14537  */
14538 void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res);
14539
14540 /**
14541  * Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
14542  * but with all dynamically-allocated buffers duplicated in new buffers.
14543  */
14544 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig);
14545
14546 /**
14547  * Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
14548  */
14549 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o);
14550
14551 /**
14552  * Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
14553  */
14554 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void);
14555
14556 /**
14557  * Checks if the given object is currently in the success state
14558  */
14559 bool CResult_SignedRawInvoiceNoneZ_is_ok(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR o);
14560
14561 /**
14562  * Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
14563  */
14564 void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res);
14565
14566 /**
14567  * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
14568  * but with all dynamically-allocated buffers duplicated in new buffers.
14569  */
14570 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig);
14571
14572 /**
14573  * Creates a new tuple which has the same data as `orig`
14574  * but with all dynamically-allocated buffers duplicated in new buffers.
14575  */
14576 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
14577
14578 /**
14579  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
14580  */
14581 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
14582
14583 /**
14584  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
14585  */
14586 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
14587
14588 /**
14589  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
14590  */
14591 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
14592
14593 /**
14594  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
14595  */
14596 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
14597
14598 /**
14599  * Checks if the given object is currently in the success state
14600  */
14601 bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o);
14602
14603 /**
14604  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
14605  */
14606 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
14607
14608 /**
14609  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
14610  * but with all dynamically-allocated buffers duplicated in new buffers.
14611  */
14612 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
14613
14614 /**
14615  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14616  */
14617 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
14618
14619 /**
14620  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
14621  */
14622 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
14623
14624 /**
14625  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
14626  */
14627 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
14628
14629 /**
14630  * Checks if the given object is currently in the success state
14631  */
14632 bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o);
14633
14634 /**
14635  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
14636  */
14637 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
14638
14639 /**
14640  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
14641  * but with all dynamically-allocated buffers duplicated in new buffers.
14642  */
14643 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
14644
14645 /**
14646  * Creates a new CResult_NoneSemanticErrorZ in the success state.
14647  */
14648 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
14649
14650 /**
14651  * Creates a new CResult_NoneSemanticErrorZ in the error state.
14652  */
14653 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
14654
14655 /**
14656  * Checks if the given object is currently in the success state
14657  */
14658 bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o);
14659
14660 /**
14661  * Frees any resources used by the CResult_NoneSemanticErrorZ.
14662  */
14663 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
14664
14665 /**
14666  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
14667  * but with all dynamically-allocated buffers duplicated in new buffers.
14668  */
14669 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
14670
14671 /**
14672  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
14673  */
14674 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
14675
14676 /**
14677  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
14678  */
14679 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
14680
14681 /**
14682  * Checks if the given object is currently in the success state
14683  */
14684 bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o);
14685
14686 /**
14687  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
14688  */
14689 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
14690
14691 /**
14692  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
14693  * but with all dynamically-allocated buffers duplicated in new buffers.
14694  */
14695 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
14696
14697 /**
14698  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
14699  */
14700 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
14701
14702 /**
14703  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
14704  */
14705 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
14706
14707 /**
14708  * Checks if the given object is currently in the success state
14709  */
14710 bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o);
14711
14712 /**
14713  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
14714  */
14715 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
14716
14717 /**
14718  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
14719  * but with all dynamically-allocated buffers duplicated in new buffers.
14720  */
14721 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
14722
14723 /**
14724  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
14725  */
14726 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
14727
14728 /**
14729  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
14730  */
14731 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
14732
14733 /**
14734  * Checks if the given object is currently in the success state
14735  */
14736 bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o);
14737
14738 /**
14739  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
14740  */
14741 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
14742
14743 /**
14744  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
14745  * but with all dynamically-allocated buffers duplicated in new buffers.
14746  */
14747 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
14748
14749 /**
14750  * Creates a new CResult_StringErrorZ in the success state.
14751  */
14752 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
14753
14754 /**
14755  * Creates a new CResult_StringErrorZ in the error state.
14756  */
14757 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
14758
14759 /**
14760  * Checks if the given object is currently in the success state
14761  */
14762 bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o);
14763
14764 /**
14765  * Frees any resources used by the CResult_StringErrorZ.
14766  */
14767 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
14768
14769 /**
14770  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
14771  */
14772 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
14773
14774 /**
14775  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
14776  */
14777 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
14778
14779 /**
14780  * Checks if the given object is currently in the success state
14781  */
14782 bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o);
14783
14784 /**
14785  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
14786  */
14787 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
14788
14789 /**
14790  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
14791  * but with all dynamically-allocated buffers duplicated in new buffers.
14792  */
14793 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
14794
14795 /**
14796  * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
14797  */
14798 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o);
14799
14800 /**
14801  * Constructs a new COption_MonitorEventZ containing nothing
14802  */
14803 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void);
14804
14805 /**
14806  * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
14807  */
14808 void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res);
14809
14810 /**
14811  * Creates a new COption_MonitorEventZ which has the same data as `orig`
14812  * but with all dynamically-allocated buffers duplicated in new buffers.
14813  */
14814 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig);
14815
14816 /**
14817  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
14818  */
14819 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o);
14820
14821 /**
14822  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
14823  */
14824 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e);
14825
14826 /**
14827  * Checks if the given object is currently in the success state
14828  */
14829 bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o);
14830
14831 /**
14832  * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
14833  */
14834 void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res);
14835
14836 /**
14837  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
14838  * but with all dynamically-allocated buffers duplicated in new buffers.
14839  */
14840 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig);
14841
14842 /**
14843  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
14844  */
14845 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
14846
14847 /**
14848  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
14849  */
14850 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
14851
14852 /**
14853  * Checks if the given object is currently in the success state
14854  */
14855 bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o);
14856
14857 /**
14858  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
14859  */
14860 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
14861
14862 /**
14863  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
14864  * but with all dynamically-allocated buffers duplicated in new buffers.
14865  */
14866 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
14867
14868 /**
14869  * Creates a new tuple which has the same data as `orig`
14870  * but with all dynamically-allocated buffers duplicated in new buffers.
14871  */
14872 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
14873
14874 /**
14875  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
14876  */
14877 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
14878
14879 /**
14880  * Frees any resources used by the C2Tuple_OutPointScriptZ.
14881  */
14882 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
14883
14884 /**
14885  * Creates a new tuple which has the same data as `orig`
14886  * but with all dynamically-allocated buffers duplicated in new buffers.
14887  */
14888 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
14889
14890 /**
14891  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
14892  */
14893 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
14894
14895 /**
14896  * Frees any resources used by the C2Tuple_u32ScriptZ.
14897  */
14898 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
14899
14900 /**
14901  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14902  */
14903 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
14904
14905 /**
14906  * Creates a new tuple which has the same data as `orig`
14907  * but with all dynamically-allocated buffers duplicated in new buffers.
14908  */
14909 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
14910
14911 /**
14912  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
14913  */
14914 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
14915
14916 /**
14917  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
14918  */
14919 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
14920
14921 /**
14922  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14923  */
14924 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
14925
14926 /**
14927  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14928  */
14929 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
14930
14931 /**
14932  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14933  */
14934 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
14935
14936 /**
14937  * Creates a new tuple which has the same data as `orig`
14938  * but with all dynamically-allocated buffers duplicated in new buffers.
14939  */
14940 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
14941
14942 /**
14943  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
14944  */
14945 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
14946
14947 /**
14948  * Frees any resources used by the C2Tuple_u32TxOutZ.
14949  */
14950 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
14951
14952 /**
14953  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14954  */
14955 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
14956
14957 /**
14958  * Creates a new tuple which has the same data as `orig`
14959  * but with all dynamically-allocated buffers duplicated in new buffers.
14960  */
14961 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
14962
14963 /**
14964  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
14965  */
14966 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
14967
14968 /**
14969  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
14970  */
14971 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
14972
14973 /**
14974  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14975  */
14976 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
14977
14978 /**
14979  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14980  */
14981 void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
14982
14983 /**
14984  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
14985  */
14986 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
14987
14988 /**
14989  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
14990  */
14991 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
14992
14993 /**
14994  * Checks if the given object is currently in the success state
14995  */
14996 bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o);
14997
14998 /**
14999  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
15000  */
15001 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
15002
15003 /**
15004  * Creates a new CResult_NoneLightningErrorZ in the success state.
15005  */
15006 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
15007
15008 /**
15009  * Creates a new CResult_NoneLightningErrorZ in the error state.
15010  */
15011 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
15012
15013 /**
15014  * Checks if the given object is currently in the success state
15015  */
15016 bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o);
15017
15018 /**
15019  * Frees any resources used by the CResult_NoneLightningErrorZ.
15020  */
15021 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
15022
15023 /**
15024  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
15025  * but with all dynamically-allocated buffers duplicated in new buffers.
15026  */
15027 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
15028
15029 /**
15030  * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
15031  */
15032 struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
15033
15034 /**
15035  * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
15036  */
15037 void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
15038
15039 /**
15040  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15041  */
15042 void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
15043
15044 /**
15045  * Creates a new CResult_boolLightningErrorZ in the success state.
15046  */
15047 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
15048
15049 /**
15050  * Creates a new CResult_boolLightningErrorZ in the error state.
15051  */
15052 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
15053
15054 /**
15055  * Checks if the given object is currently in the success state
15056  */
15057 bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o);
15058
15059 /**
15060  * Frees any resources used by the CResult_boolLightningErrorZ.
15061  */
15062 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
15063
15064 /**
15065  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
15066  * but with all dynamically-allocated buffers duplicated in new buffers.
15067  */
15068 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
15069
15070 /**
15071  * Creates a new tuple which has the same data as `orig`
15072  * but with all dynamically-allocated buffers duplicated in new buffers.
15073  */
15074 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
15075
15076 /**
15077  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
15078  */
15079 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
15080
15081 /**
15082  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
15083  */
15084 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
15085
15086 /**
15087  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15088  */
15089 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
15090
15091 /**
15092  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15093  */
15094 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
15095
15096 /**
15097  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15098  */
15099 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
15100
15101 /**
15102  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
15103  */
15104 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
15105
15106 /**
15107  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
15108  */
15109 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
15110
15111 /**
15112  * Checks if the given object is currently in the success state
15113  */
15114 bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o);
15115
15116 /**
15117  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
15118  */
15119 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
15120
15121 /**
15122  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
15123  * but with all dynamically-allocated buffers duplicated in new buffers.
15124  */
15125 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
15126
15127 /**
15128  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
15129  */
15130 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
15131
15132 /**
15133  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
15134  */
15135 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
15136
15137 /**
15138  * Checks if the given object is currently in the success state
15139  */
15140 bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o);
15141
15142 /**
15143  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
15144  */
15145 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
15146
15147 /**
15148  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
15149  * but with all dynamically-allocated buffers duplicated in new buffers.
15150  */
15151 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
15152
15153 /**
15154  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
15155  */
15156 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
15157
15158 /**
15159  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
15160  */
15161 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
15162
15163 /**
15164  * Checks if the given object is currently in the success state
15165  */
15166 bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o);
15167
15168 /**
15169  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
15170  */
15171 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
15172
15173 /**
15174  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
15175  * but with all dynamically-allocated buffers duplicated in new buffers.
15176  */
15177 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
15178
15179 /**
15180  * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
15181  */
15182 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
15183
15184 /**
15185  * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
15186  */
15187 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
15188
15189 /**
15190  * Checks if the given object is currently in the success state
15191  */
15192 bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o);
15193
15194 /**
15195  * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
15196  */
15197 void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
15198
15199 /**
15200  * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
15201  * but with all dynamically-allocated buffers duplicated in new buffers.
15202  */
15203 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
15204
15205 /**
15206  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
15207  */
15208 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o);
15209
15210 /**
15211  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
15212  */
15213 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e);
15214
15215 /**
15216  * Checks if the given object is currently in the success state
15217  */
15218 bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o);
15219
15220 /**
15221  * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
15222  */
15223 void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res);
15224
15225 /**
15226  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
15227  * but with all dynamically-allocated buffers duplicated in new buffers.
15228  */
15229 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig);
15230
15231 /**
15232  * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
15233  */
15234 struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o);
15235
15236 /**
15237  * Constructs a new COption_AccessZ containing nothing
15238  */
15239 struct LDKCOption_AccessZ COption_AccessZ_none(void);
15240
15241 /**
15242  * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
15243  */
15244 void COption_AccessZ_free(struct LDKCOption_AccessZ _res);
15245
15246 /**
15247  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
15248  */
15249 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o);
15250
15251 /**
15252  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
15253  */
15254 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e);
15255
15256 /**
15257  * Checks if the given object is currently in the success state
15258  */
15259 bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o);
15260
15261 /**
15262  * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
15263  */
15264 void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res);
15265
15266 /**
15267  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
15268  * but with all dynamically-allocated buffers duplicated in new buffers.
15269  */
15270 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig);
15271
15272 /**
15273  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
15274  */
15275 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
15276
15277 /**
15278  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
15279  */
15280 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
15281
15282 /**
15283  * Checks if the given object is currently in the success state
15284  */
15285 bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o);
15286
15287 /**
15288  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
15289  */
15290 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
15291
15292 /**
15293  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
15294  * but with all dynamically-allocated buffers duplicated in new buffers.
15295  */
15296 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
15297
15298 /**
15299  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
15300  */
15301 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
15302
15303 /**
15304  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
15305  */
15306 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
15307
15308 /**
15309  * Checks if the given object is currently in the success state
15310  */
15311 bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o);
15312
15313 /**
15314  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
15315  */
15316 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
15317
15318 /**
15319  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
15320  * but with all dynamically-allocated buffers duplicated in new buffers.
15321  */
15322 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
15323
15324 /**
15325  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
15326  */
15327 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
15328
15329 /**
15330  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
15331  */
15332 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
15333
15334 /**
15335  * Checks if the given object is currently in the success state
15336  */
15337 bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o);
15338
15339 /**
15340  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
15341  */
15342 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
15343
15344 /**
15345  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
15346  * but with all dynamically-allocated buffers duplicated in new buffers.
15347  */
15348 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
15349
15350 /**
15351  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15352  */
15353 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
15354
15355 /**
15356  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
15357  */
15358 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
15359
15360 /**
15361  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
15362  */
15363 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
15364
15365 /**
15366  * Checks if the given object is currently in the success state
15367  */
15368 bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o);
15369
15370 /**
15371  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
15372  */
15373 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
15374
15375 /**
15376  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
15377  * but with all dynamically-allocated buffers duplicated in new buffers.
15378  */
15379 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
15380
15381 /**
15382  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
15383  */
15384 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
15385
15386 /**
15387  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
15388  */
15389 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
15390
15391 /**
15392  * Checks if the given object is currently in the success state
15393  */
15394 bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o);
15395
15396 /**
15397  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
15398  */
15399 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
15400
15401 /**
15402  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
15403  * but with all dynamically-allocated buffers duplicated in new buffers.
15404  */
15405 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
15406
15407 /**
15408  * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
15409  */
15410 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o);
15411
15412 /**
15413  * Constructs a new COption_CVec_NetAddressZZ containing nothing
15414  */
15415 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void);
15416
15417 /**
15418  * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
15419  */
15420 void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
15421
15422 /**
15423  * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
15424  * but with all dynamically-allocated buffers duplicated in new buffers.
15425  */
15426 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
15427
15428 /**
15429  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
15430  */
15431 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
15432
15433 /**
15434  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
15435  */
15436 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
15437
15438 /**
15439  * Checks if the given object is currently in the success state
15440  */
15441 bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o);
15442
15443 /**
15444  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
15445  */
15446 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
15447
15448 /**
15449  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
15450  * but with all dynamically-allocated buffers duplicated in new buffers.
15451  */
15452 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
15453
15454 /**
15455  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15456  */
15457 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
15458
15459 /**
15460  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15461  */
15462 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
15463
15464 /**
15465  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15466  */
15467 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
15468
15469 /**
15470  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15471  */
15472 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
15473
15474 /**
15475  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
15476  */
15477 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
15478
15479 /**
15480  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
15481  */
15482 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
15483
15484 /**
15485  * Checks if the given object is currently in the success state
15486  */
15487 bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o);
15488
15489 /**
15490  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
15491  */
15492 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
15493
15494 /**
15495  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
15496  * but with all dynamically-allocated buffers duplicated in new buffers.
15497  */
15498 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
15499
15500 /**
15501  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
15502  */
15503 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
15504
15505 /**
15506  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
15507  */
15508 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
15509
15510 /**
15511  * Checks if the given object is currently in the success state
15512  */
15513 bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o);
15514
15515 /**
15516  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
15517  */
15518 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
15519
15520 /**
15521  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
15522  * but with all dynamically-allocated buffers duplicated in new buffers.
15523  */
15524 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
15525
15526 /**
15527  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
15528  */
15529 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
15530
15531 /**
15532  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
15533  */
15534 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
15535
15536 /**
15537  * Checks if the given object is currently in the success state
15538  */
15539 bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o);
15540
15541 /**
15542  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
15543  */
15544 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
15545
15546 /**
15547  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
15548  * but with all dynamically-allocated buffers duplicated in new buffers.
15549  */
15550 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
15551
15552 /**
15553  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
15554  */
15555 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
15556
15557 /**
15558  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
15559  */
15560 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
15561
15562 /**
15563  * Checks if the given object is currently in the success state
15564  */
15565 bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o);
15566
15567 /**
15568  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
15569  */
15570 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
15571
15572 /**
15573  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
15574  * but with all dynamically-allocated buffers duplicated in new buffers.
15575  */
15576 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
15577
15578 /**
15579  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
15580  */
15581 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
15582
15583 /**
15584  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
15585  */
15586 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
15587
15588 /**
15589  * Checks if the given object is currently in the success state
15590  */
15591 bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o);
15592
15593 /**
15594  * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
15595  */
15596 void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
15597
15598 /**
15599  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
15600  * but with all dynamically-allocated buffers duplicated in new buffers.
15601  */
15602 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
15603
15604 /**
15605  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
15606  */
15607 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
15608
15609 /**
15610  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
15611  */
15612 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
15613
15614 /**
15615  * Checks if the given object is currently in the success state
15616  */
15617 bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o);
15618
15619 /**
15620  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
15621  */
15622 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
15623
15624 /**
15625  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
15626  * but with all dynamically-allocated buffers duplicated in new buffers.
15627  */
15628 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
15629
15630 /**
15631  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
15632  */
15633 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
15634
15635 /**
15636  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
15637  */
15638 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
15639
15640 /**
15641  * Checks if the given object is currently in the success state
15642  */
15643 bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o);
15644
15645 /**
15646  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
15647  */
15648 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
15649
15650 /**
15651  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
15652  * but with all dynamically-allocated buffers duplicated in new buffers.
15653  */
15654 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
15655
15656 /**
15657  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
15658  */
15659 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
15660
15661 /**
15662  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
15663  */
15664 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
15665
15666 /**
15667  * Checks if the given object is currently in the success state
15668  */
15669 bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o);
15670
15671 /**
15672  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
15673  */
15674 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
15675
15676 /**
15677  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
15678  * but with all dynamically-allocated buffers duplicated in new buffers.
15679  */
15680 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
15681
15682 /**
15683  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
15684  */
15685 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
15686
15687 /**
15688  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
15689  */
15690 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
15691
15692 /**
15693  * Checks if the given object is currently in the success state
15694  */
15695 bool CResult_FundingLockedDecodeErrorZ_is_ok(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR o);
15696
15697 /**
15698  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
15699  */
15700 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
15701
15702 /**
15703  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
15704  * but with all dynamically-allocated buffers duplicated in new buffers.
15705  */
15706 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
15707
15708 /**
15709  * Creates a new CResult_InitDecodeErrorZ in the success state.
15710  */
15711 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
15712
15713 /**
15714  * Creates a new CResult_InitDecodeErrorZ in the error state.
15715  */
15716 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
15717
15718 /**
15719  * Checks if the given object is currently in the success state
15720  */
15721 bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o);
15722
15723 /**
15724  * Frees any resources used by the CResult_InitDecodeErrorZ.
15725  */
15726 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
15727
15728 /**
15729  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
15730  * but with all dynamically-allocated buffers duplicated in new buffers.
15731  */
15732 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
15733
15734 /**
15735  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
15736  */
15737 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
15738
15739 /**
15740  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
15741  */
15742 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
15743
15744 /**
15745  * Checks if the given object is currently in the success state
15746  */
15747 bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o);
15748
15749 /**
15750  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
15751  */
15752 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
15753
15754 /**
15755  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
15756  * but with all dynamically-allocated buffers duplicated in new buffers.
15757  */
15758 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
15759
15760 /**
15761  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
15762  */
15763 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
15764
15765 /**
15766  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
15767  */
15768 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
15769
15770 /**
15771  * Checks if the given object is currently in the success state
15772  */
15773 bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o);
15774
15775 /**
15776  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
15777  */
15778 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
15779
15780 /**
15781  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
15782  * but with all dynamically-allocated buffers duplicated in new buffers.
15783  */
15784 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
15785
15786 /**
15787  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
15788  */
15789 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
15790
15791 /**
15792  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
15793  */
15794 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
15795
15796 /**
15797  * Checks if the given object is currently in the success state
15798  */
15799 bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o);
15800
15801 /**
15802  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
15803  */
15804 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
15805
15806 /**
15807  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
15808  * but with all dynamically-allocated buffers duplicated in new buffers.
15809  */
15810 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
15811
15812 /**
15813  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
15814  */
15815 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
15816
15817 /**
15818  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
15819  */
15820 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
15821
15822 /**
15823  * Checks if the given object is currently in the success state
15824  */
15825 bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o);
15826
15827 /**
15828  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
15829  */
15830 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
15831
15832 /**
15833  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
15834  * but with all dynamically-allocated buffers duplicated in new buffers.
15835  */
15836 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
15837
15838 /**
15839  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
15840  */
15841 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
15842
15843 /**
15844  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
15845  */
15846 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
15847
15848 /**
15849  * Checks if the given object is currently in the success state
15850  */
15851 bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o);
15852
15853 /**
15854  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
15855  */
15856 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
15857
15858 /**
15859  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
15860  * but with all dynamically-allocated buffers duplicated in new buffers.
15861  */
15862 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
15863
15864 /**
15865  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
15866  */
15867 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
15868
15869 /**
15870  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
15871  */
15872 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
15873
15874 /**
15875  * Checks if the given object is currently in the success state
15876  */
15877 bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o);
15878
15879 /**
15880  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
15881  */
15882 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
15883
15884 /**
15885  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
15886  * but with all dynamically-allocated buffers duplicated in new buffers.
15887  */
15888 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
15889
15890 /**
15891  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
15892  */
15893 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
15894
15895 /**
15896  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
15897  */
15898 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
15899
15900 /**
15901  * Checks if the given object is currently in the success state
15902  */
15903 bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o);
15904
15905 /**
15906  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
15907  */
15908 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
15909
15910 /**
15911  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
15912  * but with all dynamically-allocated buffers duplicated in new buffers.
15913  */
15914 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
15915
15916 /**
15917  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
15918  */
15919 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
15920
15921 /**
15922  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
15923  */
15924 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
15925
15926 /**
15927  * Checks if the given object is currently in the success state
15928  */
15929 bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o);
15930
15931 /**
15932  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
15933  */
15934 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
15935
15936 /**
15937  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
15938  * but with all dynamically-allocated buffers duplicated in new buffers.
15939  */
15940 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
15941
15942 /**
15943  * Creates a new CResult_PingDecodeErrorZ in the success state.
15944  */
15945 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
15946
15947 /**
15948  * Creates a new CResult_PingDecodeErrorZ in the error state.
15949  */
15950 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
15951
15952 /**
15953  * Checks if the given object is currently in the success state
15954  */
15955 bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o);
15956
15957 /**
15958  * Frees any resources used by the CResult_PingDecodeErrorZ.
15959  */
15960 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
15961
15962 /**
15963  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
15964  * but with all dynamically-allocated buffers duplicated in new buffers.
15965  */
15966 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
15967
15968 /**
15969  * Creates a new CResult_PongDecodeErrorZ in the success state.
15970  */
15971 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
15972
15973 /**
15974  * Creates a new CResult_PongDecodeErrorZ in the error state.
15975  */
15976 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
15977
15978 /**
15979  * Checks if the given object is currently in the success state
15980  */
15981 bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o);
15982
15983 /**
15984  * Frees any resources used by the CResult_PongDecodeErrorZ.
15985  */
15986 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
15987
15988 /**
15989  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
15990  * but with all dynamically-allocated buffers duplicated in new buffers.
15991  */
15992 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
15993
15994 /**
15995  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
15996  */
15997 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
15998
15999 /**
16000  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
16001  */
16002 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16003
16004 /**
16005  * Checks if the given object is currently in the success state
16006  */
16007 bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
16008
16009 /**
16010  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
16011  */
16012 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
16013
16014 /**
16015  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16016  * but with all dynamically-allocated buffers duplicated in new buffers.
16017  */
16018 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16019
16020 /**
16021  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
16022  */
16023 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
16024
16025 /**
16026  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
16027  */
16028 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16029
16030 /**
16031  * Checks if the given object is currently in the success state
16032  */
16033 bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
16034
16035 /**
16036  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
16037  */
16038 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
16039
16040 /**
16041  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16042  * but with all dynamically-allocated buffers duplicated in new buffers.
16043  */
16044 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16045
16046 /**
16047  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
16048  */
16049 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
16050
16051 /**
16052  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
16053  */
16054 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
16055
16056 /**
16057  * Checks if the given object is currently in the success state
16058  */
16059 bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o);
16060
16061 /**
16062  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
16063  */
16064 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
16065
16066 /**
16067  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
16068  * but with all dynamically-allocated buffers duplicated in new buffers.
16069  */
16070 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
16071
16072 /**
16073  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
16074  */
16075 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
16076
16077 /**
16078  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
16079  */
16080 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
16081
16082 /**
16083  * Checks if the given object is currently in the success state
16084  */
16085 bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o);
16086
16087 /**
16088  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
16089  */
16090 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
16091
16092 /**
16093  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
16094  * but with all dynamically-allocated buffers duplicated in new buffers.
16095  */
16096 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
16097
16098 /**
16099  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
16100  */
16101 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
16102
16103 /**
16104  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
16105  */
16106 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
16107
16108 /**
16109  * Checks if the given object is currently in the success state
16110  */
16111 bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o);
16112
16113 /**
16114  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
16115  */
16116 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
16117
16118 /**
16119  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
16120  * but with all dynamically-allocated buffers duplicated in new buffers.
16121  */
16122 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
16123
16124 /**
16125  * Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
16126  */
16127 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o);
16128
16129 /**
16130  * Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
16131  */
16132 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e);
16133
16134 /**
16135  * Checks if the given object is currently in the success state
16136  */
16137 bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o);
16138
16139 /**
16140  * Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
16141  */
16142 void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res);
16143
16144 /**
16145  * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
16146  * but with all dynamically-allocated buffers duplicated in new buffers.
16147  */
16148 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig);
16149
16150 /**
16151  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
16152  */
16153 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
16154
16155 /**
16156  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
16157  */
16158 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16159
16160 /**
16161  * Checks if the given object is currently in the success state
16162  */
16163 bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
16164
16165 /**
16166  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
16167  */
16168 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
16169
16170 /**
16171  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
16172  * but with all dynamically-allocated buffers duplicated in new buffers.
16173  */
16174 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16175
16176 /**
16177  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
16178  */
16179 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
16180
16181 /**
16182  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
16183  */
16184 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16185
16186 /**
16187  * Checks if the given object is currently in the success state
16188  */
16189 bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
16190
16191 /**
16192  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
16193  */
16194 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
16195
16196 /**
16197  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
16198  * but with all dynamically-allocated buffers duplicated in new buffers.
16199  */
16200 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16201
16202 /**
16203  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
16204  */
16205 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
16206
16207 /**
16208  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
16209  */
16210 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
16211
16212 /**
16213  * Checks if the given object is currently in the success state
16214  */
16215 bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o);
16216
16217 /**
16218  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
16219  */
16220 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
16221
16222 /**
16223  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
16224  * but with all dynamically-allocated buffers duplicated in new buffers.
16225  */
16226 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
16227
16228 /**
16229  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
16230  */
16231 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
16232
16233 /**
16234  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
16235  */
16236 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
16237
16238 /**
16239  * Checks if the given object is currently in the success state
16240  */
16241 bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o);
16242
16243 /**
16244  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
16245  */
16246 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
16247
16248 /**
16249  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
16250  * but with all dynamically-allocated buffers duplicated in new buffers.
16251  */
16252 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
16253
16254 /**
16255  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
16256  */
16257 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
16258
16259 /**
16260  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
16261  */
16262 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
16263
16264 /**
16265  * Checks if the given object is currently in the success state
16266  */
16267 bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o);
16268
16269 /**
16270  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
16271  */
16272 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
16273
16274 /**
16275  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
16276  * but with all dynamically-allocated buffers duplicated in new buffers.
16277  */
16278 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
16279
16280 /**
16281  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
16282  */
16283 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
16284
16285 /**
16286  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
16287  */
16288 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
16289
16290 /**
16291  * Checks if the given object is currently in the success state
16292  */
16293 bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o);
16294
16295 /**
16296  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
16297  */
16298 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
16299
16300 /**
16301  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
16302  * but with all dynamically-allocated buffers duplicated in new buffers.
16303  */
16304 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
16305
16306 /**
16307  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
16308  */
16309 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
16310
16311 /**
16312  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
16313  */
16314 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
16315
16316 /**
16317  * Checks if the given object is currently in the success state
16318  */
16319 bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o);
16320
16321 /**
16322  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
16323  */
16324 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
16325
16326 /**
16327  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
16328  * but with all dynamically-allocated buffers duplicated in new buffers.
16329  */
16330 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
16331
16332 /**
16333  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16334  */
16335 void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res);
16336
16337 /**
16338  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
16339  */
16340 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
16341
16342 /**
16343  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
16344  */
16345 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
16346
16347 /**
16348  * Checks if the given object is currently in the success state
16349  */
16350 bool CResult_InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR o);
16351
16352 /**
16353  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
16354  */
16355 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
16356
16357 /**
16358  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
16359  * but with all dynamically-allocated buffers duplicated in new buffers.
16360  */
16361 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
16362
16363 /**
16364  * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
16365  */
16366 struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
16367
16368 /**
16369  * Constructs a new COption_FilterZ containing nothing
16370  */
16371 struct LDKCOption_FilterZ COption_FilterZ_none(void);
16372
16373 /**
16374  * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
16375  */
16376 void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
16377
16378 /**
16379  * Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
16380  */
16381 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o);
16382
16383 /**
16384  * Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
16385  */
16386 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
16387
16388 /**
16389  * Checks if the given object is currently in the success state
16390  */
16391 bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o);
16392
16393 /**
16394  * Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
16395  */
16396 void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res);
16397
16398 /**
16399  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16400  */
16401 void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res);
16402
16403 /**
16404  * Frees any resources used by the PaymentPurpose
16405  */
16406 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
16407
16408 /**
16409  * Creates a copy of the PaymentPurpose
16410  */
16411 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
16412
16413 /**
16414  * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
16415  */
16416 struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret);
16417
16418 /**
16419  * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
16420  */
16421 struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
16422
16423 /**
16424  * Frees any resources used by the ClosureReason
16425  */
16426 void ClosureReason_free(struct LDKClosureReason this_ptr);
16427
16428 /**
16429  * Creates a copy of the ClosureReason
16430  */
16431 struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
16432
16433 /**
16434  * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
16435  */
16436 struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg);
16437
16438 /**
16439  * Utility method to constructs a new HolderForceClosed-variant ClosureReason
16440  */
16441 struct LDKClosureReason ClosureReason_holder_force_closed(void);
16442
16443 /**
16444  * Utility method to constructs a new CooperativeClosure-variant ClosureReason
16445  */
16446 struct LDKClosureReason ClosureReason_cooperative_closure(void);
16447
16448 /**
16449  * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
16450  */
16451 struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
16452
16453 /**
16454  * Utility method to constructs a new FundingTimedOut-variant ClosureReason
16455  */
16456 struct LDKClosureReason ClosureReason_funding_timed_out(void);
16457
16458 /**
16459  * Utility method to constructs a new ProcessingError-variant ClosureReason
16460  */
16461 struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
16462
16463 /**
16464  * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
16465  */
16466 struct LDKClosureReason ClosureReason_disconnected_peer(void);
16467
16468 /**
16469  * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
16470  */
16471 struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
16472
16473 /**
16474  * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
16475  */
16476 struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
16477
16478 /**
16479  * Read a ClosureReason from a byte array, created by ClosureReason_write
16480  */
16481 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser);
16482
16483 /**
16484  * Frees any resources used by the Event
16485  */
16486 void Event_free(struct LDKEvent this_ptr);
16487
16488 /**
16489  * Creates a copy of the Event
16490  */
16491 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
16492
16493 /**
16494  * Utility method to constructs a new FundingGenerationReady-variant Event
16495  */
16496 struct LDKEvent Event_funding_generation_ready(struct LDKThirtyTwoBytes temporary_channel_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, uint64_t user_channel_id);
16497
16498 /**
16499  * Utility method to constructs a new PaymentReceived-variant Event
16500  */
16501 struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amt, struct LDKPaymentPurpose purpose);
16502
16503 /**
16504  * Utility method to constructs a new PaymentSent-variant Event
16505  */
16506 struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
16507
16508 /**
16509  * Utility method to constructs a new PaymentPathFailed-variant Event
16510  */
16511 struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id, struct LDKRouteParameters retry);
16512
16513 /**
16514  * Utility method to constructs a new PaymentFailed-variant Event
16515  */
16516 struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash);
16517
16518 /**
16519  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
16520  */
16521 struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
16522
16523 /**
16524  * Utility method to constructs a new SpendableOutputs-variant Event
16525  */
16526 struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
16527
16528 /**
16529  * Utility method to constructs a new PaymentForwarded-variant Event
16530  */
16531 struct LDKEvent Event_payment_forwarded(struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx);
16532
16533 /**
16534  * Utility method to constructs a new ChannelClosed-variant Event
16535  */
16536 struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64_t user_channel_id, struct LDKClosureReason reason);
16537
16538 /**
16539  * Utility method to constructs a new DiscardFunding-variant Event
16540  */
16541 struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
16542
16543 /**
16544  * Utility method to constructs a new PaymentPathSuccessful-variant Event
16545  */
16546 struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
16547
16548 /**
16549  * Utility method to constructs a new OpenChannelRequest-variant Event
16550  */
16551 struct LDKEvent Event_open_channel_request(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t funding_satoshis, uint64_t push_msat);
16552
16553 /**
16554  * Serialize the Event object into a byte array which can be read by Event_read
16555  */
16556 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
16557
16558 /**
16559  * Read a Event from a byte array, created by Event_write
16560  */
16561 struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser);
16562
16563 /**
16564  * Frees any resources used by the MessageSendEvent
16565  */
16566 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
16567
16568 /**
16569  * Creates a copy of the MessageSendEvent
16570  */
16571 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
16572
16573 /**
16574  * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
16575  */
16576 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
16577
16578 /**
16579  * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
16580  */
16581 struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
16582
16583 /**
16584  * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
16585  */
16586 struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
16587
16588 /**
16589  * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
16590  */
16591 struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
16592
16593 /**
16594  * Utility method to constructs a new SendFundingLocked-variant MessageSendEvent
16595  */
16596 struct LDKMessageSendEvent MessageSendEvent_send_funding_locked(struct LDKPublicKey node_id, struct LDKFundingLocked msg);
16597
16598 /**
16599  * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
16600  */
16601 struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
16602
16603 /**
16604  * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
16605  */
16606 struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
16607
16608 /**
16609  * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
16610  */
16611 struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
16612
16613 /**
16614  * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
16615  */
16616 struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
16617
16618 /**
16619  * Utility method to constructs a new SendShutdown-variant MessageSendEvent
16620  */
16621 struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
16622
16623 /**
16624  * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
16625  */
16626 struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
16627
16628 /**
16629  * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
16630  */
16631 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
16632
16633 /**
16634  * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
16635  */
16636 struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg);
16637
16638 /**
16639  * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
16640  */
16641 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
16642
16643 /**
16644  * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
16645  */
16646 struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
16647
16648 /**
16649  * Utility method to constructs a new HandleError-variant MessageSendEvent
16650  */
16651 struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
16652
16653 /**
16654  * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
16655  */
16656 struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
16657
16658 /**
16659  * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
16660  */
16661 struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
16662
16663 /**
16664  * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
16665  */
16666 struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
16667
16668 /**
16669  * Calls the free function if one is set
16670  */
16671 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
16672
16673 /**
16674  * Calls the free function if one is set
16675  */
16676 void EventsProvider_free(struct LDKEventsProvider this_ptr);
16677
16678 /**
16679  * Calls the free function if one is set
16680  */
16681 void EventHandler_free(struct LDKEventHandler this_ptr);
16682
16683 /**
16684  * Frees any resources used by the APIError
16685  */
16686 void APIError_free(struct LDKAPIError this_ptr);
16687
16688 /**
16689  * Creates a copy of the APIError
16690  */
16691 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
16692
16693 /**
16694  * Utility method to constructs a new APIMisuseError-variant APIError
16695  */
16696 struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
16697
16698 /**
16699  * Utility method to constructs a new FeeRateTooHigh-variant APIError
16700  */
16701 struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
16702
16703 /**
16704  * Utility method to constructs a new RouteError-variant APIError
16705  */
16706 struct LDKAPIError APIError_route_error(struct LDKStr err);
16707
16708 /**
16709  * Utility method to constructs a new ChannelUnavailable-variant APIError
16710  */
16711 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
16712
16713 /**
16714  * Utility method to constructs a new MonitorUpdateFailed-variant APIError
16715  */
16716 struct LDKAPIError APIError_monitor_update_failed(void);
16717
16718 /**
16719  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
16720  */
16721 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
16722
16723 /**
16724  * Creates a digital signature of a message given a SecretKey, like the node's secret.
16725  * 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.
16726  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
16727  */
16728 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
16729
16730 /**
16731  * Recovers the PublicKey of the signer of the message given the message and the signature.
16732  */
16733 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
16734
16735 /**
16736  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
16737  * and the PublicKey.
16738  */
16739 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
16740
16741 /**
16742  * Construct the invoice's HRP and signatureless data into a preimage to be hashed.
16743  */
16744 struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z data_without_signature);
16745
16746 /**
16747  * Creates a copy of the Level
16748  */
16749 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
16750
16751 /**
16752  * Utility method to constructs a new Gossip-variant Level
16753  */
16754 enum LDKLevel Level_gossip(void);
16755
16756 /**
16757  * Utility method to constructs a new Trace-variant Level
16758  */
16759 enum LDKLevel Level_trace(void);
16760
16761 /**
16762  * Utility method to constructs a new Debug-variant Level
16763  */
16764 enum LDKLevel Level_debug(void);
16765
16766 /**
16767  * Utility method to constructs a new Info-variant Level
16768  */
16769 enum LDKLevel Level_info(void);
16770
16771 /**
16772  * Utility method to constructs a new Warn-variant Level
16773  */
16774 enum LDKLevel Level_warn(void);
16775
16776 /**
16777  * Utility method to constructs a new Error-variant Level
16778  */
16779 enum LDKLevel Level_error(void);
16780
16781 /**
16782  * Checks if two Levels contain equal inner contents.
16783  * This ignores pointers and is_owned flags and looks at the values in fields.
16784  */
16785 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
16786
16787 /**
16788  * Checks if two Levels contain equal inner contents.
16789  */
16790 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
16791
16792 /**
16793  * Returns the most verbose logging level.
16794  */
16795 MUST_USE_RES enum LDKLevel Level_max(void);
16796
16797 /**
16798  * Frees any resources used by the Record, if is_owned is set and inner is non-NULL.
16799  */
16800 void Record_free(struct LDKRecord this_obj);
16801
16802 /**
16803  * The verbosity level of the message.
16804  */
16805 enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr);
16806
16807 /**
16808  * The verbosity level of the message.
16809  */
16810 void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val);
16811
16812 /**
16813  * The message body.
16814  */
16815 struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr);
16816
16817 /**
16818  * The message body.
16819  */
16820 void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
16821
16822 /**
16823  * The module path of the message.
16824  */
16825 struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr);
16826
16827 /**
16828  * The module path of the message.
16829  */
16830 void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
16831
16832 /**
16833  * The source file containing the message.
16834  */
16835 struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr);
16836
16837 /**
16838  * The source file containing the message.
16839  */
16840 void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
16841
16842 /**
16843  * The line containing the message.
16844  */
16845 uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr);
16846
16847 /**
16848  * The line containing the message.
16849  */
16850 void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val);
16851
16852 /**
16853  * Creates a copy of the Record
16854  */
16855 struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig);
16856
16857 /**
16858  * Calls the free function if one is set
16859  */
16860 void Logger_free(struct LDKLogger this_ptr);
16861
16862 /**
16863  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
16864  */
16865 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
16866
16867 /**
16868  * Confirmations we will wait for before considering the channel locked in.
16869  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
16870  * equivalent limit applied to outbound channels).
16871  *
16872  * Default value: 6.
16873  */
16874 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
16875
16876 /**
16877  * Confirmations we will wait for before considering the channel locked in.
16878  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
16879  * equivalent limit applied to outbound channels).
16880  *
16881  * Default value: 6.
16882  */
16883 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
16884
16885 /**
16886  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
16887  * the number of blocks we have to punish our counterparty if they broadcast a revoked
16888  * transaction).
16889  *
16890  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
16891  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
16892  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
16893  * possibly with time in between to RBF the spending transaction).
16894  *
16895  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
16896  * case of an honest unilateral channel close, which implicitly decrease the economic value of
16897  * our channel.
16898  *
16899  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
16900  * can tweak config to ask for more security, not less.
16901  */
16902 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
16903
16904 /**
16905  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
16906  * the number of blocks we have to punish our counterparty if they broadcast a revoked
16907  * transaction).
16908  *
16909  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
16910  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
16911  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
16912  * possibly with time in between to RBF the spending transaction).
16913  *
16914  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
16915  * case of an honest unilateral channel close, which implicitly decrease the economic value of
16916  * our channel.
16917  *
16918  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
16919  * can tweak config to ask for more security, not less.
16920  */
16921 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
16922
16923 /**
16924  * Set to the smallest value HTLC we will accept to process.
16925  *
16926  * This value is sent to our counterparty on channel-open and we close the channel any time
16927  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
16928  *
16929  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
16930  * by the protocol.
16931  */
16932 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
16933
16934 /**
16935  * Set to the smallest value HTLC we will accept to process.
16936  *
16937  * This value is sent to our counterparty on channel-open and we close the channel any time
16938  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
16939  *
16940  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
16941  * by the protocol.
16942  */
16943 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
16944
16945 /**
16946  * Constructs a new ChannelHandshakeConfig given each field
16947  */
16948 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);
16949
16950 /**
16951  * Creates a copy of the ChannelHandshakeConfig
16952  */
16953 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
16954
16955 /**
16956  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
16957  */
16958 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
16959
16960 /**
16961  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
16962  */
16963 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
16964
16965 /**
16966  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
16967  * only applies to inbound channels.
16968  *
16969  * Default value: 0.
16970  */
16971 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
16972
16973 /**
16974  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
16975  * only applies to inbound channels.
16976  *
16977  * Default value: 0.
16978  */
16979 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
16980
16981 /**
16982  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
16983  * you to limit the maximum minimum-size they can require.
16984  *
16985  * Default value: u64::max_value.
16986  */
16987 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
16988
16989 /**
16990  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
16991  * you to limit the maximum minimum-size they can require.
16992  *
16993  * Default value: u64::max_value.
16994  */
16995 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
16996
16997 /**
16998  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
16999  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
17000  *
17001  * Default value: 0.
17002  */
17003 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17004
17005 /**
17006  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
17007  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
17008  *
17009  * Default value: 0.
17010  */
17011 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17012
17013 /**
17014  * The remote node will require we keep a certain amount in direct payment to ourselves at all
17015  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
17016  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
17017  *
17018  * Default value: u64::max_value.
17019  */
17020 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17021
17022 /**
17023  * The remote node will require we keep a certain amount in direct payment to ourselves at all
17024  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
17025  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
17026  *
17027  * Default value: u64::max_value.
17028  */
17029 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17030
17031 /**
17032  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
17033  * time. This allows you to set a minimum such value.
17034  *
17035  * Default value: 0.
17036  */
17037 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17038
17039 /**
17040  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
17041  * time. This allows you to set a minimum such value.
17042  *
17043  * Default value: 0.
17044  */
17045 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
17046
17047 /**
17048  * Before a channel is usable the funding transaction will need to be confirmed by at least a
17049  * certain number of blocks, specified by the node which is not the funder (as the funder can
17050  * assume they aren't going to double-spend themselves).
17051  * This config allows you to set a limit on the maximum amount of time to wait.
17052  *
17053  * Default value: 144, or roughly one day and only applies to outbound channels.
17054  */
17055 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17056
17057 /**
17058  * Before a channel is usable the funding transaction will need to be confirmed by at least a
17059  * certain number of blocks, specified by the node which is not the funder (as the funder can
17060  * assume they aren't going to double-spend themselves).
17061  * This config allows you to set a limit on the maximum amount of time to wait.
17062  *
17063  * Default value: 144, or roughly one day and only applies to outbound channels.
17064  */
17065 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
17066
17067 /**
17068  * Set to force an incoming channel to match our announced channel preference in
17069  * [`ChannelConfig::announced_channel`].
17070  *
17071  * For a node which is not online reliably, this should be set to true and
17072  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
17073  * channels will ever be opened.
17074  *
17075  * Default value: true.
17076  */
17077 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17078
17079 /**
17080  * Set to force an incoming channel to match our announced channel preference in
17081  * [`ChannelConfig::announced_channel`].
17082  *
17083  * For a node which is not online reliably, this should be set to true and
17084  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
17085  * channels will ever be opened.
17086  *
17087  * Default value: true.
17088  */
17089 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
17090
17091 /**
17092  * Set to the amount of time we're willing to wait to claim money back to us.
17093  *
17094  * Not checking this value would be a security issue, as our peer would be able to set it to
17095  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
17096  *
17097  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
17098  * reduce the loss of having useless locked funds (if your peer accepts)
17099  */
17100 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17101
17102 /**
17103  * Set to the amount of time we're willing to wait to claim money back to us.
17104  *
17105  * Not checking this value would be a security issue, as our peer would be able to set it to
17106  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
17107  *
17108  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
17109  * reduce the loss of having useless locked funds (if your peer accepts)
17110  */
17111 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
17112
17113 /**
17114  * Constructs a new ChannelHandshakeLimits given each field
17115  */
17116 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_funding_satoshis_arg, uint64_t max_htlc_minimum_msat_arg, uint64_t min_max_htlc_value_in_flight_msat_arg, uint64_t max_channel_reserve_satoshis_arg, uint16_t min_max_accepted_htlcs_arg, uint32_t max_minimum_depth_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg);
17117
17118 /**
17119  * Creates a copy of the ChannelHandshakeLimits
17120  */
17121 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
17122
17123 /**
17124  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
17125  */
17126 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
17127
17128 /**
17129  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
17130  */
17131 void ChannelConfig_free(struct LDKChannelConfig this_obj);
17132
17133 /**
17134  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
17135  * over the channel.
17136  * This may be allowed to change at runtime in a later update, however doing so must result in
17137  * update messages sent to notify all nodes of our updated relay fee.
17138  *
17139  * Default value: 0.
17140  */
17141 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17142
17143 /**
17144  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
17145  * over the channel.
17146  * This may be allowed to change at runtime in a later update, however doing so must result in
17147  * update messages sent to notify all nodes of our updated relay fee.
17148  *
17149  * Default value: 0.
17150  */
17151 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
17152
17153 /**
17154  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
17155  * excess of [`forwarding_fee_proportional_millionths`].
17156  * This may be allowed to change at runtime in a later update, however doing so must result in
17157  * update messages sent to notify all nodes of our updated relay fee.
17158  *
17159  * The default value of a single satoshi roughly matches the market rate on many routing nodes
17160  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
17161  * this node.
17162  *
17163  * Default value: 1000.
17164  *
17165  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
17166  */
17167 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17168
17169 /**
17170  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
17171  * excess of [`forwarding_fee_proportional_millionths`].
17172  * This may be allowed to change at runtime in a later update, however doing so must result in
17173  * update messages sent to notify all nodes of our updated relay fee.
17174  *
17175  * The default value of a single satoshi roughly matches the market rate on many routing nodes
17176  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
17177  * this node.
17178  *
17179  * Default value: 1000.
17180  *
17181  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
17182  */
17183 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
17184
17185 /**
17186  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
17187  * the channel this config applies to.
17188  *
17189  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
17190  * HTLC balance when a channel appears on-chain whereas
17191  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
17192  * (non-HTLC-encumbered) balance.
17193  *
17194  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
17195  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
17196  * commitment transaction at least once per this many blocks (minus some margin to allow us
17197  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
17198  * the spending transaction).
17199  *
17200  * Default value: 72 (12 hours at an average of 6 blocks/hour).
17201  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
17202  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
17203  *
17204  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
17205  */
17206 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17207
17208 /**
17209  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
17210  * the channel this config applies to.
17211  *
17212  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
17213  * HTLC balance when a channel appears on-chain whereas
17214  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
17215  * (non-HTLC-encumbered) balance.
17216  *
17217  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
17218  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
17219  * commitment transaction at least once per this many blocks (minus some margin to allow us
17220  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
17221  * the spending transaction).
17222  *
17223  * Default value: 72 (12 hours at an average of 6 blocks/hour).
17224  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
17225  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
17226  *
17227  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
17228  */
17229 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
17230
17231 /**
17232  * Set to announce the channel publicly and notify all nodes that they can route via this
17233  * channel.
17234  *
17235  * This should only be set to true for nodes which expect to be online reliably.
17236  *
17237  * As the node which funds a channel picks this value this will only apply for new outbound
17238  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
17239  *
17240  * This cannot be changed after the initial channel handshake.
17241  *
17242  * Default value: false.
17243  */
17244 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17245
17246 /**
17247  * Set to announce the channel publicly and notify all nodes that they can route via this
17248  * channel.
17249  *
17250  * This should only be set to true for nodes which expect to be online reliably.
17251  *
17252  * As the node which funds a channel picks this value this will only apply for new outbound
17253  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
17254  *
17255  * This cannot be changed after the initial channel handshake.
17256  *
17257  * Default value: false.
17258  */
17259 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
17260
17261 /**
17262  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
17263  * supports it, they will then enforce the mutual-close output to us matches what we provided
17264  * at intialization, preventing us from closing to an alternate pubkey.
17265  *
17266  * This is set to true by default to provide a slight increase in security, though ultimately
17267  * any attacker who is able to take control of a channel can just as easily send the funds via
17268  * lightning payments, so we never require that our counterparties support this option.
17269  *
17270  * This cannot be changed after a channel has been initialized.
17271  *
17272  * Default value: true.
17273  */
17274 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17275
17276 /**
17277  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
17278  * supports it, they will then enforce the mutual-close output to us matches what we provided
17279  * at intialization, preventing us from closing to an alternate pubkey.
17280  *
17281  * This is set to true by default to provide a slight increase in security, though ultimately
17282  * any attacker who is able to take control of a channel can just as easily send the funds via
17283  * lightning payments, so we never require that our counterparties support this option.
17284  *
17285  * This cannot be changed after a channel has been initialized.
17286  *
17287  * Default value: true.
17288  */
17289 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
17290
17291 /**
17292  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
17293  * small to claim on-chain.
17294  *
17295  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
17296  * not be claimable on-chain, instead being turned into additional miner fees if either
17297  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
17298  * to such payments may be sustantial if there are many dust HTLCs present when the
17299  * channel is force-closed.
17300  *
17301  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
17302  * exposure across all three types per-channel. Setting this too low may prevent the
17303  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
17304  * important to prevent stealing of dust HTLCs by miners.
17305  *
17306  * Default value: 5_000_000 msat.
17307  */
17308 uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17309
17310 /**
17311  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
17312  * small to claim on-chain.
17313  *
17314  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
17315  * not be claimable on-chain, instead being turned into additional miner fees if either
17316  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
17317  * to such payments may be sustantial if there are many dust HTLCs present when the
17318  * channel is force-closed.
17319  *
17320  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
17321  * exposure across all three types per-channel. Setting this too low may prevent the
17322  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
17323  * important to prevent stealing of dust HTLCs by miners.
17324  *
17325  * Default value: 5_000_000 msat.
17326  */
17327 void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
17328
17329 /**
17330  * The additional fee we're willing to pay to avoid waiting for the counterparty's
17331  * `to_self_delay` to reclaim funds.
17332  *
17333  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
17334  * closing transaction which both sides find acceptable, ultimately paid by the channel
17335  * funder/initiator.
17336  *
17337  * When we are the funder, because we have to pay the channel closing fee, we bound the
17338  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
17339  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
17340  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
17341  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
17342  * funds.
17343  *
17344  * When we are not the funder, we require the closing transaction fee pay at least our
17345  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
17346  * Thus, this value is ignored when we are not the funder.
17347  *
17348  * Default value: 1000 satoshis.
17349  *
17350  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
17351  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
17352  */
17353 uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17354
17355 /**
17356  * The additional fee we're willing to pay to avoid waiting for the counterparty's
17357  * `to_self_delay` to reclaim funds.
17358  *
17359  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
17360  * closing transaction which both sides find acceptable, ultimately paid by the channel
17361  * funder/initiator.
17362  *
17363  * When we are the funder, because we have to pay the channel closing fee, we bound the
17364  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
17365  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
17366  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
17367  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
17368  * funds.
17369  *
17370  * When we are not the funder, we require the closing transaction fee pay at least our
17371  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
17372  * Thus, this value is ignored when we are not the funder.
17373  *
17374  * Default value: 1000 satoshis.
17375  *
17376  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
17377  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
17378  */
17379 void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
17380
17381 /**
17382  * Constructs a new ChannelConfig given each field
17383  */
17384 MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg, uint64_t max_dust_htlc_exposure_msat_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg);
17385
17386 /**
17387  * Creates a copy of the ChannelConfig
17388  */
17389 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
17390
17391 /**
17392  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
17393  */
17394 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
17395
17396 /**
17397  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
17398  */
17399 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
17400
17401 /**
17402  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
17403  */
17404 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
17405
17406 /**
17407  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
17408  */
17409 void UserConfig_free(struct LDKUserConfig this_obj);
17410
17411 /**
17412  * Channel config that we propose to our counterparty.
17413  */
17414 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17415
17416 /**
17417  * Channel config that we propose to our counterparty.
17418  */
17419 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
17420
17421 /**
17422  * Limits applied to our counterparty's proposed channel config settings.
17423  */
17424 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17425
17426 /**
17427  * Limits applied to our counterparty's proposed channel config settings.
17428  */
17429 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
17430
17431 /**
17432  * Channel config which affects behavior during channel lifetime.
17433  */
17434 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17435
17436 /**
17437  * Channel config which affects behavior during channel lifetime.
17438  */
17439 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
17440
17441 /**
17442  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
17443  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
17444  * node which is not online reliably.
17445  *
17446  * For nodes which are not online reliably, you should set all channels to *not* be announced
17447  * (using [`ChannelConfig::announced_channel`] and
17448  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
17449  * ensure you are not exposed to any forwarding risk.
17450  *
17451  * Note that because you cannot change a channel's announced state after creation, there is no
17452  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
17453  * from a publicly-announced forwarding node to a private non-forwarding node you must close
17454  * all your channels and open new ones. For privacy, you should also change your node_id
17455  * (swapping all private and public key material for new ones) at that time.
17456  *
17457  * Default value: false.
17458  */
17459 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17460
17461 /**
17462  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
17463  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
17464  * node which is not online reliably.
17465  *
17466  * For nodes which are not online reliably, you should set all channels to *not* be announced
17467  * (using [`ChannelConfig::announced_channel`] and
17468  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
17469  * ensure you are not exposed to any forwarding risk.
17470  *
17471  * Note that because you cannot change a channel's announced state after creation, there is no
17472  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
17473  * from a publicly-announced forwarding node to a private non-forwarding node you must close
17474  * all your channels and open new ones. For privacy, you should also change your node_id
17475  * (swapping all private and public key material for new ones) at that time.
17476  *
17477  * Default value: false.
17478  */
17479 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
17480
17481 /**
17482  * If this is set to false, we do not accept inbound requests to open a new channel.
17483  * Default value: true.
17484  */
17485 bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17486
17487 /**
17488  * If this is set to false, we do not accept inbound requests to open a new channel.
17489  * Default value: true.
17490  */
17491 void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
17492
17493 /**
17494  * If this is set to true, the user needs to manually accept inbound requests to open a new
17495  * channel.
17496  *
17497  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
17498  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
17499  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
17500  * user explicitly chooses to accept the request.
17501  *
17502  * Default value: false.
17503  *
17504  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
17505  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
17506  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
17507  */
17508 bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17509
17510 /**
17511  * If this is set to true, the user needs to manually accept inbound requests to open a new
17512  * channel.
17513  *
17514  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
17515  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
17516  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
17517  * user explicitly chooses to accept the request.
17518  *
17519  * Default value: false.
17520  *
17521  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
17522  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
17523  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
17524  */
17525 void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
17526
17527 /**
17528  * Constructs a new UserConfig given each field
17529  */
17530 MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg, bool manually_accept_inbound_channels_arg);
17531
17532 /**
17533  * Creates a copy of the UserConfig
17534  */
17535 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
17536
17537 /**
17538  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
17539  */
17540 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
17541
17542 /**
17543  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
17544  */
17545 void BestBlock_free(struct LDKBestBlock this_obj);
17546
17547 /**
17548  * Creates a copy of the BestBlock
17549  */
17550 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
17551
17552 /**
17553  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
17554  * network.
17555  */
17556 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
17557
17558 /**
17559  * Returns a `BestBlock` as identified by the given block hash and height.
17560  */
17561 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
17562
17563 /**
17564  * Returns the best block hash.
17565  */
17566 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
17567
17568 /**
17569  * Returns the best block height.
17570  */
17571 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
17572
17573 /**
17574  * Creates a copy of the AccessError
17575  */
17576 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
17577
17578 /**
17579  * Utility method to constructs a new UnknownChain-variant AccessError
17580  */
17581 enum LDKAccessError AccessError_unknown_chain(void);
17582
17583 /**
17584  * Utility method to constructs a new UnknownTx-variant AccessError
17585  */
17586 enum LDKAccessError AccessError_unknown_tx(void);
17587
17588 /**
17589  * Calls the free function if one is set
17590  */
17591 void Access_free(struct LDKAccess this_ptr);
17592
17593 /**
17594  * Calls the free function if one is set
17595  */
17596 void Listen_free(struct LDKListen this_ptr);
17597
17598 /**
17599  * Calls the free function if one is set
17600  */
17601 void Confirm_free(struct LDKConfirm this_ptr);
17602
17603 /**
17604  * Creates a copy of the ChannelMonitorUpdateErr
17605  */
17606 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
17607
17608 /**
17609  * Utility method to constructs a new TemporaryFailure-variant ChannelMonitorUpdateErr
17610  */
17611 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void);
17612
17613 /**
17614  * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateErr
17615  */
17616 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void);
17617
17618 /**
17619  * Calls the free function if one is set
17620  */
17621 void Watch_free(struct LDKWatch this_ptr);
17622
17623 /**
17624  * Calls the free function if one is set
17625  */
17626 void Filter_free(struct LDKFilter this_ptr);
17627
17628 /**
17629  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
17630  */
17631 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
17632
17633 /**
17634  * First block where the transaction output may have been spent.
17635  *
17636  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
17637  */
17638 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
17639
17640 /**
17641  * First block where the transaction output may have been spent.
17642  *
17643  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
17644  */
17645 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17646
17647 /**
17648  * Outpoint identifying the transaction output.
17649  */
17650 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
17651
17652 /**
17653  * Outpoint identifying the transaction output.
17654  */
17655 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
17656
17657 /**
17658  * Spending condition of the transaction output.
17659  */
17660 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
17661
17662 /**
17663  * Spending condition of the transaction output.
17664  */
17665 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
17666
17667 /**
17668  * Constructs a new WatchedOutput given each field
17669  */
17670 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
17671
17672 /**
17673  * Creates a copy of the WatchedOutput
17674  */
17675 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
17676
17677 /**
17678  * Checks if two WatchedOutputs contain equal inner contents.
17679  */
17680 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
17681
17682 /**
17683  * Calls the free function if one is set
17684  */
17685 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
17686
17687 /**
17688  * Creates a copy of the ConfirmationTarget
17689  */
17690 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
17691
17692 /**
17693  * Utility method to constructs a new Background-variant ConfirmationTarget
17694  */
17695 enum LDKConfirmationTarget ConfirmationTarget_background(void);
17696
17697 /**
17698  * Utility method to constructs a new Normal-variant ConfirmationTarget
17699  */
17700 enum LDKConfirmationTarget ConfirmationTarget_normal(void);
17701
17702 /**
17703  * Utility method to constructs a new HighPriority-variant ConfirmationTarget
17704  */
17705 enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
17706
17707 /**
17708  * Checks if two ConfirmationTargets contain equal inner contents.
17709  * This ignores pointers and is_owned flags and looks at the values in fields.
17710  */
17711 bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
17712
17713 /**
17714  * Calls the free function if one is set
17715  */
17716 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
17717
17718 /**
17719  * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
17720  */
17721 void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj);
17722
17723 /**
17724  * Creates a copy of the MonitorUpdateId
17725  */
17726 struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
17727
17728 /**
17729  * Checks if two MonitorUpdateIds contain equal inner contents.
17730  */
17731 uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
17732
17733 /**
17734  * Checks if two MonitorUpdateIds contain equal inner contents.
17735  * This ignores pointers and is_owned flags and looks at the values in fields.
17736  * Two objects with NULL inner values will be considered "equal" here.
17737  */
17738 bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b);
17739
17740 /**
17741  * Calls the free function if one is set
17742  */
17743 void Persist_free(struct LDKPersist this_ptr);
17744
17745 /**
17746  * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL.
17747  */
17748 void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj);
17749
17750 /**
17751  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
17752  */
17753 void ChainMonitor_free(struct LDKChainMonitor this_obj);
17754
17755 /**
17756  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
17757  *
17758  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
17759  * will call back to it indicating transactions and outputs of interest. This allows clients to
17760  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
17761  * always need to fetch full blocks absent another means for determining which blocks contain
17762  * transactions relevant to the watched channels.
17763  */
17764 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
17765
17766 /**
17767  * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
17768  * claims which are awaiting confirmation.
17769  *
17770  * Includes the balances from each [`ChannelMonitor`] *except* those included in
17771  * `ignored_channels`, allowing you to filter out balances from channels which are still open
17772  * (and whose balance should likely be pulled from the [`ChannelDetails`]).
17773  *
17774  * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
17775  * inclusion in the return value.
17776  */
17777 MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
17778
17779 /**
17780  * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no
17781  * such [`ChannelMonitor`] is currently being monitored for.
17782  *
17783  * Note that the result holds a mutex over our monitor set, and should not be held
17784  * indefinitely.
17785  */
17786 MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo);
17787
17788 /**
17789  * Lists the funding outpoint of each [`ChannelMonitor`] being monitored.
17790  *
17791  * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always
17792  * monitoring for on-chain state resolutions.
17793  */
17794 MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
17795
17796 /**
17797  * Indicates the persistence of a [`ChannelMonitor`] has completed after
17798  * [`ChannelMonitorUpdateErr::TemporaryFailure`] was returned from an update operation.
17799  *
17800  * Thus, the anticipated use is, at a high level:
17801  *  1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
17802  *     update to disk and begins updating any remote (e.g. watchtower/backup) copies,
17803  *     returning [`ChannelMonitorUpdateErr::TemporaryFailure`],
17804  *  2) once all remote copies are updated, you call this function with the
17805  *     `completed_update_id` that completed, and once all pending updates have completed the
17806  *     channel will be re-enabled.
17807  *
17808  * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
17809  * registered [`ChannelMonitor`]s.
17810  */
17811 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);
17812
17813 /**
17814  * Constructs a new Listen which calls the relevant methods on this_arg.
17815  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
17816  */
17817 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
17818
17819 /**
17820  * Constructs a new Confirm which calls the relevant methods on this_arg.
17821  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
17822  */
17823 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
17824
17825 /**
17826  * Constructs a new Watch which calls the relevant methods on this_arg.
17827  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
17828  */
17829 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
17830
17831 /**
17832  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
17833  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
17834  */
17835 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
17836
17837 /**
17838  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
17839  */
17840 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
17841
17842 /**
17843  * The sequence number of this update. Updates *must* be replayed in-order according to this
17844  * sequence number (and updates may panic if they are not). The update_id values are strictly
17845  * increasing and increase by one for each new update, with one exception specified below.
17846  *
17847  * This sequence number is also used to track up to which points updates which returned
17848  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
17849  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
17850  *
17851  * The only instance where update_id values are not strictly increasing is the case where we
17852  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
17853  * its docs for more details.
17854  */
17855 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
17856
17857 /**
17858  * The sequence number of this update. Updates *must* be replayed in-order according to this
17859  * sequence number (and updates may panic if they are not). The update_id values are strictly
17860  * increasing and increase by one for each new update, with one exception specified below.
17861  *
17862  * This sequence number is also used to track up to which points updates which returned
17863  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
17864  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
17865  *
17866  * The only instance where update_id values are not strictly increasing is the case where we
17867  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
17868  * its docs for more details.
17869  */
17870 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
17871
17872 /**
17873  * Creates a copy of the ChannelMonitorUpdate
17874  */
17875 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
17876
17877 /**
17878  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
17879  */
17880 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
17881
17882 /**
17883  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
17884  */
17885 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
17886
17887 /**
17888  * Frees any resources used by the MonitorEvent
17889  */
17890 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
17891
17892 /**
17893  * Creates a copy of the MonitorEvent
17894  */
17895 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
17896
17897 /**
17898  * Utility method to constructs a new HTLCEvent-variant MonitorEvent
17899  */
17900 struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
17901
17902 /**
17903  * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
17904  */
17905 struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
17906
17907 /**
17908  * Utility method to constructs a new UpdateCompleted-variant MonitorEvent
17909  */
17910 struct LDKMonitorEvent MonitorEvent_update_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id);
17911
17912 /**
17913  * Utility method to constructs a new UpdateFailed-variant MonitorEvent
17914  */
17915 struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a);
17916
17917 /**
17918  * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
17919  */
17920 struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj);
17921
17922 /**
17923  * Read a MonitorEvent from a byte array, created by MonitorEvent_write
17924  */
17925 struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser);
17926
17927 /**
17928  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
17929  */
17930 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
17931
17932 /**
17933  * Creates a copy of the HTLCUpdate
17934  */
17935 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
17936
17937 /**
17938  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
17939  */
17940 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
17941
17942 /**
17943  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
17944  */
17945 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
17946
17947 /**
17948  * Frees any resources used by the Balance
17949  */
17950 void Balance_free(struct LDKBalance this_ptr);
17951
17952 /**
17953  * Creates a copy of the Balance
17954  */
17955 struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
17956
17957 /**
17958  * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
17959  */
17960 struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
17961
17962 /**
17963  * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
17964  */
17965 struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
17966
17967 /**
17968  * Utility method to constructs a new ContentiousClaimable-variant Balance
17969  */
17970 struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height);
17971
17972 /**
17973  * Utility method to constructs a new MaybeClaimableHTLCAwaitingTimeout-variant Balance
17974  */
17975 struct LDKBalance Balance_maybe_claimable_htlcawaiting_timeout(uint64_t claimable_amount_satoshis, uint32_t claimable_height);
17976
17977 /**
17978  * Checks if two Balances contain equal inner contents.
17979  * This ignores pointers and is_owned flags and looks at the values in fields.
17980  */
17981 bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
17982
17983 /**
17984  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
17985  */
17986 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
17987
17988 /**
17989  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
17990  */
17991 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
17992
17993 /**
17994  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
17995  * itself.
17996  *
17997  * panics if the given update is not the next update by update_id.
17998  */
17999 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, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger);
18000
18001 /**
18002  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
18003  * ChannelMonitor.
18004  */
18005 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18006
18007 /**
18008  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
18009  */
18010 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18011
18012 /**
18013  * Gets a list of txids, with their output scripts (in the order they appear in the
18014  * transaction), which we must learn about spends of via block_connected().
18015  */
18016 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18017
18018 /**
18019  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
18020  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
18021  * have been registered.
18022  */
18023 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
18024
18025 /**
18026  * Get the list of HTLCs who's status has been updated on chain. This should be called by
18027  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
18028  */
18029 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18030
18031 /**
18032  * Gets the list of pending events which were generated by previous actions, clearing the list
18033  * in the process.
18034  *
18035  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
18036  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
18037  * no internal locking in ChannelMonitors.
18038  */
18039 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18040
18041 /**
18042  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
18043  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
18044  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
18045  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
18046  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
18047  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
18048  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
18049  * out-of-band the other node operator to coordinate with him if option is available to you.
18050  * In any-case, choice is up to the user.
18051  */
18052 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);
18053
18054 /**
18055  * Processes transactions in a newly connected block, which may result in any of the following:
18056  * - update the monitor's state against resolved HTLCs
18057  * - punish the counterparty in the case of seeing a revoked commitment transaction
18058  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
18059  * - detect settled outputs for later spending
18060  * - schedule and bump any in-flight claims
18061  *
18062  * Returns any new outputs to watch from `txdata`; after called, these are also included in
18063  * [`get_outputs_to_watch`].
18064  *
18065  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
18066  */
18067 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);
18068
18069 /**
18070  * Determines if the disconnected block contained any transactions of interest and updates
18071  * appropriately.
18072  */
18073 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);
18074
18075 /**
18076  * Processes transactions confirmed in a block with the given header and height, returning new
18077  * outputs to watch. See [`block_connected`] for details.
18078  *
18079  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
18080  * blocks. See [`chain::Confirm`] for calling expectations.
18081  *
18082  * [`block_connected`]: Self::block_connected
18083  */
18084 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);
18085
18086 /**
18087  * Processes a transaction that was reorganized out of the chain.
18088  *
18089  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
18090  * than blocks. See [`chain::Confirm`] for calling expectations.
18091  *
18092  * [`block_disconnected`]: Self::block_disconnected
18093  */
18094 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);
18095
18096 /**
18097  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
18098  * [`block_connected`] for details.
18099  *
18100  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
18101  * blocks. See [`chain::Confirm`] for calling expectations.
18102  *
18103  * [`block_connected`]: Self::block_connected
18104  */
18105 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);
18106
18107 /**
18108  * Returns the set of txids that should be monitored for re-organization out of the chain.
18109  */
18110 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18111
18112 /**
18113  * Gets the latest best block which was connected either via the [`chain::Listen`] or
18114  * [`chain::Confirm`] interfaces.
18115  */
18116 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18117
18118 /**
18119  * Gets the balances in this channel which are either claimable by us if we were to
18120  * force-close the channel now or which are claimable on-chain (possibly awaiting
18121  * confirmation).
18122  *
18123  * Any balances in the channel which are available on-chain (excluding on-chain fees) are
18124  * included here until an [`Event::SpendableOutputs`] event has been generated for the
18125  * balance, or until our counterparty has claimed the balance and accrued several
18126  * confirmations on the claim transaction.
18127  *
18128  * Note that the balances available when you or your counterparty have broadcasted revoked
18129  * state(s) may not be fully captured here.
18130  *
18131  * See [`Balance`] for additional details on the types of claimable balances which
18132  * may be returned here and their meanings.
18133  */
18134 MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18135
18136 /**
18137  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
18138  */
18139 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
18140
18141 /**
18142  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
18143  */
18144 void OutPoint_free(struct LDKOutPoint this_obj);
18145
18146 /**
18147  * The referenced transaction's txid.
18148  */
18149 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
18150
18151 /**
18152  * The referenced transaction's txid.
18153  */
18154 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18155
18156 /**
18157  * The index of the referenced output in its transaction's vout.
18158  */
18159 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
18160
18161 /**
18162  * The index of the referenced output in its transaction's vout.
18163  */
18164 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
18165
18166 /**
18167  * Constructs a new OutPoint given each field
18168  */
18169 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
18170
18171 /**
18172  * Creates a copy of the OutPoint
18173  */
18174 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
18175
18176 /**
18177  * Checks if two OutPoints contain equal inner contents.
18178  * This ignores pointers and is_owned flags and looks at the values in fields.
18179  * Two objects with NULL inner values will be considered "equal" here.
18180  */
18181 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
18182
18183 /**
18184  * Checks if two OutPoints contain equal inner contents.
18185  */
18186 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
18187
18188 /**
18189  * Convert an `OutPoint` to a lightning channel id.
18190  */
18191 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
18192
18193 /**
18194  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
18195  */
18196 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
18197
18198 /**
18199  * Read a OutPoint from a byte array, created by OutPoint_write
18200  */
18201 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
18202
18203 /**
18204  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
18205  */
18206 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
18207
18208 /**
18209  * The outpoint which is spendable
18210  */
18211 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18212
18213 /**
18214  * The outpoint which is spendable
18215  */
18216 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
18217
18218 /**
18219  * Per commitment point to derive delayed_payment_key by key holder
18220  */
18221 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18222
18223 /**
18224  * Per commitment point to derive delayed_payment_key by key holder
18225  */
18226 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18227
18228 /**
18229  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
18230  * the witness_script.
18231  */
18232 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18233
18234 /**
18235  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
18236  * the witness_script.
18237  */
18238 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
18239
18240 /**
18241  * The output which is referenced by the given outpoint
18242  */
18243 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
18244
18245 /**
18246  * The revocation point specific to the commitment transaction which was broadcast. Used to
18247  * derive the witnessScript for this output.
18248  */
18249 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18250
18251 /**
18252  * The revocation point specific to the commitment transaction which was broadcast. Used to
18253  * derive the witnessScript for this output.
18254  */
18255 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18256
18257 /**
18258  * Arbitrary identification information returned by a call to
18259  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
18260  * the channel to spend the output.
18261  */
18262 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
18263
18264 /**
18265  * Arbitrary identification information returned by a call to
18266  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
18267  * the channel to spend the output.
18268  */
18269 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18270
18271 /**
18272  * The value of the channel which this output originated from, possibly indirectly.
18273  */
18274 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18275
18276 /**
18277  * The value of the channel which this output originated from, possibly indirectly.
18278  */
18279 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
18280
18281 /**
18282  * Constructs a new DelayedPaymentOutputDescriptor given each field
18283  */
18284 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);
18285
18286 /**
18287  * Creates a copy of the DelayedPaymentOutputDescriptor
18288  */
18289 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
18290
18291 /**
18292  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
18293  */
18294 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
18295
18296 /**
18297  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
18298  */
18299 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
18300
18301 /**
18302  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
18303  */
18304 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
18305
18306 /**
18307  * The outpoint which is spendable
18308  */
18309 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18310
18311 /**
18312  * The outpoint which is spendable
18313  */
18314 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
18315
18316 /**
18317  * The output which is referenced by the given outpoint
18318  */
18319 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
18320
18321 /**
18322  * Arbitrary identification information returned by a call to
18323  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
18324  * the channel to spend the output.
18325  */
18326 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
18327
18328 /**
18329  * Arbitrary identification information returned by a call to
18330  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
18331  * the channel to spend the output.
18332  */
18333 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18334
18335 /**
18336  * The value of the channel which this transactions spends.
18337  */
18338 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18339
18340 /**
18341  * The value of the channel which this transactions spends.
18342  */
18343 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
18344
18345 /**
18346  * Constructs a new StaticPaymentOutputDescriptor given each field
18347  */
18348 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);
18349
18350 /**
18351  * Creates a copy of the StaticPaymentOutputDescriptor
18352  */
18353 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
18354
18355 /**
18356  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
18357  */
18358 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
18359
18360 /**
18361  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
18362  */
18363 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
18364
18365 /**
18366  * Frees any resources used by the SpendableOutputDescriptor
18367  */
18368 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
18369
18370 /**
18371  * Creates a copy of the SpendableOutputDescriptor
18372  */
18373 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
18374
18375 /**
18376  * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
18377  */
18378 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output);
18379
18380 /**
18381  * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
18382  */
18383 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a);
18384
18385 /**
18386  * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
18387  */
18388 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
18389
18390 /**
18391  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
18392  */
18393 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
18394
18395 /**
18396  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
18397  */
18398 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
18399
18400 /**
18401  * Calls the free function if one is set
18402  */
18403 void BaseSign_free(struct LDKBaseSign this_ptr);
18404
18405 /**
18406  * Creates a copy of a Sign
18407  */
18408 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
18409
18410 /**
18411  * Calls the free function if one is set
18412  */
18413 void Sign_free(struct LDKSign this_ptr);
18414
18415 /**
18416  * Creates a copy of the Recipient
18417  */
18418 enum LDKRecipient Recipient_clone(const enum LDKRecipient *NONNULL_PTR orig);
18419
18420 /**
18421  * Utility method to constructs a new Node-variant Recipient
18422  */
18423 enum LDKRecipient Recipient_node(void);
18424
18425 /**
18426  * Utility method to constructs a new PhantomNode-variant Recipient
18427  */
18428 enum LDKRecipient Recipient_phantom_node(void);
18429
18430 /**
18431  * Calls the free function if one is set
18432  */
18433 void KeysInterface_free(struct LDKKeysInterface this_ptr);
18434
18435 /**
18436  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
18437  */
18438 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
18439
18440 /**
18441  * Private key of anchor tx
18442  */
18443 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18444
18445 /**
18446  * Private key of anchor tx
18447  */
18448 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
18449
18450 /**
18451  * Holder secret key for blinded revocation pubkey
18452  */
18453 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18454
18455 /**
18456  * Holder secret key for blinded revocation pubkey
18457  */
18458 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
18459
18460 /**
18461  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
18462  */
18463 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18464
18465 /**
18466  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
18467  */
18468 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
18469
18470 /**
18471  * Holder secret key used in HTLC tx
18472  */
18473 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18474
18475 /**
18476  * Holder secret key used in HTLC tx
18477  */
18478 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
18479
18480 /**
18481  * Holder htlc secret key used in commitment tx htlc outputs
18482  */
18483 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18484
18485 /**
18486  * Holder htlc secret key used in commitment tx htlc outputs
18487  */
18488 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
18489
18490 /**
18491  * Commitment seed
18492  */
18493 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18494
18495 /**
18496  * Commitment seed
18497  */
18498 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18499
18500 /**
18501  * Creates a copy of the InMemorySigner
18502  */
18503 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
18504
18505 /**
18506  * Create a new InMemorySigner
18507  */
18508 MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(struct LDKSecretKey node_secret, struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id);
18509
18510 /**
18511  * Counterparty pubkeys.
18512  * Will panic if ready_channel wasn't called.
18513  */
18514 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18515
18516 /**
18517  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
18518  * transactions, ie the amount of time that we have to wait to recover our funds if we
18519  * broadcast a transaction.
18520  * Will panic if ready_channel wasn't called.
18521  */
18522 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18523
18524 /**
18525  * The contest_delay value specified by us and applied on transactions broadcastable
18526  * by our counterparty, ie the amount of time that they have to wait to recover their funds
18527  * if they broadcast a transaction.
18528  * Will panic if ready_channel wasn't called.
18529  */
18530 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18531
18532 /**
18533  * Whether the holder is the initiator
18534  * Will panic if ready_channel wasn't called.
18535  */
18536 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18537
18538 /**
18539  * Funding outpoint
18540  * Will panic if ready_channel wasn't called.
18541  */
18542 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18543
18544 /**
18545  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
18546  * building transactions.
18547  *
18548  * Will panic if ready_channel wasn't called.
18549  */
18550 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18551
18552 /**
18553  * Whether anchors should be used.
18554  * Will panic if ready_channel wasn't called.
18555  */
18556 MUST_USE_RES bool InMemorySigner_opt_anchors(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18557
18558 /**
18559  * Sign the single input of spend_tx at index `input_idx` which spends the output
18560  * described by descriptor, returning the witness stack for the input.
18561  *
18562  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
18563  * is not spending the outpoint described by `descriptor.outpoint`,
18564  * or if an output descriptor script_pubkey does not match the one we can spend.
18565  */
18566 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);
18567
18568 /**
18569  * Sign the single input of spend_tx at index `input_idx` which spends the output
18570  * described by descriptor, returning the witness stack for the input.
18571  *
18572  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
18573  * is not spending the outpoint described by `descriptor.outpoint`, does not have a
18574  * sequence set to `descriptor.to_self_delay`, or if an output descriptor
18575  * script_pubkey does not match the one we can spend.
18576  */
18577 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);
18578
18579 /**
18580  * Constructs a new BaseSign which calls the relevant methods on this_arg.
18581  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
18582  */
18583 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18584
18585 /**
18586  * Constructs a new Sign which calls the relevant methods on this_arg.
18587  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
18588  */
18589 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18590
18591 /**
18592  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
18593  */
18594 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
18595
18596 /**
18597  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
18598  */
18599 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKSecretKey arg);
18600
18601 /**
18602  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
18603  */
18604 void KeysManager_free(struct LDKKeysManager this_obj);
18605
18606 /**
18607  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
18608  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
18609  * starting_time isn't strictly required to actually be a time, but it must absolutely,
18610  * without a doubt, be unique to this instance. ie if you start multiple times with the same
18611  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
18612  * simply use the current time (with very high precision).
18613  *
18614  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
18615  * obviously, starting_time should be unique every time you reload the library - it is only
18616  * used to generate new ephemeral key data (which will be stored by the individual channel if
18617  * necessary).
18618  *
18619  * Note that the seed is required to recover certain on-chain funds independent of
18620  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
18621  * channel, and some on-chain during-closing funds.
18622  *
18623  * Note that until the 0.1 release there is no guarantee of backward compatibility between
18624  * versions. Once the library is more fully supported, the docs will be updated to include a
18625  * detailed description of the guarantee.
18626  */
18627 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
18628
18629 /**
18630  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
18631  *
18632  * Key derivation parameters are accessible through a per-channel secrets
18633  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
18634  * onchain output detection for which a corresponding delayed_payment_key must be derived.
18635  */
18636 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]);
18637
18638 /**
18639  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
18640  * output to the given change destination (if sufficient change value remains). The
18641  * transaction will have a feerate, at least, of the given value.
18642  *
18643  * Returns `Err(())` if the output value is greater than the input value minus required fee,
18644  * if a descriptor was duplicated, or if an output descriptor `script_pubkey`
18645  * does not match the one we can spend.
18646  *
18647  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
18648  *
18649  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
18650  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
18651  */
18652 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);
18653
18654 /**
18655  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
18656  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
18657  */
18658 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
18659
18660 /**
18661  * Frees any resources used by the PhantomKeysManager, if is_owned is set and inner is non-NULL.
18662  */
18663 void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj);
18664
18665 /**
18666  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
18667  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
18668  */
18669 struct LDKKeysInterface PhantomKeysManager_as_KeysInterface(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
18670
18671 /**
18672  * Constructs a `PhantomKeysManager` given a 32-byte seed and an additional `cross_node_seed`
18673  * that is shared across all nodes that intend to participate in [phantom node payments] together.
18674  *
18675  * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and
18676  * `starting_time_nanos`.
18677  *
18678  * `cross_node_seed` must be the same across all phantom payment-receiving nodes and also the
18679  * same across restarts, or else inbound payments may fail.
18680  *
18681  * [phantom node payments]: PhantomKeysManager
18682  */
18683 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]);
18684
18685 /**
18686  * See [`KeysManager::spend_spendable_outputs`] for documentation on this method.
18687  */
18688 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);
18689
18690 /**
18691  * See [`KeysManager::derive_channel_keys`] for documentation on this method.
18692  */
18693 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]);
18694
18695 /**
18696  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
18697  */
18698 void ChannelManager_free(struct LDKChannelManager this_obj);
18699
18700 /**
18701  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
18702  */
18703 void ChainParameters_free(struct LDKChainParameters this_obj);
18704
18705 /**
18706  * The network for determining the `chain_hash` in Lightning messages.
18707  */
18708 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
18709
18710 /**
18711  * The network for determining the `chain_hash` in Lightning messages.
18712  */
18713 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
18714
18715 /**
18716  * The hash and height of the latest block successfully connected.
18717  *
18718  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
18719  */
18720 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
18721
18722 /**
18723  * The hash and height of the latest block successfully connected.
18724  *
18725  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
18726  */
18727 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
18728
18729 /**
18730  * Constructs a new ChainParameters given each field
18731  */
18732 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
18733
18734 /**
18735  * Creates a copy of the ChainParameters
18736  */
18737 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
18738
18739 /**
18740  * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL.
18741  */
18742 void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
18743
18744 /**
18745  * Base routing fee in millisatoshis.
18746  */
18747 uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
18748
18749 /**
18750  * Base routing fee in millisatoshis.
18751  */
18752 void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
18753
18754 /**
18755  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
18756  */
18757 uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
18758
18759 /**
18760  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
18761  */
18762 void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
18763
18764 /**
18765  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
18766  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
18767  * `cltv_expiry_delta` for more details.
18768  */
18769 uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
18770
18771 /**
18772  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
18773  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
18774  * `cltv_expiry_delta` for more details.
18775  */
18776 void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
18777
18778 /**
18779  * Constructs a new CounterpartyForwardingInfo given each field
18780  */
18781 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);
18782
18783 /**
18784  * Creates a copy of the CounterpartyForwardingInfo
18785  */
18786 struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
18787
18788 /**
18789  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
18790  */
18791 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
18792
18793 /**
18794  * The node_id of our counterparty
18795  */
18796 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
18797
18798 /**
18799  * The node_id of our counterparty
18800  */
18801 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18802
18803 /**
18804  * The Features the channel counterparty provided upon last connection.
18805  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
18806  * many routing-relevant features are present in the init context.
18807  */
18808 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
18809
18810 /**
18811  * The Features the channel counterparty provided upon last connection.
18812  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
18813  * many routing-relevant features are present in the init context.
18814  */
18815 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
18816
18817 /**
18818  * The value, in satoshis, that must always be held in the channel for our counterparty. This
18819  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
18820  * claiming at least this value on chain.
18821  *
18822  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
18823  *
18824  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
18825  */
18826 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
18827
18828 /**
18829  * The value, in satoshis, that must always be held in the channel for our counterparty. This
18830  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
18831  * claiming at least this value on chain.
18832  *
18833  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
18834  *
18835  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
18836  */
18837 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
18838
18839 /**
18840  * Information on the fees and requirements that the counterparty requires when forwarding
18841  * payments to us through this channel.
18842  *
18843  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
18844  */
18845 struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
18846
18847 /**
18848  * Information on the fees and requirements that the counterparty requires when forwarding
18849  * payments to us through this channel.
18850  *
18851  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
18852  */
18853 void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
18854
18855 /**
18856  * Constructs a new ChannelCounterparty given each field
18857  */
18858 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);
18859
18860 /**
18861  * Creates a copy of the ChannelCounterparty
18862  */
18863 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
18864
18865 /**
18866  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
18867  */
18868 void ChannelDetails_free(struct LDKChannelDetails this_obj);
18869
18870 /**
18871  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
18872  * thereafter this is the txid of the funding transaction xor the funding transaction output).
18873  * Note that this means this value is *not* persistent - it can change once during the
18874  * lifetime of the channel.
18875  */
18876 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
18877
18878 /**
18879  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
18880  * thereafter this is the txid of the funding transaction xor the funding transaction output).
18881  * Note that this means this value is *not* persistent - it can change once during the
18882  * lifetime of the channel.
18883  */
18884 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18885
18886 /**
18887  * Parameters which apply to our counterparty. See individual fields for more information.
18888  */
18889 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
18890
18891 /**
18892  * Parameters which apply to our counterparty. See individual fields for more information.
18893  */
18894 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
18895
18896 /**
18897  * The Channel's funding transaction output, if we've negotiated the funding transaction with
18898  * our counterparty already.
18899  *
18900  * Note that, if this has been set, `channel_id` will be equivalent to
18901  * `funding_txo.unwrap().to_channel_id()`.
18902  *
18903  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
18904  */
18905 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
18906
18907 /**
18908  * The Channel's funding transaction output, if we've negotiated the funding transaction with
18909  * our counterparty already.
18910  *
18911  * Note that, if this has been set, `channel_id` will be equivalent to
18912  * `funding_txo.unwrap().to_channel_id()`.
18913  *
18914  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
18915  */
18916 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
18917
18918 /**
18919  * The position of the funding transaction in the chain. None if the funding transaction has
18920  * not yet been confirmed and the channel fully opened.
18921  */
18922 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
18923
18924 /**
18925  * The position of the funding transaction in the chain. None if the funding transaction has
18926  * not yet been confirmed and the channel fully opened.
18927  */
18928 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
18929
18930 /**
18931  * The value, in satoshis, of this channel as appears in the funding output
18932  */
18933 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
18934
18935 /**
18936  * The value, in satoshis, of this channel as appears in the funding output
18937  */
18938 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
18939
18940 /**
18941  * The value, in satoshis, that must always be held in the channel for us. This value ensures
18942  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
18943  * this value on chain.
18944  *
18945  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
18946  *
18947  * This value will be `None` for outbound channels until the counterparty accepts the channel.
18948  *
18949  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
18950  */
18951 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
18952
18953 /**
18954  * The value, in satoshis, that must always be held in the channel for us. This value ensures
18955  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
18956  * this value on chain.
18957  *
18958  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
18959  *
18960  * This value will be `None` for outbound channels until the counterparty accepts the channel.
18961  *
18962  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
18963  */
18964 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
18965
18966 /**
18967  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
18968  */
18969 uint64_t ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
18970
18971 /**
18972  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
18973  */
18974 void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
18975
18976 /**
18977  * Our total balance.  This is the amount we would get if we close the channel.
18978  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
18979  * amount is not likely to be recoverable on close.
18980  *
18981  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
18982  * balance is not available for inclusion in new outbound HTLCs). This further does not include
18983  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
18984  * This does not consider any on-chain fees.
18985  *
18986  * See also [`ChannelDetails::outbound_capacity_msat`]
18987  */
18988 uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
18989
18990 /**
18991  * Our total balance.  This is the amount we would get if we close the channel.
18992  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
18993  * amount is not likely to be recoverable on close.
18994  *
18995  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
18996  * balance is not available for inclusion in new outbound HTLCs). This further does not include
18997  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
18998  * This does not consider any on-chain fees.
18999  *
19000  * See also [`ChannelDetails::outbound_capacity_msat`]
19001  */
19002 void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19003
19004 /**
19005  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
19006  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
19007  * available for inclusion in new outbound HTLCs). This further does not include any pending
19008  * outgoing HTLCs which are awaiting some other resolution to be sent.
19009  *
19010  * See also [`ChannelDetails::balance_msat`]
19011  *
19012  * This value is not exact. Due to various in-flight changes, feerate changes, and our
19013  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
19014  * should be able to spend nearly this amount.
19015  */
19016 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19017
19018 /**
19019  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
19020  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
19021  * available for inclusion in new outbound HTLCs). This further does not include any pending
19022  * outgoing HTLCs which are awaiting some other resolution to be sent.
19023  *
19024  * See also [`ChannelDetails::balance_msat`]
19025  *
19026  * This value is not exact. Due to various in-flight changes, feerate changes, and our
19027  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
19028  * should be able to spend nearly this amount.
19029  */
19030 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19031
19032 /**
19033  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
19034  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
19035  * available for inclusion in new inbound HTLCs).
19036  * Note that there are some corner cases not fully handled here, so the actual available
19037  * inbound capacity may be slightly higher than this.
19038  *
19039  * This value is not exact. Due to various in-flight changes, feerate changes, and our
19040  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
19041  * However, our counterparty should be able to spend nearly this amount.
19042  */
19043 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19044
19045 /**
19046  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
19047  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
19048  * available for inclusion in new inbound HTLCs).
19049  * Note that there are some corner cases not fully handled here, so the actual available
19050  * inbound capacity may be slightly higher than this.
19051  *
19052  * This value is not exact. Due to various in-flight changes, feerate changes, and our
19053  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
19054  * However, our counterparty should be able to spend nearly this amount.
19055  */
19056 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19057
19058 /**
19059  * The number of required confirmations on the funding transaction before the funding will be
19060  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
19061  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
19062  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
19063  * [`ChannelHandshakeLimits::max_minimum_depth`].
19064  *
19065  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19066  *
19067  * [`is_outbound`]: ChannelDetails::is_outbound
19068  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
19069  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
19070  */
19071 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19072
19073 /**
19074  * The number of required confirmations on the funding transaction before the funding will be
19075  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
19076  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
19077  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
19078  * [`ChannelHandshakeLimits::max_minimum_depth`].
19079  *
19080  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19081  *
19082  * [`is_outbound`]: ChannelDetails::is_outbound
19083  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
19084  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
19085  */
19086 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
19087
19088 /**
19089  * The number of blocks (after our commitment transaction confirms) that we will need to wait
19090  * until we can claim our funds after we force-close the channel. During this time our
19091  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
19092  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
19093  * time to claim our non-HTLC-encumbered funds.
19094  *
19095  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19096  */
19097 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19098
19099 /**
19100  * The number of blocks (after our commitment transaction confirms) that we will need to wait
19101  * until we can claim our funds after we force-close the channel. During this time our
19102  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
19103  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
19104  * time to claim our non-HTLC-encumbered funds.
19105  *
19106  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19107  */
19108 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
19109
19110 /**
19111  * True if the channel was initiated (and thus funded) by us.
19112  */
19113 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19114
19115 /**
19116  * True if the channel was initiated (and thus funded) by us.
19117  */
19118 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
19119
19120 /**
19121  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
19122  * channel is not currently being shut down. `funding_locked` message exchange implies the
19123  * required confirmation count has been reached (and we were connected to the peer at some
19124  * point after the funding transaction received enough confirmations). The required
19125  * confirmation count is provided in [`confirmations_required`].
19126  *
19127  * [`confirmations_required`]: ChannelDetails::confirmations_required
19128  */
19129 bool ChannelDetails_get_is_funding_locked(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19130
19131 /**
19132  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
19133  * channel is not currently being shut down. `funding_locked` message exchange implies the
19134  * required confirmation count has been reached (and we were connected to the peer at some
19135  * point after the funding transaction received enough confirmations). The required
19136  * confirmation count is provided in [`confirmations_required`].
19137  *
19138  * [`confirmations_required`]: ChannelDetails::confirmations_required
19139  */
19140 void ChannelDetails_set_is_funding_locked(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
19141
19142 /**
19143  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
19144  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
19145  *
19146  * This is a strict superset of `is_funding_locked`.
19147  */
19148 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19149
19150 /**
19151  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
19152  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
19153  *
19154  * This is a strict superset of `is_funding_locked`.
19155  */
19156 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
19157
19158 /**
19159  * True if this channel is (or will be) publicly-announced.
19160  */
19161 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19162
19163 /**
19164  * True if this channel is (or will be) publicly-announced.
19165  */
19166 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
19167
19168 /**
19169  * Constructs a new ChannelDetails given each field
19170  */
19171 MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKCOption_u64Z short_channel_id_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_funding_locked_arg, bool is_usable_arg, bool is_public_arg);
19172
19173 /**
19174  * Creates a copy of the ChannelDetails
19175  */
19176 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
19177
19178 /**
19179  * Frees any resources used by the PaymentSendFailure
19180  */
19181 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
19182
19183 /**
19184  * Creates a copy of the PaymentSendFailure
19185  */
19186 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
19187
19188 /**
19189  * Utility method to constructs a new ParameterError-variant PaymentSendFailure
19190  */
19191 struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a);
19192
19193 /**
19194  * Utility method to constructs a new PathParameterError-variant PaymentSendFailure
19195  */
19196 struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a);
19197
19198 /**
19199  * Utility method to constructs a new AllFailedRetrySafe-variant PaymentSendFailure
19200  */
19201 struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDKCVec_APIErrorZ a);
19202
19203 /**
19204  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
19205  */
19206 struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id);
19207
19208 /**
19209  * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL.
19210  */
19211 void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj);
19212
19213 /**
19214  * The list of channels to be included in the invoice route hints.
19215  */
19216 struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
19217
19218 /**
19219  * The list of channels to be included in the invoice route hints.
19220  */
19221 void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val);
19222
19223 /**
19224  * A fake scid used for representing the phantom node's fake channel in generating the invoice
19225  * route hints.
19226  */
19227 uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
19228
19229 /**
19230  * A fake scid used for representing the phantom node's fake channel in generating the invoice
19231  * route hints.
19232  */
19233 void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val);
19234
19235 /**
19236  * The pubkey of the real backing node that would ultimately receive the payment.
19237  */
19238 struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
19239
19240 /**
19241  * The pubkey of the real backing node that would ultimately receive the payment.
19242  */
19243 void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19244
19245 /**
19246  * Constructs a new PhantomRouteHints given each field
19247  */
19248 MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg);
19249
19250 /**
19251  * Constructs a new ChannelManager to hold several channels and route between them.
19252  *
19253  * This is the main \"logic hub\" for all channel-related actions, and implements
19254  * ChannelMessageHandler.
19255  *
19256  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
19257  *
19258  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
19259  *
19260  * Users need to notify the new ChannelManager when a new block is connected or
19261  * disconnected using its `block_connected` and `block_disconnected` methods, starting
19262  * from after `params.latest_hash`.
19263  */
19264 MUST_USE_RES struct LDKChannelManager ChannelManager_new(struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKKeysInterface keys_manager, struct LDKUserConfig config, struct LDKChainParameters params);
19265
19266 /**
19267  * Gets the current configuration applied to all new channels,  as
19268  */
19269 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
19270
19271 /**
19272  * Creates a new outbound channel to the given remote node and with the given value.
19273  *
19274  * `user_channel_id` will be provided back as in
19275  * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
19276  * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 0
19277  * for inbound channels, so you may wish to avoid using 0 for `user_channel_id` here.
19278  * `user_channel_id` has no meaning inside of LDK, it is simply copied to events and otherwise
19279  * ignored.
19280  *
19281  * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
19282  * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
19283  *
19284  * Note that we do not check if you are currently connected to the given peer. If no
19285  * connection is available, the outbound `open_channel` message may fail to send, resulting in
19286  * the channel eventually being silently forgotten (dropped on reload).
19287  *
19288  * Returns the new Channel's temporary `channel_id`. This ID will appear as
19289  * [`Event::FundingGenerationReady::temporary_channel_id`] and in
19290  * [`ChannelDetails::channel_id`] until after
19291  * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
19292  * one derived from the funding transaction's TXID. If the counterparty rejects the channel
19293  * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
19294  *
19295  * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
19296  * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
19297  * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
19298  *
19299  * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
19300  */
19301 MUST_USE_RES struct LDKCResult__u832APIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, uint64_t user_channel_id, struct LDKUserConfig override_config);
19302
19303 /**
19304  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
19305  * more information.
19306  */
19307 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
19308
19309 /**
19310  * Gets the list of usable channels, in random order. Useful as an argument to
19311  * get_route to ensure non-announced channels are used.
19312  *
19313  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
19314  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
19315  * are.
19316  */
19317 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
19318
19319 /**
19320  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
19321  * will be accepted on the given channel, and after additional timeout/the closing of all
19322  * pending HTLCs, the channel will be closed on chain.
19323  *
19324  *  * If we are the channel initiator, we will pay between our [`Background`] and
19325  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
19326  *    estimate.
19327  *  * If our counterparty is the channel initiator, we will require a channel closing
19328  *    transaction feerate of at least our [`Background`] feerate or the feerate which
19329  *    would appear on a force-closure transaction, whichever is lower. We will allow our
19330  *    counterparty to pay as much fee as they'd like, however.
19331  *
19332  * May generate a SendShutdown message event on success, which should be relayed.
19333  *
19334  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
19335  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
19336  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
19337  */
19338 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
19339
19340 /**
19341  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
19342  * will be accepted on the given channel, and after additional timeout/the closing of all
19343  * pending HTLCs, the channel will be closed on chain.
19344  *
19345  * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
19346  * the channel being closed or not:
19347  *  * If we are the channel initiator, we will pay at least this feerate on the closing
19348  *    transaction. The upper-bound is set by
19349  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
19350  *    estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
19351  *  * If our counterparty is the channel initiator, we will refuse to accept a channel closure
19352  *    transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
19353  *    will appear on a force-closure transaction, whichever is lower).
19354  *
19355  * May generate a SendShutdown message event on success, which should be relayed.
19356  *
19357  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
19358  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
19359  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
19360  */
19361 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_target_feerate(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], uint32_t target_feerate_sats_per_1000_weight);
19362
19363 /**
19364  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
19365  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
19366  */
19367 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
19368
19369 /**
19370  * Force close all channels, immediately broadcasting the latest local commitment transaction
19371  * for each to the chain and rejecting new HTLCs on each.
19372  */
19373 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
19374
19375 /**
19376  * Sends a payment along a given route.
19377  *
19378  * Value parameters are provided via the last hop in route, see documentation for RouteHop
19379  * fields for more info.
19380  *
19381  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
19382  * payment), we don't do anything to stop you! We always try to ensure that if the provided
19383  * next hop knows the preimage to payment_hash they can claim an additional amount as
19384  * specified in the last hop in the route! Thus, you should probably do your own
19385  * payment_preimage tracking (which you should already be doing as they represent \"proof of
19386  * payment\") and prevent double-sends yourself.
19387  *
19388  * May generate SendHTLCs message(s) event on success, which should be relayed.
19389  *
19390  * Each path may have a different return value, and PaymentSendValue may return a Vec with
19391  * each entry matching the corresponding-index entry in the route paths, see
19392  * PaymentSendFailure for more info.
19393  *
19394  * In general, a path may raise:
19395  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
19396  *    node public key) is specified.
19397  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
19398  *    (including due to previous monitor update failure or new permanent monitor update
19399  *    failure).
19400  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
19401  *    relevant updates.
19402  *
19403  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
19404  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
19405  * different route unless you intend to pay twice!
19406  *
19407  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
19408  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
19409  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
19410  * must not contain multiple paths as multi-path payments require a recipient-provided
19411  * payment_secret.
19412  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
19413  * bit set (either as required or as available). If multiple paths are present in the Route,
19414  * we assume the invoice had the basic_mpp feature set.
19415  *
19416  * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
19417  */
19418 MUST_USE_RES struct LDKCResult_PaymentIdPaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
19419
19420 /**
19421  * Retries a payment along the given [`Route`].
19422  *
19423  * Errors returned are a superset of those returned from [`send_payment`], so see
19424  * [`send_payment`] documentation for more details on errors. This method will also error if the
19425  * retry amount puts the payment more than 10% over the payment's total amount, if the payment
19426  * for the given `payment_id` cannot be found (likely due to timeout or success), or if
19427  * further retries have been disabled with [`abandon_payment`].
19428  *
19429  * [`send_payment`]: [`ChannelManager::send_payment`]
19430  * [`abandon_payment`]: [`ChannelManager::abandon_payment`]
19431  */
19432 MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_retry_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
19433
19434 /**
19435  * Signals that no further retries for the given payment will occur.
19436  *
19437  * After this method returns, any future calls to [`retry_payment`] for the given `payment_id`
19438  * will fail with [`PaymentSendFailure::ParameterError`]. If no such event has been generated,
19439  * an [`Event::PaymentFailed`] event will be generated as soon as there are no remaining
19440  * pending HTLCs for this payment.
19441  *
19442  * Note that calling this method does *not* prevent a payment from succeeding. You must still
19443  * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
19444  * determine the ultimate status of a payment.
19445  *
19446  * [`retry_payment`]: Self::retry_payment
19447  * [`Event::PaymentFailed`]: events::Event::PaymentFailed
19448  * [`Event::PaymentSent`]: events::Event::PaymentSent
19449  */
19450 void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id);
19451
19452 /**
19453  * Send a spontaneous payment, which is a payment that does not require the recipient to have
19454  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
19455  * the preimage, it must be a cryptographically secure random value that no intermediate node
19456  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
19457  * never reach the recipient.
19458  *
19459  * See [`send_payment`] documentation for more details on the return value of this function.
19460  *
19461  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
19462  * [`send_payment`] for more information about the risks of duplicate preimage usage.
19463  *
19464  * Note that `route` must have exactly one path.
19465  *
19466  * [`send_payment`]: Self::send_payment
19467  *
19468  * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
19469  */
19470 MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage);
19471
19472 /**
19473  * Call this upon creation of a funding transaction for the given channel.
19474  *
19475  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
19476  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
19477  *
19478  * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided
19479  * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`].
19480  *
19481  * May panic if the output found in the funding transaction is duplicative with some other
19482  * channel (note that this should be trivially prevented by using unique funding transaction
19483  * keys per-channel).
19484  *
19485  * Do NOT broadcast the funding transaction yourself. When we have safely received our
19486  * counterparty's signature the funding transaction will automatically be broadcast via the
19487  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
19488  *
19489  * Note that this includes RBF or similar transaction replacement strategies - lightning does
19490  * not currently support replacing a funding transaction on an existing channel. Instead,
19491  * create a new channel with a conflicting funding transaction.
19492  *
19493  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
19494  * [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed
19495  */
19496 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKTransaction funding_transaction);
19497
19498 /**
19499  * Regenerates channel_announcements and generates a signed node_announcement from the given
19500  * arguments, providing them in corresponding events via
19501  * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed
19502  * on-chain. This effectively re-broadcasts all channel announcements and sends our node
19503  * announcement to ensure that the lightning P2P network is aware of the channels we have and
19504  * our network addresses.
19505  *
19506  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
19507  * node to humans. They carry no in-protocol meaning.
19508  *
19509  * `addresses` represent the set (possibly empty) of socket addresses on which this node
19510  * accepts incoming connections. These will be included in the node_announcement, publicly
19511  * tying these addresses together and to this node. If you wish to preserve user privacy,
19512  * addresses should likely contain only Tor Onion addresses.
19513  *
19514  * Panics if `addresses` is absurdly large (more than 500).
19515  *
19516  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
19517  */
19518 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
19519
19520 /**
19521  * Processes HTLCs which are pending waiting on random forward delay.
19522  *
19523  * Should only really ever be called in response to a PendingHTLCsForwardable event.
19524  * Will likely generate further events.
19525  */
19526 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
19527
19528 /**
19529  * Performs actions which should happen on startup and roughly once per minute thereafter.
19530  *
19531  * This currently includes:
19532  *  * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
19533  *  * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more
19534  *    than a minute, informing the network that they should no longer attempt to route over
19535  *    the channel.
19536  *
19537  * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate
19538  * estimate fetches.
19539  */
19540 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
19541
19542 /**
19543  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
19544  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
19545  * along the path (including in our own channel on which we received it).
19546  * Returns false if no payment was found to fail backwards, true if the process of failing the
19547  * HTLC backwards has been started.
19548  */
19549 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
19550
19551 /**
19552  * Provides a payment preimage in response to [`Event::PaymentReceived`], generating any
19553  * [`MessageSendEvent`]s needed to claim the payment.
19554  *
19555  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
19556  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
19557  * event matches your expectation. If you fail to do so and call this method, you may provide
19558  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
19559  *
19560  * Returns whether any HTLCs were claimed, and thus if any new [`MessageSendEvent`]s are now
19561  * pending for processing via [`get_and_clear_pending_msg_events`].
19562  *
19563  * [`Event::PaymentReceived`]: crate::util::events::Event::PaymentReceived
19564  * [`create_inbound_payment`]: Self::create_inbound_payment
19565  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
19566  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
19567  */
19568 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
19569
19570 /**
19571  * Gets the node_id held by this ChannelManager
19572  */
19573 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
19574
19575 /**
19576  * Called to accept a request to open a channel after [`Event::OpenChannelRequest`] has been
19577  * triggered.
19578  *
19579  * The `temporary_channel_id` parameter indicates which inbound channel should be accepted.
19580  *
19581  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
19582  */
19583 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32]);
19584
19585 /**
19586  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
19587  * to pay us.
19588  *
19589  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
19590  * [`PaymentHash`] and [`PaymentPreimage`] for you.
19591  *
19592  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
19593  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
19594  * passed directly to [`claim_funds`].
19595  *
19596  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
19597  *
19598  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
19599  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
19600  *
19601  * # Note
19602  *
19603  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
19604  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
19605  *
19606  * Errors if `min_value_msat` is greater than total bitcoin supply.
19607  *
19608  * [`claim_funds`]: Self::claim_funds
19609  * [`PaymentReceived`]: events::Event::PaymentReceived
19610  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
19611  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
19612  */
19613 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);
19614
19615 /**
19616  * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share
19617  * serialized state with LDK node(s) running 0.0.103 and earlier.
19618  *
19619  * # Note
19620  * This method is deprecated and will be removed soon.
19621  *
19622  * [`create_inbound_payment`]: Self::create_inbound_payment
19623  */
19624 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);
19625
19626 /**
19627  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
19628  * stored external to LDK.
19629  *
19630  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
19631  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
19632  * the `min_value_msat` provided here, if one is provided.
19633  *
19634  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
19635  * note that LDK will not stop you from registering duplicate payment hashes for inbound
19636  * payments.
19637  *
19638  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
19639  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
19640  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
19641  * sender \"proof-of-payment\" unless they have paid the required amount.
19642  *
19643  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
19644  * in excess of the current time. This should roughly match the expiry time set in the invoice.
19645  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
19646  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
19647  * invoices when no timeout is set.
19648  *
19649  * Note that we use block header time to time-out pending inbound payments (with some margin
19650  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
19651  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
19652  * If you need exact expiry semantics, you should enforce them upon receipt of
19653  * [`PaymentReceived`].
19654  *
19655  * May panic if `invoice_expiry_delta_secs` is greater than one year.
19656  *
19657  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
19658  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
19659  *
19660  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
19661  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
19662  *
19663  * # Note
19664  *
19665  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
19666  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
19667  *
19668  * Errors if `min_value_msat` is greater than total bitcoin supply.
19669  *
19670  * [`create_inbound_payment`]: Self::create_inbound_payment
19671  * [`PaymentReceived`]: events::Event::PaymentReceived
19672  */
19673 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);
19674
19675 /**
19676  * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
19677  * serialized state with LDK node(s) running 0.0.103 and earlier.
19678  *
19679  * # Note
19680  * This method is deprecated and will be removed soon.
19681  *
19682  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
19683  */
19684 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);
19685
19686 /**
19687  * Gets an LDK-generated payment preimage from a payment hash and payment secret that were
19688  * previously returned from [`create_inbound_payment`].
19689  *
19690  * [`create_inbound_payment`]: Self::create_inbound_payment
19691  */
19692 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);
19693
19694 /**
19695  * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
19696  * are used when constructing the phantom invoice's route hints.
19697  *
19698  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
19699  */
19700 MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg);
19701
19702 /**
19703  * Gets route hints for use in receiving [phantom node payments].
19704  *
19705  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
19706  */
19707 MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg);
19708
19709 /**
19710  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
19711  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
19712  */
19713 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
19714
19715 /**
19716  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
19717  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
19718  */
19719 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
19720
19721 /**
19722  * Constructs a new Listen which calls the relevant methods on this_arg.
19723  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
19724  */
19725 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
19726
19727 /**
19728  * Constructs a new Confirm which calls the relevant methods on this_arg.
19729  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
19730  */
19731 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
19732
19733 /**
19734  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
19735  * indicating whether persistence is necessary. Only one listener on
19736  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
19737  * up.
19738  *
19739  * Note that this method is not available with the `no-std` feature.
19740  */
19741 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
19742
19743 /**
19744  * Blocks until ChannelManager needs to be persisted. Only one listener on
19745  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
19746  * up.
19747  */
19748 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
19749
19750 /**
19751  * Gets the latest best block which was connected either via the [`chain::Listen`] or
19752  * [`chain::Confirm`] interfaces.
19753  */
19754 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
19755
19756 /**
19757  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
19758  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
19759  */
19760 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
19761
19762 /**
19763  * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read
19764  */
19765 struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj);
19766
19767 /**
19768  * Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write
19769  */
19770 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser);
19771
19772 /**
19773  * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read
19774  */
19775 struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj);
19776
19777 /**
19778  * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write
19779  */
19780 struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser);
19781
19782 /**
19783  * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read
19784  */
19785 struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj);
19786
19787 /**
19788  * Read a ChannelDetails from a byte array, created by ChannelDetails_write
19789  */
19790 struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser);
19791
19792 /**
19793  * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read
19794  */
19795 struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj);
19796
19797 /**
19798  * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write
19799  */
19800 struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser);
19801
19802 /**
19803  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
19804  */
19805 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
19806
19807 /**
19808  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
19809  */
19810 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
19811
19812 /**
19813  * The keys provider which will give us relevant keys. Some keys will be loaded during
19814  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
19815  * signing data.
19816  */
19817 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
19818
19819 /**
19820  * The keys provider which will give us relevant keys. Some keys will be loaded during
19821  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
19822  * signing data.
19823  */
19824 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
19825
19826 /**
19827  * The fee_estimator for use in the ChannelManager in the future.
19828  *
19829  * No calls to the FeeEstimator will be made during deserialization.
19830  */
19831 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
19832
19833 /**
19834  * The fee_estimator for use in the ChannelManager in the future.
19835  *
19836  * No calls to the FeeEstimator will be made during deserialization.
19837  */
19838 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
19839
19840 /**
19841  * The chain::Watch for use in the ChannelManager in the future.
19842  *
19843  * No calls to the chain::Watch will be made during deserialization. It is assumed that
19844  * you have deserialized ChannelMonitors separately and will add them to your
19845  * chain::Watch after deserializing this ChannelManager.
19846  */
19847 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
19848
19849 /**
19850  * The chain::Watch for use in the ChannelManager in the future.
19851  *
19852  * No calls to the chain::Watch will be made during deserialization. It is assumed that
19853  * you have deserialized ChannelMonitors separately and will add them to your
19854  * chain::Watch after deserializing this ChannelManager.
19855  */
19856 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
19857
19858 /**
19859  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
19860  * used to broadcast the latest local commitment transactions of channels which must be
19861  * force-closed during deserialization.
19862  */
19863 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
19864
19865 /**
19866  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
19867  * used to broadcast the latest local commitment transactions of channels which must be
19868  * force-closed during deserialization.
19869  */
19870 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
19871
19872 /**
19873  * The Logger for use in the ChannelManager and which may be used to log information during
19874  * deserialization.
19875  */
19876 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
19877
19878 /**
19879  * The Logger for use in the ChannelManager and which may be used to log information during
19880  * deserialization.
19881  */
19882 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
19883
19884 /**
19885  * Default settings used for new channels. Any existing channels will continue to use the
19886  * runtime settings which were stored when the ChannelManager was serialized.
19887  */
19888 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
19889
19890 /**
19891  * Default settings used for new channels. Any existing channels will continue to use the
19892  * runtime settings which were stored when the ChannelManager was serialized.
19893  */
19894 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
19895
19896 /**
19897  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
19898  * HashMap for you. This is primarily useful for C bindings where it is not practical to
19899  * populate a HashMap directly from C.
19900  */
19901 MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct LDKKeysInterface keys_manager, struct LDKFeeEstimator fee_estimator, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKUserConfig default_config, struct LDKCVec_ChannelMonitorZ channel_monitors);
19902
19903 /**
19904  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
19905  */
19906 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
19907
19908 /**
19909  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
19910  */
19911 void DecodeError_free(struct LDKDecodeError this_obj);
19912
19913 /**
19914  * Creates a copy of the DecodeError
19915  */
19916 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
19917
19918 /**
19919  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
19920  */
19921 void Init_free(struct LDKInit this_obj);
19922
19923 /**
19924  * The relevant features which the sender supports
19925  */
19926 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
19927
19928 /**
19929  * The relevant features which the sender supports
19930  */
19931 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
19932
19933 /**
19934  * Constructs a new Init given each field
19935  */
19936 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
19937
19938 /**
19939  * Creates a copy of the Init
19940  */
19941 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
19942
19943 /**
19944  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
19945  */
19946 void ErrorMessage_free(struct LDKErrorMessage this_obj);
19947
19948 /**
19949  * The channel ID involved in the error.
19950  *
19951  * All-0s indicates a general error unrelated to a specific channel, after which all channels
19952  * with the sending peer should be closed.
19953  */
19954 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
19955
19956 /**
19957  * The channel ID involved in the error.
19958  *
19959  * All-0s indicates a general error unrelated to a specific channel, after which all channels
19960  * with the sending peer should be closed.
19961  */
19962 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19963
19964 /**
19965  * A possibly human-readable error description.
19966  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
19967  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
19968  * the terminal emulator or the logging subsystem.
19969  */
19970 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
19971
19972 /**
19973  * A possibly human-readable error description.
19974  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
19975  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
19976  * the terminal emulator or the logging subsystem.
19977  */
19978 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
19979
19980 /**
19981  * Constructs a new ErrorMessage given each field
19982  */
19983 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
19984
19985 /**
19986  * Creates a copy of the ErrorMessage
19987  */
19988 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
19989
19990 /**
19991  * Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL.
19992  */
19993 void WarningMessage_free(struct LDKWarningMessage this_obj);
19994
19995 /**
19996  * The channel ID involved in the warning.
19997  *
19998  * All-0s indicates a warning unrelated to a specific channel.
19999  */
20000 const uint8_t (*WarningMessage_get_channel_id(const struct LDKWarningMessage *NONNULL_PTR this_ptr))[32];
20001
20002 /**
20003  * The channel ID involved in the warning.
20004  *
20005  * All-0s indicates a warning unrelated to a specific channel.
20006  */
20007 void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20008
20009 /**
20010  * A possibly human-readable warning description.
20011  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
20012  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
20013  * the terminal emulator or the logging subsystem.
20014  */
20015 struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PTR this_ptr);
20016
20017 /**
20018  * A possibly human-readable warning description.
20019  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
20020  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
20021  * the terminal emulator or the logging subsystem.
20022  */
20023 void WarningMessage_set_data(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKStr val);
20024
20025 /**
20026  * Constructs a new WarningMessage given each field
20027  */
20028 MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
20029
20030 /**
20031  * Creates a copy of the WarningMessage
20032  */
20033 struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig);
20034
20035 /**
20036  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
20037  */
20038 void Ping_free(struct LDKPing this_obj);
20039
20040 /**
20041  * The desired response length
20042  */
20043 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
20044
20045 /**
20046  * The desired response length
20047  */
20048 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
20049
20050 /**
20051  * The ping packet size.
20052  * This field is not sent on the wire. byteslen zeros are sent.
20053  */
20054 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
20055
20056 /**
20057  * The ping packet size.
20058  * This field is not sent on the wire. byteslen zeros are sent.
20059  */
20060 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
20061
20062 /**
20063  * Constructs a new Ping given each field
20064  */
20065 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
20066
20067 /**
20068  * Creates a copy of the Ping
20069  */
20070 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
20071
20072 /**
20073  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
20074  */
20075 void Pong_free(struct LDKPong this_obj);
20076
20077 /**
20078  * The pong packet size.
20079  * This field is not sent on the wire. byteslen zeros are sent.
20080  */
20081 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
20082
20083 /**
20084  * The pong packet size.
20085  * This field is not sent on the wire. byteslen zeros are sent.
20086  */
20087 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
20088
20089 /**
20090  * Constructs a new Pong given each field
20091  */
20092 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
20093
20094 /**
20095  * Creates a copy of the Pong
20096  */
20097 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
20098
20099 /**
20100  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
20101  */
20102 void OpenChannel_free(struct LDKOpenChannel this_obj);
20103
20104 /**
20105  * The genesis hash of the blockchain where the channel is to be opened
20106  */
20107 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
20108
20109 /**
20110  * The genesis hash of the blockchain where the channel is to be opened
20111  */
20112 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20113
20114 /**
20115  * A temporary channel ID, until the funding outpoint is announced
20116  */
20117 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
20118
20119 /**
20120  * A temporary channel ID, until the funding outpoint is announced
20121  */
20122 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20123
20124 /**
20125  * The channel value
20126  */
20127 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20128
20129 /**
20130  * The channel value
20131  */
20132 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20133
20134 /**
20135  * The amount to push to the counterparty as part of the open, in milli-satoshi
20136  */
20137 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20138
20139 /**
20140  * The amount to push to the counterparty as part of the open, in milli-satoshi
20141  */
20142 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20143
20144 /**
20145  * The threshold below which outputs on transactions broadcast by sender will be omitted
20146  */
20147 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20148
20149 /**
20150  * The threshold below which outputs on transactions broadcast by sender will be omitted
20151  */
20152 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20153
20154 /**
20155  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
20156  */
20157 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20158
20159 /**
20160  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
20161  */
20162 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20163
20164 /**
20165  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
20166  */
20167 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20168
20169 /**
20170  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
20171  */
20172 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20173
20174 /**
20175  * The minimum HTLC size incoming to sender, in milli-satoshi
20176  */
20177 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20178
20179 /**
20180  * The minimum HTLC size incoming to sender, in milli-satoshi
20181  */
20182 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20183
20184 /**
20185  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
20186  */
20187 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20188
20189 /**
20190  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
20191  */
20192 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
20193
20194 /**
20195  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
20196  */
20197 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20198
20199 /**
20200  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
20201  */
20202 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
20203
20204 /**
20205  * The maximum number of inbound HTLCs towards sender
20206  */
20207 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20208
20209 /**
20210  * The maximum number of inbound HTLCs towards sender
20211  */
20212 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
20213
20214 /**
20215  * The sender's key controlling the funding transaction
20216  */
20217 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20218
20219 /**
20220  * The sender's key controlling the funding transaction
20221  */
20222 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20223
20224 /**
20225  * Used to derive a revocation key for transactions broadcast by counterparty
20226  */
20227 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20228
20229 /**
20230  * Used to derive a revocation key for transactions broadcast by counterparty
20231  */
20232 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20233
20234 /**
20235  * A payment key to sender for transactions broadcast by counterparty
20236  */
20237 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20238
20239 /**
20240  * A payment key to sender for transactions broadcast by counterparty
20241  */
20242 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20243
20244 /**
20245  * Used to derive a payment key to sender for transactions broadcast by sender
20246  */
20247 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20248
20249 /**
20250  * Used to derive a payment key to sender for transactions broadcast by sender
20251  */
20252 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20253
20254 /**
20255  * Used to derive an HTLC payment key to sender
20256  */
20257 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20258
20259 /**
20260  * Used to derive an HTLC payment key to sender
20261  */
20262 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20263
20264 /**
20265  * The first to-be-broadcast-by-sender transaction's per commitment point
20266  */
20267 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20268
20269 /**
20270  * The first to-be-broadcast-by-sender transaction's per commitment point
20271  */
20272 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20273
20274 /**
20275  * Channel flags
20276  */
20277 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20278
20279 /**
20280  * Channel flags
20281  */
20282 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
20283
20284 /**
20285  * The channel type that this channel will represent. If none is set, we derive the channel
20286  * type from the intersection of our feature bits with our counterparty's feature bits from
20287  * the Init message.
20288  *
20289  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20290  */
20291 struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20292
20293 /**
20294  * The channel type that this channel will represent. If none is set, we derive the channel
20295  * type from the intersection of our feature bits with our counterparty's feature bits from
20296  * the Init message.
20297  *
20298  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20299  */
20300 void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
20301
20302 /**
20303  * Creates a copy of the OpenChannel
20304  */
20305 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
20306
20307 /**
20308  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
20309  */
20310 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
20311
20312 /**
20313  * A temporary channel ID, until the funding outpoint is announced
20314  */
20315 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
20316
20317 /**
20318  * A temporary channel ID, until the funding outpoint is announced
20319  */
20320 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20321
20322 /**
20323  * The threshold below which outputs on transactions broadcast by sender will be omitted
20324  */
20325 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20326
20327 /**
20328  * The threshold below which outputs on transactions broadcast by sender will be omitted
20329  */
20330 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
20331
20332 /**
20333  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
20334  */
20335 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20336
20337 /**
20338  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
20339  */
20340 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
20341
20342 /**
20343  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
20344  */
20345 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20346
20347 /**
20348  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
20349  */
20350 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
20351
20352 /**
20353  * The minimum HTLC size incoming to sender, in milli-satoshi
20354  */
20355 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20356
20357 /**
20358  * The minimum HTLC size incoming to sender, in milli-satoshi
20359  */
20360 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
20361
20362 /**
20363  * Minimum depth of the funding transaction before the channel is considered open
20364  */
20365 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20366
20367 /**
20368  * Minimum depth of the funding transaction before the channel is considered open
20369  */
20370 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
20371
20372 /**
20373  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
20374  */
20375 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20376
20377 /**
20378  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
20379  */
20380 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
20381
20382 /**
20383  * The maximum number of inbound HTLCs towards sender
20384  */
20385 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20386
20387 /**
20388  * The maximum number of inbound HTLCs towards sender
20389  */
20390 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
20391
20392 /**
20393  * The sender's key controlling the funding transaction
20394  */
20395 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20396
20397 /**
20398  * The sender's key controlling the funding transaction
20399  */
20400 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20401
20402 /**
20403  * Used to derive a revocation key for transactions broadcast by counterparty
20404  */
20405 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20406
20407 /**
20408  * Used to derive a revocation key for transactions broadcast by counterparty
20409  */
20410 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20411
20412 /**
20413  * A payment key to sender for transactions broadcast by counterparty
20414  */
20415 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20416
20417 /**
20418  * A payment key to sender for transactions broadcast by counterparty
20419  */
20420 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20421
20422 /**
20423  * Used to derive a payment key to sender for transactions broadcast by sender
20424  */
20425 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20426
20427 /**
20428  * Used to derive a payment key to sender for transactions broadcast by sender
20429  */
20430 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20431
20432 /**
20433  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
20434  */
20435 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20436
20437 /**
20438  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
20439  */
20440 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20441
20442 /**
20443  * The first to-be-broadcast-by-sender transaction's per commitment point
20444  */
20445 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20446
20447 /**
20448  * The first to-be-broadcast-by-sender transaction's per commitment point
20449  */
20450 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20451
20452 /**
20453  * The channel type that this channel will represent. If none is set, we derive the channel
20454  * type from the intersection of our feature bits with our counterparty's feature bits from
20455  * the Init message.
20456  *
20457  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
20458  *
20459  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20460  */
20461 struct LDKChannelTypeFeatures AcceptChannel_get_channel_type(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20462
20463 /**
20464  * The channel type that this channel will represent. If none is set, we derive the channel
20465  * type from the intersection of our feature bits with our counterparty's feature bits from
20466  * the Init message.
20467  *
20468  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
20469  *
20470  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20471  */
20472 void AcceptChannel_set_channel_type(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
20473
20474 /**
20475  * Creates a copy of the AcceptChannel
20476  */
20477 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
20478
20479 /**
20480  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
20481  */
20482 void FundingCreated_free(struct LDKFundingCreated this_obj);
20483
20484 /**
20485  * A temporary channel ID, until the funding is established
20486  */
20487 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
20488
20489 /**
20490  * A temporary channel ID, until the funding is established
20491  */
20492 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20493
20494 /**
20495  * The funding transaction ID
20496  */
20497 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
20498
20499 /**
20500  * The funding transaction ID
20501  */
20502 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20503
20504 /**
20505  * The specific output index funding this channel
20506  */
20507 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
20508
20509 /**
20510  * The specific output index funding this channel
20511  */
20512 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
20513
20514 /**
20515  * The signature of the channel initiator (funder) on the initial commitment transaction
20516  */
20517 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
20518
20519 /**
20520  * The signature of the channel initiator (funder) on the initial commitment transaction
20521  */
20522 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
20523
20524 /**
20525  * Constructs a new FundingCreated given each field
20526  */
20527 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);
20528
20529 /**
20530  * Creates a copy of the FundingCreated
20531  */
20532 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
20533
20534 /**
20535  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
20536  */
20537 void FundingSigned_free(struct LDKFundingSigned this_obj);
20538
20539 /**
20540  * The channel ID
20541  */
20542 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
20543
20544 /**
20545  * The channel ID
20546  */
20547 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20548
20549 /**
20550  * The signature of the channel acceptor (fundee) on the initial commitment transaction
20551  */
20552 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
20553
20554 /**
20555  * The signature of the channel acceptor (fundee) on the initial commitment transaction
20556  */
20557 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
20558
20559 /**
20560  * Constructs a new FundingSigned given each field
20561  */
20562 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
20563
20564 /**
20565  * Creates a copy of the FundingSigned
20566  */
20567 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
20568
20569 /**
20570  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
20571  */
20572 void FundingLocked_free(struct LDKFundingLocked this_obj);
20573
20574 /**
20575  * The channel ID
20576  */
20577 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
20578
20579 /**
20580  * The channel ID
20581  */
20582 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20583
20584 /**
20585  * The per-commitment point of the second commitment transaction
20586  */
20587 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
20588
20589 /**
20590  * The per-commitment point of the second commitment transaction
20591  */
20592 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20593
20594 /**
20595  * Constructs a new FundingLocked given each field
20596  */
20597 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
20598
20599 /**
20600  * Creates a copy of the FundingLocked
20601  */
20602 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
20603
20604 /**
20605  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
20606  */
20607 void Shutdown_free(struct LDKShutdown this_obj);
20608
20609 /**
20610  * The channel ID
20611  */
20612 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
20613
20614 /**
20615  * The channel ID
20616  */
20617 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20618
20619 /**
20620  * The destination of this peer's funds on closing.
20621  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
20622  */
20623 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
20624
20625 /**
20626  * The destination of this peer's funds on closing.
20627  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
20628  */
20629 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
20630
20631 /**
20632  * Constructs a new Shutdown given each field
20633  */
20634 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
20635
20636 /**
20637  * Creates a copy of the Shutdown
20638  */
20639 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
20640
20641 /**
20642  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
20643  */
20644 void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
20645
20646 /**
20647  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
20648  * transaction.
20649  */
20650 uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
20651
20652 /**
20653  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
20654  * transaction.
20655  */
20656 void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
20657
20658 /**
20659  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
20660  * transaction.
20661  */
20662 uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
20663
20664 /**
20665  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
20666  * transaction.
20667  */
20668 void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
20669
20670 /**
20671  * Constructs a new ClosingSignedFeeRange given each field
20672  */
20673 MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
20674
20675 /**
20676  * Creates a copy of the ClosingSignedFeeRange
20677  */
20678 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
20679
20680 /**
20681  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
20682  */
20683 void ClosingSigned_free(struct LDKClosingSigned this_obj);
20684
20685 /**
20686  * The channel ID
20687  */
20688 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
20689
20690 /**
20691  * The channel ID
20692  */
20693 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20694
20695 /**
20696  * The proposed total fee for the closing transaction
20697  */
20698 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
20699
20700 /**
20701  * The proposed total fee for the closing transaction
20702  */
20703 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
20704
20705 /**
20706  * A signature on the closing transaction
20707  */
20708 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
20709
20710 /**
20711  * A signature on the closing transaction
20712  */
20713 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
20714
20715 /**
20716  * The minimum and maximum fees which the sender is willing to accept, provided only by new
20717  * nodes.
20718  *
20719  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20720  */
20721 struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
20722
20723 /**
20724  * The minimum and maximum fees which the sender is willing to accept, provided only by new
20725  * nodes.
20726  *
20727  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20728  */
20729 void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
20730
20731 /**
20732  * Constructs a new ClosingSigned given each field
20733  */
20734 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);
20735
20736 /**
20737  * Creates a copy of the ClosingSigned
20738  */
20739 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
20740
20741 /**
20742  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
20743  */
20744 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
20745
20746 /**
20747  * The channel ID
20748  */
20749 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
20750
20751 /**
20752  * The channel ID
20753  */
20754 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20755
20756 /**
20757  * The HTLC ID
20758  */
20759 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
20760
20761 /**
20762  * The HTLC ID
20763  */
20764 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
20765
20766 /**
20767  * The HTLC value in milli-satoshi
20768  */
20769 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
20770
20771 /**
20772  * The HTLC value in milli-satoshi
20773  */
20774 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
20775
20776 /**
20777  * The payment hash, the pre-image of which controls HTLC redemption
20778  */
20779 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
20780
20781 /**
20782  * The payment hash, the pre-image of which controls HTLC redemption
20783  */
20784 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20785
20786 /**
20787  * The expiry height of the HTLC
20788  */
20789 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
20790
20791 /**
20792  * The expiry height of the HTLC
20793  */
20794 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
20795
20796 /**
20797  * Creates a copy of the UpdateAddHTLC
20798  */
20799 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
20800
20801 /**
20802  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
20803  */
20804 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
20805
20806 /**
20807  * The channel ID
20808  */
20809 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
20810
20811 /**
20812  * The channel ID
20813  */
20814 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20815
20816 /**
20817  * The HTLC ID
20818  */
20819 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
20820
20821 /**
20822  * The HTLC ID
20823  */
20824 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
20825
20826 /**
20827  * The pre-image of the payment hash, allowing HTLC redemption
20828  */
20829 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
20830
20831 /**
20832  * The pre-image of the payment hash, allowing HTLC redemption
20833  */
20834 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20835
20836 /**
20837  * Constructs a new UpdateFulfillHTLC given each field
20838  */
20839 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
20840
20841 /**
20842  * Creates a copy of the UpdateFulfillHTLC
20843  */
20844 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
20845
20846 /**
20847  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
20848  */
20849 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
20850
20851 /**
20852  * The channel ID
20853  */
20854 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
20855
20856 /**
20857  * The channel ID
20858  */
20859 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20860
20861 /**
20862  * The HTLC ID
20863  */
20864 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
20865
20866 /**
20867  * The HTLC ID
20868  */
20869 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
20870
20871 /**
20872  * Creates a copy of the UpdateFailHTLC
20873  */
20874 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
20875
20876 /**
20877  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
20878  */
20879 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
20880
20881 /**
20882  * The channel ID
20883  */
20884 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
20885
20886 /**
20887  * The channel ID
20888  */
20889 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20890
20891 /**
20892  * The HTLC ID
20893  */
20894 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
20895
20896 /**
20897  * The HTLC ID
20898  */
20899 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
20900
20901 /**
20902  * The failure code
20903  */
20904 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
20905
20906 /**
20907  * The failure code
20908  */
20909 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
20910
20911 /**
20912  * Creates a copy of the UpdateFailMalformedHTLC
20913  */
20914 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
20915
20916 /**
20917  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
20918  */
20919 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
20920
20921 /**
20922  * The channel ID
20923  */
20924 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
20925
20926 /**
20927  * The channel ID
20928  */
20929 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20930
20931 /**
20932  * A signature on the commitment transaction
20933  */
20934 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
20935
20936 /**
20937  * A signature on the commitment transaction
20938  */
20939 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
20940
20941 /**
20942  * Signatures on the HTLC transactions
20943  */
20944 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
20945
20946 /**
20947  * Constructs a new CommitmentSigned given each field
20948  */
20949 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
20950
20951 /**
20952  * Creates a copy of the CommitmentSigned
20953  */
20954 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
20955
20956 /**
20957  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
20958  */
20959 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
20960
20961 /**
20962  * The channel ID
20963  */
20964 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
20965
20966 /**
20967  * The channel ID
20968  */
20969 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20970
20971 /**
20972  * The secret corresponding to the per-commitment point
20973  */
20974 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
20975
20976 /**
20977  * The secret corresponding to the per-commitment point
20978  */
20979 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20980
20981 /**
20982  * The next sender-broadcast commitment transaction's per-commitment point
20983  */
20984 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
20985
20986 /**
20987  * The next sender-broadcast commitment transaction's per-commitment point
20988  */
20989 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20990
20991 /**
20992  * Constructs a new RevokeAndACK given each field
20993  */
20994 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);
20995
20996 /**
20997  * Creates a copy of the RevokeAndACK
20998  */
20999 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
21000
21001 /**
21002  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
21003  */
21004 void UpdateFee_free(struct LDKUpdateFee this_obj);
21005
21006 /**
21007  * The channel ID
21008  */
21009 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
21010
21011 /**
21012  * The channel ID
21013  */
21014 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21015
21016 /**
21017  * Fee rate per 1000-weight of the transaction
21018  */
21019 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
21020
21021 /**
21022  * Fee rate per 1000-weight of the transaction
21023  */
21024 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
21025
21026 /**
21027  * Constructs a new UpdateFee given each field
21028  */
21029 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
21030
21031 /**
21032  * Creates a copy of the UpdateFee
21033  */
21034 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
21035
21036 /**
21037  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
21038  */
21039 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
21040
21041 /**
21042  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
21043  * belonging to the recipient
21044  */
21045 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
21046
21047 /**
21048  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
21049  * belonging to the recipient
21050  */
21051 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21052
21053 /**
21054  * The sender's per-commitment point for their current commitment transaction
21055  */
21056 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
21057
21058 /**
21059  * The sender's per-commitment point for their current commitment transaction
21060  */
21061 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21062
21063 /**
21064  * Constructs a new DataLossProtect given each field
21065  */
21066 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
21067
21068 /**
21069  * Creates a copy of the DataLossProtect
21070  */
21071 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
21072
21073 /**
21074  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
21075  */
21076 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
21077
21078 /**
21079  * The channel ID
21080  */
21081 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
21082
21083 /**
21084  * The channel ID
21085  */
21086 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21087
21088 /**
21089  * The next commitment number for the sender
21090  */
21091 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
21092
21093 /**
21094  * The next commitment number for the sender
21095  */
21096 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
21097
21098 /**
21099  * The next commitment number for the recipient
21100  */
21101 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
21102
21103 /**
21104  * The next commitment number for the recipient
21105  */
21106 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
21107
21108 /**
21109  * Creates a copy of the ChannelReestablish
21110  */
21111 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
21112
21113 /**
21114  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
21115  */
21116 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
21117
21118 /**
21119  * The channel ID
21120  */
21121 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
21122
21123 /**
21124  * The channel ID
21125  */
21126 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21127
21128 /**
21129  * The short channel ID
21130  */
21131 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
21132
21133 /**
21134  * The short channel ID
21135  */
21136 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
21137
21138 /**
21139  * A signature by the node key
21140  */
21141 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
21142
21143 /**
21144  * A signature by the node key
21145  */
21146 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
21147
21148 /**
21149  * A signature by the funding key
21150  */
21151 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
21152
21153 /**
21154  * A signature by the funding key
21155  */
21156 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
21157
21158 /**
21159  * Constructs a new AnnouncementSignatures given each field
21160  */
21161 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);
21162
21163 /**
21164  * Creates a copy of the AnnouncementSignatures
21165  */
21166 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
21167
21168 /**
21169  * Frees any resources used by the NetAddress
21170  */
21171 void NetAddress_free(struct LDKNetAddress this_ptr);
21172
21173 /**
21174  * Creates a copy of the NetAddress
21175  */
21176 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
21177
21178 /**
21179  * Utility method to constructs a new IPv4-variant NetAddress
21180  */
21181 struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port);
21182
21183 /**
21184  * Utility method to constructs a new IPv6-variant NetAddress
21185  */
21186 struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port);
21187
21188 /**
21189  * Utility method to constructs a new OnionV2-variant NetAddress
21190  */
21191 struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a);
21192
21193 /**
21194  * Utility method to constructs a new OnionV3-variant NetAddress
21195  */
21196 struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port);
21197
21198 /**
21199  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
21200  */
21201 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
21202
21203 /**
21204  * Read a NetAddress from a byte array, created by NetAddress_write
21205  */
21206 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
21207
21208 /**
21209  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
21210  */
21211 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
21212
21213 /**
21214  * The advertised features
21215  */
21216 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
21217
21218 /**
21219  * The advertised features
21220  */
21221 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
21222
21223 /**
21224  * A strictly monotonic announcement counter, with gaps allowed
21225  */
21226 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
21227
21228 /**
21229  * A strictly monotonic announcement counter, with gaps allowed
21230  */
21231 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
21232
21233 /**
21234  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
21235  * to this node).
21236  */
21237 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
21238
21239 /**
21240  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
21241  * to this node).
21242  */
21243 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21244
21245 /**
21246  * An RGB color for UI purposes
21247  */
21248 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
21249
21250 /**
21251  * An RGB color for UI purposes
21252  */
21253 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
21254
21255 /**
21256  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
21257  * of uniqueness.
21258  */
21259 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
21260
21261 /**
21262  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
21263  * of uniqueness.
21264  */
21265 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21266
21267 /**
21268  * List of addresses on which this node is reachable
21269  */
21270 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
21271
21272 /**
21273  * Creates a copy of the UnsignedNodeAnnouncement
21274  */
21275 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
21276
21277 /**
21278  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
21279  */
21280 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
21281
21282 /**
21283  * The signature by the node key
21284  */
21285 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
21286
21287 /**
21288  * The signature by the node key
21289  */
21290 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
21291
21292 /**
21293  * The actual content of the announcement
21294  */
21295 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
21296
21297 /**
21298  * The actual content of the announcement
21299  */
21300 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
21301
21302 /**
21303  * Constructs a new NodeAnnouncement given each field
21304  */
21305 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
21306
21307 /**
21308  * Creates a copy of the NodeAnnouncement
21309  */
21310 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
21311
21312 /**
21313  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
21314  */
21315 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
21316
21317 /**
21318  * The advertised channel features
21319  */
21320 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21321
21322 /**
21323  * The advertised channel features
21324  */
21325 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
21326
21327 /**
21328  * The genesis hash of the blockchain where the channel is to be opened
21329  */
21330 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
21331
21332 /**
21333  * The genesis hash of the blockchain where the channel is to be opened
21334  */
21335 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21336
21337 /**
21338  * The short channel ID
21339  */
21340 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21341
21342 /**
21343  * The short channel ID
21344  */
21345 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
21346
21347 /**
21348  * One of the two node_ids which are endpoints of this channel
21349  */
21350 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21351
21352 /**
21353  * One of the two node_ids which are endpoints of this channel
21354  */
21355 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21356
21357 /**
21358  * The other of the two node_ids which are endpoints of this channel
21359  */
21360 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21361
21362 /**
21363  * The other of the two node_ids which are endpoints of this channel
21364  */
21365 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21366
21367 /**
21368  * The funding key for the first node
21369  */
21370 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21371
21372 /**
21373  * The funding key for the first node
21374  */
21375 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21376
21377 /**
21378  * The funding key for the second node
21379  */
21380 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21381
21382 /**
21383  * The funding key for the second node
21384  */
21385 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21386
21387 /**
21388  * Creates a copy of the UnsignedChannelAnnouncement
21389  */
21390 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
21391
21392 /**
21393  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
21394  */
21395 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
21396
21397 /**
21398  * Authentication of the announcement by the first public node
21399  */
21400 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
21401
21402 /**
21403  * Authentication of the announcement by the first public node
21404  */
21405 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
21406
21407 /**
21408  * Authentication of the announcement by the second public node
21409  */
21410 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
21411
21412 /**
21413  * Authentication of the announcement by the second public node
21414  */
21415 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
21416
21417 /**
21418  * Proof of funding UTXO ownership by the first public node
21419  */
21420 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
21421
21422 /**
21423  * Proof of funding UTXO ownership by the first public node
21424  */
21425 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
21426
21427 /**
21428  * Proof of funding UTXO ownership by the second public node
21429  */
21430 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
21431
21432 /**
21433  * Proof of funding UTXO ownership by the second public node
21434  */
21435 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
21436
21437 /**
21438  * The actual announcement
21439  */
21440 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
21441
21442 /**
21443  * The actual announcement
21444  */
21445 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
21446
21447 /**
21448  * Constructs a new ChannelAnnouncement given each field
21449  */
21450 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);
21451
21452 /**
21453  * Creates a copy of the ChannelAnnouncement
21454  */
21455 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
21456
21457 /**
21458  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
21459  */
21460 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
21461
21462 /**
21463  * The genesis hash of the blockchain where the channel is to be opened
21464  */
21465 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
21466
21467 /**
21468  * The genesis hash of the blockchain where the channel is to be opened
21469  */
21470 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21471
21472 /**
21473  * The short channel ID
21474  */
21475 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21476
21477 /**
21478  * The short channel ID
21479  */
21480 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
21481
21482 /**
21483  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
21484  */
21485 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21486
21487 /**
21488  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
21489  */
21490 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
21491
21492 /**
21493  * Channel flags
21494  */
21495 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21496
21497 /**
21498  * Channel flags
21499  */
21500 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
21501
21502 /**
21503  * The number of blocks such that if:
21504  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
21505  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
21506  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
21507  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
21508  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
21509  * forwarding. Note that the HTLC sender is the one who originally sets this value when
21510  * constructing the route.
21511  */
21512 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21513
21514 /**
21515  * The number of blocks such that if:
21516  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
21517  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
21518  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
21519  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
21520  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
21521  * forwarding. Note that the HTLC sender is the one who originally sets this value when
21522  * constructing the route.
21523  */
21524 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
21525
21526 /**
21527  * The minimum HTLC size incoming to sender, in milli-satoshi
21528  */
21529 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21530
21531 /**
21532  * The minimum HTLC size incoming to sender, in milli-satoshi
21533  */
21534 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
21535
21536 /**
21537  * The base HTLC fee charged by sender, in milli-satoshi
21538  */
21539 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21540
21541 /**
21542  * The base HTLC fee charged by sender, in milli-satoshi
21543  */
21544 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
21545
21546 /**
21547  * The amount to fee multiplier, in micro-satoshi
21548  */
21549 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21550
21551 /**
21552  * The amount to fee multiplier, in micro-satoshi
21553  */
21554 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
21555
21556 /**
21557  * Creates a copy of the UnsignedChannelUpdate
21558  */
21559 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
21560
21561 /**
21562  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
21563  */
21564 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
21565
21566 /**
21567  * A signature of the channel update
21568  */
21569 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
21570
21571 /**
21572  * A signature of the channel update
21573  */
21574 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
21575
21576 /**
21577  * The actual channel update
21578  */
21579 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
21580
21581 /**
21582  * The actual channel update
21583  */
21584 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
21585
21586 /**
21587  * Constructs a new ChannelUpdate given each field
21588  */
21589 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
21590
21591 /**
21592  * Creates a copy of the ChannelUpdate
21593  */
21594 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
21595
21596 /**
21597  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
21598  */
21599 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
21600
21601 /**
21602  * The genesis hash of the blockchain being queried
21603  */
21604 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
21605
21606 /**
21607  * The genesis hash of the blockchain being queried
21608  */
21609 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21610
21611 /**
21612  * The height of the first block for the channel UTXOs being queried
21613  */
21614 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
21615
21616 /**
21617  * The height of the first block for the channel UTXOs being queried
21618  */
21619 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
21620
21621 /**
21622  * The number of blocks to include in the query results
21623  */
21624 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
21625
21626 /**
21627  * The number of blocks to include in the query results
21628  */
21629 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
21630
21631 /**
21632  * Constructs a new QueryChannelRange given each field
21633  */
21634 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
21635
21636 /**
21637  * Creates a copy of the QueryChannelRange
21638  */
21639 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
21640
21641 /**
21642  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
21643  */
21644 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
21645
21646 /**
21647  * The genesis hash of the blockchain being queried
21648  */
21649 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
21650
21651 /**
21652  * The genesis hash of the blockchain being queried
21653  */
21654 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21655
21656 /**
21657  * The height of the first block in the range of the reply
21658  */
21659 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
21660
21661 /**
21662  * The height of the first block in the range of the reply
21663  */
21664 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
21665
21666 /**
21667  * The number of blocks included in the range of the reply
21668  */
21669 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
21670
21671 /**
21672  * The number of blocks included in the range of the reply
21673  */
21674 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
21675
21676 /**
21677  * True when this is the final reply for a query
21678  */
21679 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
21680
21681 /**
21682  * True when this is the final reply for a query
21683  */
21684 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
21685
21686 /**
21687  * The short_channel_ids in the channel range
21688  */
21689 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
21690
21691 /**
21692  * Constructs a new ReplyChannelRange given each field
21693  */
21694 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);
21695
21696 /**
21697  * Creates a copy of the ReplyChannelRange
21698  */
21699 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
21700
21701 /**
21702  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
21703  */
21704 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
21705
21706 /**
21707  * The genesis hash of the blockchain being queried
21708  */
21709 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
21710
21711 /**
21712  * The genesis hash of the blockchain being queried
21713  */
21714 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21715
21716 /**
21717  * The short_channel_ids that are being queried
21718  */
21719 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
21720
21721 /**
21722  * Constructs a new QueryShortChannelIds given each field
21723  */
21724 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
21725
21726 /**
21727  * Creates a copy of the QueryShortChannelIds
21728  */
21729 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
21730
21731 /**
21732  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
21733  */
21734 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
21735
21736 /**
21737  * The genesis hash of the blockchain that was queried
21738  */
21739 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
21740
21741 /**
21742  * The genesis hash of the blockchain that was queried
21743  */
21744 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21745
21746 /**
21747  * Indicates if the query recipient maintains up-to-date channel
21748  * information for the chain_hash
21749  */
21750 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
21751
21752 /**
21753  * Indicates if the query recipient maintains up-to-date channel
21754  * information for the chain_hash
21755  */
21756 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
21757
21758 /**
21759  * Constructs a new ReplyShortChannelIdsEnd given each field
21760  */
21761 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
21762
21763 /**
21764  * Creates a copy of the ReplyShortChannelIdsEnd
21765  */
21766 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
21767
21768 /**
21769  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
21770  */
21771 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
21772
21773 /**
21774  * The genesis hash of the blockchain for channel and node information
21775  */
21776 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
21777
21778 /**
21779  * The genesis hash of the blockchain for channel and node information
21780  */
21781 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21782
21783 /**
21784  * The starting unix timestamp
21785  */
21786 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
21787
21788 /**
21789  * The starting unix timestamp
21790  */
21791 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
21792
21793 /**
21794  * The range of information in seconds
21795  */
21796 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
21797
21798 /**
21799  * The range of information in seconds
21800  */
21801 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
21802
21803 /**
21804  * Constructs a new GossipTimestampFilter given each field
21805  */
21806 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
21807
21808 /**
21809  * Creates a copy of the GossipTimestampFilter
21810  */
21811 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
21812
21813 /**
21814  * Frees any resources used by the ErrorAction
21815  */
21816 void ErrorAction_free(struct LDKErrorAction this_ptr);
21817
21818 /**
21819  * Creates a copy of the ErrorAction
21820  */
21821 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
21822
21823 /**
21824  * Utility method to constructs a new DisconnectPeer-variant ErrorAction
21825  */
21826 struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg);
21827
21828 /**
21829  * Utility method to constructs a new IgnoreError-variant ErrorAction
21830  */
21831 struct LDKErrorAction ErrorAction_ignore_error(void);
21832
21833 /**
21834  * Utility method to constructs a new IgnoreAndLog-variant ErrorAction
21835  */
21836 struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
21837
21838 /**
21839  * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction
21840  */
21841 struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void);
21842
21843 /**
21844  * Utility method to constructs a new SendErrorMessage-variant ErrorAction
21845  */
21846 struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg);
21847
21848 /**
21849  * Utility method to constructs a new SendWarningMessage-variant ErrorAction
21850  */
21851 struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level);
21852
21853 /**
21854  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
21855  */
21856 void LightningError_free(struct LDKLightningError this_obj);
21857
21858 /**
21859  * A human-readable message describing the error
21860  */
21861 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
21862
21863 /**
21864  * A human-readable message describing the error
21865  */
21866 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
21867
21868 /**
21869  * The action which should be taken against the offending peer.
21870  */
21871 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
21872
21873 /**
21874  * The action which should be taken against the offending peer.
21875  */
21876 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
21877
21878 /**
21879  * Constructs a new LightningError given each field
21880  */
21881 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
21882
21883 /**
21884  * Creates a copy of the LightningError
21885  */
21886 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
21887
21888 /**
21889  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
21890  */
21891 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
21892
21893 /**
21894  * update_add_htlc messages which should be sent
21895  */
21896 struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
21897
21898 /**
21899  * update_add_htlc messages which should be sent
21900  */
21901 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
21902
21903 /**
21904  * update_fulfill_htlc messages which should be sent
21905  */
21906 struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
21907
21908 /**
21909  * update_fulfill_htlc messages which should be sent
21910  */
21911 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
21912
21913 /**
21914  * update_fail_htlc messages which should be sent
21915  */
21916 struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
21917
21918 /**
21919  * update_fail_htlc messages which should be sent
21920  */
21921 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
21922
21923 /**
21924  * update_fail_malformed_htlc messages which should be sent
21925  */
21926 struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
21927
21928 /**
21929  * update_fail_malformed_htlc messages which should be sent
21930  */
21931 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
21932
21933 /**
21934  * An update_fee message which should be sent
21935  *
21936  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21937  */
21938 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
21939
21940 /**
21941  * An update_fee message which should be sent
21942  *
21943  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21944  */
21945 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
21946
21947 /**
21948  * Finally, the commitment_signed message which should be sent
21949  */
21950 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
21951
21952 /**
21953  * Finally, the commitment_signed message which should be sent
21954  */
21955 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
21956
21957 /**
21958  * Constructs a new CommitmentUpdate given each field
21959  */
21960 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);
21961
21962 /**
21963  * Creates a copy of the CommitmentUpdate
21964  */
21965 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
21966
21967 /**
21968  * Calls the free function if one is set
21969  */
21970 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
21971
21972 /**
21973  * Calls the free function if one is set
21974  */
21975 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
21976
21977 /**
21978  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
21979  */
21980 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
21981
21982 /**
21983  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
21984  */
21985 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
21986
21987 /**
21988  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
21989  */
21990 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
21991
21992 /**
21993  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
21994  */
21995 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
21996
21997 /**
21998  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
21999  */
22000 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
22001
22002 /**
22003  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
22004  */
22005 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
22006
22007 /**
22008  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
22009  */
22010 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
22011
22012 /**
22013  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
22014  */
22015 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
22016
22017 /**
22018  * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
22019  */
22020 struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
22021
22022 /**
22023  * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
22024  */
22025 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
22026
22027 /**
22028  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
22029  */
22030 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
22031
22032 /**
22033  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
22034  */
22035 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
22036
22037 /**
22038  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
22039  */
22040 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
22041
22042 /**
22043  * Read a FundingCreated from a byte array, created by FundingCreated_write
22044  */
22045 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
22046
22047 /**
22048  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
22049  */
22050 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
22051
22052 /**
22053  * Read a FundingSigned from a byte array, created by FundingSigned_write
22054  */
22055 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
22056
22057 /**
22058  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
22059  */
22060 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
22061
22062 /**
22063  * Read a FundingLocked from a byte array, created by FundingLocked_write
22064  */
22065 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
22066
22067 /**
22068  * Serialize the Init object into a byte array which can be read by Init_read
22069  */
22070 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
22071
22072 /**
22073  * Read a Init from a byte array, created by Init_write
22074  */
22075 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
22076
22077 /**
22078  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
22079  */
22080 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
22081
22082 /**
22083  * Read a OpenChannel from a byte array, created by OpenChannel_write
22084  */
22085 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
22086
22087 /**
22088  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
22089  */
22090 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
22091
22092 /**
22093  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
22094  */
22095 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
22096
22097 /**
22098  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
22099  */
22100 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
22101
22102 /**
22103  * Read a Shutdown from a byte array, created by Shutdown_write
22104  */
22105 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
22106
22107 /**
22108  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
22109  */
22110 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
22111
22112 /**
22113  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
22114  */
22115 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
22116
22117 /**
22118  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
22119  */
22120 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
22121
22122 /**
22123  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
22124  */
22125 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
22126
22127 /**
22128  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
22129  */
22130 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
22131
22132 /**
22133  * Read a UpdateFee from a byte array, created by UpdateFee_write
22134  */
22135 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
22136
22137 /**
22138  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
22139  */
22140 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
22141
22142 /**
22143  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
22144  */
22145 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
22146
22147 /**
22148  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
22149  */
22150 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
22151
22152 /**
22153  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
22154  */
22155 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
22156
22157 /**
22158  * Serialize the Ping object into a byte array which can be read by Ping_read
22159  */
22160 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
22161
22162 /**
22163  * Read a Ping from a byte array, created by Ping_write
22164  */
22165 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
22166
22167 /**
22168  * Serialize the Pong object into a byte array which can be read by Pong_read
22169  */
22170 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
22171
22172 /**
22173  * Read a Pong from a byte array, created by Pong_write
22174  */
22175 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
22176
22177 /**
22178  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
22179  */
22180 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
22181
22182 /**
22183  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
22184  */
22185 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
22186
22187 /**
22188  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
22189  */
22190 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
22191
22192 /**
22193  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
22194  */
22195 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
22196
22197 /**
22198  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
22199  */
22200 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
22201
22202 /**
22203  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
22204  */
22205 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
22206
22207 /**
22208  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
22209  */
22210 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
22211
22212 /**
22213  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
22214  */
22215 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
22216
22217 /**
22218  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
22219  */
22220 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
22221
22222 /**
22223  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
22224  */
22225 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
22226
22227 /**
22228  * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read
22229  */
22230 struct LDKCVec_u8Z WarningMessage_write(const struct LDKWarningMessage *NONNULL_PTR obj);
22231
22232 /**
22233  * Read a WarningMessage from a byte array, created by WarningMessage_write
22234  */
22235 struct LDKCResult_WarningMessageDecodeErrorZ WarningMessage_read(struct LDKu8slice ser);
22236
22237 /**
22238  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
22239  */
22240 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
22241
22242 /**
22243  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
22244  */
22245 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
22246
22247 /**
22248  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
22249  */
22250 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
22251
22252 /**
22253  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
22254  */
22255 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
22256
22257 /**
22258  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
22259  */
22260 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
22261
22262 /**
22263  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
22264  */
22265 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
22266
22267 /**
22268  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
22269  */
22270 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
22271
22272 /**
22273  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
22274  */
22275 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
22276
22277 /**
22278  *\n\t * Calculates the overflow safe ending block height for the query.\n\t * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`\n\t
22279  */
22280 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
22281
22282 /**
22283  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
22284  */
22285 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
22286
22287 /**
22288  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
22289  */
22290 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
22291
22292 /**
22293  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
22294  */
22295 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
22296
22297 /**
22298  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
22299  */
22300 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
22301
22302 /**
22303  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
22304  */
22305 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
22306
22307 /**
22308  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
22309  */
22310 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
22311
22312 /**
22313  * Calls the free function if one is set
22314  */
22315 void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
22316
22317 /**
22318  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
22319  */
22320 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
22321
22322 /**
22323  * Constructs a new IgnoringMessageHandler given each field
22324  */
22325 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
22326
22327 /**
22328  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
22329  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
22330  */
22331 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
22332
22333 /**
22334  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
22335  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
22336  */
22337 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
22338
22339 /**
22340  * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
22341  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
22342  */
22343 struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
22344
22345 /**
22346  * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg.
22347  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is
22348  */
22349 struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
22350
22351 /**
22352  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
22353  */
22354 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
22355
22356 /**
22357  * Constructs a new ErroringMessageHandler
22358  */
22359 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
22360
22361 /**
22362  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
22363  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
22364  */
22365 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
22366
22367 /**
22368  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
22369  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
22370  */
22371 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
22372
22373 /**
22374  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
22375  */
22376 void MessageHandler_free(struct LDKMessageHandler this_obj);
22377
22378 /**
22379  * A message handler which handles messages specific to channels. Usually this is just a
22380  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
22381  *
22382  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
22383  */
22384 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
22385
22386 /**
22387  * A message handler which handles messages specific to channels. Usually this is just a
22388  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
22389  *
22390  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
22391  */
22392 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
22393
22394 /**
22395  * A message handler which handles messages updating our knowledge of the network channel
22396  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
22397  * [`IgnoringMessageHandler`].
22398  *
22399  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
22400  */
22401 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
22402
22403 /**
22404  * A message handler which handles messages updating our knowledge of the network channel
22405  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
22406  * [`IgnoringMessageHandler`].
22407  *
22408  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
22409  */
22410 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
22411
22412 /**
22413  * Constructs a new MessageHandler given each field
22414  */
22415 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
22416
22417 /**
22418  * Creates a copy of a SocketDescriptor
22419  */
22420 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
22421
22422 /**
22423  * Calls the free function if one is set
22424  */
22425 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
22426
22427 /**
22428  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
22429  */
22430 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
22431
22432 /**
22433  * Used to indicate that we probably can't make any future connections to this peer, implying
22434  * we should go ahead and force-close any channels we have with it.
22435  */
22436 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
22437
22438 /**
22439  * Used to indicate that we probably can't make any future connections to this peer, implying
22440  * we should go ahead and force-close any channels we have with it.
22441  */
22442 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
22443
22444 /**
22445  * Constructs a new PeerHandleError given each field
22446  */
22447 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
22448
22449 /**
22450  * Creates a copy of the PeerHandleError
22451  */
22452 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
22453
22454 /**
22455  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
22456  */
22457 void PeerManager_free(struct LDKPeerManager this_obj);
22458
22459 /**
22460  * Constructs a new PeerManager with the given message handlers and node_id secret key
22461  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
22462  * cryptographically secure random bytes.
22463  */
22464 MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, struct LDKSecretKey our_node_secret, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger, struct LDKCustomMessageHandler custom_message_handler);
22465
22466 /**
22467  * Get the list of node ids for peers which have completed the initial handshake.
22468  *
22469  * For outbound connections, this will be the same as the their_node_id parameter passed in to
22470  * new_outbound_connection, however entries will only appear once the initial handshake has
22471  * completed and we are sure the remote peer has the private key for the given node_id.
22472  */
22473 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
22474
22475 /**
22476  * Indicates a new outbound connection has been established to a node with the given node_id.
22477  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
22478  * descriptor but must disconnect the connection immediately.
22479  *
22480  * Returns a small number of bytes to send to the remote node (currently always 50).
22481  *
22482  * Panics if descriptor is duplicative with some other descriptor which has not yet been
22483  * [`socket_disconnected()`].
22484  *
22485  * [`socket_disconnected()`]: PeerManager::socket_disconnected
22486  */
22487 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);
22488
22489 /**
22490  * Indicates a new inbound connection has been established.
22491  *
22492  * May refuse the connection by returning an Err, but will never write bytes to the remote end
22493  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
22494  * call socket_disconnected for the new descriptor but must disconnect the connection
22495  * immediately.
22496  *
22497  * Panics if descriptor is duplicative with some other descriptor which has not yet been
22498  * [`socket_disconnected()`].
22499  *
22500  * [`socket_disconnected()`]: PeerManager::socket_disconnected
22501  */
22502 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
22503
22504 /**
22505  * Indicates that there is room to write data to the given socket descriptor.
22506  *
22507  * May return an Err to indicate that the connection should be closed.
22508  *
22509  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
22510  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
22511  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
22512  * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't
22513  * sufficient!
22514  *
22515  * [`send_data`]: SocketDescriptor::send_data
22516  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
22517  */
22518 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
22519
22520 /**
22521  * Indicates that data was read from the given socket descriptor.
22522  *
22523  * May return an Err to indicate that the connection should be closed.
22524  *
22525  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
22526  * Thus, however, you should call [`process_events`] after any `read_event` to generate
22527  * [`send_data`] calls to handle responses.
22528  *
22529  * If `Ok(true)` is returned, further read_events should not be triggered until a
22530  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
22531  * send buffer).
22532  *
22533  * [`send_data`]: SocketDescriptor::send_data
22534  * [`process_events`]: PeerManager::process_events
22535  */
22536 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);
22537
22538 /**
22539  * Checks for any events generated by our handlers and processes them. Includes sending most
22540  * response messages as well as messages generated by calls to handler functions directly (eg
22541  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
22542  *
22543  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
22544  * issues!
22545  *
22546  * You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
22547  * or one of the other clients provided in our language bindings.
22548  *
22549  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
22550  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
22551  * [`send_data`]: SocketDescriptor::send_data
22552  */
22553 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
22554
22555 /**
22556  * Indicates that the given socket descriptor's connection is now closed.
22557  */
22558 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
22559
22560 /**
22561  * Disconnect a peer given its node id.
22562  *
22563  * Set `no_connection_possible` to true to prevent any further connection with this peer,
22564  * force-closing any channels we have with it.
22565  *
22566  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
22567  * peer. Thus, be very careful about reentrancy issues.
22568  *
22569  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
22570  */
22571 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
22572
22573 /**
22574  * Disconnects all currently-connected peers. This is useful on platforms where there may be
22575  * an indication that TCP sockets have stalled even if we weren't around to time them out
22576  * using regular ping/pongs.
22577  */
22578 void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg);
22579
22580 /**
22581  * Send pings to each peer and disconnect those which did not respond to the last round of
22582  * pings.
22583  *
22584  * This may be called on any timescale you want, however, roughly once every five to ten
22585  * seconds is preferred. The call rate determines both how often we send a ping to our peers
22586  * and how much time they have to respond before we disconnect them.
22587  *
22588  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
22589  * issues!
22590  *
22591  * [`send_data`]: SocketDescriptor::send_data
22592  */
22593 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
22594
22595 /**
22596  * Gets the weight for an HTLC-Success transaction.
22597  */
22598 uint64_t htlc_success_tx_weight(bool opt_anchors);
22599
22600 /**
22601  * Gets the weight for an HTLC-Timeout transaction.
22602  */
22603 uint64_t htlc_timeout_tx_weight(bool opt_anchors);
22604
22605 /**
22606  * Build the commitment secret from the seed and the commitment number
22607  */
22608 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
22609
22610 /**
22611  * Build a closing transaction
22612  */
22613 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);
22614
22615 /**
22616  * Frees any resources used by the CounterpartyCommitmentSecrets, if is_owned is set and inner is non-NULL.
22617  */
22618 void CounterpartyCommitmentSecrets_free(struct LDKCounterpartyCommitmentSecrets this_obj);
22619
22620 /**
22621  * Creates a copy of the CounterpartyCommitmentSecrets
22622  */
22623 struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_clone(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR orig);
22624
22625 /**
22626  * Creates a new empty `CounterpartyCommitmentSecrets` structure.
22627  */
22628 MUST_USE_RES struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_new(void);
22629
22630 /**
22631  * Returns the minimum index of all stored secrets. Note that indexes start
22632  * at 1 << 48 and get decremented by one for each new secret.
22633  */
22634 MUST_USE_RES uint64_t CounterpartyCommitmentSecrets_get_min_seen_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg);
22635
22636 /**
22637  * Inserts the `secret` at `idx`. Returns `Ok(())` if the secret
22638  * was generated in accordance with BOLT 3 and is consistent with previous secrets.
22639  */
22640 MUST_USE_RES struct LDKCResult_NoneNoneZ CounterpartyCommitmentSecrets_provide_secret(struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx, struct LDKThirtyTwoBytes secret);
22641
22642 /**
22643  * Returns the secret at `idx`.
22644  * Returns `None` if `idx` is < [`CounterpartyCommitmentSecrets::get_min_seen_secret`].
22645  *
22646  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22647  */
22648 MUST_USE_RES struct LDKThirtyTwoBytes CounterpartyCommitmentSecrets_get_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx);
22649
22650 /**
22651  * Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read
22652  */
22653 struct LDKCVec_u8Z CounterpartyCommitmentSecrets_write(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR obj);
22654
22655 /**
22656  * Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write
22657  */
22658 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitmentSecrets_read(struct LDKu8slice ser);
22659
22660 /**
22661  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
22662  * from the base secret and the per_commitment_point.
22663  *
22664  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
22665  * generated (ie our own).
22666  */
22667 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
22668
22669 /**
22670  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
22671  * from the base point and the per_commitment_key. This is the public equivalent of
22672  * derive_private_key - using only public keys to derive a public key instead of private keys.
22673  *
22674  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
22675  * generated (ie our own).
22676  */
22677 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
22678
22679 /**
22680  * Derives a per-commitment-transaction revocation key from its constituent parts.
22681  *
22682  * Only the cheating participant owns a valid witness to propagate a revoked
22683  * commitment transaction, thus per_commitment_secret always come from cheater
22684  * and revocation_base_secret always come from punisher, which is the broadcaster
22685  * of the transaction spending with this key knowledge.
22686  *
22687  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
22688  * generated (ie our own).
22689  */
22690 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
22691
22692 /**
22693  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
22694  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
22695  * public key instead of private keys.
22696  *
22697  * Only the cheating participant owns a valid witness to propagate a revoked
22698  * commitment transaction, thus per_commitment_point always come from cheater
22699  * and revocation_base_point always come from punisher, which is the broadcaster
22700  * of the transaction spending with this key knowledge.
22701  *
22702  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
22703  * generated (ie our own).
22704  */
22705 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
22706
22707 /**
22708  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
22709  */
22710 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
22711
22712 /**
22713  * The broadcaster's per-commitment public key which was used to derive the other keys.
22714  */
22715 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
22716
22717 /**
22718  * The broadcaster's per-commitment public key which was used to derive the other keys.
22719  */
22720 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22721
22722 /**
22723  * The revocation key which is used to allow the broadcaster of the commitment
22724  * transaction to provide their counterparty the ability to punish them if they broadcast
22725  * an old state.
22726  */
22727 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
22728
22729 /**
22730  * The revocation key which is used to allow the broadcaster of the commitment
22731  * transaction to provide their counterparty the ability to punish them if they broadcast
22732  * an old state.
22733  */
22734 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22735
22736 /**
22737  * Broadcaster's HTLC Key
22738  */
22739 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
22740
22741 /**
22742  * Broadcaster's HTLC Key
22743  */
22744 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22745
22746 /**
22747  * Countersignatory's HTLC Key
22748  */
22749 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
22750
22751 /**
22752  * Countersignatory's HTLC Key
22753  */
22754 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22755
22756 /**
22757  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
22758  */
22759 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
22760
22761 /**
22762  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
22763  */
22764 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22765
22766 /**
22767  * Constructs a new TxCreationKeys given each field
22768  */
22769 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);
22770
22771 /**
22772  * Creates a copy of the TxCreationKeys
22773  */
22774 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
22775
22776 /**
22777  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
22778  */
22779 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
22780
22781 /**
22782  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
22783  */
22784 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
22785
22786 /**
22787  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
22788  */
22789 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
22790
22791 /**
22792  * The public key which is used to sign all commitment transactions, as it appears in the
22793  * on-chain channel lock-in 2-of-2 multisig output.
22794  */
22795 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
22796
22797 /**
22798  * The public key which is used to sign all commitment transactions, as it appears in the
22799  * on-chain channel lock-in 2-of-2 multisig output.
22800  */
22801 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22802
22803 /**
22804  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
22805  * revocation keys. This is combined with the per-commitment-secret generated by the
22806  * counterparty to create a secret which the counterparty can reveal to revoke previous
22807  * states.
22808  */
22809 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
22810
22811 /**
22812  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
22813  * revocation keys. This is combined with the per-commitment-secret generated by the
22814  * counterparty to create a secret which the counterparty can reveal to revoke previous
22815  * states.
22816  */
22817 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22818
22819 /**
22820  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
22821  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
22822  * static across every commitment transaction.
22823  */
22824 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
22825
22826 /**
22827  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
22828  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
22829  * static across every commitment transaction.
22830  */
22831 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22832
22833 /**
22834  * The base point which is used (with derive_public_key) to derive a per-commitment payment
22835  * public key which receives non-HTLC-encumbered funds which are only available for spending
22836  * after some delay (or can be claimed via the revocation path).
22837  */
22838 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
22839
22840 /**
22841  * The base point which is used (with derive_public_key) to derive a per-commitment payment
22842  * public key which receives non-HTLC-encumbered funds which are only available for spending
22843  * after some delay (or can be claimed via the revocation path).
22844  */
22845 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22846
22847 /**
22848  * The base point which is used (with derive_public_key) to derive a per-commitment public key
22849  * which is used to encumber HTLC-in-flight outputs.
22850  */
22851 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
22852
22853 /**
22854  * The base point which is used (with derive_public_key) to derive a per-commitment public key
22855  * which is used to encumber HTLC-in-flight outputs.
22856  */
22857 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22858
22859 /**
22860  * Constructs a new ChannelPublicKeys given each field
22861  */
22862 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);
22863
22864 /**
22865  * Creates a copy of the ChannelPublicKeys
22866  */
22867 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
22868
22869 /**
22870  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
22871  */
22872 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
22873
22874 /**
22875  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
22876  */
22877 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
22878
22879 /**
22880  * Create per-state keys from channel base points and the per-commitment point.
22881  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
22882  */
22883 MUST_USE_RES struct LDKCResult_TxCreationKeysErrorZ TxCreationKeys_derive_new(struct LDKPublicKey per_commitment_point, struct LDKPublicKey broadcaster_delayed_payment_base, struct LDKPublicKey broadcaster_htlc_base, struct LDKPublicKey countersignatory_revocation_base, struct LDKPublicKey countersignatory_htlc_base);
22884
22885 /**
22886  * Generate per-state keys from channel static keys.
22887  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
22888  */
22889 MUST_USE_RES struct LDKCResult_TxCreationKeysErrorZ TxCreationKeys_from_channel_static_keys(struct LDKPublicKey per_commitment_point, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys);
22890
22891 /**
22892  * A script either spendable by the revocation
22893  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
22894  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
22895  */
22896 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
22897
22898 /**
22899  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
22900  */
22901 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
22902
22903 /**
22904  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
22905  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
22906  * need to compare this value to whether the commitment transaction in question is that of
22907  * the counterparty or our own.
22908  */
22909 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
22910
22911 /**
22912  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
22913  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
22914  * need to compare this value to whether the commitment transaction in question is that of
22915  * the counterparty or our own.
22916  */
22917 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
22918
22919 /**
22920  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
22921  * this divided by 1000.
22922  */
22923 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
22924
22925 /**
22926  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
22927  * this divided by 1000.
22928  */
22929 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
22930
22931 /**
22932  * The CLTV lock-time at which this HTLC expires.
22933  */
22934 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
22935
22936 /**
22937  * The CLTV lock-time at which this HTLC expires.
22938  */
22939 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
22940
22941 /**
22942  * The hash of the preimage which unlocks this HTLC.
22943  */
22944 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
22945
22946 /**
22947  * The hash of the preimage which unlocks this HTLC.
22948  */
22949 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22950
22951 /**
22952  * The position within the commitment transactions' outputs. This may be None if the value is
22953  * below the dust limit (in which case no output appears in the commitment transaction and the
22954  * value is spent to additional transaction fees).
22955  */
22956 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
22957
22958 /**
22959  * The position within the commitment transactions' outputs. This may be None if the value is
22960  * below the dust limit (in which case no output appears in the commitment transaction and the
22961  * value is spent to additional transaction fees).
22962  */
22963 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
22964
22965 /**
22966  * Constructs a new HTLCOutputInCommitment given each field
22967  */
22968 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);
22969
22970 /**
22971  * Creates a copy of the HTLCOutputInCommitment
22972  */
22973 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
22974
22975 /**
22976  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
22977  */
22978 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
22979
22980 /**
22981  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
22982  */
22983 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
22984
22985 /**
22986  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
22987  * does not need to have its previous_output_index filled.
22988  */
22989 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, const struct LDKTxCreationKeys *NONNULL_PTR keys);
22990
22991 /**
22992  * Gets the redeemscript for a funding output from the two funding public keys.
22993  * Note that the order of funding public keys does not matter.
22994  */
22995 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
22996
22997 /**
22998  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
22999  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
23000  * transaction which needs signing, and can be used to construct an HTLC transaction which is
23001  * broadcastable given a counterparty HTLC signature.
23002  *
23003  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
23004  * commitment transaction).
23005  */
23006 struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key);
23007
23008 /**
23009  * Gets the witnessScript for an anchor output from the funding public key.
23010  * The witness in the spending input must be:
23011  * <BIP 143 funding_signature>
23012  * After 16 blocks of confirmation, an alternative satisfying witness could be:
23013  * <>
23014  * (empty vector required to satisfy compliance with MINIMALIF-standard rule)
23015  */
23016 struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey);
23017
23018 /**
23019  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
23020  */
23021 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
23022
23023 /**
23024  * Holder public keys
23025  */
23026 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
23027
23028 /**
23029  * Holder public keys
23030  */
23031 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
23032
23033 /**
23034  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
23035  */
23036 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
23037
23038 /**
23039  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
23040  */
23041 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
23042
23043 /**
23044  * Whether the holder is the initiator of this channel.
23045  * This is an input to the commitment number obscure factor computation.
23046  */
23047 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
23048
23049 /**
23050  * Whether the holder is the initiator of this channel.
23051  * This is an input to the commitment number obscure factor computation.
23052  */
23053 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
23054
23055 /**
23056  * The late-bound counterparty channel transaction parameters.
23057  * These parameters are populated at the point in the protocol where the counterparty provides them.
23058  *
23059  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23060  */
23061 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
23062
23063 /**
23064  * The late-bound counterparty channel transaction parameters.
23065  * These parameters are populated at the point in the protocol where the counterparty provides them.
23066  *
23067  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23068  */
23069 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
23070
23071 /**
23072  * The late-bound funding outpoint
23073  *
23074  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23075  */
23076 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
23077
23078 /**
23079  * The late-bound funding outpoint
23080  *
23081  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23082  */
23083 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
23084
23085 /**
23086  * Are anchors used for this channel.  Boolean is serialization backwards-compatible
23087  */
23088 enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
23089
23090 /**
23091  * Are anchors used for this channel.  Boolean is serialization backwards-compatible
23092  */
23093 void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
23094
23095 /**
23096  * Constructs a new ChannelTransactionParameters given each field
23097  */
23098 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);
23099
23100 /**
23101  * Creates a copy of the ChannelTransactionParameters
23102  */
23103 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
23104
23105 /**
23106  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
23107  */
23108 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
23109
23110 /**
23111  * Counter-party public keys
23112  */
23113 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
23114
23115 /**
23116  * Counter-party public keys
23117  */
23118 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
23119
23120 /**
23121  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
23122  */
23123 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
23124
23125 /**
23126  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
23127  */
23128 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
23129
23130 /**
23131  * Constructs a new CounterpartyChannelTransactionParameters given each field
23132  */
23133 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
23134
23135 /**
23136  * Creates a copy of the CounterpartyChannelTransactionParameters
23137  */
23138 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
23139
23140 /**
23141  * Whether the late bound parameters are populated.
23142  */
23143 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
23144
23145 /**
23146  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
23147  * given that the holder is the broadcaster.
23148  *
23149  * self.is_populated() must be true before calling this function.
23150  */
23151 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
23152
23153 /**
23154  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
23155  * given that the counterparty is the broadcaster.
23156  *
23157  * self.is_populated() must be true before calling this function.
23158  */
23159 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
23160
23161 /**
23162  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
23163  */
23164 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
23165
23166 /**
23167  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
23168  */
23169 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
23170
23171 /**
23172  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
23173  */
23174 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
23175
23176 /**
23177  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
23178  */
23179 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
23180
23181 /**
23182  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
23183  */
23184 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
23185
23186 /**
23187  * Get the channel pubkeys for the broadcaster
23188  */
23189 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23190
23191 /**
23192  * Get the channel pubkeys for the countersignatory
23193  */
23194 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23195
23196 /**
23197  * Get the contest delay applicable to the transactions.
23198  * Note that the contest delay was selected by the countersignatory.
23199  */
23200 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23201
23202 /**
23203  * Whether the channel is outbound from the broadcaster.
23204  *
23205  * The boolean representing the side that initiated the channel is
23206  * an input to the commitment number obscure factor computation.
23207  */
23208 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23209
23210 /**
23211  * The funding outpoint
23212  */
23213 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23214
23215 /**
23216  * Whether to use anchors for this channel
23217  */
23218 MUST_USE_RES bool DirectedChannelTransactionParameters_opt_anchors(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23219
23220 /**
23221  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
23222  */
23223 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
23224
23225 /**
23226  * Our counterparty's signature for the transaction
23227  */
23228 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
23229
23230 /**
23231  * Our counterparty's signature for the transaction
23232  */
23233 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
23234
23235 /**
23236  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
23237  */
23238 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
23239
23240 /**
23241  * Creates a copy of the HolderCommitmentTransaction
23242  */
23243 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
23244
23245 /**
23246  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
23247  */
23248 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
23249
23250 /**
23251  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
23252  */
23253 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
23254
23255 /**
23256  * Create a new holder transaction with the given counterparty signatures.
23257  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
23258  */
23259 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);
23260
23261 /**
23262  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
23263  */
23264 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
23265
23266 /**
23267  * The commitment transaction
23268  */
23269 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
23270
23271 /**
23272  * The commitment transaction
23273  */
23274 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
23275
23276 /**
23277  * The txid for the commitment transaction.
23278  *
23279  * This is provided as a performance optimization, instead of calling transaction.txid()
23280  * multiple times.
23281  */
23282 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
23283
23284 /**
23285  * The txid for the commitment transaction.
23286  *
23287  * This is provided as a performance optimization, instead of calling transaction.txid()
23288  * multiple times.
23289  */
23290 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23291
23292 /**
23293  * Constructs a new BuiltCommitmentTransaction given each field
23294  */
23295 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
23296
23297 /**
23298  * Creates a copy of the BuiltCommitmentTransaction
23299  */
23300 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
23301
23302 /**
23303  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
23304  */
23305 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
23306
23307 /**
23308  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
23309  */
23310 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
23311
23312 /**
23313  * Get the SIGHASH_ALL sighash value of the transaction.
23314  *
23315  * This can be used to verify a signature.
23316  */
23317 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);
23318
23319 /**
23320  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
23321  * because we are about to broadcast a holder transaction.
23322  */
23323 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);
23324
23325 /**
23326  * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL.
23327  */
23328 void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
23329
23330 /**
23331  * Creates a copy of the ClosingTransaction
23332  */
23333 struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig);
23334
23335 /**
23336  * Checks if two ClosingTransactions contain equal inner contents.
23337  */
23338 uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o);
23339
23340 /**
23341  * Construct an object of the class
23342  */
23343 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);
23344
23345 /**
23346  * Trust our pre-built transaction.
23347  *
23348  * Applies a wrapper which allows access to the transaction.
23349  *
23350  * This should only be used if you fully trust the builder of this object. It should not
23351  * be used by an external signer - instead use the verify function.
23352  */
23353 MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
23354
23355 /**
23356  * Verify our pre-built transaction.
23357  *
23358  * Applies a wrapper which allows access to the transaction.
23359  *
23360  * An external validating signer must call this method before signing
23361  * or using the built transaction.
23362  */
23363 MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
23364
23365 /**
23366  * The value to be sent to the holder, or zero if the output will be omitted
23367  */
23368 MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
23369
23370 /**
23371  * The value to be sent to the counterparty, or zero if the output will be omitted
23372  */
23373 MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
23374
23375 /**
23376  * The destination of the holder's output
23377  */
23378 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
23379
23380 /**
23381  * The destination of the counterparty's output
23382  */
23383 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
23384
23385 /**
23386  * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL.
23387  */
23388 void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
23389
23390 /**
23391  * The pre-built Bitcoin commitment transaction
23392  */
23393 MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
23394
23395 /**
23396  * Get the SIGHASH_ALL sighash value of the transaction.
23397  *
23398  * This can be used to verify a signature.
23399  */
23400 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);
23401
23402 /**
23403  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
23404  * because we are about to broadcast a holder transaction.
23405  */
23406 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);
23407
23408 /**
23409  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
23410  */
23411 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
23412
23413 /**
23414  * Creates a copy of the CommitmentTransaction
23415  */
23416 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
23417
23418 /**
23419  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
23420  */
23421 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
23422
23423 /**
23424  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
23425  */
23426 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
23427
23428 /**
23429  * The backwards-counting commitment number
23430  */
23431 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
23432
23433 /**
23434  * The value to be sent to the broadcaster
23435  */
23436 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
23437
23438 /**
23439  * The value to be sent to the counterparty
23440  */
23441 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
23442
23443 /**
23444  * The feerate paid per 1000-weight-unit in this commitment transaction.
23445  */
23446 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
23447
23448 /**
23449  * Trust our pre-built transaction and derived transaction creation public keys.
23450  *
23451  * Applies a wrapper which allows access to these fields.
23452  *
23453  * This should only be used if you fully trust the builder of this object.  It should not
23454  * be used by an external signer - instead use the verify function.
23455  */
23456 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
23457
23458 /**
23459  * Verify our pre-built transaction and derived transaction creation public keys.
23460  *
23461  * Applies a wrapper which allows access to these fields.
23462  *
23463  * An external validating signer must call this method before signing
23464  * or using the built transaction.
23465  */
23466 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);
23467
23468 /**
23469  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
23470  */
23471 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
23472
23473 /**
23474  * The transaction ID of the built Bitcoin transaction
23475  */
23476 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
23477
23478 /**
23479  * The pre-built Bitcoin commitment transaction
23480  */
23481 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
23482
23483 /**
23484  * The pre-calculated transaction creation public keys.
23485  */
23486 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
23487
23488 /**
23489  * Should anchors be used.
23490  */
23491 MUST_USE_RES bool TrustedCommitmentTransaction_opt_anchors(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
23492
23493 /**
23494  * Get a signature for each HTLC which was included in the commitment transaction (ie for
23495  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
23496  *
23497  * The returned Vec has one entry for each HTLC, and in the same order.
23498  *
23499  * This function is only valid in the holder commitment context, it always uses SigHashType::All.
23500  */
23501 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);
23502
23503 /**
23504  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
23505  * shared secret first. This prevents on-chain observers from discovering how many commitment
23506  * transactions occurred in a channel before it was closed.
23507  *
23508  * This function gets the shared secret from relevant channel public keys and can be used to
23509  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
23510  */
23511 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
23512
23513 /**
23514  * Checks if two InitFeaturess contain equal inner contents.
23515  * This ignores pointers and is_owned flags and looks at the values in fields.
23516  * Two objects with NULL inner values will be considered "equal" here.
23517  */
23518 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
23519
23520 /**
23521  * Checks if two NodeFeaturess contain equal inner contents.
23522  * This ignores pointers and is_owned flags and looks at the values in fields.
23523  * Two objects with NULL inner values will be considered "equal" here.
23524  */
23525 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
23526
23527 /**
23528  * Checks if two ChannelFeaturess contain equal inner contents.
23529  * This ignores pointers and is_owned flags and looks at the values in fields.
23530  * Two objects with NULL inner values will be considered "equal" here.
23531  */
23532 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
23533
23534 /**
23535  * Checks if two InvoiceFeaturess contain equal inner contents.
23536  * This ignores pointers and is_owned flags and looks at the values in fields.
23537  * Two objects with NULL inner values will be considered "equal" here.
23538  */
23539 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
23540
23541 /**
23542  * Checks if two ChannelTypeFeaturess contain equal inner contents.
23543  * This ignores pointers and is_owned flags and looks at the values in fields.
23544  * Two objects with NULL inner values will be considered "equal" here.
23545  */
23546 bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b);
23547
23548 /**
23549  * Creates a copy of the InitFeatures
23550  */
23551 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
23552
23553 /**
23554  * Creates a copy of the NodeFeatures
23555  */
23556 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
23557
23558 /**
23559  * Creates a copy of the ChannelFeatures
23560  */
23561 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
23562
23563 /**
23564  * Creates a copy of the InvoiceFeatures
23565  */
23566 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
23567
23568 /**
23569  * Creates a copy of the ChannelTypeFeatures
23570  */
23571 struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig);
23572
23573 /**
23574  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
23575  */
23576 void InitFeatures_free(struct LDKInitFeatures this_obj);
23577
23578 /**
23579  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
23580  */
23581 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
23582
23583 /**
23584  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
23585  */
23586 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
23587
23588 /**
23589  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
23590  */
23591 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
23592
23593 /**
23594  * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL.
23595  */
23596 void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj);
23597
23598 /**
23599  * Create a blank Features with no features set
23600  */
23601 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
23602
23603 /**
23604  * Creates a Features with the bits set which are known by the implementation
23605  */
23606 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
23607
23608 /**
23609  * Returns true if this `Features` object contains unknown feature flags which are set as
23610  * \"required\".
23611  */
23612 MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
23613
23614 /**
23615  * Create a blank Features with no features set
23616  */
23617 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
23618
23619 /**
23620  * Creates a Features with the bits set which are known by the implementation
23621  */
23622 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
23623
23624 /**
23625  * Returns true if this `Features` object contains unknown feature flags which are set as
23626  * \"required\".
23627  */
23628 MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
23629
23630 /**
23631  * Create a blank Features with no features set
23632  */
23633 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
23634
23635 /**
23636  * Creates a Features with the bits set which are known by the implementation
23637  */
23638 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
23639
23640 /**
23641  * Returns true if this `Features` object contains unknown feature flags which are set as
23642  * \"required\".
23643  */
23644 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
23645
23646 /**
23647  * Create a blank Features with no features set
23648  */
23649 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
23650
23651 /**
23652  * Creates a Features with the bits set which are known by the implementation
23653  */
23654 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
23655
23656 /**
23657  * Returns true if this `Features` object contains unknown feature flags which are set as
23658  * \"required\".
23659  */
23660 MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
23661
23662 /**
23663  * Create a blank Features with no features set
23664  */
23665 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void);
23666
23667 /**
23668  * Creates a Features with the bits set which are known by the implementation
23669  */
23670 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_known(void);
23671
23672 /**
23673  * Returns true if this `Features` object contains unknown feature flags which are set as
23674  * \"required\".
23675  */
23676 MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
23677
23678 /**
23679  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
23680  */
23681 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
23682
23683 /**
23684  * Read a InitFeatures from a byte array, created by InitFeatures_write
23685  */
23686 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
23687
23688 /**
23689  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
23690  */
23691 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
23692
23693 /**
23694  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
23695  */
23696 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
23697
23698 /**
23699  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
23700  */
23701 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
23702
23703 /**
23704  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
23705  */
23706 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
23707
23708 /**
23709  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
23710  */
23711 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
23712
23713 /**
23714  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
23715  */
23716 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
23717
23718 /**
23719  * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
23720  */
23721 struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj);
23722
23723 /**
23724  * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
23725  */
23726 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser);
23727
23728 /**
23729  * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
23730  */
23731 void ShutdownScript_free(struct LDKShutdownScript this_obj);
23732
23733 /**
23734  * Creates a copy of the ShutdownScript
23735  */
23736 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
23737
23738 /**
23739  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
23740  */
23741 void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
23742
23743 /**
23744  * The script that did not meet the requirements from [BOLT #2].
23745  *
23746  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
23747  */
23748 struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
23749
23750 /**
23751  * The script that did not meet the requirements from [BOLT #2].
23752  *
23753  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
23754  */
23755 void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
23756
23757 /**
23758  * Constructs a new InvalidShutdownScript given each field
23759  */
23760 MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
23761
23762 /**
23763  * Creates a copy of the InvalidShutdownScript
23764  */
23765 struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig);
23766
23767 /**
23768  * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
23769  */
23770 struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
23771
23772 /**
23773  * Read a ShutdownScript from a byte array, created by ShutdownScript_write
23774  */
23775 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
23776
23777 /**
23778  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
23779  */
23780 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
23781
23782 /**
23783  * Generates a P2WSH script pubkey from the given [`WScriptHash`].
23784  */
23785 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
23786
23787 /**
23788  * Generates a witness script pubkey from the given segwit version and program.
23789  *
23790  * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
23791  * [`ShutdownScript::new_p2wsh`] instead.
23792  *
23793  * # Errors
23794  *
23795  * This function may return an error if `program` is invalid for the segwit `version`.
23796  */
23797 MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(uint8_t version, struct LDKu8slice program);
23798
23799 /**
23800  * Converts the shutdown script into the underlying [`Script`].
23801  */
23802 MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
23803
23804 /**
23805  * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
23806  *
23807  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23808  */
23809 MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
23810
23811 /**
23812  * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
23813  *
23814  * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
23815  */
23816 MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
23817
23818 /**
23819  * Calls the free function if one is set
23820  */
23821 void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
23822
23823 /**
23824  * Calls the free function if one is set
23825  */
23826 void Type_free(struct LDKType this_ptr);
23827
23828 /**
23829  * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
23830  */
23831 void NodeId_free(struct LDKNodeId this_obj);
23832
23833 /**
23834  * Creates a copy of the NodeId
23835  */
23836 struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig);
23837
23838 /**
23839  * Create a new NodeId from a public key
23840  */
23841 MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey);
23842
23843 /**
23844  * Get the public key slice from this NodeId
23845  */
23846 MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
23847
23848 /**
23849  * Checks if two NodeIds contain equal inner contents.
23850  */
23851 uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
23852
23853 /**
23854  * Serialize the NodeId object into a byte array which can be read by NodeId_read
23855  */
23856 struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj);
23857
23858 /**
23859  * Read a NodeId from a byte array, created by NodeId_write
23860  */
23861 struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser);
23862
23863 /**
23864  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
23865  */
23866 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
23867
23868 /**
23869  * Creates a copy of the NetworkGraph
23870  */
23871 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
23872
23873 /**
23874  * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
23875  */
23876 void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
23877
23878 /**
23879  * Frees any resources used by the NetworkUpdate
23880  */
23881 void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
23882
23883 /**
23884  * Creates a copy of the NetworkUpdate
23885  */
23886 struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
23887
23888 /**
23889  * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
23890  */
23891 struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
23892
23893 /**
23894  * Utility method to constructs a new ChannelClosed-variant NetworkUpdate
23895  */
23896 struct LDKNetworkUpdate NetworkUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent);
23897
23898 /**
23899  * Utility method to constructs a new NodeFailure-variant NetworkUpdate
23900  */
23901 struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
23902
23903 /**
23904  * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
23905  */
23906 struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
23907
23908 /**
23909  * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
23910  */
23911 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser);
23912
23913 /**
23914  * Constructs a new EventHandler which calls the relevant methods on this_arg.
23915  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
23916  */
23917 struct LDKEventHandler NetGraphMsgHandler_as_EventHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
23918
23919 /**
23920  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
23921  */
23922 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
23923
23924 /**
23925  * Creates a new tracker of the actual state of the network of channels and nodes,
23926  * assuming an existing Network Graph.
23927  * Chain monitor is used to make sure announced channels exist on-chain,
23928  * channel data is correct, and that the announcement is signed with
23929  * channel owners' keys.
23930  */
23931 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
23932
23933 /**
23934  * Adds a provider used to check new announcements. Does not affect
23935  * existing announcements unless they are updated.
23936  * Add, update or remove the provider would replace the current one.
23937  */
23938 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access);
23939
23940 /**
23941  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
23942  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
23943  */
23944 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
23945
23946 /**
23947  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
23948  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
23949  */
23950 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
23951
23952 /**
23953  * Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL.
23954  */
23955 void ChannelUpdateInfo_free(struct LDKChannelUpdateInfo this_obj);
23956
23957 /**
23958  * When the last update to the channel direction was issued.
23959  * Value is opaque, as set in the announcement.
23960  */
23961 uint32_t ChannelUpdateInfo_get_last_update(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
23962
23963 /**
23964  * When the last update to the channel direction was issued.
23965  * Value is opaque, as set in the announcement.
23966  */
23967 void ChannelUpdateInfo_set_last_update(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint32_t val);
23968
23969 /**
23970  * Whether the channel can be currently used for payments (in this one direction).
23971  */
23972 bool ChannelUpdateInfo_get_enabled(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
23973
23974 /**
23975  * Whether the channel can be currently used for payments (in this one direction).
23976  */
23977 void ChannelUpdateInfo_set_enabled(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, bool val);
23978
23979 /**
23980  * The difference in CLTV values that you must have when routing through this channel.
23981  */
23982 uint16_t ChannelUpdateInfo_get_cltv_expiry_delta(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
23983
23984 /**
23985  * The difference in CLTV values that you must have when routing through this channel.
23986  */
23987 void ChannelUpdateInfo_set_cltv_expiry_delta(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint16_t val);
23988
23989 /**
23990  * The minimum value, which must be relayed to the next hop via the channel
23991  */
23992 uint64_t ChannelUpdateInfo_get_htlc_minimum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
23993
23994 /**
23995  * The minimum value, which must be relayed to the next hop via the channel
23996  */
23997 void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
23998
23999 /**
24000  * The maximum value which may be relayed to the next hop via the channel.
24001  */
24002 struct LDKCOption_u64Z ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
24003
24004 /**
24005  * The maximum value which may be relayed to the next hop via the channel.
24006  */
24007 void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
24008
24009 /**
24010  * Fees charged when the channel is used for routing
24011  */
24012 struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
24013
24014 /**
24015  * Fees charged when the channel is used for routing
24016  */
24017 void ChannelUpdateInfo_set_fees(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
24018
24019 /**
24020  * Most recent update for the channel received from the network
24021  * Mostly redundant with the data we store in fields explicitly.
24022  * Everything else is useful only for sending out for initial routing sync.
24023  * Not stored if contains excess data to prevent DoS.
24024  *
24025  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24026  */
24027 struct LDKChannelUpdate ChannelUpdateInfo_get_last_update_message(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
24028
24029 /**
24030  * Most recent update for the channel received from the network
24031  * Mostly redundant with the data we store in fields explicitly.
24032  * Everything else is useful only for sending out for initial routing sync.
24033  * Not stored if contains excess data to prevent DoS.
24034  *
24035  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24036  */
24037 void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
24038
24039 /**
24040  * Constructs a new ChannelUpdateInfo given each field
24041  */
24042 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, struct LDKCOption_u64Z htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, struct LDKChannelUpdate last_update_message_arg);
24043
24044 /**
24045  * Creates a copy of the ChannelUpdateInfo
24046  */
24047 struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig);
24048
24049 /**
24050  * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read
24051  */
24052 struct LDKCVec_u8Z ChannelUpdateInfo_write(const struct LDKChannelUpdateInfo *NONNULL_PTR obj);
24053
24054 /**
24055  * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write
24056  */
24057 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ ChannelUpdateInfo_read(struct LDKu8slice ser);
24058
24059 /**
24060  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
24061  */
24062 void ChannelInfo_free(struct LDKChannelInfo this_obj);
24063
24064 /**
24065  * Protocol features of a channel communicated during its announcement
24066  */
24067 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
24068
24069 /**
24070  * Protocol features of a channel communicated during its announcement
24071  */
24072 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
24073
24074 /**
24075  * Source node of the first direction of a channel
24076  */
24077 struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
24078
24079 /**
24080  * Source node of the first direction of a channel
24081  */
24082 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
24083
24084 /**
24085  * Details about the first direction of a channel
24086  *
24087  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24088  */
24089 struct LDKChannelUpdateInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
24090
24091 /**
24092  * Details about the first direction of a channel
24093  *
24094  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24095  */
24096 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
24097
24098 /**
24099  * Source node of the second direction of a channel
24100  */
24101 struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
24102
24103 /**
24104  * Source node of the second direction of a channel
24105  */
24106 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
24107
24108 /**
24109  * Details about the second direction of a channel
24110  *
24111  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24112  */
24113 struct LDKChannelUpdateInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
24114
24115 /**
24116  * Details about the second direction of a channel
24117  *
24118  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24119  */
24120 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
24121
24122 /**
24123  * The channel capacity as seen on-chain, if chain lookup is available.
24124  */
24125 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
24126
24127 /**
24128  * The channel capacity as seen on-chain, if chain lookup is available.
24129  */
24130 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
24131
24132 /**
24133  * An initial announcement of the channel
24134  * Mostly redundant with the data we store in fields explicitly.
24135  * Everything else is useful only for sending out for initial routing sync.
24136  * Not stored if contains excess data to prevent DoS.
24137  *
24138  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24139  */
24140 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
24141
24142 /**
24143  * An initial announcement of the channel
24144  * Mostly redundant with the data we store in fields explicitly.
24145  * Everything else is useful only for sending out for initial routing sync.
24146  * Not stored if contains excess data to prevent DoS.
24147  *
24148  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24149  */
24150 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
24151
24152 /**
24153  * Creates a copy of the ChannelInfo
24154  */
24155 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
24156
24157 /**
24158  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
24159  */
24160 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
24161
24162 /**
24163  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
24164  */
24165 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
24166
24167 /**
24168  * Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL.
24169  */
24170 void DirectedChannelInfo_free(struct LDKDirectedChannelInfo this_obj);
24171
24172 /**
24173  * Creates a copy of the DirectedChannelInfo
24174  */
24175 struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirectedChannelInfo *NONNULL_PTR orig);
24176
24177 /**
24178  * Returns information for the channel.
24179  */
24180 MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
24181
24182 /**
24183  * Returns information for the direction.
24184  *
24185  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24186  */
24187 MUST_USE_RES struct LDKChannelUpdateInfo DirectedChannelInfo_direction(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
24188
24189 /**
24190  * Returns the [`EffectiveCapacity`] of the channel in the direction.
24191  *
24192  * This is either the total capacity from the funding transaction, if known, or the
24193  * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
24194  * whichever is smaller.
24195  */
24196 MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
24197
24198 /**
24199  * Frees any resources used by the EffectiveCapacity
24200  */
24201 void EffectiveCapacity_free(struct LDKEffectiveCapacity this_ptr);
24202
24203 /**
24204  * Creates a copy of the EffectiveCapacity
24205  */
24206 struct LDKEffectiveCapacity EffectiveCapacity_clone(const struct LDKEffectiveCapacity *NONNULL_PTR orig);
24207
24208 /**
24209  * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity
24210  */
24211 struct LDKEffectiveCapacity EffectiveCapacity_exact_liquidity(uint64_t liquidity_msat);
24212
24213 /**
24214  * Utility method to constructs a new MaximumHTLC-variant EffectiveCapacity
24215  */
24216 struct LDKEffectiveCapacity EffectiveCapacity_maximum_htlc(uint64_t amount_msat);
24217
24218 /**
24219  * Utility method to constructs a new Total-variant EffectiveCapacity
24220  */
24221 struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat);
24222
24223 /**
24224  * Utility method to constructs a new Infinite-variant EffectiveCapacity
24225  */
24226 struct LDKEffectiveCapacity EffectiveCapacity_infinite(void);
24227
24228 /**
24229  * Utility method to constructs a new Unknown-variant EffectiveCapacity
24230  */
24231 struct LDKEffectiveCapacity EffectiveCapacity_unknown(void);
24232
24233 /**
24234  * Returns the effective capacity denominated in millisatoshi.
24235  */
24236 MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacity *NONNULL_PTR this_arg);
24237
24238 /**
24239  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
24240  */
24241 void RoutingFees_free(struct LDKRoutingFees this_obj);
24242
24243 /**
24244  * Flat routing fee in satoshis
24245  */
24246 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
24247
24248 /**
24249  * Flat routing fee in satoshis
24250  */
24251 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
24252
24253 /**
24254  * Liquidity-based routing fee in millionths of a routed amount.
24255  * In other words, 10000 is 1%.
24256  */
24257 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
24258
24259 /**
24260  * Liquidity-based routing fee in millionths of a routed amount.
24261  * In other words, 10000 is 1%.
24262  */
24263 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
24264
24265 /**
24266  * Constructs a new RoutingFees given each field
24267  */
24268 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
24269
24270 /**
24271  * Checks if two RoutingFeess contain equal inner contents.
24272  * This ignores pointers and is_owned flags and looks at the values in fields.
24273  * Two objects with NULL inner values will be considered "equal" here.
24274  */
24275 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
24276
24277 /**
24278  * Creates a copy of the RoutingFees
24279  */
24280 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
24281
24282 /**
24283  * Checks if two RoutingFeess contain equal inner contents.
24284  */
24285 uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
24286
24287 /**
24288  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
24289  */
24290 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
24291
24292 /**
24293  * Read a RoutingFees from a byte array, created by RoutingFees_write
24294  */
24295 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
24296
24297 /**
24298  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
24299  */
24300 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
24301
24302 /**
24303  * Protocol features the node announced support for
24304  */
24305 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
24306
24307 /**
24308  * Protocol features the node announced support for
24309  */
24310 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
24311
24312 /**
24313  * When the last known update to the node state was issued.
24314  * Value is opaque, as set in the announcement.
24315  */
24316 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
24317
24318 /**
24319  * When the last known update to the node state was issued.
24320  * Value is opaque, as set in the announcement.
24321  */
24322 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
24323
24324 /**
24325  * Color assigned to the node
24326  */
24327 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
24328
24329 /**
24330  * Color assigned to the node
24331  */
24332 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
24333
24334 /**
24335  * Moniker assigned to the node.
24336  * May be invalid or malicious (eg control chars),
24337  * should not be exposed to the user.
24338  */
24339 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
24340
24341 /**
24342  * Moniker assigned to the node.
24343  * May be invalid or malicious (eg control chars),
24344  * should not be exposed to the user.
24345  */
24346 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24347
24348 /**
24349  * Internet-level addresses via which one can connect to the node
24350  */
24351 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
24352
24353 /**
24354  * An initial announcement of the node
24355  * Mostly redundant with the data we store in fields explicitly.
24356  * Everything else is useful only for sending out for initial routing sync.
24357  * Not stored if contains excess data to prevent DoS.
24358  *
24359  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24360  */
24361 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
24362
24363 /**
24364  * An initial announcement of the node
24365  * Mostly redundant with the data we store in fields explicitly.
24366  * Everything else is useful only for sending out for initial routing sync.
24367  * Not stored if contains excess data to prevent DoS.
24368  *
24369  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24370  */
24371 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
24372
24373 /**
24374  * Constructs a new NodeAnnouncementInfo given each field
24375  */
24376 MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKThirtyTwoBytes alias_arg, struct LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg);
24377
24378 /**
24379  * Creates a copy of the NodeAnnouncementInfo
24380  */
24381 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
24382
24383 /**
24384  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
24385  */
24386 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
24387
24388 /**
24389  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
24390  */
24391 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
24392
24393 /**
24394  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
24395  */
24396 void NodeInfo_free(struct LDKNodeInfo this_obj);
24397
24398 /**
24399  * All valid channels a node has announced
24400  */
24401 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
24402
24403 /**
24404  * Lowest fees enabling routing via any of the enabled, known channels to a node.
24405  * The two fields (flat and proportional fee) are independent,
24406  * meaning they don't have to refer to the same channel.
24407  *
24408  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24409  */
24410 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
24411
24412 /**
24413  * Lowest fees enabling routing via any of the enabled, known channels to a node.
24414  * The two fields (flat and proportional fee) are independent,
24415  * meaning they don't have to refer to the same channel.
24416  *
24417  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24418  */
24419 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
24420
24421 /**
24422  * More information about a node from node_announcement.
24423  * Optional because we store a Node entry after learning about it from
24424  * a channel announcement, but before receiving a node announcement.
24425  *
24426  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24427  */
24428 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
24429
24430 /**
24431  * More information about a node from node_announcement.
24432  * Optional because we store a Node entry after learning about it from
24433  * a channel announcement, but before receiving a node announcement.
24434  *
24435  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24436  */
24437 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
24438
24439 /**
24440  * Constructs a new NodeInfo given each field
24441  */
24442 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
24443
24444 /**
24445  * Creates a copy of the NodeInfo
24446  */
24447 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
24448
24449 /**
24450  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
24451  */
24452 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
24453
24454 /**
24455  * Read a NodeInfo from a byte array, created by NodeInfo_write
24456  */
24457 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
24458
24459 /**
24460  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
24461  */
24462 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
24463
24464 /**
24465  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
24466  */
24467 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
24468
24469 /**
24470  * Creates a new, empty, network graph.
24471  */
24472 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
24473
24474 /**
24475  * Returns a read-only view of the network graph.
24476  */
24477 MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
24478
24479 /**
24480  * For an already known node (from channel announcements), update its stored properties from a
24481  * given node announcement.
24482  *
24483  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
24484  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
24485  * routing messages from a source using a protocol other than the lightning P2P protocol.
24486  */
24487 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
24488
24489 /**
24490  * For an already known node (from channel announcements), update its stored properties from a
24491  * given node announcement without verifying the associated signatures. Because we aren't
24492  * given the associated signatures here we cannot relay the node announcement to any of our
24493  * peers.
24494  */
24495 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);
24496
24497 /**
24498  * Store or update channel info from a channel announcement.
24499  *
24500  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
24501  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
24502  * routing messages from a source using a protocol other than the lightning P2P protocol.
24503  *
24504  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
24505  * the corresponding UTXO exists on chain and is correctly-formatted.
24506  */
24507 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_AccessZ chain_access);
24508
24509 /**
24510  * Store or update channel info from a channel announcement without verifying the associated
24511  * signatures. Because we aren't given the associated signatures here we cannot relay the
24512  * channel announcement to any of our peers.
24513  *
24514  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
24515  * the corresponding UTXO exists on chain and is correctly-formatted.
24516  */
24517 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_AccessZ chain_access);
24518
24519 /**
24520  * Close a channel if a corresponding HTLC fail was sent.
24521  * If permanent, removes a channel from the local storage.
24522  * May cause the removal of nodes too, if this was their last channel.
24523  * If not permanent, makes channels unavailable for routing.
24524  */
24525 void NetworkGraph_close_channel_from_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
24526
24527 /**
24528  * Marks a node in the graph as failed.
24529  */
24530 void NetworkGraph_fail_node(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent);
24531
24532 /**
24533  * Removes information about channels that we haven't heard any updates about in some time.
24534  * This can be used regularly to prune the network graph of channels that likely no longer
24535  * exist.
24536  *
24537  * While there is no formal requirement that nodes regularly re-broadcast their channel
24538  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
24539  * pruning occur for updates which are at least two weeks old, which we implement here.
24540  *
24541  * Note that for users of the `lightning-background-processor` crate this method may be
24542  * automatically called regularly for you.
24543  *
24544  * This method is only available with the `std` feature. See
24545  * [`NetworkGraph::remove_stale_channels_with_time`] for `no-std` use.
24546  */
24547 void NetworkGraph_remove_stale_channels(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
24548
24549 /**
24550  * Removes information about channels that we haven't heard any updates about in some time.
24551  * This can be used regularly to prune the network graph of channels that likely no longer
24552  * exist.
24553  *
24554  * While there is no formal requirement that nodes regularly re-broadcast their channel
24555  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
24556  * pruning occur for updates which are at least two weeks old, which we implement here.
24557  *
24558  * This function takes the current unix time as an argument. For users with the `std` feature
24559  * enabled, [`NetworkGraph::remove_stale_channels`] may be preferable.
24560  */
24561 void NetworkGraph_remove_stale_channels_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix);
24562
24563 /**
24564  * For an already known (from announcement) channel, update info about one of the directions
24565  * of the channel.
24566  *
24567  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
24568  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
24569  * routing messages from a source using a protocol other than the lightning P2P protocol.
24570  *
24571  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
24572  * materially in the future will be rejected.
24573  */
24574 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
24575
24576 /**
24577  * For an already known (from announcement) channel, update info about one of the directions
24578  * of the channel without verifying the associated signatures. Because we aren't given the
24579  * associated signatures here we cannot relay the channel update to any of our peers.
24580  *
24581  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
24582  * materially in the future will be rejected.
24583  */
24584 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
24585
24586 /**
24587  * Get network addresses by node id.
24588  * Returns None if the requested node is completely unknown,
24589  * or if node announcement for the node was never received.
24590  */
24591 MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey);
24592
24593 /**
24594  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
24595  */
24596 void RouteHop_free(struct LDKRouteHop this_obj);
24597
24598 /**
24599  * The node_id of the node at this hop.
24600  */
24601 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
24602
24603 /**
24604  * The node_id of the node at this hop.
24605  */
24606 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24607
24608 /**
24609  * The node_announcement features of the node at this hop. For the last hop, these may be
24610  * amended to match the features present in the invoice this node generated.
24611  */
24612 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
24613
24614 /**
24615  * The node_announcement features of the node at this hop. For the last hop, these may be
24616  * amended to match the features present in the invoice this node generated.
24617  */
24618 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
24619
24620 /**
24621  * The channel that should be used from the previous hop to reach this node.
24622  */
24623 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
24624
24625 /**
24626  * The channel that should be used from the previous hop to reach this node.
24627  */
24628 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
24629
24630 /**
24631  * The channel_announcement features of the channel that should be used from the previous hop
24632  * to reach this node.
24633  */
24634 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
24635
24636 /**
24637  * The channel_announcement features of the channel that should be used from the previous hop
24638  * to reach this node.
24639  */
24640 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
24641
24642 /**
24643  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
24644  * For the last hop, this should be the full value of the payment (might be more than
24645  * requested if we had to match htlc_minimum_msat).
24646  */
24647 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
24648
24649 /**
24650  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
24651  * For the last hop, this should be the full value of the payment (might be more than
24652  * requested if we had to match htlc_minimum_msat).
24653  */
24654 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
24655
24656 /**
24657  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
24658  * expected at the destination, in excess of the current block height.
24659  */
24660 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
24661
24662 /**
24663  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
24664  * expected at the destination, in excess of the current block height.
24665  */
24666 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
24667
24668 /**
24669  * Constructs a new RouteHop given each field
24670  */
24671 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);
24672
24673 /**
24674  * Creates a copy of the RouteHop
24675  */
24676 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
24677
24678 /**
24679  * Checks if two RouteHops contain equal inner contents.
24680  */
24681 uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
24682
24683 /**
24684  * Checks if two RouteHops contain equal inner contents.
24685  * This ignores pointers and is_owned flags and looks at the values in fields.
24686  * Two objects with NULL inner values will be considered "equal" here.
24687  */
24688 bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
24689
24690 /**
24691  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
24692  */
24693 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
24694
24695 /**
24696  * Read a RouteHop from a byte array, created by RouteHop_write
24697  */
24698 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
24699
24700 /**
24701  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
24702  */
24703 void Route_free(struct LDKRoute this_obj);
24704
24705 /**
24706  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
24707  * last RouteHop in each path must be the same.
24708  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
24709  * destination. Thus, this must always be at least length one. While the maximum length of any
24710  * given path is variable, keeping the length of any path to less than 20 should currently
24711  * ensure it is viable.
24712  */
24713 struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
24714
24715 /**
24716  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
24717  * last RouteHop in each path must be the same.
24718  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
24719  * destination. Thus, this must always be at least length one. While the maximum length of any
24720  * given path is variable, keeping the length of any path to less than 20 should currently
24721  * ensure it is viable.
24722  */
24723 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
24724
24725 /**
24726  * The `payment_params` parameter passed to [`find_route`].
24727  * This is used by `ChannelManager` to track information which may be required for retries,
24728  * provided back to you via [`Event::PaymentPathFailed`].
24729  *
24730  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
24731  *
24732  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24733  */
24734 struct LDKPaymentParameters Route_get_payment_params(const struct LDKRoute *NONNULL_PTR this_ptr);
24735
24736 /**
24737  * The `payment_params` parameter passed to [`find_route`].
24738  * This is used by `ChannelManager` to track information which may be required for retries,
24739  * provided back to you via [`Event::PaymentPathFailed`].
24740  *
24741  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
24742  *
24743  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24744  */
24745 void Route_set_payment_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
24746
24747 /**
24748  * Constructs a new Route given each field
24749  */
24750 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPaymentParameters payment_params_arg);
24751
24752 /**
24753  * Creates a copy of the Route
24754  */
24755 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
24756
24757 /**
24758  * Checks if two Routes contain equal inner contents.
24759  */
24760 uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
24761
24762 /**
24763  * Checks if two Routes contain equal inner contents.
24764  * This ignores pointers and is_owned flags and looks at the values in fields.
24765  * Two objects with NULL inner values will be considered "equal" here.
24766  */
24767 bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
24768
24769 /**
24770  * Returns the total amount of fees paid on this [`Route`].
24771  *
24772  * This doesn't include any extra payment made to the recipient, which can happen in excess of
24773  * the amount passed to [`find_route`]'s `params.final_value_msat`.
24774  */
24775 MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
24776
24777 /**
24778  * Returns the total amount paid on this [`Route`], excluding the fees.
24779  */
24780 MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
24781
24782 /**
24783  * Serialize the Route object into a byte array which can be read by Route_read
24784  */
24785 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
24786
24787 /**
24788  * Read a Route from a byte array, created by Route_write
24789  */
24790 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
24791
24792 /**
24793  * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL.
24794  */
24795 void RouteParameters_free(struct LDKRouteParameters this_obj);
24796
24797 /**
24798  * The parameters of the failed payment path.
24799  */
24800 struct LDKPaymentParameters RouteParameters_get_payment_params(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
24801
24802 /**
24803  * The parameters of the failed payment path.
24804  */
24805 void RouteParameters_set_payment_params(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
24806
24807 /**
24808  * The amount in msats sent on the failed payment path.
24809  */
24810 uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
24811
24812 /**
24813  * The amount in msats sent on the failed payment path.
24814  */
24815 void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val);
24816
24817 /**
24818  * The CLTV on the final hop of the failed payment path.
24819  */
24820 uint32_t RouteParameters_get_final_cltv_expiry_delta(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
24821
24822 /**
24823  * The CLTV on the final hop of the failed payment path.
24824  */
24825 void RouteParameters_set_final_cltv_expiry_delta(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint32_t val);
24826
24827 /**
24828  * Constructs a new RouteParameters given each field
24829  */
24830 MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPaymentParameters payment_params_arg, uint64_t final_value_msat_arg, uint32_t final_cltv_expiry_delta_arg);
24831
24832 /**
24833  * Creates a copy of the RouteParameters
24834  */
24835 struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig);
24836
24837 /**
24838  * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
24839  */
24840 struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj);
24841
24842 /**
24843  * Read a RouteParameters from a byte array, created by RouteParameters_write
24844  */
24845 struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser);
24846
24847 /**
24848  * Frees any resources used by the PaymentParameters, if is_owned is set and inner is non-NULL.
24849  */
24850 void PaymentParameters_free(struct LDKPaymentParameters this_obj);
24851
24852 /**
24853  * The node id of the payee.
24854  */
24855 struct LDKPublicKey PaymentParameters_get_payee_pubkey(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
24856
24857 /**
24858  * The node id of the payee.
24859  */
24860 void PaymentParameters_set_payee_pubkey(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24861
24862 /**
24863  * Features supported by the payee.
24864  *
24865  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
24866  * does not contain any features.
24867  *
24868  * [`for_keysend`]: Self::for_keysend
24869  *
24870  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24871  */
24872 struct LDKInvoiceFeatures PaymentParameters_get_features(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
24873
24874 /**
24875  * Features supported by the payee.
24876  *
24877  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
24878  * does not contain any features.
24879  *
24880  * [`for_keysend`]: Self::for_keysend
24881  *
24882  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24883  */
24884 void PaymentParameters_set_features(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val);
24885
24886 /**
24887  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
24888  */
24889 struct LDKCVec_RouteHintZ PaymentParameters_get_route_hints(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
24890
24891 /**
24892  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
24893  */
24894 void PaymentParameters_set_route_hints(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val);
24895
24896 /**
24897  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
24898  */
24899 struct LDKCOption_u64Z PaymentParameters_get_expiry_time(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
24900
24901 /**
24902  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
24903  */
24904 void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
24905
24906 /**
24907  * The maximum total CLTV delta we accept for the route.
24908  */
24909 uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
24910
24911 /**
24912  * The maximum total CLTV delta we accept for the route.
24913  */
24914 void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val);
24915
24916 /**
24917  * Constructs a new PaymentParameters given each field
24918  */
24919 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);
24920
24921 /**
24922  * Creates a copy of the PaymentParameters
24923  */
24924 struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig);
24925
24926 /**
24927  * Checks if two PaymentParameterss contain equal inner contents.
24928  */
24929 uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o);
24930
24931 /**
24932  * Checks if two PaymentParameterss contain equal inner contents.
24933  * This ignores pointers and is_owned flags and looks at the values in fields.
24934  * Two objects with NULL inner values will be considered "equal" here.
24935  */
24936 bool PaymentParameters_eq(const struct LDKPaymentParameters *NONNULL_PTR a, const struct LDKPaymentParameters *NONNULL_PTR b);
24937
24938 /**
24939  * Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read
24940  */
24941 struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NONNULL_PTR obj);
24942
24943 /**
24944  * Read a PaymentParameters from a byte array, created by PaymentParameters_write
24945  */
24946 struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser);
24947
24948 /**
24949  * Creates a payee with the node id of the given `pubkey`.
24950  */
24951 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey);
24952
24953 /**
24954  * Creates a payee with the node id of the given `pubkey` to use for keysend payments.
24955  */
24956 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey);
24957
24958 /**
24959  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
24960  */
24961 void RouteHint_free(struct LDKRouteHint this_obj);
24962
24963 struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr);
24964
24965 void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val);
24966
24967 /**
24968  * Constructs a new RouteHint given each field
24969  */
24970 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg);
24971
24972 /**
24973  * Creates a copy of the RouteHint
24974  */
24975 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
24976
24977 /**
24978  * Checks if two RouteHints contain equal inner contents.
24979  */
24980 uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
24981
24982 /**
24983  * Checks if two RouteHints contain equal inner contents.
24984  * This ignores pointers and is_owned flags and looks at the values in fields.
24985  * Two objects with NULL inner values will be considered "equal" here.
24986  */
24987 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
24988
24989 /**
24990  * Serialize the RouteHint object into a byte array which can be read by RouteHint_read
24991  */
24992 struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj);
24993
24994 /**
24995  * Read a RouteHint from a byte array, created by RouteHint_write
24996  */
24997 struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser);
24998
24999 /**
25000  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
25001  */
25002 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
25003
25004 /**
25005  * The node_id of the non-target end of the route
25006  */
25007 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
25008
25009 /**
25010  * The node_id of the non-target end of the route
25011  */
25012 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25013
25014 /**
25015  * The short_channel_id of this channel
25016  */
25017 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
25018
25019 /**
25020  * The short_channel_id of this channel
25021  */
25022 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
25023
25024 /**
25025  * The fees which must be paid to use this channel
25026  */
25027 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
25028
25029 /**
25030  * The fees which must be paid to use this channel
25031  */
25032 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
25033
25034 /**
25035  * The difference in CLTV values between this node and the next node.
25036  */
25037 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
25038
25039 /**
25040  * The difference in CLTV values between this node and the next node.
25041  */
25042 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
25043
25044 /**
25045  * The minimum value, in msat, which must be relayed to the next hop.
25046  */
25047 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
25048
25049 /**
25050  * The minimum value, in msat, which must be relayed to the next hop.
25051  */
25052 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
25053
25054 /**
25055  * The maximum value in msat available for routing with a single HTLC.
25056  */
25057 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
25058
25059 /**
25060  * The maximum value in msat available for routing with a single HTLC.
25061  */
25062 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
25063
25064 /**
25065  * Constructs a new RouteHintHop given each field
25066  */
25067 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);
25068
25069 /**
25070  * Creates a copy of the RouteHintHop
25071  */
25072 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
25073
25074 /**
25075  * Checks if two RouteHintHops contain equal inner contents.
25076  */
25077 uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
25078
25079 /**
25080  * Checks if two RouteHintHops contain equal inner contents.
25081  * This ignores pointers and is_owned flags and looks at the values in fields.
25082  * Two objects with NULL inner values will be considered "equal" here.
25083  */
25084 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
25085
25086 /**
25087  * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
25088  */
25089 struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj);
25090
25091 /**
25092  * Read a RouteHintHop from a byte array, created by RouteHintHop_write
25093  */
25094 struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser);
25095
25096 /**
25097  * Finds a route from us (payer) to the given target node (payee).
25098  *
25099  * If the payee provided features in their invoice, they should be provided via `params.payee`.
25100  * Without this, MPP will only be used if the payee's features are available in the network graph.
25101  *
25102  * Private routing paths between a public node and the target may be included in `params.payee`.
25103  *
25104  * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
25105  * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of our local
25106  * channels from [`NetworkGraph`] will be ignored, and only those in `first_hops` will be used.
25107  *
25108  * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
25109  * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
25110  * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
25111  *
25112  * # Note
25113  *
25114  * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
25115  * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
25116  * function.
25117  *
25118  * # Panics
25119  *
25120  * Panics if first_hops contains channels without short_channel_ids;
25121  * [`ChannelManager::list_usable_channels`] will never include such channels.
25122  *
25123  * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
25124  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
25125  *
25126  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
25127  */
25128 struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer);
25129
25130 /**
25131  * Calls the free function if one is set
25132  */
25133 void Score_free(struct LDKScore this_ptr);
25134
25135 /**
25136  * Calls the free function if one is set
25137  */
25138 void LockableScore_free(struct LDKLockableScore this_ptr);
25139
25140 /**
25141  * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL.
25142  */
25143 void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj);
25144
25145 /**
25146  * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
25147  */
25148 MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score);
25149
25150 /**
25151  * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL.
25152  */
25153 void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj);
25154
25155 /**
25156  * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
25157  */
25158 struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj);
25159
25160 /**
25161  * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
25162  */
25163 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser);
25164
25165 /**
25166  * Creates a new scorer using `penalty_msat`.
25167  */
25168 MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat);
25169
25170 /**
25171  * Constructs a new Score which calls the relevant methods on this_arg.
25172  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
25173  */
25174 struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg);
25175
25176 /**
25177  * Frees any resources used by the Scorer, if is_owned is set and inner is non-NULL.
25178  */
25179 void Scorer_free(struct LDKScorer this_obj);
25180
25181 /**
25182  * Frees any resources used by the ScoringParameters, if is_owned is set and inner is non-NULL.
25183  */
25184 void ScoringParameters_free(struct LDKScoringParameters this_obj);
25185
25186 /**
25187  * A fixed penalty in msats to apply to each channel.
25188  *
25189  * Default value: 500 msat
25190  */
25191 uint64_t ScoringParameters_get_base_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
25192
25193 /**
25194  * A fixed penalty in msats to apply to each channel.
25195  *
25196  * Default value: 500 msat
25197  */
25198 void ScoringParameters_set_base_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
25199
25200 /**
25201  * A penalty in msats to apply to a channel upon failing to relay a payment.
25202  *
25203  * This accumulates for each failure but may be reduced over time based on
25204  * [`failure_penalty_half_life`] or when successfully routing through a channel.
25205  *
25206  * Default value: 1,024,000 msat
25207  *
25208  * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
25209  */
25210 uint64_t ScoringParameters_get_failure_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
25211
25212 /**
25213  * A penalty in msats to apply to a channel upon failing to relay a payment.
25214  *
25215  * This accumulates for each failure but may be reduced over time based on
25216  * [`failure_penalty_half_life`] or when successfully routing through a channel.
25217  *
25218  * Default value: 1,024,000 msat
25219  *
25220  * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
25221  */
25222 void ScoringParameters_set_failure_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
25223
25224 /**
25225  * When the amount being sent over a channel is this many 1024ths of the total channel
25226  * capacity, we begin applying [`overuse_penalty_msat_per_1024th`].
25227  *
25228  * Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel)
25229  *
25230  * [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th
25231  */
25232 uint16_t ScoringParameters_get_overuse_penalty_start_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
25233
25234 /**
25235  * When the amount being sent over a channel is this many 1024ths of the total channel
25236  * capacity, we begin applying [`overuse_penalty_msat_per_1024th`].
25237  *
25238  * Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel)
25239  *
25240  * [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th
25241  */
25242 void ScoringParameters_set_overuse_penalty_start_1024th(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint16_t val);
25243
25244 /**
25245  * A penalty applied, per whole 1024ths of the channel capacity which the amount being sent
25246  * over the channel exceeds [`overuse_penalty_start_1024th`] by.
25247  *
25248  * Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty
25249  *                to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel)
25250  *
25251  * [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th
25252  */
25253 uint64_t ScoringParameters_get_overuse_penalty_msat_per_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
25254
25255 /**
25256  * A penalty applied, per whole 1024ths of the channel capacity which the amount being sent
25257  * over the channel exceeds [`overuse_penalty_start_1024th`] by.
25258  *
25259  * Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty
25260  *                to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel)
25261  *
25262  * [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th
25263  */
25264 void ScoringParameters_set_overuse_penalty_msat_per_1024th(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
25265
25266 /**
25267  * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
25268  * cut in half.
25269  *
25270  * Successfully routing through a channel will immediately cut the penalty in half as well.
25271  *
25272  * Default value: 1 hour
25273  *
25274  * # Note
25275  *
25276  * When built with the `no-std` feature, time will never elapse. Therefore, this penalty will
25277  * never decay.
25278  *
25279  * [`failure_penalty_msat`]: Self::failure_penalty_msat
25280  */
25281 uint64_t ScoringParameters_get_failure_penalty_half_life(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
25282
25283 /**
25284  * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
25285  * cut in half.
25286  *
25287  * Successfully routing through a channel will immediately cut the penalty in half as well.
25288  *
25289  * Default value: 1 hour
25290  *
25291  * # Note
25292  *
25293  * When built with the `no-std` feature, time will never elapse. Therefore, this penalty will
25294  * never decay.
25295  *
25296  * [`failure_penalty_msat`]: Self::failure_penalty_msat
25297  */
25298 void ScoringParameters_set_failure_penalty_half_life(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
25299
25300 /**
25301  * Constructs a new ScoringParameters given each field
25302  */
25303 MUST_USE_RES struct LDKScoringParameters ScoringParameters_new(uint64_t base_penalty_msat_arg, uint64_t failure_penalty_msat_arg, uint16_t overuse_penalty_start_1024th_arg, uint64_t overuse_penalty_msat_per_1024th_arg, uint64_t failure_penalty_half_life_arg);
25304
25305 /**
25306  * Serialize the ScoringParameters object into a byte array which can be read by ScoringParameters_read
25307  */
25308 struct LDKCVec_u8Z ScoringParameters_write(const struct LDKScoringParameters *NONNULL_PTR obj);
25309
25310 /**
25311  * Read a ScoringParameters from a byte array, created by ScoringParameters_write
25312  */
25313 struct LDKCResult_ScoringParametersDecodeErrorZ ScoringParameters_read(struct LDKu8slice ser);
25314
25315 /**
25316  * Creates a new scorer using the given scoring parameters.
25317  */
25318 MUST_USE_RES struct LDKScorer Scorer_new(struct LDKScoringParameters params);
25319
25320 /**
25321  * Creates a "default" Scorer. See struct and individual field documentaiton for details on which values are used.
25322  */
25323 MUST_USE_RES struct LDKScorer Scorer_default(void);
25324
25325 /**
25326  * Creates a "default" ScoringParameters. See struct and individual field documentaiton for details on which values are used.
25327  */
25328 MUST_USE_RES struct LDKScoringParameters ScoringParameters_default(void);
25329
25330 /**
25331  * Constructs a new Score which calls the relevant methods on this_arg.
25332  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
25333  */
25334 struct LDKScore Scorer_as_Score(const struct LDKScorer *NONNULL_PTR this_arg);
25335
25336 /**
25337  * Serialize the Scorer object into a byte array which can be read by Scorer_read
25338  */
25339 struct LDKCVec_u8Z Scorer_write(const struct LDKScorer *NONNULL_PTR obj);
25340
25341 /**
25342  * Read a Scorer from a byte array, created by Scorer_write
25343  */
25344 struct LDKCResult_ScorerDecodeErrorZ Scorer_read(struct LDKu8slice ser);
25345
25346 /**
25347  * Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL.
25348  */
25349 void ProbabilisticScorer_free(struct LDKProbabilisticScorer this_obj);
25350
25351 /**
25352  * Frees any resources used by the ProbabilisticScoringParameters, if is_owned is set and inner is non-NULL.
25353  */
25354 void ProbabilisticScoringParameters_free(struct LDKProbabilisticScoringParameters this_obj);
25355
25356 /**
25357  * A multiplier used to determine the amount in msats willing to be paid to avoid routing
25358  * through a channel, as per multiplying by the negative `log10` of the channel's success
25359  * probability for a payment.
25360  *
25361  * The success probability is determined by the effective channel capacity, the payment amount,
25362  * and knowledge learned from prior successful and unsuccessful payments. The lower bound of
25363  * the success probability is 0.01, effectively limiting the penalty to the range
25364  * `0..=2*liquidity_penalty_multiplier_msat`. The knowledge learned is decayed over time based
25365  * on [`liquidity_offset_half_life`].
25366  *
25367  * Default value: 10,000 msat
25368  *
25369  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
25370  */
25371 uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
25372
25373 /**
25374  * A multiplier used to determine the amount in msats willing to be paid to avoid routing
25375  * through a channel, as per multiplying by the negative `log10` of the channel's success
25376  * probability for a payment.
25377  *
25378  * The success probability is determined by the effective channel capacity, the payment amount,
25379  * and knowledge learned from prior successful and unsuccessful payments. The lower bound of
25380  * the success probability is 0.01, effectively limiting the penalty to the range
25381  * `0..=2*liquidity_penalty_multiplier_msat`. The knowledge learned is decayed over time based
25382  * on [`liquidity_offset_half_life`].
25383  *
25384  * Default value: 10,000 msat
25385  *
25386  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
25387  */
25388 void ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
25389
25390 /**
25391  * The time required to elapse before any knowledge learned about channel liquidity balances is
25392  * cut in half.
25393  *
25394  * The bounds are defined in terms of offsets and are initially zero. Increasing the offsets
25395  * gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases
25396  * the certainty of the channel liquidity balance.
25397  *
25398  * Default value: 1 hour
25399  *
25400  * # Note
25401  *
25402  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
25403  * liquidity knowledge will never decay except when the bounds cross.
25404  */
25405 uint64_t ProbabilisticScoringParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
25406
25407 /**
25408  * The time required to elapse before any knowledge learned about channel liquidity balances is
25409  * cut in half.
25410  *
25411  * The bounds are defined in terms of offsets and are initially zero. Increasing the offsets
25412  * gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases
25413  * the certainty of the channel liquidity balance.
25414  *
25415  * Default value: 1 hour
25416  *
25417  * # Note
25418  *
25419  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
25420  * liquidity knowledge will never decay except when the bounds cross.
25421  */
25422 void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
25423
25424 /**
25425  * Constructs a new ProbabilisticScoringParameters given each field
25426  */
25427 MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_new(uint64_t liquidity_penalty_multiplier_msat_arg, uint64_t liquidity_offset_half_life_arg);
25428
25429 /**
25430  * Creates a copy of the ProbabilisticScoringParameters
25431  */
25432 struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_clone(const struct LDKProbabilisticScoringParameters *NONNULL_PTR orig);
25433
25434 /**
25435  * Serialize the ProbabilisticScoringParameters object into a byte array which can be read by ProbabilisticScoringParameters_read
25436  */
25437 struct LDKCVec_u8Z ProbabilisticScoringParameters_write(const struct LDKProbabilisticScoringParameters *NONNULL_PTR obj);
25438
25439 /**
25440  * Read a ProbabilisticScoringParameters from a byte array, created by ProbabilisticScoringParameters_write
25441  */
25442 struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ ProbabilisticScoringParameters_read(struct LDKu8slice ser);
25443
25444 /**
25445  * Creates a new scorer using the given scoring parameters for sending payments from a node
25446  * through a network graph.
25447  */
25448 MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringParameters params, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
25449
25450 /**
25451  * Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used.
25452  */
25453 MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_default(void);
25454
25455 /**
25456  * Constructs a new Score which calls the relevant methods on this_arg.
25457  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
25458  */
25459 struct LDKScore ProbabilisticScorer_as_Score(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
25460
25461 /**
25462  * Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read
25463  */
25464 struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj);
25465
25466 /**
25467  * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write
25468  */
25469 struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b);
25470
25471 /**
25472  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
25473  */
25474 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
25475
25476 /**
25477  * Initialize a new FilesystemPersister and set the path to the individual channels'
25478  * files.
25479  */
25480 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
25481
25482 /**
25483  * Get the directory which was provided when this persister was initialized.
25484  */
25485 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
25486
25487 /**
25488  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
25489  * initialization, within a file called \"manager\".
25490  */
25491 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
25492
25493 /**
25494  * Read `ChannelMonitor`s from disk.
25495  */
25496 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
25497
25498 /**
25499  * Constructs a new Persist which calls the relevant methods on this_arg.
25500  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
25501  */
25502 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
25503
25504 /**
25505  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
25506  */
25507 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
25508
25509 /**
25510  * Calls the free function if one is set
25511  */
25512 void ChannelManagerPersister_free(struct LDKChannelManagerPersister this_ptr);
25513
25514 /**
25515  * Start a background thread that takes care of responsibilities enumerated in the [top-level
25516  * documentation].
25517  *
25518  * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
25519  * `persist_manager` returns an error. In case of an error, the error is retrieved by calling
25520  * either [`join`] or [`stop`].
25521  *
25522  * # Data Persistence
25523  *
25524  * `persist_manager` is responsible for writing out the [`ChannelManager`] to disk, and/or
25525  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
25526  * [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's
25527  * provided implementation.
25528  *
25529  * Typically, users should either implement [`ChannelManagerPersister`] to never return an
25530  * error or call [`join`] and handle any error that may arise. For the latter case,
25531  * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
25532  *
25533  * # Event Handling
25534  *
25535  * `event_handler` is responsible for handling events that users should be notified of (e.g.,
25536  * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
25537  * functionality implemented by other handlers.
25538  * * [`NetGraphMsgHandler`] if given will update the [`NetworkGraph`] based on payment failures.
25539  *
25540  * [top-level documentation]: BackgroundProcessor
25541  * [`join`]: Self::join
25542  * [`stop`]: Self::stop
25543  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
25544  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
25545  * [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
25546  * [`NetworkGraph`]: lightning::routing::network_graph::NetworkGraph
25547  *
25548  * Note that net_graph_msg_handler (or a relevant inner pointer) may be NULL or all-0s to represent None
25549  */
25550 MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKChannelManagerPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, struct LDKNetGraphMsgHandler net_graph_msg_handler, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger);
25551
25552 /**
25553  * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
25554  * [`ChannelManager`].
25555  *
25556  * # Panics
25557  *
25558  * This function panics if the background thread has panicked such as while persisting or
25559  * handling events.
25560  *
25561  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
25562  */
25563 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
25564
25565 /**
25566  * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
25567  * [`ChannelManager`].
25568  *
25569  * # Panics
25570  *
25571  * This function panics if the background thread has panicked such as while persisting or
25572  * handling events.
25573  *
25574  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
25575  */
25576 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
25577
25578 /**
25579  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
25580  */
25581 void Invoice_free(struct LDKInvoice this_obj);
25582
25583 /**
25584  * Checks if two Invoices contain equal inner contents.
25585  * This ignores pointers and is_owned flags and looks at the values in fields.
25586  * Two objects with NULL inner values will be considered "equal" here.
25587  */
25588 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
25589
25590 /**
25591  * Creates a copy of the Invoice
25592  */
25593 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
25594
25595 /**
25596  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
25597  */
25598 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
25599
25600 /**
25601  * Checks if two SignedRawInvoices contain equal inner contents.
25602  * This ignores pointers and is_owned flags and looks at the values in fields.
25603  * Two objects with NULL inner values will be considered "equal" here.
25604  */
25605 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
25606
25607 /**
25608  * Creates a copy of the SignedRawInvoice
25609  */
25610 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
25611
25612 /**
25613  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
25614  */
25615 void RawInvoice_free(struct LDKRawInvoice this_obj);
25616
25617 /**
25618  * data part
25619  */
25620 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
25621
25622 /**
25623  * data part
25624  */
25625 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
25626
25627 /**
25628  * Checks if two RawInvoices contain equal inner contents.
25629  * This ignores pointers and is_owned flags and looks at the values in fields.
25630  * Two objects with NULL inner values will be considered "equal" here.
25631  */
25632 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
25633
25634 /**
25635  * Creates a copy of the RawInvoice
25636  */
25637 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
25638
25639 /**
25640  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
25641  */
25642 void RawDataPart_free(struct LDKRawDataPart this_obj);
25643
25644 /**
25645  * generation time of the invoice
25646  */
25647 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
25648
25649 /**
25650  * generation time of the invoice
25651  */
25652 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
25653
25654 /**
25655  * Checks if two RawDataParts contain equal inner contents.
25656  * This ignores pointers and is_owned flags and looks at the values in fields.
25657  * Two objects with NULL inner values will be considered "equal" here.
25658  */
25659 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
25660
25661 /**
25662  * Creates a copy of the RawDataPart
25663  */
25664 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
25665
25666 /**
25667  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
25668  */
25669 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
25670
25671 /**
25672  * Checks if two PositiveTimestamps contain equal inner contents.
25673  * This ignores pointers and is_owned flags and looks at the values in fields.
25674  * Two objects with NULL inner values will be considered "equal" here.
25675  */
25676 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
25677
25678 /**
25679  * Creates a copy of the PositiveTimestamp
25680  */
25681 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
25682
25683 /**
25684  * Creates a copy of the SiPrefix
25685  */
25686 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
25687
25688 /**
25689  * Utility method to constructs a new Milli-variant SiPrefix
25690  */
25691 enum LDKSiPrefix SiPrefix_milli(void);
25692
25693 /**
25694  * Utility method to constructs a new Micro-variant SiPrefix
25695  */
25696 enum LDKSiPrefix SiPrefix_micro(void);
25697
25698 /**
25699  * Utility method to constructs a new Nano-variant SiPrefix
25700  */
25701 enum LDKSiPrefix SiPrefix_nano(void);
25702
25703 /**
25704  * Utility method to constructs a new Pico-variant SiPrefix
25705  */
25706 enum LDKSiPrefix SiPrefix_pico(void);
25707
25708 /**
25709  * Checks if two SiPrefixs contain equal inner contents.
25710  * This ignores pointers and is_owned flags and looks at the values in fields.
25711  */
25712 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
25713
25714 /**
25715  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
25716  * This is effectively 10^12 * the prefix multiplier
25717  */
25718 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
25719
25720 /**
25721  * Creates a copy of the Currency
25722  */
25723 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
25724
25725 /**
25726  * Utility method to constructs a new Bitcoin-variant Currency
25727  */
25728 enum LDKCurrency Currency_bitcoin(void);
25729
25730 /**
25731  * Utility method to constructs a new BitcoinTestnet-variant Currency
25732  */
25733 enum LDKCurrency Currency_bitcoin_testnet(void);
25734
25735 /**
25736  * Utility method to constructs a new Regtest-variant Currency
25737  */
25738 enum LDKCurrency Currency_regtest(void);
25739
25740 /**
25741  * Utility method to constructs a new Simnet-variant Currency
25742  */
25743 enum LDKCurrency Currency_simnet(void);
25744
25745 /**
25746  * Utility method to constructs a new Signet-variant Currency
25747  */
25748 enum LDKCurrency Currency_signet(void);
25749
25750 /**
25751  * Checks if two Currencys contain equal inner contents.
25752  */
25753 uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
25754
25755 /**
25756  * Checks if two Currencys contain equal inner contents.
25757  * This ignores pointers and is_owned flags and looks at the values in fields.
25758  */
25759 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
25760
25761 /**
25762  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
25763  */
25764 void Sha256_free(struct LDKSha256 this_obj);
25765
25766 /**
25767  * Creates a copy of the Sha256
25768  */
25769 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
25770
25771 /**
25772  * Checks if two Sha256s contain equal inner contents.
25773  */
25774 uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
25775
25776 /**
25777  * Checks if two Sha256s contain equal inner contents.
25778  * This ignores pointers and is_owned flags and looks at the values in fields.
25779  * Two objects with NULL inner values will be considered "equal" here.
25780  */
25781 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
25782
25783 /**
25784  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
25785  */
25786 void Description_free(struct LDKDescription this_obj);
25787
25788 /**
25789  * Creates a copy of the Description
25790  */
25791 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
25792
25793 /**
25794  * Checks if two Descriptions contain equal inner contents.
25795  */
25796 uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
25797
25798 /**
25799  * Checks if two Descriptions contain equal inner contents.
25800  * This ignores pointers and is_owned flags and looks at the values in fields.
25801  * Two objects with NULL inner values will be considered "equal" here.
25802  */
25803 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
25804
25805 /**
25806  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
25807  */
25808 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
25809
25810 struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr);
25811
25812 void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25813
25814 /**
25815  * Constructs a new PayeePubKey given each field
25816  */
25817 MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg);
25818
25819 /**
25820  * Creates a copy of the PayeePubKey
25821  */
25822 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
25823
25824 /**
25825  * Checks if two PayeePubKeys contain equal inner contents.
25826  */
25827 uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
25828
25829 /**
25830  * Checks if two PayeePubKeys contain equal inner contents.
25831  * This ignores pointers and is_owned flags and looks at the values in fields.
25832  * Two objects with NULL inner values will be considered "equal" here.
25833  */
25834 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
25835
25836 /**
25837  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
25838  */
25839 void ExpiryTime_free(struct LDKExpiryTime this_obj);
25840
25841 /**
25842  * Creates a copy of the ExpiryTime
25843  */
25844 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
25845
25846 /**
25847  * Checks if two ExpiryTimes contain equal inner contents.
25848  */
25849 uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
25850
25851 /**
25852  * Checks if two ExpiryTimes contain equal inner contents.
25853  * This ignores pointers and is_owned flags and looks at the values in fields.
25854  * Two objects with NULL inner values will be considered "equal" here.
25855  */
25856 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
25857
25858 /**
25859  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
25860  */
25861 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
25862
25863 uint64_t MinFinalCltvExpiry_get_a(const struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr);
25864
25865 void MinFinalCltvExpiry_set_a(struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr, uint64_t val);
25866
25867 /**
25868  * Constructs a new MinFinalCltvExpiry given each field
25869  */
25870 MUST_USE_RES struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_new(uint64_t a_arg);
25871
25872 /**
25873  * Creates a copy of the MinFinalCltvExpiry
25874  */
25875 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
25876
25877 /**
25878  * Checks if two MinFinalCltvExpirys contain equal inner contents.
25879  */
25880 uint64_t MinFinalCltvExpiry_hash(const struct LDKMinFinalCltvExpiry *NONNULL_PTR o);
25881
25882 /**
25883  * Checks if two MinFinalCltvExpirys contain equal inner contents.
25884  * This ignores pointers and is_owned flags and looks at the values in fields.
25885  * Two objects with NULL inner values will be considered "equal" here.
25886  */
25887 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
25888
25889 /**
25890  * Frees any resources used by the Fallback
25891  */
25892 void Fallback_free(struct LDKFallback this_ptr);
25893
25894 /**
25895  * Creates a copy of the Fallback
25896  */
25897 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
25898
25899 /**
25900  * Utility method to constructs a new SegWitProgram-variant Fallback
25901  */
25902 struct LDKFallback Fallback_seg_wit_program(struct LDKu5 version, struct LDKCVec_u8Z program);
25903
25904 /**
25905  * Utility method to constructs a new PubKeyHash-variant Fallback
25906  */
25907 struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a);
25908
25909 /**
25910  * Utility method to constructs a new ScriptHash-variant Fallback
25911  */
25912 struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
25913
25914 /**
25915  * Checks if two Fallbacks contain equal inner contents.
25916  */
25917 uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
25918
25919 /**
25920  * Checks if two Fallbacks contain equal inner contents.
25921  * This ignores pointers and is_owned flags and looks at the values in fields.
25922  */
25923 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
25924
25925 /**
25926  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
25927  */
25928 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
25929
25930 /**
25931  * Creates a copy of the InvoiceSignature
25932  */
25933 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
25934
25935 /**
25936  * Checks if two InvoiceSignatures contain equal inner contents.
25937  * This ignores pointers and is_owned flags and looks at the values in fields.
25938  * Two objects with NULL inner values will be considered "equal" here.
25939  */
25940 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
25941
25942 /**
25943  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
25944  */
25945 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
25946
25947 /**
25948  * Creates a copy of the PrivateRoute
25949  */
25950 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
25951
25952 /**
25953  * Checks if two PrivateRoutes contain equal inner contents.
25954  */
25955 uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
25956
25957 /**
25958  * Checks if two PrivateRoutes contain equal inner contents.
25959  * This ignores pointers and is_owned flags and looks at the values in fields.
25960  * Two objects with NULL inner values will be considered "equal" here.
25961  */
25962 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
25963
25964 /**
25965  * Disassembles the `SignedRawInvoice` into its three parts:
25966  *  1. raw invoice
25967  *  2. hash of the raw invoice
25968  *  3. signature
25969  */
25970 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
25971
25972 /**
25973  * The `RawInvoice` which was signed.
25974  */
25975 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
25976
25977 /**
25978  * The hash of the `RawInvoice` that was signed.
25979  */
25980 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
25981
25982 /**
25983  * InvoiceSignature for the invoice.
25984  */
25985 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
25986
25987 /**
25988  * Recovers the public key used for signing the invoice from the recoverable signature.
25989  */
25990 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
25991
25992 /**
25993  * Checks if the signature is valid for the included payee public key or if none exists if it's
25994  * valid for the recovered signature (which should always be true?).
25995  */
25996 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
25997
25998 /**
25999  * Calculate the hash of the encoded `RawInvoice`
26000  */
26001 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26002
26003 /**
26004  *
26005  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26006  */
26007 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26008
26009 /**
26010  *
26011  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26012  */
26013 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26014
26015 /**
26016  *
26017  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26018  */
26019 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26020
26021 /**
26022  *
26023  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26024  */
26025 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26026
26027 /**
26028  *
26029  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26030  */
26031 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26032
26033 /**
26034  *
26035  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26036  */
26037 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26038
26039 /**
26040  *
26041  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26042  */
26043 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26044
26045 /**
26046  *
26047  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26048  */
26049 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26050
26051 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26052
26053 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26054
26055 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26056
26057 /**
26058  * Creates a `PositiveTimestamp` from a Unix timestamp in the range `0..=MAX_TIMESTAMP`.
26059  *
26060  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
26061  */
26062 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
26063
26064 /**
26065  * Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding Unix timestamp in
26066  * the range `0..=MAX_TIMESTAMP`.
26067  *
26068  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
26069  */
26070 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
26071
26072 /**
26073  * Creates a `PositiveTimestamp` from a [`Duration`] since the Unix epoch in the range
26074  * `0..=MAX_TIMESTAMP`.
26075  *
26076  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
26077  */
26078 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_duration_since_epoch(uint64_t duration);
26079
26080 /**
26081  * Returns the Unix timestamp representing the stored time
26082  */
26083 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
26084
26085 /**
26086  * Returns the duration of the stored time since the Unix epoch
26087  */
26088 MUST_USE_RES uint64_t PositiveTimestamp_as_duration_since_epoch(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
26089
26090 /**
26091  * Returns the [`SystemTime`] representing the stored time
26092  */
26093 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
26094
26095 /**
26096  * Transform the `Invoice` into it's unchecked version
26097  */
26098 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
26099
26100 /**
26101  * Check that the invoice is signed correctly and that key recovery works
26102  */
26103 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
26104
26105 /**
26106  * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
26107  * ```
26108  * use lightning_invoice::*;
26109  *
26110  * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\
26111  * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\
26112  * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\
26113  * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\
26114  * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\
26115  * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\
26116  * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\
26117  * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\
26118  * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\
26119  * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\
26120  * j5r6drg6k6zcqj0fcwg\";
26121  *
26122  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
26123  *
26124  * assert!(Invoice::from_signed(signed).is_ok());
26125  * ```
26126  */
26127 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
26128
26129 /**
26130  * Returns the `Invoice`'s timestamp (should equal its creation time)
26131  */
26132 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
26133
26134 /**
26135  * Returns the `Invoice`'s timestamp as a duration since the Unix epoch
26136  */
26137 MUST_USE_RES uint64_t Invoice_duration_since_epoch(const struct LDKInvoice *NONNULL_PTR this_arg);
26138
26139 /**
26140  * Returns the hash to which we will receive the preimage on completion of the payment
26141  */
26142 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
26143
26144 /**
26145  * Get the payee's public key if one was included in the invoice
26146  *
26147  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26148  */
26149 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
26150
26151 /**
26152  * Get the payment secret if one was included in the invoice
26153  */
26154 MUST_USE_RES const uint8_t (*Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
26155
26156 /**
26157  * Get the invoice features if they were included in the invoice
26158  *
26159  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26160  */
26161 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
26162
26163 /**
26164  * Recover the payee's public key (only to be used if none was included in the invoice)
26165  */
26166 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
26167
26168 /**
26169  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
26170  */
26171 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
26172
26173 /**
26174  * Returns whether the invoice has expired.
26175  */
26176 MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg);
26177
26178 /**
26179  * Returns whether the expiry time would pass at the given point in time.
26180  * `at_time` is the timestamp as a duration since the Unix epoch.
26181  */
26182 MUST_USE_RES bool Invoice_would_expire(const struct LDKInvoice *NONNULL_PTR this_arg, uint64_t at_time);
26183
26184 /**
26185  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
26186  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
26187  */
26188 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
26189
26190 /**
26191  * Returns a list of all routes included in the invoice
26192  */
26193 MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
26194
26195 /**
26196  * Returns a list of all routes included in the invoice as the underlying hints
26197  */
26198 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
26199
26200 /**
26201  * Returns the currency for which the invoice was issued
26202  */
26203 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
26204
26205 /**
26206  * Returns the amount if specified in the invoice as millisatoshis.
26207  */
26208 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_milli_satoshis(const struct LDKInvoice *NONNULL_PTR this_arg);
26209
26210 /**
26211  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
26212  * returns `CreationError::DescriptionTooLong` otherwise
26213  *
26214  * Please note that single characters may use more than one byte due to UTF8 encoding.
26215  */
26216 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
26217
26218 /**
26219  * Returns the underlying description `String`
26220  */
26221 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
26222
26223 /**
26224  * Construct an `ExpiryTime` from seconds.
26225  */
26226 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_seconds(uint64_t seconds);
26227
26228 /**
26229  * Construct an `ExpiryTime` from a `Duration`.
26230  */
26231 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_duration(uint64_t duration);
26232
26233 /**
26234  * Returns the expiry time in seconds
26235  */
26236 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
26237
26238 /**
26239  * Returns a reference to the underlying `Duration` (=expiry time)
26240  */
26241 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
26242
26243 /**
26244  * Creates a new (partial) route from a list of hops
26245  */
26246 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
26247
26248 /**
26249  * Returns the underlying list of hops
26250  */
26251 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
26252
26253 /**
26254  * Creates a copy of the CreationError
26255  */
26256 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
26257
26258 /**
26259  * Utility method to constructs a new DescriptionTooLong-variant CreationError
26260  */
26261 enum LDKCreationError CreationError_description_too_long(void);
26262
26263 /**
26264  * Utility method to constructs a new RouteTooLong-variant CreationError
26265  */
26266 enum LDKCreationError CreationError_route_too_long(void);
26267
26268 /**
26269  * Utility method to constructs a new TimestampOutOfBounds-variant CreationError
26270  */
26271 enum LDKCreationError CreationError_timestamp_out_of_bounds(void);
26272
26273 /**
26274  * Utility method to constructs a new InvalidAmount-variant CreationError
26275  */
26276 enum LDKCreationError CreationError_invalid_amount(void);
26277
26278 /**
26279  * Utility method to constructs a new MissingRouteHints-variant CreationError
26280  */
26281 enum LDKCreationError CreationError_missing_route_hints(void);
26282
26283 /**
26284  * Checks if two CreationErrors contain equal inner contents.
26285  * This ignores pointers and is_owned flags and looks at the values in fields.
26286  */
26287 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
26288
26289 /**
26290  * Get the string representation of a CreationError object
26291  */
26292 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
26293
26294 /**
26295  * Creates a copy of the SemanticError
26296  */
26297 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
26298
26299 /**
26300  * Utility method to constructs a new NoPaymentHash-variant SemanticError
26301  */
26302 enum LDKSemanticError SemanticError_no_payment_hash(void);
26303
26304 /**
26305  * Utility method to constructs a new MultiplePaymentHashes-variant SemanticError
26306  */
26307 enum LDKSemanticError SemanticError_multiple_payment_hashes(void);
26308
26309 /**
26310  * Utility method to constructs a new NoDescription-variant SemanticError
26311  */
26312 enum LDKSemanticError SemanticError_no_description(void);
26313
26314 /**
26315  * Utility method to constructs a new MultipleDescriptions-variant SemanticError
26316  */
26317 enum LDKSemanticError SemanticError_multiple_descriptions(void);
26318
26319 /**
26320  * Utility method to constructs a new NoPaymentSecret-variant SemanticError
26321  */
26322 enum LDKSemanticError SemanticError_no_payment_secret(void);
26323
26324 /**
26325  * Utility method to constructs a new MultiplePaymentSecrets-variant SemanticError
26326  */
26327 enum LDKSemanticError SemanticError_multiple_payment_secrets(void);
26328
26329 /**
26330  * Utility method to constructs a new InvalidFeatures-variant SemanticError
26331  */
26332 enum LDKSemanticError SemanticError_invalid_features(void);
26333
26334 /**
26335  * Utility method to constructs a new InvalidRecoveryId-variant SemanticError
26336  */
26337 enum LDKSemanticError SemanticError_invalid_recovery_id(void);
26338
26339 /**
26340  * Utility method to constructs a new InvalidSignature-variant SemanticError
26341  */
26342 enum LDKSemanticError SemanticError_invalid_signature(void);
26343
26344 /**
26345  * Utility method to constructs a new ImpreciseAmount-variant SemanticError
26346  */
26347 enum LDKSemanticError SemanticError_imprecise_amount(void);
26348
26349 /**
26350  * Checks if two SemanticErrors contain equal inner contents.
26351  * This ignores pointers and is_owned flags and looks at the values in fields.
26352  */
26353 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
26354
26355 /**
26356  * Get the string representation of a SemanticError object
26357  */
26358 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
26359
26360 /**
26361  * Frees any resources used by the SignOrCreationError
26362  */
26363 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
26364
26365 /**
26366  * Creates a copy of the SignOrCreationError
26367  */
26368 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
26369
26370 /**
26371  * Utility method to constructs a new SignError-variant SignOrCreationError
26372  */
26373 struct LDKSignOrCreationError SignOrCreationError_sign_error(void);
26374
26375 /**
26376  * Utility method to constructs a new CreationError-variant SignOrCreationError
26377  */
26378 struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a);
26379
26380 /**
26381  * Checks if two SignOrCreationErrors contain equal inner contents.
26382  * This ignores pointers and is_owned flags and looks at the values in fields.
26383  */
26384 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
26385
26386 /**
26387  * Get the string representation of a SignOrCreationError object
26388  */
26389 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
26390
26391 /**
26392  * Frees any resources used by the InvoicePayer, if is_owned is set and inner is non-NULL.
26393  */
26394 void InvoicePayer_free(struct LDKInvoicePayer this_obj);
26395
26396 /**
26397  * Calls the free function if one is set
26398  */
26399 void Payer_free(struct LDKPayer this_ptr);
26400
26401 /**
26402  * Calls the free function if one is set
26403  */
26404 void Router_free(struct LDKRouter this_ptr);
26405
26406 /**
26407  * Frees any resources used by the RetryAttempts, if is_owned is set and inner is non-NULL.
26408  */
26409 void RetryAttempts_free(struct LDKRetryAttempts this_obj);
26410
26411 uintptr_t RetryAttempts_get_a(const struct LDKRetryAttempts *NONNULL_PTR this_ptr);
26412
26413 void RetryAttempts_set_a(struct LDKRetryAttempts *NONNULL_PTR this_ptr, uintptr_t val);
26414
26415 /**
26416  * Constructs a new RetryAttempts given each field
26417  */
26418 MUST_USE_RES struct LDKRetryAttempts RetryAttempts_new(uintptr_t a_arg);
26419
26420 /**
26421  * Creates a copy of the RetryAttempts
26422  */
26423 struct LDKRetryAttempts RetryAttempts_clone(const struct LDKRetryAttempts *NONNULL_PTR orig);
26424
26425 /**
26426  * Checks if two RetryAttemptss contain equal inner contents.
26427  * This ignores pointers and is_owned flags and looks at the values in fields.
26428  * Two objects with NULL inner values will be considered "equal" here.
26429  */
26430 bool RetryAttempts_eq(const struct LDKRetryAttempts *NONNULL_PTR a, const struct LDKRetryAttempts *NONNULL_PTR b);
26431
26432 /**
26433  * Checks if two RetryAttemptss contain equal inner contents.
26434  */
26435 uint64_t RetryAttempts_hash(const struct LDKRetryAttempts *NONNULL_PTR o);
26436
26437 /**
26438  * Frees any resources used by the PaymentError
26439  */
26440 void PaymentError_free(struct LDKPaymentError this_ptr);
26441
26442 /**
26443  * Creates a copy of the PaymentError
26444  */
26445 struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig);
26446
26447 /**
26448  * Utility method to constructs a new Invoice-variant PaymentError
26449  */
26450 struct LDKPaymentError PaymentError_invoice(struct LDKStr a);
26451
26452 /**
26453  * Utility method to constructs a new Routing-variant PaymentError
26454  */
26455 struct LDKPaymentError PaymentError_routing(struct LDKLightningError a);
26456
26457 /**
26458  * Utility method to constructs a new Sending-variant PaymentError
26459  */
26460 struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a);
26461
26462 /**
26463  * Creates an invoice payer that retries failed payment paths.
26464  *
26465  * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once
26466  * `retry_attempts` has been exceeded for a given [`Invoice`].
26467  */
26468 MUST_USE_RES struct LDKInvoicePayer InvoicePayer_new(struct LDKPayer payer, struct LDKRouter router, const struct LDKMultiThreadedLockableScore *NONNULL_PTR scorer, struct LDKLogger logger, struct LDKEventHandler event_handler, struct LDKRetryAttempts retry_attempts);
26469
26470 /**
26471  * Pays the given [`Invoice`], caching it for later use in case a retry is needed.
26472  *
26473  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
26474  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
26475  * for you.
26476  */
26477 MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice);
26478
26479 /**
26480  * Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in
26481  * case a retry is needed.
26482  *
26483  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
26484  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
26485  * for you.
26486  */
26487 MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_zero_value_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice, uint64_t amount_msats);
26488
26489 /**
26490  * Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in
26491  * case a retry is needed.
26492  *
26493  * You should ensure that `payment_preimage` is unique and that its `payment_hash` has never
26494  * been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so for you.
26495  */
26496 MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_pubkey(const struct LDKInvoicePayer *NONNULL_PTR this_arg, struct LDKPublicKey pubkey, struct LDKThirtyTwoBytes payment_preimage, uint64_t amount_msats, uint32_t final_cltv_expiry_delta);
26497
26498 /**
26499  * Removes the payment cached by the given payment hash.
26500  *
26501  * Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an
26502  * [`EventHandler`]. Otherwise, calling this method is unnecessary.
26503  */
26504 void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
26505
26506 /**
26507  * Constructs a new EventHandler which calls the relevant methods on this_arg.
26508  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
26509  */
26510 struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg);
26511
26512 /**
26513  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
26514  * See [`PhantomKeysManager`] for more information on phantom node payments.
26515  *
26516  * `phantom_route_hints` parameter:
26517  * * Contains channel info for all nodes participating in the phantom invoice
26518  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
26519  *   participating node
26520  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
26521  *   updated when a channel becomes disabled or closes
26522  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
26523  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
26524  *   down
26525  *
26526  * `payment_hash` and `payment_secret` come from [`ChannelManager::create_inbound_payment`] or
26527  * [`ChannelManager::create_inbound_payment_for_hash`]. These values can be retrieved from any
26528  * participating node.
26529  *
26530  * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
26531  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
26532  * requirement).
26533  *
26534  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
26535  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
26536  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
26537  */
26538 struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKStr description, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, enum LDKCurrency network);
26539
26540 /**
26541  * Utility to construct an invoice. Generally, unless you want to do something like a custom
26542  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
26543  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
26544  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
26545  * that the payment secret is valid when the invoice is paid.
26546  */
26547 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description);
26548
26549 /**
26550  * See [`create_invoice_from_channelmanager`]
26551  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
26552  * available and the current time is supplied by the caller.
26553  */
26554 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint64_t duration_since_epoch);
26555
26556 /**
26557  * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
26558  */
26559 void DefaultRouter_free(struct LDKDefaultRouter this_obj);
26560
26561 /**
26562  * Creates a new router using the given [`NetworkGraph`] and  [`Logger`].
26563  */
26564 MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
26565
26566 /**
26567  * Constructs a new Router which calls the relevant methods on this_arg.
26568  * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
26569  */
26570 struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg);
26571
26572 /**
26573  * Constructs a new Payer which calls the relevant methods on this_arg.
26574  * This copies the `inner` pointer in this_arg and thus the returned Payer must be freed before this_arg is
26575  */
26576 struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_PTR this_arg);
26577
26578 /**
26579  * Read a SiPrefix object from a string
26580  */
26581 struct LDKCResult_SiPrefixNoneZ SiPrefix_from_str(struct LDKStr s);
26582
26583 /**
26584  * Read a Invoice object from a string
26585  */
26586 struct LDKCResult_InvoiceNoneZ Invoice_from_str(struct LDKStr s);
26587
26588 /**
26589  * Read a SignedRawInvoice object from a string
26590  */
26591 struct LDKCResult_SignedRawInvoiceNoneZ SignedRawInvoice_from_str(struct LDKStr s);
26592
26593 /**
26594  * Get the string representation of a Invoice object
26595  */
26596 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
26597
26598 /**
26599  * Get the string representation of a SignedRawInvoice object
26600  */
26601 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
26602
26603 /**
26604  * Get the string representation of a Currency object
26605  */
26606 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
26607
26608 /**
26609  * Get the string representation of a SiPrefix object
26610  */
26611 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
26612
26613 #endif /* LDK_C_BINDINGS_H */
26614
26615 #include "ldk_ver.h"